diff --git a/StartServerWPF.Modules.Main/Fonts/iconfont.ttf b/StartServerWPF.Assets/Fonts/iconfont.ttf
similarity index 100%
rename from StartServerWPF.Modules.Main/Fonts/iconfont.ttf
rename to StartServerWPF.Assets/Fonts/iconfont.ttf
diff --git a/StartServerWPF.Modules.Main/Images/Union.png b/StartServerWPF.Assets/Images/Union.png
similarity index 100%
rename from StartServerWPF.Modules.Main/Images/Union.png
rename to StartServerWPF.Assets/Images/Union.png
diff --git a/StartServerWPF.Modules.Main/Images/background.jpg b/StartServerWPF.Assets/Images/background.jpg
similarity index 100%
rename from StartServerWPF.Modules.Main/Images/background.jpg
rename to StartServerWPF.Assets/Images/background.jpg
diff --git a/StartServerWPF.Modules.Main/Images/calendar.png b/StartServerWPF.Assets/Images/calendar.png
similarity index 100%
rename from StartServerWPF.Modules.Main/Images/calendar.png
rename to StartServerWPF.Assets/Images/calendar.png
diff --git a/StartServerWPF.Assets/LogHelper.cs b/StartServerWPF.Assets/LogHelper.cs
new file mode 100644
index 0000000..4c38f3b
--- /dev/null
+++ b/StartServerWPF.Assets/LogHelper.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StartServerWPF.Assets
+{
+ public class LogHelper
+ {
+
+ public static void WriteSerLog(string fn, string logstr)
+ {
+ // try
+ {
+ fn = fn + "SerLog_" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
+ if (!File.Exists(fn))
+ {
+ Directory.CreateDirectory(Path.GetDirectoryName(fn));
+ }
+ using (StreamWriter sw = new StreamWriter(fn, true, Encoding.Default))
+ {
+ sw.WriteLine(logstr);
+ sw.Close();
+ }
+ }
+ //catch (Exception ex)
+ //{
+
+ //}
+ }
+ }
+}
diff --git a/StartServerWPF.Assets/Properties/AssemblyInfo.cs b/StartServerWPF.Assets/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..a93d6ae
--- /dev/null
+++ b/StartServerWPF.Assets/Properties/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("StartServerWPF.Assets")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("StartServerWPF.Assets")]
+[assembly: AssemblyCopyright("Copyright © 2023")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+//若要开始生成可本地化的应用程序,请设置
+//.csproj 文件中的 CultureYouAreCodingWith
+//例如,如果您在源文件中使用的是美国英语,
+//使用的是美国英语,请将 设置为 en-US。 然后取消
+//对以下 NeutralResourceLanguage 特性的注释。 更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly:ThemeInfo(
+ ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+ //(未在页面中找到资源时使用,
+ //或应用程序资源字典中找到时使用)
+ ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+ //(未在页面中找到资源时使用,
+ //、应用程序或任何主题专用资源字典中找到时使用)
+)]
+
+
+// 程序集的版本信息由下列四个值组成:
+//
+// 主版本
+// 次版本
+// 生成号
+// 修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/StartServerWPF.Assets/Properties/Resources.Designer.cs b/StartServerWPF.Assets/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..e41d58d
--- /dev/null
+++ b/StartServerWPF.Assets/Properties/Resources.Designer.cs
@@ -0,0 +1,62 @@
+//------------------------------------------------------------------------------
+//
+// 此代码由工具生成。
+// 运行时版本: 4.0.30319.42000
+//
+// 对此文件的更改可能导致不正确的行为,如果
+// 重新生成代码,则所做更改将丢失。
+//
+//------------------------------------------------------------------------------
+
+namespace StartServerWPF.Assets.Properties {
+
+
+ ///
+ /// 强类型资源类,用于查找本地化字符串等。
+ ///
+ // 此类是由 StronglyTypedResourceBuilder
+ // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+ // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+ // (以 /str 作为命令选项),或重新生成 VS 项目。
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// 返回此类使用的缓存 ResourceManager 实例。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if ((resourceMan == null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("StartServerWPF.Assets.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// 重写当前线程的 CurrentUICulture 属性,对
+ /// 使用此强类型资源类的所有资源查找执行重写。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/StartServerWPF.Assets/Properties/Resources.resx b/StartServerWPF.Assets/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/StartServerWPF.Assets/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/StartServerWPF.Assets/Properties/Settings.Designer.cs b/StartServerWPF.Assets/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..c682eed
--- /dev/null
+++ b/StartServerWPF.Assets/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace StartServerWPF.Assets.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/StartServerWPF.Assets/Properties/Settings.settings b/StartServerWPF.Assets/Properties/Settings.settings
new file mode 100644
index 0000000..033d7a5
--- /dev/null
+++ b/StartServerWPF.Assets/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StartServerWPF.Assets/StartServerWPF.Assets.csproj b/StartServerWPF.Assets/StartServerWPF.Assets.csproj
new file mode 100644
index 0000000..4e0cc9a
--- /dev/null
+++ b/StartServerWPF.Assets/StartServerWPF.Assets.csproj
@@ -0,0 +1,87 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {EA0D3C2D-5BEB-420C-9222-2E6E5F40BF5C}
+ library
+ StartServerWPF.Assets
+ StartServerWPF.Assets
+ v4.6.1
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+
+
+
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StartServerWPF.Modules.Main/Styles/BaseResources.xaml b/StartServerWPF.Assets/Styles/BaseResources.xaml
similarity index 74%
rename from StartServerWPF.Modules.Main/Styles/BaseResources.xaml
rename to StartServerWPF.Assets/Styles/BaseResources.xaml
index 761e695..46fde0d 100644
--- a/StartServerWPF.Modules.Main/Styles/BaseResources.xaml
+++ b/StartServerWPF.Assets/Styles/BaseResources.xaml
@@ -1,4 +1,4 @@
- pack://application:,,,/StartServerWPF.Modules.Main;component/Fonts/#iconfont
+ pack://application:,,,/StartServerWPF.Assets;component/Fonts/#iconfont
\ No newline at end of file
diff --git a/StartServerWPF.Modules.Main/JsonParser.cs b/StartServerWPF.Modules.Main/JsonParser.cs
index 01c43cd..c5b9e65 100644
--- a/StartServerWPF.Modules.Main/JsonParser.cs
+++ b/StartServerWPF.Modules.Main/JsonParser.cs
@@ -15,7 +15,6 @@ namespace StartServerWPF.Modules.Main
// public static string zyProPath = @"\serverprogram";
public static string systemConfigPath = "SystemConfig.json";
- public static string systemLogFileName;
public static string serverVision = "20230517";
public static SystemConfig ReadSystemJsonFile(string jsonFile)
diff --git a/StartServerWPF.Modules.Main/Models/LogMessageModel.cs b/StartServerWPF.Modules.Main/Models/LogMessageModel.cs
index 9ee4643..88c70eb 100644
--- a/StartServerWPF.Modules.Main/Models/LogMessageModel.cs
+++ b/StartServerWPF.Modules.Main/Models/LogMessageModel.cs
@@ -9,10 +9,19 @@ namespace StartServerWPF.Modules.Main.Models
{
public class LogMessageModel
{
- public int LogType { get; set; }
+ public string LogType { get; set; }
public string AppName { get; set; }
public string State { get; set; }
public DateTime OriginTime { get; set; }
public string Message { get; set; }
+ public string Oprate { get; set; }
+
+
+
+ public override string ToString()
+ {
+ string str = $"{OriginTime.ToString("s")} {LogType} {AppName} {State} ";
+ return str;
+ }
}
}
diff --git a/StartServerWPF.Modules.Main/Models/UserMessage.cs b/StartServerWPF.Modules.Main/Models/UserMessage.cs
index 40b127c..61b25c0 100644
--- a/StartServerWPF.Modules.Main/Models/UserMessage.cs
+++ b/StartServerWPF.Modules.Main/Models/UserMessage.cs
@@ -28,6 +28,7 @@ namespace StartServerWPF.Modules.Main.Models
public string message { get; set; }
public int uid { get; set; }
public int code { get; set; }
+ public string account { get; set; }
}
public class CSUserSubscribeMessage
diff --git a/StartServerWPF.Modules.Main/StartServerWPF.Modules.Main.csproj b/StartServerWPF.Modules.Main/StartServerWPF.Modules.Main.csproj
index 43a9239..3fa0cc5 100644
--- a/StartServerWPF.Modules.Main/StartServerWPF.Modules.Main.csproj
+++ b/StartServerWPF.Modules.Main/StartServerWPF.Modules.Main.csproj
@@ -5,10 +5,18 @@
True
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -18,17 +26,14 @@
+
+
+
..\StartServerWPF\DotRas.dll
-
-
-
-
-
-
$(DefaultXamlRuntime)
diff --git a/StartServerWPF.Modules.Main/ViewModels/LogManagementViewModel.cs b/StartServerWPF.Modules.Main/ViewModels/LogManagementViewModel.cs
index c3750a6..a6173fa 100644
--- a/StartServerWPF.Modules.Main/ViewModels/LogManagementViewModel.cs
+++ b/StartServerWPF.Modules.Main/ViewModels/LogManagementViewModel.cs
@@ -21,23 +21,27 @@ namespace StartServerWPF.Modules.Main.ViewModels
{
IEventAggregator _ea;
private readonly IDialogService _dialogService;
+ private readonly MainViewModel _mainViewModel;
public LogManagementViewModel(
- IEventAggregator ea, IDialogService dialogService)
-
+ IEventAggregator ea, IDialogService dialogService, MainViewModel mainViewModel)
+
{
this._dialogService = dialogService;
- InitInfo();
+ this._mainViewModel = mainViewModel;
}
private string _title = "日志查看";
public string Title => _title;
+ public ICommand LoadedCommand => new DelegateCommand(()=>
+ {
+ InitInfo();
+ });
public ICommand UploadCommand { get; set; }
public DelegateCommand QueryDataCommand => new(QueryData);
public DelegateCommand ResetQueryDataCommand => new(InitInfo);
- public DelegateCommand HFWarningCommand => new(HFWarning);
private void InitInfo()
{
StartTime = DateTime.Today;
@@ -53,67 +57,53 @@ namespace StartServerWPF.Modules.Main.ViewModels
public void QueryData()
{
+ SelectIndexLogType = "全部";
DataList = new List();
- string fileName = "";
- // File.Exists("");
+ string fileName = _mainViewModel.sc.vpnInfo.SystemLogPath+ "SerLog_" + EndTime.ToString("yyyyMMdd") + ".txt";
+ if (!File.Exists(fileName))
+ return;
Task.Run(() =>
{
- // var lines= File.ReadAllLines(fileName);
- for (int i = 0; i < 10; i++)
+ _queryDataList = new List();
+ var lines= File.ReadAllLines(fileName);
+ foreach (var item in lines)
{
- DataList.Add(new LogMessageModel()
+ var str= item.Trim().Split(" ");
+
+ _queryDataList.Add(new LogMessageModel()
{
- AppName = "app"+i,
- LogType = 1,
- Message = "start",
- OriginTime = DateTime.Now.AddMinutes(i),
- State = "启动中"
+ OriginTime = Convert.ToDateTime(str[0]),
+ LogType = str[1],
+ AppName = str[2],
+ State = str[3]
});
}
+ _totalDataList = _queryDataList;
+ int index = _queryDataList.Count;
+ MaxCountPage = (index % countPerPage == 0 ? index / countPerPage : index / countPerPage + 1);
+ DataList = _totalDataList.Take(countPerPage).ToList();
});
}
- private void HFWarning()
- {
- DialogParameters param = new DialogParameters();
- param.Add("type", 0);
- ShowEditDialog(param);
- }
- private void ShowEditDialog(DialogParameters param)
- {
- _dialogService.ShowDialog(
- "HFLogDialog",
- param,
- new Action(result =>
- {
- if (result != null && result.Result == ButtonResult.OK)
- {
- System.Windows.MessageBox.Show("数据已保存", "提示");
- Refresh();
- }
- }));
- }
- public void WriteTxt(FileStream fs)
+
+
+ private string _SelectIndexLogType;
+
+ public string SelectIndexLogType
{
- try
+ get => _SelectIndexLogType;
+ set
{
- // foreach (var item in _totalDataList)
+ if (_queryDataList != null)
{
- // string mesg = item.CreateTime + "\t" + item.UserName + "\t" + item.UserId + "\t" + item.Message;
- //获得字节数组
- // mesg = mesg + "\n";
- // byte[] data = System.Text.Encoding.Default.GetBytes(mesg);
- //开始写入
- // fs.Write(data, 0, data.Length);
- }
- //清空缓冲区、关闭流
- fs.Flush();
- fs.Close();
- }
- catch
- {
- Console.WriteLine("WriteError");
+ _totalDataList = _queryDataList.Where(l => l.LogType == value).ToList();
+ int index = _totalDataList.Count;
+ MaxCountPage = (index % countPerPage == 0 ? index / countPerPage : index / countPerPage + 1);
+ DataList = _totalDataList.Take(countPerPage).ToList();
+ }
+ SetProperty(ref _SelectIndexLogType, value);
}
+
}
private DateTime _StartTime;
@@ -140,7 +130,9 @@ namespace StartServerWPF.Modules.Main.ViewModels
/////
///// 所有数据
/////
- //private List _totalDataList;
+ private List _totalDataList;
+
+ private List _queryDataList;
///
/// 页码
///
@@ -181,7 +173,7 @@ namespace StartServerWPF.Modules.Main.ViewModels
///
private void PageUpdated(FunctionEventArgs info)
{
- // DataList = _totalDataList.Skip((info.Info - 1) * countPerPage).Take(countPerPage).ToList();
+ DataList = _totalDataList.Skip((info.Info - 1) * countPerPage).Take(countPerPage).ToList();
}
}
diff --git a/StartServerWPF.Modules.Main/ViewModels/MainViewModel.cs b/StartServerWPF.Modules.Main/ViewModels/MainViewModel.cs
index d9f1f44..2ff11ab 100644
--- a/StartServerWPF.Modules.Main/ViewModels/MainViewModel.cs
+++ b/StartServerWPF.Modules.Main/ViewModels/MainViewModel.cs
@@ -1,7 +1,9 @@
-using Org.BouncyCastle.Crypto.Modes;
+using K4os.Compression.LZ4.Engine;
+using Org.BouncyCastle.Crypto.Modes;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
+using StartServerWPF.Assets;
using StartServerWPF.Modules.Main.models;
using StartServerWPF.Modules.Main.Models;
using System;
@@ -97,6 +99,14 @@ namespace StartServerWPF.Modules.Main.ViewModels
{
_websocket.SendMes(JsonSerializer.Serialize(new CSUserSubscribeMessage { type = CSMessage.subscribe }));
_loginViewDialogViewModel.CloseDialog(new DialogResult(ButtonResult.OK));
+ var log = new LogMessageModel
+ {
+ LogType = "系统",
+ AppName = "系统",
+ State = user.account+ "登录",
+ OriginTime = DateTime.Now,
+ };
+ LogHelper.WriteSerLog(sc.vpnInfo.SystemLogPath, log.ToString());
}
});
break;
@@ -298,8 +308,14 @@ namespace StartServerWPF.Modules.Main.ViewModels
vpn.CreateOrUpdateVPN(sc.vpnInfo.VpnName, sc.vpnInfo.VpnIP);
vpn.ConnectVPN(sc.vpnInfo.VpnName, sc.vpnInfo.VpnUserName, sc.vpnInfo.VpnPsw);
Thread.Sleep(1000);
- string logStr = DateTime.Now.ToString("s") + "\tVPN手动连接";
- WriteSerLog(sc.vpnInfo.SystemLogPath + JsonParser.systemLogFileName, logStr);
+ var log = new LogMessageModel
+ {
+ LogType="网络",
+ AppName="VPN",
+ State="连接",
+ OriginTime = DateTime.Now,
+ };
+ LogHelper.WriteSerLog(sc.vpnInfo.SystemLogPath , log.ToString());
SetControlstatus();
}
@@ -311,8 +327,14 @@ namespace StartServerWPF.Modules.Main.ViewModels
Thread.Sleep(500);
SetControlstatus();
Thread.Sleep(100);
- string logStr = DateTime.Now.ToString("s") + "\tVPN手动断开";
- WriteSerLog(sc.vpnInfo.SystemLogPath + JsonParser.systemLogFileName, logStr);
+ var log = new LogMessageModel
+ {
+ LogType = "网络",
+ AppName = "VPN",
+ State = "断开",
+ OriginTime = DateTime.Now,
+ };
+ LogHelper.WriteSerLog(sc.vpnInfo.SystemLogPath , log.ToString());
}
}
@@ -384,8 +406,14 @@ namespace StartServerWPF.Modules.Main.ViewModels
}
}
RunTime = DateDiff(DateTime.Now, StartTime);
- string logStr = StartTime.ToString("s") + "\t服务器程序启动";
- WriteSerLog(sc.vpnInfo.SystemLogPath + JsonParser.systemLogFileName, logStr);
+ var log = new LogMessageModel
+ {
+ LogType = "系统",
+ AppName = "系统",
+ State = "启动服务程序",
+ OriginTime = DateTime.Now,
+ };
+ LogHelper.WriteSerLog(sc.vpnInfo.SystemLogPath , log.ToString());
IsIndeterminate =true;
timer1.Interval = TimeSpan.FromSeconds(ProMonInterval);
timer1.Start();
@@ -407,8 +435,14 @@ namespace StartServerWPF.Modules.Main.ViewModels
}
timer1.Stop();
IsIndeterminate = false;
- string logStr = DateTime.Now.ToString("s") + "\t服务器程序关闭";
- WriteSerLog(sc.vpnInfo.SystemLogPath + JsonParser.systemLogFileName, logStr);
+ var log = new LogMessageModel
+ {
+ LogType = "系统",
+ AppName = "系统",
+ State = "启动服务关闭",
+ OriginTime = DateTime.Now,
+ };
+ LogHelper.WriteSerLog(sc.vpnInfo.SystemLogPath , log.ToString());
StartTime = new DateTime();
}
@@ -477,10 +511,14 @@ namespace StartServerWPF.Modules.Main.ViewModels
IntervalTimesSource.Add(30);
IntervalTimesSource.Add(60);
SelectedIndex = 1;
- JsonParser.systemLogFileName = "SerLog_" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
- string logStr = DateTime.Now.ToString("s") + "\t程序启动";
- WriteSerLog(sc.vpnInfo.SystemLogPath + JsonParser.systemLogFileName, logStr);
- //CheckIp();
+ var log = new LogMessageModel
+ {
+ LogType = "系统",
+ AppName = "系统",
+ State = "程序启动",
+ OriginTime = DateTime.Now,
+ };
+ LogHelper.WriteSerLog(sc.vpnInfo.SystemLogPath , log.ToString());
}
#region 方法
private bool CMDStartProcess(ProcessInfo proInfo)
@@ -687,13 +725,19 @@ namespace StartServerWPF.Modules.Main.ViewModels
Thread.Sleep(2);
StartProcess(pro);
Thread.Sleep(20);
- string logStr = DateTime.Now.ToString("s") + "\t服务器程序" + pro.ProName + "重启";
- WriteSerLog(sc.vpnInfo.SystemLogPath + JsonParser.systemLogFileName, logStr);
+ var log = new LogMessageModel
+ {
+ LogType = "应用",
+ AppName = pro.ProName,
+ State = "重启",
+ OriginTime = DateTime.Now,
+ };
+ LogHelper.WriteSerLog(sc.vpnInfo.SystemLogPath , log.ToString());
string jsonStr= JsonSerializer.Serialize(new CSDeviceWebhook
{
type= CSMessage.webhook,
- message=logStr,
+ message = log.ToString(),
}, new JsonSerializerOptions
{
// 整齐打印
@@ -705,81 +749,25 @@ namespace StartServerWPF.Modules.Main.ViewModels
}
}
}
- #region 注释
- //int sfp = FindProcess(sc.proServer);
- //if (sfp == 0)
- //{
- // ReciveDataSource.Add("服务器程序运行正常");
- //}
- //else
- //{
- // ReciveDataSource.Add("服务器程序未运行");
- // Thread.Sleep(2);
- // StartProcess(sc.proServer);
- // Thread.Sleep(20);
- // ReciveDataSource.Add("服务器程序重启成功");
- // string logStr = DateTime.Now.ToString("s") + "\t服务器程序" + sc.proServer.ProName + "重启";
- // WriteSerLog(sc.vpnInfo.SystemLogPath + JsonParser.systemLogFileName, logStr);
- //}
- //sfp = FindProcess(sc.proRecv);
- //if (sfp == 0)
- //{
- // ReciveDataSource.Add("接收数据程序运行正常");
- //}
- //else
- //{
- // ReciveDataSource.Add("接收数据程序未运行");
- // Thread.Sleep(2);
- // StartProcess(sc.proRecv);
- // Thread.Sleep(20);
- // ReciveDataSource.Add("接收数据程序重启成功");
- // string logStr = DateTime.Now.ToString("s") + "\t接收数据程序" + sc.proRecv.ProName + "重启";
- // WriteSerLog(sc.vpnInfo.SystemLogPath + JsonParser.systemLogFileName, logStr);
- //}
- //sfp = FindProcess(sc.proApms);
- //if (sfp == 0)
- //{
- // ReciveDataSource.Add("自动识别程序运行正常");
- //}
- //else
- //{
- // ReciveDataSource.Add("自动识别程序未运行");
- // Thread.Sleep(2);
- // StartProcess(sc.proApms);
- // Thread.Sleep(20);
- // ReciveDataSource.Add("自动识别程序重启成功");
- // string logStr = DateTime.Now.ToString("s") + "\t自动识别程序" + sc.proApms.ProName + "重启";
- // WriteSerLog(sc.vpnInfo.SystemLogPath + JsonParser.systemLogFileName, logStr);
- //}
- //sfp = FindProcess(sc.proMonitor);
- //if (sfp == 0)
- //{
- // ReciveDataSource.Add("网页服务程序运行正常");
- //}
- //else
- //{
- // ReciveDataSource.Add("网页服务程序未运行");
- // Thread.Sleep(2);
- // StartProcess(sc.proMonitor);
- // Thread.Sleep(20);
- // ReciveDataSource.Add("网页服务程序重启成功");
- // string logStr = DateTime.Now.ToString("s") + "\t网页服务程序" + sc.proMonitor.ProName + "重启";
- // WriteSerLog(sc.vpnInfo.SystemLogPath + JsonParser.systemLogFileName, logStr);
- //}
- #endregion
RunTime = DateDiff(DateTime.Now, StartTime);
vpnStatus = vpn.CheckVpnStatus(sc.vpnInfo.VpnName);
if (!vpnStatus)
{
vpn.ConnectVPN(sc.vpnInfo.VpnName, sc.vpnInfo.VpnUserName, sc.vpnInfo.VpnPsw);
Thread.Sleep(1000);
- string logStr = DateTime.Now.ToString("s") + "\tVPN断开,重连";
- WriteSerLog(sc.vpnInfo.SystemLogPath + JsonParser.systemLogFileName, logStr);
+ var log = new LogMessageModel
+ {
+ LogType = "应用",
+ AppName = "VPN",
+ State = "重连",
+ OriginTime = DateTime.Now,
+ };
+ LogHelper.WriteSerLog(sc.vpnInfo.SystemLogPath , log.ToString());
string jsonStr = JsonSerializer.Serialize(new CSDeviceWebhook
{
type = CSMessage.webhook,
- message = logStr,
+ message = log.ToString(),
}, new JsonSerializerOptions
{
@@ -807,7 +795,6 @@ namespace StartServerWPF.Modules.Main.ViewModels
}
}
}
- //return AddressIP;
}
public void SetControlstatus()
@@ -829,16 +816,6 @@ namespace StartServerWPF.Modules.Main.ViewModels
}
}
- public void WriteSerLog(string fn, string logstr)
- {
- if(!File.Exists(fn))
- {
- Directory.CreateDirectory(Path.GetDirectoryName(fn));
- }
- StreamWriter sw = new StreamWriter(fn, true, Encoding.Default);
- sw.WriteLine(logstr);
- sw.Close();
- }
#endregion
}
diff --git a/StartServerWPF.Modules.Main/Views/LogManagementView.xaml b/StartServerWPF.Modules.Main/Views/LogManagementView.xaml
index 5cf8c09..b9167db 100644
--- a/StartServerWPF.Modules.Main/Views/LogManagementView.xaml
+++ b/StartServerWPF.Modules.Main/Views/LogManagementView.xaml
@@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"
xmlns:hc="https://handyorg.github.io/handycontrol"
@@ -22,6 +23,14 @@
+
+
+
+
+
+
+
+
@@ -35,15 +44,15 @@
-
+
-
-
-
+
+
-
+
@@ -79,8 +88,8 @@
-
-
+
+
diff --git a/StartServerWPF.Modules.Main/Views/LoginViewDialog.xaml b/StartServerWPF.Modules.Main/Views/LoginViewDialog.xaml
index 1343989..9867783 100644
--- a/StartServerWPF.Modules.Main/Views/LoginViewDialog.xaml
+++ b/StartServerWPF.Modules.Main/Views/LoginViewDialog.xaml
@@ -19,7 +19,7 @@
-
+
diff --git a/StartServerWPF.Modules.Main/Views/MainView.xaml b/StartServerWPF.Modules.Main/Views/MainView.xaml
index 97f65e7..00bf774 100644
--- a/StartServerWPF.Modules.Main/Views/MainView.xaml
+++ b/StartServerWPF.Modules.Main/Views/MainView.xaml
@@ -12,7 +12,7 @@
-
+
diff --git a/StartServerWPF.Modules.Main/Views/RealTimeWaveformView.xaml b/StartServerWPF.Modules.Main/Views/RealTimeWaveformView.xaml
index 74bdd41..7da4a0a 100644
--- a/StartServerWPF.Modules.Main/Views/RealTimeWaveformView.xaml
+++ b/StartServerWPF.Modules.Main/Views/RealTimeWaveformView.xaml
@@ -10,9 +10,9 @@
-
-
+
+
diff --git a/StartServerWPF.Modules.Main/Views/TreeMenuView.xaml b/StartServerWPF.Modules.Main/Views/TreeMenuView.xaml
index b074706..ee53395 100644
--- a/StartServerWPF.Modules.Main/Views/TreeMenuView.xaml
+++ b/StartServerWPF.Modules.Main/Views/TreeMenuView.xaml
@@ -10,7 +10,7 @@
-
+
diff --git a/StartServerWPF.Modules.Main/Views/WaveformPlayBackView.xaml b/StartServerWPF.Modules.Main/Views/WaveformPlayBackView.xaml
index 636fdda..80dc556 100644
--- a/StartServerWPF.Modules.Main/Views/WaveformPlayBackView.xaml
+++ b/StartServerWPF.Modules.Main/Views/WaveformPlayBackView.xaml
@@ -10,9 +10,9 @@
-
-
+
+
diff --git a/StartServerWPF.Modules.MseedChart/StartServerWPF.Modules.MseedChart.csproj b/StartServerWPF.Modules.MseedChart/StartServerWPF.Modules.MseedChart.csproj
index 3f385a8..81b86c7 100644
--- a/StartServerWPF.Modules.MseedChart/StartServerWPF.Modules.MseedChart.csproj
+++ b/StartServerWPF.Modules.MseedChart/StartServerWPF.Modules.MseedChart.csproj
@@ -148,5 +148,11 @@
Designer
+
+
+ {ea0d3c2d-5beb-420c-9222-2e6e5f40bf5c}
+ StartServerWPF.Assets
+
+
\ No newline at end of file
diff --git a/StartServerWPF.Modules.MseedChart/ViewModels/ChartPlotViewModel.cs b/StartServerWPF.Modules.MseedChart/ViewModels/ChartPlotViewModel.cs
index 7e350ae..8d56be9 100644
--- a/StartServerWPF.Modules.MseedChart/ViewModels/ChartPlotViewModel.cs
+++ b/StartServerWPF.Modules.MseedChart/ViewModels/ChartPlotViewModel.cs
@@ -207,15 +207,15 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
{
if(!value)
{
- YasixZENVisible("SHN", true);
- YasixZENVisible("SHN", true);
- YasixZENVisible("SHE", true);
+ YasixZENVisible("SHZ", false);
+ YasixZENVisible("SHN", false);
+ YasixZENVisible("SHE", false);
}
else
{
- YasixZENVisible("SHN", false);
- YasixZENVisible("SHE", false);
- YasixZENVisible("SHZ", false);
+ YasixZENVisible("SHZ", true);
+ YasixZENVisible("SHN", true);
+ YasixZENVisible("SHE", true);
YasixZENVisible(SelectChannel, false);
}
@@ -231,8 +231,10 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
{
if (SingleChannel)
{
- YasixZENVisible(_SelectChannel, false);
- YasixZENVisible(value, true);
+ //隐藏上当前轴
+ YasixZENVisible(_SelectChannel, true);
+ //显示选择轴
+ YasixZENVisible(value, false);
}
SetProperty(ref _SelectChannel, value);
}
@@ -293,7 +295,11 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
st.Stop();
Debug.WriteLine("统计时间StartChart************:{0}", st.Elapsed);
FeedDatasToChart();
- _wavesModel.CreateAxisYEventTime(CurrentEventTime, LChartALL.ViewXY, smList.ToList());
+ if (CurrentEventTime != null)
+ {
+ _wavesModel.CreateAxisYEventTime(CurrentEventTime, LChartALL.ViewXY, smList.ToList());
+ }
+
}
}
@@ -329,7 +335,11 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
LChartALL.EndUpdate();
}
}
-
+ ///
+ /// Y轴的显示和隐藏
+ ///
+ /// SHZ,SHN,SHE
+ /// true 隐藏轴,false显示轴
private void YasixZENVisible(string content, bool yAxesVisible)
{
if (_lChartAll != null)
@@ -345,10 +355,18 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
{
if (yAxesVisible)
{
+ //隐藏轴
v.YAxes.Remove(axisY);
}
else
{
+ //显示轴
+ var axis= v.YAxes.Where(y => y.Title.Text==axisY.Title.Text).FirstOrDefault();
+ if (axis != null)
+ {
+ //找到相同的轴不用处理
+ continue;
+ }
string str = axisY.Title.Text.Replace(conStr, "");
int yIndex = 0;
if (content == "SHZ")
diff --git a/StartServerWPF.sln b/StartServerWPF.sln
index 38fd939..54479c0 100644
--- a/StartServerWPF.sln
+++ b/StartServerWPF.sln
@@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StartServerWPF", "StartServ
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StartServerWPF.Modules.MseedChart", "StartServerWPF.Modules.MseedChart\StartServerWPF.Modules.MseedChart.csproj", "{E0B8EEB4-E63B-488C-BEAD-F03D488CDCB6}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StartServerWPF.Assets", "StartServerWPF.Assets\StartServerWPF.Assets.csproj", "{EA0D3C2D-5BEB-420C-9222-2E6E5F40BF5C}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -27,6 +29,10 @@ Global
{E0B8EEB4-E63B-488C-BEAD-F03D488CDCB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0B8EEB4-E63B-488C-BEAD-F03D488CDCB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0B8EEB4-E63B-488C-BEAD-F03D488CDCB6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EA0D3C2D-5BEB-420C-9222-2E6E5F40BF5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EA0D3C2D-5BEB-420C-9222-2E6E5F40BF5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EA0D3C2D-5BEB-420C-9222-2E6E5F40BF5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EA0D3C2D-5BEB-420C-9222-2E6E5F40BF5C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/StartServerWPF/StartServerWPF.csproj b/StartServerWPF/StartServerWPF.csproj
index 695a3ec..d5dc264 100644
--- a/StartServerWPF/StartServerWPF.csproj
+++ b/StartServerWPF/StartServerWPF.csproj
@@ -8,10 +8,14 @@
+
+
+ Always
+
PreserveNewest
diff --git a/StartServerWPF/ViewModels/MainWindowViewModel.cs b/StartServerWPF/ViewModels/MainWindowViewModel.cs
index 6525229..756030a 100644
--- a/StartServerWPF/ViewModels/MainWindowViewModel.cs
+++ b/StartServerWPF/ViewModels/MainWindowViewModel.cs
@@ -1,7 +1,11 @@
-using Prism.Commands;
+using Microsoft.VisualBasic.ApplicationServices;
+using Prism.Commands;
using Prism.Ioc;
using Prism.Mvvm;
+using StartServerWPF.Assets;
+using StartServerWPF.Modules.Main.Models;
using StartServerWPF.Modules.Main.ViewModels;
+using System;
using System.Windows;
namespace StartServerWPF.ViewModels
@@ -20,8 +24,18 @@ namespace StartServerWPF.ViewModels
{
if (MessageBox.Show("是否退出程序?", "警告", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
{
+
var main = _containerProvider.Resolve();
- main.OneKeyStop();
+ var log = new LogMessageModel
+ {
+ LogType = "系统",
+ AppName = "系统",
+ State = "程序退出",
+ OriginTime = DateTime.Now,
+ };
+ LogHelper.WriteSerLog(main.sc.vpnInfo.SystemLogPath, log.ToString());
+
+ main.OneKeyStop();
Application.Current.Shutdown();
}
});
diff --git a/StartServerWPF/Views/MainWindow.xaml b/StartServerWPF/Views/MainWindow.xaml
index 16e353b..d269b46 100644
--- a/StartServerWPF/Views/MainWindow.xaml
+++ b/StartServerWPF/Views/MainWindow.xaml
@@ -8,7 +8,7 @@
-
+
@@ -22,7 +22,7 @@
-
+
diff --git a/StartServerWPF/mseed2ascii.exe b/StartServerWPF/mseed2ascii.exe
new file mode 100644
index 0000000..818bb05
Binary files /dev/null and b/StartServerWPF/mseed2ascii.exe differ