fix packege

This commit is contained in:
DevWiki 2022-04-06 21:11:15 +08:00
parent f77a512451
commit 5f6714e4c1
8 changed files with 55 additions and 28 deletions

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31912.275
# Visual Studio Version 16
VisualStudioVersion = 16.0.32228.343
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebSocketTool", "WebSocketTool\WebSocketTool.csproj", "{1002416D-BE37-48F3-97FA-630D37C5FC91}"
EndProject

View File

@ -8,11 +8,11 @@ using System.Windows;
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("WebSocketTool")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("WebSocket Test Tool")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("DevWiki")]
[assembly: AssemblyProduct("WebSocketTool")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyCopyright("Copyright DevWiki © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View File

@ -1,8 +1,14 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows;
using System.Windows.Documents;
using log4net;
using log4net.Appender;
using log4net.Core;
using log4net.Repository;
using log4net.Repository.Hierarchy;
namespace WebSocketTool.Util
{
@ -25,6 +31,40 @@ namespace WebSocketTool.Util
{
LogName = logName;
}
InitLog4Net();
}
private void InitLog4Net()
{
Hierarchy hierarchy = (Hierarchy)log4net.LogManager.GetRepository();
var appender = CreateReleaseAppender();
appender.ActivateOptions();
if (hierarchy != null)
{
hierarchy.Root.Level = Level.Info;
log4net.Config.BasicConfigurator.Configure(hierarchy, appender);
}
else
{
log4net.Config.BasicConfigurator.Configure(appender);
}
}
private static RollingFileAppender CreateReleaseAppender()
{
var appender = new RollingFileAppender
{
Name = "ReleaseFileLog",
File = Path.Combine("log", "WebSocketTool.log"),
AppendToFile = true,
MaxSizeRollBackups = 10,
MaximumFileSize = "10MB",
RollingStyle = RollingFileAppender.RollingMode.Size,
StaticLogFileName = true,
Encoding = Encoding.UTF8,
Layout = new log4net.Layout.PatternLayout("%date [%thread] %-5level %logger - %message%newline")
};
return appender;
}
public Log GetLog(string tag)

View File

@ -111,9 +111,6 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="log4net.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

View File

@ -1,19 +0,0 @@
<?xml version="1.0"?>
<log4net>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="log/WebSocketTool.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="20MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
<param name="Encoding" value="UTF-8"/>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="RollingFileAppender" />
</root>
</log4net>

BIN
WebSocketTool/pack/libz.exe Normal file

Binary file not shown.

View File

@ -0,0 +1,4 @@
libz.exe inject-dll --assembly ../bin/Release/WebSocketTool.exe --include ../bin/Release/*.dll --move
mkdir output
move ../bin/Release/WebSocketTool.exe output/WebSocketTool.exe

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -12,6 +12,11 @@
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>websocket-sharp.snk</AssemblyOriginatorKeyFile>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>