import os import re import sys sys.stdout.reconfigure(encoding='utf-8') ROOT_CS = r"C:\Users\Phitchayut\Downloads\Ananta_PS_FullBuild\Ananta_PS_FullBuild\Drmk.Server" DEST_GO = r"C:\Users\Phitchayut\Desktop\ngp-Ananta-DEV5\ngp-Ananta-DEV5" def clean_comment(line): # Converts C# /// xml doc comments to Go // comments if line.strip().startswith("///"): return re.sub(r'^\s*///\s*', '// ', line) return line def convert_cs_types(code): # Basic primitive type replacements replaces = [ (r'\buint\b', 'uint32'), (r'\bulong\b', 'uint64'), (r'\bint\b', 'int32'), (r'\blong\b', 'int64'), (r'\bushort\b', 'uint16'), (r'\bshort\b', 'int16'), (r'\bfloat\b', 'float32'), (r'\bdouble\b', 'float64'), (r'\bboolean\b', 'bool'), (r'\bBoolean\b', 'bool'), (r'\bString\b', 'string'), (r'\bnull\b', 'nil'), (r'\btrue\b', 'true'), (r'\bfalse\b', 'false'), ] for p, r in replaces: code = re.sub(p, r, code) return code print("Full port script template ready")