diff --git a/Txgy.FilesWatcher/DBModels/UploadRealtime.cs b/Txgy.FilesWatcher/DBModels/UploadRealtime.cs
new file mode 100644
index 0000000..9c73abc
--- /dev/null
+++ b/Txgy.FilesWatcher/DBModels/UploadRealtime.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Txgy.FilesWatcher.DBModels
+{
+ public class UploadRealtime
+ {
+ public string filename { get; set; }
+ public string uploadtime { get; set; }
+
+ }
+}
diff --git a/Txgy.FilesWatcher/DBModels/realtimewavedatas.cs b/Txgy.FilesWatcher/DBModels/realtimewavedatas.cs
new file mode 100644
index 0000000..c00ee0e
--- /dev/null
+++ b/Txgy.FilesWatcher/DBModels/realtimewavedatas.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Txgy.FilesWatcher.DBModels
+{
+ public class realtimewavedatas
+ {
+ public string EventTime { get; set; }
+
+ public int WorkAreaID { get; set; }
+
+ public byte[] WaveData { get; set; }
+ public byte[] JsonFile { get; set; }
+ }
+}
diff --git a/Txgy.FilesWatcher/Txgy.FilesWatcher.csproj b/Txgy.FilesWatcher/Txgy.FilesWatcher.csproj
index 2f31402..9289384 100644
--- a/Txgy.FilesWatcher/Txgy.FilesWatcher.csproj
+++ b/Txgy.FilesWatcher/Txgy.FilesWatcher.csproj
@@ -6,7 +6,9 @@
True
+
+
diff --git a/Txgy.FilesWatcher/ViewModels/MainViewModel.cs b/Txgy.FilesWatcher/ViewModels/MainViewModel.cs
index 68e4fbd..0d47525 100644
--- a/Txgy.FilesWatcher/ViewModels/MainViewModel.cs
+++ b/Txgy.FilesWatcher/ViewModels/MainViewModel.cs
@@ -22,6 +22,7 @@ using System.Text.Unicode;
using System.Net.Sockets;
using System.Security.Policy;
using Prism.Events;
+using System.Windows.Shapes;
namespace Txgy.FilesWatcher.ViewModels
{
@@ -29,82 +30,21 @@ namespace Txgy.FilesWatcher.ViewModels
{
public MainViewModel(WebsocketClient websocketClient, IEventAggregator ea)
{
- string filter = "*.txt";
+ string filter = "*.index";
string str = File.ReadAllText("systemconfig.json");
systemConfig = JsonSerializer.Deserialize(str);
WatcherPath = systemConfig.FilePath;
+ WatcherMseedPath= systemConfig.WatcherMseedPath;
+ MseedFilePath = systemConfig.MseedFilePath;
+ watcherArray[0] = new FileSystemWatcher();
+ watcherArray[1] = new FileSystemWatcher();
InitializeParams(filter);
StartTime = DateTime.Now;
- this._websocketClient = websocketClient;
this._ea = ea;
- _websocketClient.WebsocketError = WebSocket_Error;
- _websocketClient.WebSocketMessageReceived = WebSocket4Net_MessageReceived;
- _websocketClient.WebSocketInit(systemConfig.Url);
- }
- private void WebSocket4Net_MessageReceived(string message)
- {
- Debug.WriteLine($"服务端回复数据:{message}!");
- using (JsonDocument document = JsonDocument.Parse(message))
- {
- JsonElement root = document.RootElement;
- if (root.TryGetProperty("type", out JsonElement dataElement))
- {
- string type = dataElement.ToString();
- switch (type)
- {
- case CSMessage.sigin:
- var user= JsonSerializer.Deserialize(message, new JsonSerializerOptions
- {
- // 整齐打印
- WriteIndented = true,
- //重新编码,解决中文乱码问题
- Encoder = JavaScriptEncoder.Create(UnicodeRanges.All)
- });
- if(user.code==200)
- {
- isLogin = true;
- LoginContent = "登 出";
- }
- App.Current.Dispatcher.Invoke(() =>
- {
- HandyControl.Controls.MessageBox.Show(user.message, "warning");
- });
- this.HideLoading();
- break;
- case CSMessage.subscribe:
- var sub= JsonSerializer.Deserialize(message, new JsonSerializerOptions
- {
- // 整齐打印
- WriteIndented = true,
- //重新编码,解决中文乱码问题
- Encoder = JavaScriptEncoder.Create(UnicodeRanges.All)
- });
- break;
- case CSMessage.publish:
- var publish = JsonSerializer.Deserialize(message, new JsonSerializerOptions
- {
- // 整齐打印
- WriteIndented = true,
- //重新编码,解决中文乱码问题
- Encoder = JavaScriptEncoder.Create(UnicodeRanges.All)
- });
- if (publish.serialNumber >= 0)
- {
- dataList[publish.serialNumber - 1].IsSend = true;
- }
- break;
- default:
- break;
- }
- }
-
- }
- }
- void WebSocket_Error(SuperSocket.ClientEngine.ErrorEventArgs e)
- {
- //出错后隐藏加载窗口
- this.HideLoading();
- Debug.WriteLine("websocket_Error:" + e.Exception.ToString());
+ // this._websocketClient = websocketClient;
+ // _websocketClient.WebsocketError = WebSocket_Error;
+ // _websocketClient.WebSocketMessageReceived = WebSocket4Net_MessageReceived;
+ // _websocketClient.WebSocketInit(systemConfig.Url);
}
private string watcherPath;
@@ -113,7 +53,21 @@ namespace Txgy.FilesWatcher.ViewModels
get { return watcherPath; }
set { SetProperty(ref watcherPath, value); }
}
+ private string watcherMseedPath;
+ public string WatcherMseedPath
+ {
+ get { return watcherMseedPath; }
+ set { SetProperty(ref watcherMseedPath, value); }
+ }
+
+ private string mseedFilePath;
+ public string MseedFilePath
+
+ {
+ get { return mseedFilePath; }
+ set { SetProperty(ref mseedFilePath, value); }
+ }
private ObservableCollection dataList = new ObservableCollection();
public ObservableCollection DataList
@@ -187,13 +141,13 @@ namespace Txgy.FilesWatcher.ViewModels
if (!isLogin)
{
this.ShowLoading();
- _websocketClient.SiginServer(Account, Password);
+ // _websocketClient.SiginServer(Account, Password);
}
else
{
isLogin = false;
LoginContent = "登 录";
- _websocketClient.Closed();
+ // _websocketClient.Closed();
}
});
@@ -209,7 +163,6 @@ namespace Txgy.FilesWatcher.ViewModels
timer1.Start();
timer1.Tick += timer1_Tick;
IsIndeterminate = true;
- _websocketClient.SendMes(JsonSerializer.Serialize(new CSUserSubscribeMessage { type = CSMessage.subscribe }));
}
private void Stop()
@@ -217,23 +170,33 @@ namespace Txgy.FilesWatcher.ViewModels
WatchStartOrSopt(false);
timer1.Stop();
IsIndeterminate = false;
- _websocketClient.SendMes(JsonSerializer.Serialize(new CSUserSubscribeMessage { type = CSMessage.unsubscribe }));
-
}
- public DelegateCommand FilePathSaveCommand => new(() =>
+ public DelegateCommand