Skip to content

Commit 1a612aa

Browse files
author
Hiram
committed
catch exception and update version to 0.2.0
1 parent 9d8564d commit 1a612aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+85
-35
lines changed

Backup/HiProtobuf_0.2.0.zip

1.55 MB
Binary file not shown.
Binary file not shown.
22 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.

Example/HiProtobuf/HiProtobuf.Lib.dll

512 Bytes
Binary file not shown.

Example/HiProtobuf/HiProtobuf.Lib.pdb

0 Bytes
Binary file not shown.

Example/HiProtobuf/HiProtobuf.UI.exe

512 Bytes
Binary file not shown.

Example/HiProtobuf/HiProtobuf.UI.pdb

0 Bytes
Binary file not shown.

HiProtobuf/HiProtobuf.Lib/DataHandler.cs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,33 +68,37 @@ private void ProcessData(string path)
6868
var dataIns = dataProp.GetValue(_excelIns);
6969
var dataType = dataProp.PropertyType;
7070
var ins = _assembly.CreateInstance("HiProtobuf." + name);
71-
var addMethod = dataType.GetMethod("Add", new Type[] { typeof(int), ins.GetType() });
72-
int id = (int)((Range)usedRange.Cells[i, 1]).Value2;
73-
addMethod.Invoke(dataIns, new[] { id, ins });
71+
var addMethod = dataType.GetMethod("Add", new Type[] {typeof(int), ins.GetType()});
72+
int id = (int) ((Range) usedRange.Cells[i, 1]).Value2;
73+
addMethod.Invoke(dataIns, new[] {id, ins});
7474
for (int j = 1; j <= colCount; j++)
7575
{
76-
var variableType = ((Range)usedRange.Cells[2, j]).Text.ToString();
77-
var variableName = ((Range)usedRange.Cells[3, j]).Text.ToString();
78-
var variableValue = ((Range)usedRange.Cells[i, j]).Text.ToString();
76+
var variableType = ((Range) usedRange.Cells[2, j]).Text.ToString();
77+
var variableName = ((Range) usedRange.Cells[3, j]).Text.ToString();
78+
var variableValue = ((Range) usedRange.Cells[i, j]).Text.ToString();
7979
var insType = ins.GetType();
8080
var fieldName = variableName + "_";
81-
FieldInfo insField = insType.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance);
81+
FieldInfo insField =
82+
insType.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance);
8283
var value = GetVariableValue(variableType, variableValue);
8384
insField.SetValue(ins, value);
8485
}
8586
}
8687
Serialize(_excelIns);
87-
workbooks.Close();
88-
excelApp.Quit();
89-
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
88+
//workbooks.Close();
89+
//excelApp.Quit();
90+
//System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
9091
}
9192
catch (Exception e)
93+
{
94+
Console.WriteLine(e);
95+
throw;
96+
}
97+
finally
9298
{
9399
workbooks.Close();
94100
excelApp.Quit();
95101
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
96-
Console.WriteLine(e);
97-
throw;
98102
}
99103
}
100104

HiProtobuf/HiProtobuf.Lib/ProtoHandler.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,20 @@ void ProcessExcel(string path)
6565
//}
6666
var name = Path.GetFileNameWithoutExtension(path);
6767
new ProtoGenerater(name, rowCount, colCount, usedRange).Process();
68-
workbooks.Close();
69-
excelApp.Quit();
70-
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
68+
//workbooks.Close();
69+
//excelApp.Quit();
70+
//System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
7171
}
7272
catch (Exception e)
73+
{
74+
Console.WriteLine(e);
75+
throw;
76+
}
77+
finally
7378
{
7479
workbooks.Close();
7580
excelApp.Quit();
7681
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
77-
Console.WriteLine(e);
78-
throw;
7982
}
8083
}
8184
}
Binary file not shown.
Binary file not shown.

HiProtobuf/HiProtobuf.Lib/obj/Debug/HiProtobuf.Lib.csproj.FileListAbsolute.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\bin\Debug\HiProtobuf.Lib.pd
33
D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\bin\Debug\Google.Protobuf.dll
44
D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\bin\Debug\HiFramework.Assert.dll
55
D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\bin\Debug\HiFramework.Log.dll
6-
D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\obj\Debug\HiProtobuf.Lib.csprojAssemblyReference.cache
76
D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\obj\Debug\HiProtobuf.Lib.csproj.CoreCompileInputs.cache
87
D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\obj\Debug\HiProtobuf.Lib.csproj.CopyComplete
98
D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\obj\Debug\HiProtobuf.Lib.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

HiProtobuf/HiProtobuf.UI/Config.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ internal static void Load()
2020
{
2121
if (File.Exists(_path))
2222
{
23-
XmlSerializer xs = new XmlSerializer(typeof(PathConfig));
23+
XmlSerializer xs = XmlSerializer.FromTypes(new Type[] { typeof(PathConfig) })[0];
2424
Stream stream = new FileStream(_path, FileMode.Open, FileAccess.Read, FileShare.Read);
2525
PathConfig pathCfg = xs.Deserialize(stream) as PathConfig;
2626
Settings.Export_Folder = pathCfg.Export_Folder;
@@ -37,7 +37,7 @@ internal static void Save()
3737
pathCfg.Export_Folder = Settings.Export_Folder;
3838
pathCfg.Excel_Folder = Settings.Excel_Folder;
3939
pathCfg.Compiler_Path = Settings.Compiler_Path;
40-
XmlSerializer xs = new XmlSerializer(typeof(PathConfig));
40+
XmlSerializer xs = XmlSerializer.FromTypes(new Type[] { typeof(PathConfig) })[0];
4141
Stream stream = new FileStream(_path, FileMode.Create, FileAccess.Write, FileShare.Read);
4242
xs.Serialize(stream, pathCfg);
4343
stream.Close();

HiProtobuf/HiProtobuf.UI/HiProtobuf.UI.csproj

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@
1111
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
<Deterministic>true</Deterministic>
14+
<PublishUrl>publish\</PublishUrl>
15+
<Install>true</Install>
16+
<InstallFrom>Disk</InstallFrom>
17+
<UpdateEnabled>false</UpdateEnabled>
18+
<UpdateMode>Foreground</UpdateMode>
19+
<UpdateInterval>7</UpdateInterval>
20+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
21+
<UpdatePeriodically>false</UpdatePeriodically>
22+
<UpdateRequired>false</UpdateRequired>
23+
<MapFileExtensions>true</MapFileExtensions>
24+
<ApplicationRevision>0</ApplicationRevision>
25+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
26+
<IsWebBootstrapper>false</IsWebBootstrapper>
27+
<UseApplicationTrust>false</UseApplicationTrust>
28+
<BootstrapperEnabled>true</BootstrapperEnabled>
1429
</PropertyGroup>
1530
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1631
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -37,15 +52,14 @@
3752
</Reference>
3853
<Reference Include="System" />
3954
<Reference Include="System.Core" />
40-
<Reference Include="System.Xml.Linq" />
4155
<Reference Include="System.Data.DataSetExtensions" />
4256
<Reference Include="Microsoft.CSharp" />
4357
<Reference Include="System.Data" />
4458
<Reference Include="System.Deployment" />
4559
<Reference Include="System.Drawing" />
4660
<Reference Include="System.Net.Http" />
4761
<Reference Include="System.Windows.Forms" />
48-
<Reference Include="System.Xml" />
62+
<Reference Include="System.XML" />
4963
</ItemGroup>
5064
<ItemGroup>
5165
<Compile Include="HiProtobuf.cs">
@@ -54,7 +68,7 @@
5468
<Compile Include="HiProtobuf.Designer.cs">
5569
<DependentUpon>HiProtobuf.cs</DependentUpon>
5670
</Compile>
57-
<Compile Include="UILogger.cs" />
71+
<Compile Include="Logger.cs" />
5872
<Compile Include="Program.cs" />
5973
<Compile Include="Properties\AssemblyInfo.cs" />
6074
<Compile Include="Config.cs" />
@@ -90,5 +104,12 @@
90104
<Name>HiProtobuf.Lib</Name>
91105
</ProjectReference>
92106
</ItemGroup>
107+
<ItemGroup>
108+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
109+
<Visible>False</Visible>
110+
<ProductName>.NET Framework 3.5 SP1</ProductName>
111+
<Install>false</Install>
112+
</BootstrapperPackage>
113+
</ItemGroup>
93114
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
94115
</Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<PublishUrlHistory>publish\</PublishUrlHistory>
5+
<InstallUrlHistory />
6+
<SupportUrlHistory />
7+
<UpdateUrlHistory />
8+
<BootstrapperUrlHistory />
9+
<ErrorReportUrlHistory />
10+
<FallbackCulture>zh-CN</FallbackCulture>
11+
<VerifyUploadedFiles>false</VerifyUploadedFiles>
12+
</PropertyGroup>
13+
</Project>

HiProtobuf/HiProtobuf.UI/HiProtobuf.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ private void Form1_Load(object sender, EventArgs e)
2626
{
2727
Log.OnInfo += (x) =>
2828
{
29-
textBox6.Text = UILogger.Log;
29+
textBox6.Text = Logger.Log;
3030
};
3131
Log.OnWarning += (x) =>
3232
{
33-
textBox6.Text = UILogger.Log;
33+
textBox6.Text = Logger.Log;
3434
};
3535
Log.OnError += (x) =>
3636
{
37-
textBox6.Text = UILogger.Log;
37+
textBox6.Text = Logger.Log;
3838
};
3939
}
4040

HiProtobuf/HiProtobuf.UI/UILogger.cs renamed to HiProtobuf/HiProtobuf.UI/Logger.cs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
using HiFramework.Log;
1+
using HiFramework.Log;
2+
using System;
3+
using System.Runtime.ExceptionServices;
74

85
namespace HiProtobuf.UI
96
{
10-
internal class UILogger : ILogHandler
7+
internal class Logger : ILogHandler
118
{
9+
internal Logger()
10+
{
11+
AppDomain.CurrentDomain.FirstChanceException += OnException;
12+
}
13+
14+
private void OnException(object sender, FirstChanceExceptionEventArgs e)
15+
{
16+
string str = e.Exception.ToString();
17+
Log += "[Exception]" + str.ToString() + "\r\n";
18+
}
19+
1220
public static string Log;
1321
public void Info(params object[] args)
1422
{

HiProtobuf/HiProtobuf.UI/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static class Program
2222
[STAThread]
2323
static void Main()
2424
{
25-
Log.LogHandler = new UILogger();
25+
Log.LogHandler = new Logger();
2626
Config.Load();
2727

2828
Application.EnableVisualStyles();
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f846fb7a7bf7a73a430d5062da41f61fb8bef54d
1+
9d090274b40e384e9d6dce0b3f0c0f9cc2ada2be
Binary file not shown.
Binary file not shown.
Binary file not shown.

HiProtobuf/HiProtobuf.UI/obj/Debug/build.force

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
22
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue">&lt;AssemblyExplorer&gt;&#xD;
33
&lt;Assembly Path="D:\MyGit\github\HiProtobuf\HiProtobuf\packages\HiFramework.Log.1.0.2\lib\net35\HiFramework.Log.dll" /&gt;&#xD;
4+
&lt;Assembly Path="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll" /&gt;&#xD;
5+
&lt;Assembly Path="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.Xml.dll" /&gt;&#xD;
46
&lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)