@@ -13,7 +13,7 @@ def isEmptyLine(self):
13
13
return self .parsedContent == None and self .comment == ""
14
14
15
15
def isComment (self ):
16
- return self .content == "" and self . comment != ""
16
+ return self .comment != ""
17
17
18
18
def isDefinition (self ):
19
19
return self .parsedContent != None
@@ -41,24 +41,43 @@ def parseFile(name):
41
41
allLines .append (parseLine (line ))
42
42
return allLines
43
43
44
- def printFile (name ):
44
+
45
+ def getComments (j , lines ):
46
+ out = []
47
+ anyComment = False
48
+ while j < len (lines ) and lines [j ].isComment ():
49
+ if len (out ) == 0 :
50
+ out .append (" /// <summary>" )
51
+ out .append (" /%s" % (lines [j ].comment ))
52
+ j = j + 1
53
+ if len (out ) > 0 :
54
+ out .append (" /// </summary>" )
55
+ return out
56
+
57
+
58
+ def printFile (name , addComments ):
45
59
out = []
46
60
lines = parseFile (name )
47
61
48
62
for i in range (0 , len (lines )):
63
+ # blank lines
49
64
if not lines [i ].isDefinition ():
50
65
if i + 1 >= len (lines ) or lines [i + 1 ].isDefinition ():
51
66
out .append ("" )
67
+ # definitions
52
68
elif lines [i ].isDefinition ():
69
+ if addComments == True :
70
+ out .extend (getComments (i + 1 , lines ))
53
71
value = lines [i ].parsedContent .group ("value" )
54
72
value = value .replace ("WM_USER" ,"Constants.WM_USER" )
55
73
value = value .replace ("NPPMSG" ,"Constants.NPPMSG" )
56
- out .append (" %s = %s," % (lines [i ].parsedContent .group ("name" ), value ))
74
+ name = lines [i ].parsedContent .group ("name" )
75
+ out .append (" %s = %s," % (name , value ))
57
76
return out
58
77
59
78
if __name__ == "__main__" :
60
- preffile = printFile ("../../../notepad-plus-plus/PowerEditor/src/WinControls/Preference/preference_rc.h" )
79
+ preffile = printFile ("../../../notepad-plus-plus/PowerEditor/src/WinControls/Preference/preference_rc.h" , False )
61
80
Regenerate ("../../Visual Studio Project Template C#/PluginInfrastructure/Preference_h.cs" , "/* " , preffile )
62
81
63
- resourcefile = printFile ("../../../notepad-plus-plus/PowerEditor/src/resource.h" )
64
- Regenerate ("../../Visual Studio Project Template C#/PluginInfrastructure/resource_h .cs" , "/* " , resourcefile )
82
+ resourcefile = printFile ("../../../notepad-plus-plus/PowerEditor/src/resource.h" , False )
83
+ Regenerate ("../../Visual Studio Project Template C#/PluginInfrastructure/Resource_h .cs" , "/* " , resourcefile )
0 commit comments