Baseline: Ausgangszustand vor Modularisierung
Erster Commit des bestehenden monolithischen WinForms-Copytraders, inklusive der Alt-Backups (*.bak), damit diese dauerhaft in der Historie rekonstruierbar bleiben. Threema-Lib unter libs/ wurde vendored (nested .git entfernt). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import re
|
||||
import sys
|
||||
|
||||
def revert_file(filepath):
|
||||
with open(filepath, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# 1. Remove AddRange statements for our columns
|
||||
# Example: dgv_dashboard.Columns.AddRange(new DataGridViewColumn[] { ... col_dgv_ ... });
|
||||
pattern1 = r'\s*dgv_\w+\.Columns\.AddRange\(new DataGridViewColumn\[\] \{[^}]*col_dgv_[^}]*\}\);'
|
||||
content = re.sub(pattern1, '', content, flags=re.MULTILINE)
|
||||
|
||||
# 2. Remove all lines referencing col_dgv_ (declarations, instantiations, property assignments)
|
||||
# Be careful not to remove lines that just accidentally match. We'll match lines that start with whitespace and have col_dgv_
|
||||
lines = content.splitlines()
|
||||
new_lines = []
|
||||
skip = False
|
||||
for line in lines:
|
||||
if "col_dgv_" in line:
|
||||
continue
|
||||
if line.strip() == "//" and new_lines and new_lines[-1].strip() == "//":
|
||||
# Might be part of our property comment block // \n // col_name \n //
|
||||
# Wait, easier to just strip empty trailing // later.
|
||||
pass
|
||||
new_lines.append(line)
|
||||
|
||||
content = "\n".join(new_lines)
|
||||
|
||||
# 3. Clean up empty comment blocks
|
||||
content = re.sub(r'\s*// \s*\n\s*// \s*\n\s*// \s*\n', '\n', content)
|
||||
|
||||
with open(filepath, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
|
||||
print("Reverted.")
|
||||
|
||||
if __name__ == '__main__':
|
||||
revert_file(sys.argv[1])
|
||||
Reference in New Issue
Block a user