Skip to content

Commit af5f0ed

Browse files
committed
Better dumper
1 parent 755d75e commit af5f0ed

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

IronPythonModule/IPPlugin.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,28 @@ public void DumpPropsToFile(string path, object obj) {
119119
string value;
120120

121121
foreach (PropertyInfo pInfo in pInfos) {
122-
try { name = pInfo.Name; } catch (Exception ex) { name = ex.Message; }
123-
try { value = pInfo.GetValue(obj, null).ToString(); } catch (Exception ex) { value = ex.Message; }
124-
objprops += name + " = " + value + nuline;
122+
name = pInfo.Name;
123+
124+
try {
125+
value = pInfo.GetValue(obj, null).ToString();
126+
objprops += name + " = " + value + nuline;
127+
} catch (Exception ex) {
128+
value = GetParams(pInfo.GetIndexParameters());
129+
objprops += name + ":" + nuline + value + nuline;
130+
}
125131
}
126132

127133
File.AppendAllText(path, objprops + nuline);
128134
}
129135

136+
public string GetParams(ParameterInfo[] paramsInfo) {
137+
string result = "\tLength: " + paramsInfo.Length + "\r\n";
138+
foreach (ParameterInfo paramInfo in paramsInfo) {
139+
result += "\t" + paramInfo.ToString() + "\r\n";
140+
}
141+
return result;
142+
}
143+
130144
public void DeleteLog(string path) {
131145
path = ValidateRelativePath(path + ".log");
132146
if (path == null)

0 commit comments

Comments
 (0)