Skip to content

Commit

Permalink
catch exception and update version to 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiram committed Jul 17, 2019
1 parent 9d8564d commit 1a612aa
Show file tree
Hide file tree
Showing 49 changed files with 85 additions and 35 deletions.
Binary file added Backup/HiProtobuf_0.2.0.zip
Binary file not shown.
Binary file modified Example/Export/language/csharp_dll/HiProtobuf.Excel.csharp.dll
Binary file not shown.
Binary file modified Example/HiProtobuf.UI.exe - 快捷方式.lnk
Binary file not shown.
Binary file modified Example/HiProtobuf/HiFramework.Log.dll
Binary file not shown.
Binary file modified Example/HiProtobuf/HiProtobuf.Lib.dll
Binary file not shown.
Binary file modified Example/HiProtobuf/HiProtobuf.Lib.pdb
Binary file not shown.
Binary file modified Example/HiProtobuf/HiProtobuf.UI.exe
Binary file not shown.
Binary file modified Example/HiProtobuf/HiProtobuf.UI.pdb
Binary file not shown.
28 changes: 16 additions & 12 deletions HiProtobuf/HiProtobuf.Lib/DataHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,33 +68,37 @@ private void ProcessData(string path)
var dataIns = dataProp.GetValue(_excelIns);
var dataType = dataProp.PropertyType;
var ins = _assembly.CreateInstance("HiProtobuf." + name);
var addMethod = dataType.GetMethod("Add", new Type[] { typeof(int), ins.GetType() });
int id = (int)((Range)usedRange.Cells[i, 1]).Value2;
addMethod.Invoke(dataIns, new[] { id, ins });
var addMethod = dataType.GetMethod("Add", new Type[] {typeof(int), ins.GetType()});
int id = (int) ((Range) usedRange.Cells[i, 1]).Value2;
addMethod.Invoke(dataIns, new[] {id, ins});
for (int j = 1; j <= colCount; j++)
{
var variableType = ((Range)usedRange.Cells[2, j]).Text.ToString();
var variableName = ((Range)usedRange.Cells[3, j]).Text.ToString();
var variableValue = ((Range)usedRange.Cells[i, j]).Text.ToString();
var variableType = ((Range) usedRange.Cells[2, j]).Text.ToString();
var variableName = ((Range) usedRange.Cells[3, j]).Text.ToString();
var variableValue = ((Range) usedRange.Cells[i, j]).Text.ToString();
var insType = ins.GetType();
var fieldName = variableName + "_";
FieldInfo insField = insType.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance);
FieldInfo insField =
insType.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance);
var value = GetVariableValue(variableType, variableValue);
insField.SetValue(ins, value);
}
}
Serialize(_excelIns);
workbooks.Close();
excelApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
//workbooks.Close();
//excelApp.Quit();
//System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
finally
{
workbooks.Close();
excelApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
Console.WriteLine(e);
throw;
}
}

Expand Down
13 changes: 8 additions & 5 deletions HiProtobuf/HiProtobuf.Lib/ProtoHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,20 @@ void ProcessExcel(string path)
//}
var name = Path.GetFileNameWithoutExtension(path);
new ProtoGenerater(name, rowCount, colCount, usedRange).Process();
workbooks.Close();
excelApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
//workbooks.Close();
//excelApp.Quit();
//System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
finally
{
workbooks.Close();
excelApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
Console.WriteLine(e);
throw;
}
}
}
Expand Down
Binary file modified HiProtobuf/HiProtobuf.Lib/bin/Debug/HiProtobuf.Lib.dll
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.Lib/bin/Debug/HiProtobuf.Lib.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\bin\Debug\HiProtobuf.Lib.pd
D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\bin\Debug\Google.Protobuf.dll
D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\bin\Debug\HiFramework.Assert.dll
D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\bin\Debug\HiFramework.Log.dll
D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\obj\Debug\HiProtobuf.Lib.csprojAssemblyReference.cache
D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\obj\Debug\HiProtobuf.Lib.csproj.CoreCompileInputs.cache
D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\obj\Debug\HiProtobuf.Lib.csproj.CopyComplete
D:\MyGit\github\HiProtobuf\HiProtobuf\HiProtobuf.Lib\obj\Debug\HiProtobuf.Lib.dll
Expand Down
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.Lib/obj/Debug/HiProtobuf.Lib.dll
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.Lib/obj/Debug/HiProtobuf.Lib.pdb
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.Test/bin/Debug/HiFramework.Log.dll
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.Test/bin/Debug/HiProtobuf.Lib.dll
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.Test/bin/Debug/HiProtobuf.Lib.pdb
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.Test/bin/Debug/HiProtobuf.Test.dll
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.Test/bin/Debug/HiProtobuf.Test.pdb
Binary file not shown.
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.Test/obj/Debug/HiProtobuf.Test.dll
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.Test/obj/Debug/HiProtobuf.Test.pdb
Binary file not shown.
4 changes: 2 additions & 2 deletions HiProtobuf/HiProtobuf.UI/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal static void Load()
{
if (File.Exists(_path))
{
XmlSerializer xs = new XmlSerializer(typeof(PathConfig));
XmlSerializer xs = XmlSerializer.FromTypes(new Type[] { typeof(PathConfig) })[0];
Stream stream = new FileStream(_path, FileMode.Open, FileAccess.Read, FileShare.Read);
PathConfig pathCfg = xs.Deserialize(stream) as PathConfig;
Settings.Export_Folder = pathCfg.Export_Folder;
Expand All @@ -37,7 +37,7 @@ internal static void Save()
pathCfg.Export_Folder = Settings.Export_Folder;
pathCfg.Excel_Folder = Settings.Excel_Folder;
pathCfg.Compiler_Path = Settings.Compiler_Path;
XmlSerializer xs = new XmlSerializer(typeof(PathConfig));
XmlSerializer xs = XmlSerializer.FromTypes(new Type[] { typeof(PathConfig) })[0];
Stream stream = new FileStream(_path, FileMode.Create, FileAccess.Write, FileShare.Read);
xs.Serialize(stream, pathCfg);
stream.Close();
Expand Down
27 changes: 24 additions & 3 deletions HiProtobuf/HiProtobuf.UI/HiProtobuf.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -37,15 +52,14 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.XML" />
</ItemGroup>
<ItemGroup>
<Compile Include="HiProtobuf.cs">
Expand All @@ -54,7 +68,7 @@
<Compile Include="HiProtobuf.Designer.cs">
<DependentUpon>HiProtobuf.cs</DependentUpon>
</Compile>
<Compile Include="UILogger.cs" />
<Compile Include="Logger.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Config.cs" />
Expand Down Expand Up @@ -90,5 +104,12 @@
<Name>HiProtobuf.Lib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
13 changes: 13 additions & 0 deletions HiProtobuf/HiProtobuf.UI/HiProtobuf.UI.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>zh-CN</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>
6 changes: 3 additions & 3 deletions HiProtobuf/HiProtobuf.UI/HiProtobuf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ private void Form1_Load(object sender, EventArgs e)
{
Log.OnInfo += (x) =>
{
textBox6.Text = UILogger.Log;
textBox6.Text = Logger.Log;
};
Log.OnWarning += (x) =>
{
textBox6.Text = UILogger.Log;
textBox6.Text = Logger.Log;
};
Log.OnError += (x) =>
{
textBox6.Text = UILogger.Log;
textBox6.Text = Logger.Log;
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HiFramework.Log;
using HiFramework.Log;
using System;
using System.Runtime.ExceptionServices;

namespace HiProtobuf.UI
{
internal class UILogger : ILogHandler
internal class Logger : ILogHandler
{
internal Logger()
{
AppDomain.CurrentDomain.FirstChanceException += OnException;
}

private void OnException(object sender, FirstChanceExceptionEventArgs e)
{
string str = e.Exception.ToString();
Log += "[Exception]" + str.ToString() + "\r\n";
}

public static string Log;
public void Info(params object[] args)
{
Expand Down
2 changes: 1 addition & 1 deletion HiProtobuf/HiProtobuf.UI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static class Program
[STAThread]
static void Main()
{
Log.LogHandler = new UILogger();
Log.LogHandler = new Logger();
Config.Load();

Application.EnableVisualStyles();
Expand Down
Binary file modified HiProtobuf/HiProtobuf.UI/bin/Debug/HiFramework.Log.dll
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.UI/bin/Debug/HiProtobuf.Lib.dll
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.UI/bin/Debug/HiProtobuf.Lib.pdb
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.UI/bin/Debug/HiProtobuf.UI.exe
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.UI/bin/Debug/HiProtobuf.UI.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f846fb7a7bf7a73a430d5062da41f61fb8bef54d
9d090274b40e384e9d6dce0b3f0c0f9cc2ada2be
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.UI/obj/Debug/HiProtobuf.UI.exe
Binary file not shown.
Binary file modified HiProtobuf/HiProtobuf.UI/obj/Debug/HiProtobuf.UI.pdb
Binary file not shown.
Empty file.
2 changes: 2 additions & 0 deletions HiProtobuf/HiProtobuf.sln.DotSettings.user
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<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">
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue">&lt;AssemblyExplorer&gt;&#xD;
&lt;Assembly Path="D:\MyGit\github\HiProtobuf\HiProtobuf\packages\HiFramework.Log.1.0.2\lib\net35\HiFramework.Log.dll" /&gt;&#xD;
&lt;Assembly Path="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll" /&gt;&#xD;
&lt;Assembly Path="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.Xml.dll" /&gt;&#xD;
&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 comments on commit 1a612aa

Please sign in to comment.