28 lines
858 B
Python
Vendored
28 lines
858 B
Python
Vendored
import os
|
|
import re
|
|
import sys
|
|
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
|
|
src_dir = r"C:\Users\Phitchayut\Downloads\Ananta_PS_FullBuild\Ananta_PS_FullBuild\Drmk.Server\Drmk.Handlers\Game"
|
|
dst_dir = r"C:\Users\Phitchayut\Desktop\ngp-Ananta-DEV5\ngp-Ananta-DEV5\internal\gameserver"
|
|
|
|
files = [f for f in os.listdir(src_dir) if f.endswith(".cs")]
|
|
print(f"Found {len(files)} files to port from {src_dir}")
|
|
|
|
def to_snake_case(name):
|
|
# GameRouter.BowlingPinGadget.cs -> router_bowling_pin_gadget.go
|
|
base = name[:-3]
|
|
if base.startswith("GameRouter."):
|
|
base = base[11:]
|
|
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', base)
|
|
s2 = re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
|
|
return f"router_{s2}.go"
|
|
|
|
mapped = {}
|
|
for f in files:
|
|
target = to_snake_case(f)
|
|
mapped[f] = target
|
|
|
|
print(f"Sample mapping: {list(mapped.items())[:5]}")
|