-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcombine.py
More file actions
31 lines (26 loc) · 756 Bytes
/
combine.py
File metadata and controls
31 lines (26 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import glob
files = glob.glob('**/*.cs', recursive=True)
output = []
using = []
for file_name in files:
if file_name.startswith("obj"):
continue
if file_name.startswith("_"):
continue
output.append("/*")
output.append(file_name)
output.append("*/")
output.append("")
file = open(file_name, 'r', encoding="utf8")
lines = file.readlines()
for line in lines:
if line.startswith("using"):
using.append(line.rstrip())
else:
output.append(line.rstrip())
output.append("")
output.append("")
with open('output.txt', 'w', encoding="utf8") as outfile:
outfile.write("\n".join(set(using)))
outfile.write("\n")
outfile.write("\n".join(output))