1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using FObjBase;
using Misc;
namespace FLY.FeedbackRenZiJia.Server
{
public class TDGage : Misc.ISaveToXml
{
#region 参数--------------------------------------------------------------------
#region 初始化------------------------------------------------------------------
public string mParamDirectory;//参数目录 m_path;//数据文件的 根目录默认是 Gage1
public string mName;//名字 如:gage0
#endregion
#region 本地数据----------------------------------------------------------------
public OBJ_FileBus.Server mServer;
public FeedbackHeat mfeedback;
#endregion
#region 服务器数据--------------------------------------------------------------
/// <summary>
/// OBJ服务端口
/// </summary>
public int OBJ_Port { get; set; } = 20007;
/// <summary>
/// 远程服务器
/// </summary>
public IPEndPoint ServerIPEP { get; set; }
public FLY.Thick.Base.Client.DynAreaService mDynAreaService;
public FLY.Thick.Blowing.Client.BlowingServiceClient mRenZiJia;
public FLY.Thick.Blowing.Client.BlowingDetectServiceClient mBDetect;
#endregion
#endregion
public TDGage(string nam)
{
mName = nam;
mParamDirectory = mName;// @"D:\" + m_name;
if (!System.IO.Directory.Exists(mParamDirectory))
{
System.IO.Directory.CreateDirectory(mParamDirectory);
}
System.Environment.CurrentDirectory = mParamDirectory;
Init1();
}
#region Init登陆服务器初始化----------------------------------------------------
/// <summary>
/// 第1步, 加载本地数据
/// </summary>
public void Init1()
{
#region 数据备份。。。。
BackupFile.Add("feedback.xml", BackupFile.xml_isFileOK);
BackupFile.Add("heatbuf.xml", BackupFile.xml_isFileOK);
BackupFile.Add("heatcell.xml", BackupFile.xml_isFileOK);
BackupFile.Add("system.xml", BackupFile.xml_isFileOK);
BackupFile.CheckResult cr = BackupFile.Check();
#endregion
OBJ_Port = 20007;
ServerIPEP = Misc.StringConverter.ToIPEndPoint("127.0.0.1:20006");
Load();
#region 与服务器同步的数据
mDynAreaService = new FLY.Thick.Base.Client.DynAreaService();
mRenZiJia = new FLY.Thick.Blowing.Client.BlowingServiceClient();
mBDetect = new Thick.Blowing.Client.BlowingDetectServiceClient();
#endregion
#region 提取保存的数据
mfeedback = new FeedbackHeat();//系统参数
mfeedback.Init(
mDynAreaService.mDynArea,
mRenZiJia,mBDetect
);
mServer = new OBJ_FileBus.Server("");
#endregion
Init2();
}
/// <summary>
/// 第2步, 连接到服务器,初始化参数 。由界面的 【登陆】 按钮触发
/// </summary>
private void Init2()
{
#region 网络初始化
FObjSys.Current.Connect_to_Another_OBJSys(
ServerIPEP,
mDynAreaService.ID,
mRenZiJia.ID,
mBDetect.ID
);
#endregion
}
#endregion
public void Save()
{
Misc.SaveToXmlHepler.Save("system.xml", this);
}
public void Load()
{
Misc.SaveToXmlHepler.Load("system.xml", this);
}
#region ISaveToXml 成员
public string[] GetSavePropertyNames()
{
return new string[]{
"OBJ_Port",
"ServerIPEP"
};
}
#endregion
}
}