2023年12月2日_3
添加MapViewer项目
修改MapViewNetwork类中,输入输出、构建管网等方法
已删除4个文件
已重命名6个文件
已修改41个文件
已添加8个文件
| | |
| | | |
| | | } |
| | | |
| | | public static class MessageCompressHelper |
| | | { |
| | | public static void SaveCompressedBase64ToFile<T>(T obj, string filePath) |
| | | { |
| | | // å°å¯¹è±¡åºåå为åèæ°ç» |
| | | var formatter = MessagePackSerializer.Serialize<T>(obj); |
| | | //var obj1 = MessagePackSerializer.Deserialize<T>(formatter); |
| | | File.WriteAllBytes(filePath, formatter); |
| | | //byte[] compressedData; |
| | | |
| | | //// ä½¿ç¨ GZip å缩åèæ°ç» |
| | | //using (var outputStream = new MemoryStream()) |
| | | //{ |
| | | // using (var gzipStream = new GZipStream(outputStream, CompressionMode.Compress)) |
| | | // { |
| | | // outputStream.Write(formatter, 0, formatter.Length); |
| | | // } |
| | | // compressedData = outputStream.ToArray(); |
| | | //} |
| | | |
| | | //// å°å缩åçåèæ°ç»è½¬ä¸º Base64 å符串 |
| | | //var base64String = Convert.ToBase64String(compressedData); |
| | | |
| | | // å° Base64 å符串åå
¥æä»¶ |
| | | //File.WriteAllText(filePath, base64String); |
| | | } |
| | | |
| | | public static T ReadCompressedBase64FromFile<T>(string filePath) |
| | | { |
| | | //// 仿件ä¸è¯»å Base64 å符串 |
| | | //var base64String = File.ReadAllText(filePath); |
| | | |
| | | //// å° Base64 å符串转为å缩åçåèæ°ç» |
| | | //byte[] compressedData = Convert.FromBase64String(base64String); |
| | | |
| | | //// ä½¿ç¨ GZip è§£å缩åèæ°ç» |
| | | //using (var inputStream = new MemoryStream(compressedData)) |
| | | //using (var outputStream = new MemoryStream()) |
| | | //{ |
| | | // using (var gzipStream = new GZipStream(inputStream, CompressionMode.Decompress)) |
| | | // { |
| | | // gzipStream.CopyTo(outputStream); |
| | | // } |
| | | |
| | | // // å°è§£å缩åçåèæ°ç»ååºåå为对象 |
| | | // var obj = MessagePackSerializer.Deserialize<T>(outputStream.ToArray()); |
| | | |
| | | // return obj; |
| | | //} |
| | | var formatter=File.ReadAllBytes(filePath ); |
| | | var obj = MessagePackSerializer.Deserialize<T>(formatter); |
| | | return obj; |
| | | |
| | | |
| | | } |
| | | |
| | | //public static void CopyMessage<T>(this object obj) |
| | | //{ |
| | | |
| | | // //return obj1; |
| | | //} |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | public class ProtoBufHelper |
| | | { |
| | | //public static void SaveCompressedProtoBufToFile<T>(T obj, string filePath) where T : IMessage<T> |
| | | //{ |
| | | // // å°å¯¹è±¡åºåå为åèæ°ç» |
| | | // byte[] buffer = obj.ToByteArray(); |
| | | |
| | | // // ä½¿ç¨ GZip å缩åèæ°ç» |
| | | // byte[] compressedData; |
| | | // using (var outputStream = new MemoryStream()) |
| | | // { |
| | | // using (var gzipStream = new GZipStream(outputStream, CompressionMode.Compress)) |
| | | // { |
| | | // gzipStream.Write(buffer, 0, buffer.Length); |
| | | // } |
| | | // compressedData = outputStream.ToArray(); |
| | | // } |
| | | |
| | | // // å°å缩åçåèæ°ç»åå
¥æä»¶ |
| | | // File.WriteAllBytes(filePath, compressedData); |
| | | //} |
| | | |
| | | //public static T ReadCompressedProtoBufFromFile<T>(string filePath) where T : IMessage<T>, new() |
| | | //{ |
| | | // // 仿件ä¸è¯»ååèæ°ç» |
| | | // byte[] buffer = File.ReadAllBytes(filePath); |
| | | |
| | | // // ä½¿ç¨ GZip è§£å缩åèæ°ç» |
| | | // byte[] decompressedData; |
| | | // using (var inputStream = new MemoryStream(buffer)) |
| | | // using (var outputStream = new MemoryStream()) |
| | | // { |
| | | // using (var gzipStream = new GZipStream(inputStream, CompressionMode.Decompress)) |
| | | // { |
| | | // gzipStream.CopyTo(outputStream); |
| | | // } |
| | | // decompressedData = outputStream.ToArray(); |
| | | // } |
| | | |
| | | // // å°è§£å缩åçåèæ°ç»ååºåå为对象 |
| | | // T obj = new T(); |
| | | // obj.MergeFrom(decompressedData); |
| | | |
| | | // return obj; |
| | | //} |
| | | } |
| | | |
| | | |
| | | |
| | | //[Serializable] |
| | | //public class CDictionary<TKey, TValue> : Dictionary<TKey, TValue> |
| | | //{ |
| | | // public CDictionary() :base() { } |
| | | // public new void Add(TKey key, TValue value) |
| | | // { |
| | | // if (ContainsKey(key)) |
| | | // { |
| | | // // å¤çéå¤é®çé»è¾ï¼è¿é以è¦çåæå¼ä¸ºä¾ |
| | | // this[key] = value; |
| | | // } |
| | | // else |
| | | // { |
| | | // base.Add(key, value); |
| | | // } |
| | | // } |
| | | |
| | | // public void FromDictionary(Dictionary<TKey, TValue> dictionary) |
| | | // { |
| | | // //CustomDictionary<TKey, TValue> customDictionary = new CustomDictionary<TKey, TValue>(); |
| | | // this.Clear(); |
| | | // foreach (KeyValuePair<TKey, TValue> kvp in dictionary) |
| | | // { |
| | | // this.Add(kvp.Key, kvp.Value); |
| | | // } |
| | | // //return customDictionary; |
| | | |
| | | // } |
| | | |
| | | // public Dictionary<TKey, TValue> ToDictionary() |
| | | // { |
| | | // Dictionary<TKey, TValue> dictionary = new Dictionary<TKey, TValue>(); |
| | | // foreach (KeyValuePair<TKey, TValue> kvp in this) |
| | | // { |
| | | // dictionary[kvp.Key] = kvp.Value; |
| | | // } |
| | | // return dictionary; |
| | | // } |
| | | //} |
| | | |
| | | |
| | | public static class ToDictionaryExtentions |
| | | { |
| | | public static ConcurrentDictionary<TKey, TValue> ToDictionaryEx<TElement, TKey, TValue>( |
| | | this IEnumerable<TElement> source, |
| | | Func<TElement, TKey> keyGetter, |
| | | Func<TElement, TValue> valueGetter) |
| | | { |
| | | ConcurrentDictionary<TKey, TValue> dict = new ConcurrentDictionary<TKey, TValue>(); // new Dictionary<TKey, TValue>(); |
| | | foreach (var e in source) |
| | | { |
| | | var key = keyGetter(e); |
| | | if (dict.ContainsKey(key)) |
| | | { |
| | | continue; |
| | | } |
| | | dict.TryAdd(key, valueGetter(e)); |
| | | } |
| | | return dict; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | using System; |
| | | using CommonBase.Properties; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Data; |
| | |
| | | path = AppDomain.CurrentDomain.BaseDirectory + "config.wdb"; |
| | | |
| | | //æ£æ¥æ°æ®åºæ¯å¦åå¨ï¼ä¸å¨åæ°å»º |
| | | //if (!File.Exists(path)) |
| | | // File.WriteAllBytes(path, Resources.Db); |
| | | if (!File.Exists(path)) |
| | | File.WriteAllBytes(path, Resources.Db); |
| | | |
| | | //åå§åæ°æ®åºè¿æ¥ä¸² |
| | | Connection = new SQLiteConnection($"Data Source={path};Pooling=true;FailIfMissing=false"); |
| | |
| | | |
| | | |
| | | //æ£æ¥æ°æ®åºæ¯å¦åå¨ï¼ä¸å¨åæ°å»º |
| | | //if (!File.Exists(path)) |
| | | // File.WriteAllBytes(path, Resources.Db); |
| | | if (!File.Exists(path)) |
| | | File.WriteAllBytes(path, Resources.Db); |
| | | |
| | | // ç§»é¤åªè¯»å±æ§ |
| | | FileAttributes attributes = File.GetAttributes(path); |
| | |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("æ²¡ææ°æ®å¯ä¾å¯¼åº"); |
| | | MessageBox.Show("æ²¡ææ°æ®å¯ä¾å¯¼åº", "æç¤º"); |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | throw new Exception("æä½å¤±è´¥"); |
| | | MessageBox.Show("æä½å¤±è´¥", "æç¤º"); |
| | | } |
| | | }//DataSetè¾åºExcel |
| | | |
| | |
| | | |
| | | if (filePath.Length <= 0 || !(extension == ".xls" || extension == ".xlsx" || extension == ".csv")) |
| | | { |
| | | throw new Exception("æä»¶åç§°é误æè
æ ¼å¼é误"); |
| | | //return null; |
| | | MessageBox.Show("æä»¶åç§°é误æè
æ ¼å¼é误"); |
| | | return null; |
| | | } |
| | | int r = 0; |
| | | |
| | |
| | | |
| | | if (strFileNme.Length <= 0 || !(strFileNme.Substring(strFileNme.LastIndexOf(".")).ToLower() == ".xls" || strFileNme.Substring(strFileNme.LastIndexOf(".")).ToLower() == ".xlsx")) |
| | | { |
| | | throw new Exception("æä»¶åç§°é误æè
æ ¼å¼é误"); |
| | | //return null; |
| | | MessageBox.Show("æä»¶åç§°é误æè
æ ¼å¼é误"); |
| | | return null; |
| | | } |
| | | int r = 0; |
| | | |
| | |
| | | } |
| | | public class GlobalPath |
| | | { |
| | | public static string Path { get; set; } |
| | | private static string path = null; |
| | | public static string Path { get { return path; } set { path = value; if (!string.IsNullOrEmpty(path) && path[path.Length - 1] != '\\') path = path + "\\"; } } |
| | | public static string configPath { get { string p = Path + @"\config\"; if (!Directory.Exists(p)) Directory.CreateDirectory(p); return p; }} |
| | | public static string modelPath { get { string p = Path + @"\model\"; if (!Directory.Exists(p)) Directory.CreateDirectory(p); return p; } } |
| | | |
| | |
| | | public Dictionary<string, SaveSettings> saveSettings { get; set; } = new Dictionary<string, SaveSettings>(); |
| | | |
| | | } |
| | | |
| | | public class SaveSettings |
| | | { |
| | | |
| | | public List<int> Length_Ds=null; |
| | | public List<DRange> list_Range=null; |
| | | public List<MyDoubleRange> list_Range=null; |
| | | public ConcurrentDictionary<ulong, double> saveDatas = null; |
| | | public string savePath=null; |
| | | |
| | |
| | | { |
| | | if (value == null) return; |
| | | |
| | | list_Range = value.Split('|').ToList().Select(n => new DRange(double.Parse(n.Split(',')[0]), double.Parse(n.Split(',')[1]))).ToList(); |
| | | list_Range = value.Split('|').ToList().Select(n => new MyDoubleRange(double.Parse(n.Split(',')[0]), double.Parse(n.Split(',')[1]))).ToList(); |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace CommonBase |
| | | { |
| | | public class Json |
| | | { |
| | | public static string Serialize(object obj) |
| | | { |
| | | return JsonConvert.SerializeObject(obj); |
| | | } |
| | | public static T Deserialize<T>(string json) |
| | | { |
| | | return JsonConvert.DeserializeObject<T>(json); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | public class Log |
| | | { |
| | | public static int LengthLimit = 100000; |
| | | public static bool Enable = false; |
| | | public static bool isAdded = false; |
| | | public static object lockObj=new object(); |
| | |
| | | |
| | | var time = DateTime.Now; |
| | | var now = time.ToString("HH:mm:ss"); |
| | | string nowtxt = ""; |
| | | if (now != lastTime) |
| | | { |
| | | sbs[name].AppendLine(now); |
| | | nowtxt= $"\r\n{now}"; |
| | | } |
| | | |
| | | string tt = ""; |
| | |
| | | { |
| | | signtxt = ":"; |
| | | } |
| | | sbs[name].AppendLine($"{signtxt}{tt}{time.ToString("fff")}\t{txt}\t({(time - ts[name][level]).TotalMilliseconds})"); |
| | | sbs[name].Append($"({(time - ts[name][level]).TotalMilliseconds})\r\n{nowtxt}{signtxt}{tt}{time.ToString("fff")}\t{txt}\t"); |
| | | lastTime = now; |
| | | ts[name][level] = time; |
| | | } |
| | |
| | | { |
| | | var name = key == "default" ? "" : key; |
| | | var file = $@"Log\log_{name}.lua"; |
| | | //if (File.Exists(file)) File.Copy(file, $@"Log\log_{name}_bk_{DateTime.Now.ToString("yyyyMMddHHmmss")}.lua", true); |
| | | |
| | | if (!Directory.Exists("Log\\")) Directory.CreateDirectory("Log\\"); |
| | | |
| | | StreamWriter sw = null; |
| | |
| | | sw = new StreamWriter(file); |
| | | sw.WriteLine(sbs[key].ToString()); |
| | | sw.Close(); |
| | | if (sbs[key].Length>LengthLimit) |
| | | { |
| | | if (File.Exists(file)) File.Copy(file, $@"Log\log_{name}_bk_{DateTime.Now.ToString("yyyyMMddHHmmss")}.lua", true); |
| | | sbs[key].Clear(); |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | if (sw != null) sw.Close(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | public static void OpenFile() |
| | |
| | | if (dateTime==default(DateTime)) { dateTime=DateTime.Now; } |
| | | //string currentDirectory = Directory.GetCurrentDirectory(); |
| | | string resultPath = GlobalPath.resultPath;// Path.Combine(GlobalPath.resultPath, "result"); |
| | | |
| | | string currentDirectory = Directory.GetCurrentDirectory(); |
| | | //string resultPath = GlobalPath.resultPath; |
| | | string userPathFile = resultPath + "UserPath.ini"; |
| | | string userPath = null; |
| | | if (File.Exists(userPathFile)) |
| | | { |
| | | userPath = File.ReadAllText(userPathFile); |
| | | } |
| | | if (userPath == null || !Directory.Exists(userPath)) |
| | | { |
| | | userPath = resultPath; |
| | | } |
| | | bool flag = false; |
| | | |
| | | int lastMinutes = 10; |
| | |
| | | if (MessageBox.Show("èªå¨éæ©åå²è¾åºï¼\r\næ¯ï¼èªå¨\r\nå¦ï¼æå¨", "æ¹æ¡æ©ä¼", MessageBoxButtons.YesNo) == DialogResult.No) |
| | | { |
| | | OpenFileDialog openFileDialog = new OpenFileDialog(); |
| | | openFileDialog.InitialDirectory = resultPath; |
| | | |
| | | openFileDialog.InitialDirectory = userPath; |
| | | openFileDialog.Filter = "JSON Files (*.json)|*.json"; |
| | | openFileDialog.Multiselect = true; |
| | | |
| | |
| | | DateTime tenMinutesAgo = currentTime.AddMinutes(-lastMinutes); |
| | | |
| | | // æ¥æ¾ç®å½ä¸çææ.jsonæä»¶ï¼å¹¶æ ¹æ®ä¿®æ¹æ¶é´è¿è¡çé |
| | | string[] jsonFiles = Directory.GetFiles(resultPath, "*.json") |
| | | string[] jsonFiles = Directory.GetFiles(userPath, "*.json") |
| | | .Where(file => File.GetLastWriteTime(file) >= tenMinutesAgo && File.GetLastWriteTime(file) <= currentTime) |
| | | .ToArray(); |
| | | string[] inputFiles = Directory.GetFiles(resultPath, "*.input") |
| | | string[] inputFiles = Directory.GetFiles(userPath, "*.input") |
| | | .Where(file => File.GetLastWriteTime(file) >= tenMinutesAgo && File.GetLastWriteTime(file) <= currentTime) |
| | | .ToArray(); |
| | | files = jsonFiles.ToList(); |
| | |
| | | DateTime tenMinutesAgo = currentTime.AddMinutes(-lastMinutes); |
| | | |
| | | // æ¥æ¾ç®å½ä¸çææ.jsonæä»¶ï¼å¹¶æ ¹æ®ä¿®æ¹æ¶é´è¿è¡çé |
| | | string[] jsonFiles = Directory.GetFiles(resultPath, "*.json") |
| | | string[] jsonFiles = Directory.GetFiles(userPath, "*.json") |
| | | .Where(file => getTimeByFileName(file) >= tenMinutesAgo && getTimeByFileName(file) <= currentTime) |
| | | .OrderBy(file =>file) |
| | | .ToArray(); |
| | | |
| | | string[] inputFiles = Directory.GetFiles(resultPath, "*.input") |
| | | string[] inputFiles = Directory.GetFiles(userPath, "*.input") |
| | | .Where(file => getTimeByFileName(file) >= tenMinutesAgo && getTimeByFileName(file) <= currentTime) |
| | | .OrderBy(file=>file) |
| | | .ToArray(); |
| | |
| | | List<PointF3D> points = new List<PointF3D>(); |
| | | DataTable dt = new DataTable(); |
| | | dt.Columns.Add("æ¶é´", typeof(DateTime)); |
| | | if (Inputfiles.Count!=0) dt.Columns.Add("æ¥å£æä»¶"); |
| | | if (Inputfiles.Count != 0) |
| | | { |
| | | dt.Columns.Add("æ¥å£æä»¶"); |
| | | dt.Columns.Add("ç»ææä»¶"); |
| | | } |
| | | List<double> RecentScada=null; |
| | | if (files.Count>0) |
| | | { |
| | |
| | | param = JsonConvert.DeserializeObject<LogicModelParams>(fileContent); |
| | | } |
| | | ParamBuffer.dict.TryAdd(name, param.CloneResult()); |
| | | if (ParamBuffer.dict.Count> lastMinutes*3) |
| | | { |
| | | foreach(var key in ParamBuffer.dict.Keys.ToList()) |
| | | { |
| | | if (getTimeByFileName(key) < DateTime.Now.AddMinutes(-lastMinutes)) ParamBuffer.dict.TryRemove(key,out LogicModelParams v); |
| | | } |
| | | } |
| | | } |
| | | |
| | | param.dict_ID.TryGetValue(hostID, out variable obj); |
| | |
| | | dict dict = new dict(); |
| | | dict.LoadFromString(obj.objListString); |
| | | RecentScada = getScadaPumpStatusList(dict); |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | try |
| | | { |
| | | param = MessageCompressHelper.ReadCompressedBase64FromFile<LogicModelParams>(file_full); |
| | | } |
| | | catch |
| | | { |
| | | // 读åæä»¶å
容 |
| | | string fileContent = File.ReadAllText(file_full); |
| | | param = JsonConvert.DeserializeObject<LogicModelParams>(fileContent); |
| | | } |
| | | //try |
| | | //{ |
| | | // param = MessageCompressHelper.ReadCompressedBase64FromFile<LogicModelParams>(file_full); |
| | | //} |
| | | //catch |
| | | //{ |
| | | |
| | | //} |
| | | string fileContent = File.ReadAllText(file_full); |
| | | param = JsonConvert.DeserializeObject<LogicModelParams>(fileContent); |
| | | // 读åæä»¶å
容 |
| | | |
| | | ParamBuffer.dict.TryAdd(name, param.CloneResult()); |
| | | } |
| | |
| | | if (i==files.Count-1 && dt.Rows.Count==0 || (double)dr["ç¦æ°¸ç®æ "] < 4000 && æ°´æ³µæªååæ¶æ°´åååå忝妿£å¸¸(doubles, int.Parse( dr["å¼å
³é维度å¼"].ToString()))) |
| | | { |
| | | points.Add(new PointF3D(doubles[0], doubles[1], doubles[2], dt.Rows.Count)); |
| | | if (Inputfiles.Count != 0) dr["æ¥å£æä»¶"] = Inputfiles[i]; |
| | | if (Inputfiles.Count != 0) |
| | | { |
| | | dr["æ¥å£æä»¶"] = Inputfiles[i]; |
| | | dr["ç»ææä»¶"] = files[i]; |
| | | } |
| | | dt.Rows.Add(dr); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | dt.Columns.Add("æ è®°"); |
| | | if (Inputfiles.Count != 0) dt.Columns["æ¥å£æä»¶"].SetOrdinal(dt.Columns.Count-1); |
| | | if (Inputfiles.Count != 0) |
| | | { |
| | | dt.Columns["ç»ææä»¶"].SetOrdinal(dt.Columns.Count - 1); |
| | | dt.Columns["æ¥å£æä»¶"].SetOrdinal(dt.Columns.Count - 1); |
| | | |
| | | } |
| | | |
| | | |
| | | if (points.Count <= 0) return new DataTable(); |
| | | var filterpoints = points; |
| | |
| | | dt.Rows[p.rowIndex]["æ è®°"] = ""; |
| | | } |
| | | dt.Rows[minP.rowIndex]["æ è®°"] = "â"; |
| | | |
| | | ValidNum=filterpoints.Count; |
| | | return dt; |
| | | } |
| | |
| | | static bool æ°´æ³µæªååæ¶æ°´åååå忝妿£å¸¸(double[] doubles,int å¼å
³é) |
| | | { |
| | | if (å¼å
³é != 0) return true; |
| | | var ç«æ°åå= Math.Abs(doubles[0] - doubles[3]); |
| | | var å¤å°åå = Math.Abs(doubles[1] - doubles[4]); |
| | | if (ç«æ°åå*101.972 > 1.2 || å¤å°åå*101.972 > 1.2) return false; |
| | | var ç«æ°åå= doubles[0] - doubles[3]; |
| | | var å¤å°åå = doubles[1] - doubles[4]; |
| | | |
| | | if (ç«æ°åå* å¤å°åå<0 && (Math.Abs(ç«æ°åå) *101.972 > 1.2 || Math.Abs(å¤å°åå) *101.972 > 1.2)) return false; |
| | | return true; |
| | | } |
| | | static DateTime getTimeByFileName(string filename) |
| | |
| | | double stdDev = Math.Sqrt(sumOfSquares / values.Count); |
| | | return stdDev; |
| | | } |
| | | |
| | | static string getOptString(double x) |
| | | { |
| | | if (x < 0) return "å
³é"; |
| | | else return "å¼å¯"; |
| | | } |
| | | public static string getOrderTxt(DataView dv, int bestRowIndex) |
| | | { |
| | | |
| | | if (bestRowIndex < 0) return null; |
| | | DataRowView row = dv[bestRowIndex]; |
| | | int recentRowIndex = dv.Count - 1; |
| | | double num = (double)dv[bestRowIndex][3]; |
| | | |
| | | bool isChangePump = false; |
| | | if (num<-1000) |
| | | { |
| | | isChangePump = true; |
| | | } |
| | | string stateTxt = (num > 0) ? "å¼å¯" : "å
³é"; |
| | | int num1 = (int)Math.Abs(num); |
| | | int PumpNum = num1 / 100; |
| | | string facTxt = (PumpNum <= 5) ? "ç«æ°" : "å¤å°"; |
| | | int PumpNumShow = PumpNum > 5 ? PumpNum - 5 : PumpNum; |
| | | string pumpChangeTxt = num == 0 ? "æ°´æ³µå¼åä¸å" : $"{facTxt}{stateTxt}{PumpNumShow}#æ³µ"; |
| | | //string pumpChangeTxt = num == 0 ? "æ°´æ³µå¼åä¸å" : $"{facTxt}{stateTxt}{PumpNumShow}#æ³µ"; |
| | | string pumpChangeTxt_lx = ""; |
| | | string pumpChangeTxt_fh = ""; |
| | | var time = DateTime.Now; |
| | | string PumpStateList_lx0 = ""; |
| | | string PumpStateList_fh0 = ""; |
| | |
| | | string PumpStateList_fh1 = ""; |
| | | for (int i = 1; i <= 5; i++) |
| | | { |
| | | if ((double)dv[bestRowIndex][5 + i] == 1) |
| | | { |
| | | PumpStateList_lx1 += $"{i}#"; |
| | | if (i != PumpNum) |
| | | { |
| | | PumpStateList_lx0 += $"{i}#"; |
| | | } |
| | | } |
| | | else if (i == PumpNum) |
| | | { |
| | | PumpStateList_lx0 += $"{i}#"; |
| | | } |
| | | double d = 0; |
| | | if ((d = (double)dv[bestRowIndex][15 + i]) == 1) PumpStateList_lx0 += $"{i}#"; |
| | | if ((d = (double)dv[bestRowIndex][20 + i]) == 1) PumpStateList_fh0 += $"{i}#"; |
| | | if ((d = (double)dv[bestRowIndex][5 + i]) == 1) PumpStateList_lx1 += $"{i}#"; |
| | | if ((d = (double)dv[bestRowIndex][10 + i]) == 1) PumpStateList_fh1 += $"{i}#"; |
| | | if ((d=(double)dv[bestRowIndex][25 + i]) != 0) pumpChangeTxt_lx += $"{getOptString(d)}{i}#"; |
| | | if ((d = (double)dv[bestRowIndex][30 + i]) != 0) pumpChangeTxt_fh += $"{getOptString(d)}{i}#"; |
| | | } |
| | | if (pumpChangeTxt_lx != "") pumpChangeTxt_lx = "ç«æ°" + pumpChangeTxt_lx; |
| | | if (pumpChangeTxt_fh != "") pumpChangeTxt_fh = "å¤å°" + pumpChangeTxt_fh; |
| | | //for (int i = 1; i <= 5; i++) |
| | | //{ |
| | | // if ((double)dv[bestRowIndex][5 + i] == 1) |
| | | // { |
| | | // PumpStateList_lx1 += $"{i}#"; |
| | | // if (i != PumpNum) |
| | | // { |
| | | // PumpStateList_lx0 += $"{i}#"; |
| | | // } |
| | | // } |
| | | // else if (i == PumpNum) |
| | | // { |
| | | // PumpStateList_lx0 += $"{i}#"; |
| | | // } |
| | | //} |
| | | |
| | | PumpNum = PumpNum - 5; |
| | | for (int i = 1; i <= 5; i++) |
| | | { |
| | | if ((double)dv[bestRowIndex][10 + i] == 1) |
| | | { |
| | | PumpStateList_fh1 += $"{i}#"; |
| | | if (i != PumpNum) |
| | | { |
| | | PumpStateList_fh0 += $"{i}#"; |
| | | } |
| | | } |
| | | else if (i == PumpNum) |
| | | { |
| | | PumpStateList_fh0 += $"{i}#"; |
| | | } |
| | | } |
| | | //PumpNum = PumpNum - 5; |
| | | //for (int i = 1; i <= 5; i++) |
| | | //{ |
| | | // if ((double)dv[bestRowIndex][10 + i] == 1) |
| | | // { |
| | | // PumpStateList_fh1 += $"{i}#"; |
| | | // if (i != PumpNum) |
| | | // { |
| | | // PumpStateList_fh0 += $"{i}#"; |
| | | // } |
| | | // } |
| | | // else if (i == PumpNum) |
| | | // { |
| | | // PumpStateList_fh0 += $"{i}#"; |
| | | // } |
| | | //} |
| | | |
| | | string txt = $@"{time:HH:mm} |
| | | æ¹æ¡å
å®¹ï¼ |
| | | ï² å½åè¿è¡æ¹æ¡ï¼ |
| | | ç«æ°ï¼{PumpStateList_lx0} åºåååï¼{dv[recentRowIndex][4]}MPa |
| | | å¤å°ï¼{PumpStateList_fh0} åºåååï¼{dv[recentRowIndex][5]}MPa |
| | | ç«æ°ï¼{PumpStateList_lx0} åºåååï¼{dv[recentRowIndex][4]:0.000}MPa åºåæµéï¼{dv[recentRowIndex][38]:0}m³/h |
| | | å¤å°ï¼{PumpStateList_fh0} åºåååï¼{dv[recentRowIndex][5]:0.000}MPa åºåæµéï¼{dv[recentRowIndex][39]:0}m³/h |
| | | ï² æ¨èæ¹æ¡ï¼ |
| | | ç«æ°ï¼{PumpStateList_lx1} åºåååï¼{dv[bestRowIndex][1]}MPa |
| | | å¤å°ï¼{PumpStateList_fh1} åºåååï¼{dv[bestRowIndex][2]}MPa |
| | | {pumpChangeTxt}ï¼ååè°æ´ |
| | | ç«æ°ï¼{PumpStateList_lx1} åºåååï¼{dv[bestRowIndex][1]:0.000}MPa åºåæµéï¼{dv[recentRowIndex][36]:0}m³/h |
| | | å¤å°ï¼{PumpStateList_fh1} åºåååï¼{dv[bestRowIndex][2]:0.000}MPa åºåæµéï¼{dv[recentRowIndex][37]:0}m³/h |
| | | {pumpChangeTxt_lx}{pumpChangeTxt_fh} |
| | | "; |
| | | txt = txt.Trim('\n').Trim(' '); |
| | | return txt; |
| | |
| | | content = txt |
| | | } |
| | | }); |
| | | |
| | | using (HttpClient client = new HttpClient()) |
| | | if (url == null) return "url is null"; |
| | | foreach(var url0 in url.Split(';')) |
| | | { |
| | | client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); |
| | | |
| | | HttpContent content = new StringContent(param, Encoding.UTF8, "application/json"); |
| | | |
| | | HttpResponseMessage response = client.PostAsync(url, content).Result; |
| | | |
| | | if (response.IsSuccessStatusCode) |
| | | using (HttpClient client = new HttpClient()) |
| | | { |
| | | // åéæå |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | // åé失败 |
| | | return response.ReasonPhrase; |
| | | client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); |
| | | |
| | | HttpContent content = new StringContent(param, Encoding.UTF8, "application/json"); |
| | | |
| | | HttpResponseMessage response = client.PostAsync(url0, content).Result; |
| | | |
| | | if (!response.IsSuccessStatusCode) |
| | | { |
| | | // åé失败 |
| | | return response.ReasonPhrase; |
| | | } |
| | | } |
| | | } |
| | | // åéæå |
| | | return null; |
| | | |
| | | |
| | | } |
| | | } |
| | | class PointF3D |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace CommonBase |
| | | { |
| | | public class MyDoubleRange |
| | | { |
| | | |
| | | public MyDoubleRange(double min, double max) |
| | | { |
| | | Min = min; |
| | | Max = max; |
| | | } |
| | | |
| | | public double Min { get; set; } |
| | | public double Max { get; set; } |
| | | |
| | | public double Length { get { return Max - Min; } } |
| | | |
| | | public bool IsInside(double x) |
| | | { |
| | | return x >= Min && x <= Max; |
| | | } |
| | | } |
| | | } |
| | |
| | | <Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\BouncyCastle.Cryptography.2.2.1\lib\net461\BouncyCastle.Cryptography.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="Dapper, Version=1.50.2.0, Culture=neutral, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\Dapper.1.50.2\lib\net451\Dapper.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath> |
| | | </Reference> |
| | |
| | | <Compile Include="component\DeepCopy.cs" /> |
| | | <Compile Include="component\dict.cs" /> |
| | | <Compile Include="component\json.cs" /> |
| | | <Compile Include="component\Range.cs" /> |
| | | <Compile Include="component\Relation.cs" /> |
| | | <Compile Include="component\Trigger.cs" /> |
| | | <Compile Include="control\messageCtrl.cs" /> |
| | | <Compile Include="ex\JObjectExtensions.cs" /> |
| | | <Compile Include="Helper\Base64Helper.cs" /> |
| | |
| | | <Compile Include="IFitnessFunction.cs" /> |
| | | <Compile Include="ParamModel.cs" /> |
| | | <Compile Include="Properties\AssemblyInfo.cs" /> |
| | | <Compile Include="Properties\Resources.Designer.cs"> |
| | | <AutoGen>True</AutoGen> |
| | | <DesignTime>True</DesignTime> |
| | | <DependentUpon>Resources.resx</DependentUpon> |
| | | </Compile> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <None Include="app.config" /> |
| | |
| | | <Name>Hydro.Core</Name> |
| | | </ProjectReference> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <EmbeddedResource Include="Properties\Resources.resx"> |
| | | <Generator>ResXFileCodeGenerator</Generator> |
| | | <LastGenOutput>Resources.Designer.cs</LastGenOutput> |
| | | </EmbeddedResource> |
| | | </ItemGroup> |
| | | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
| | | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
| | | <PropertyGroup> |
| | |
| | | //using NPOI.SS.Formula.Eval; |
| | | using System.Runtime.Serialization; |
| | | using Newtonsoft.Json; |
| | | using Hydro.Core.Model; |
| | | using System.Collections.Concurrent; |
| | | using Dapper; |
| | | |
| | | namespace CommonBase |
| | | { |
| | |
| | | Count++; |
| | | } |
| | | |
| | | public GeneticParams(string ConfigPath, GeneticParams gParam) |
| | | { |
| | | if (gParam == null) gParam = new GeneticParams(0); |
| | | this.Level = gParam.Level; |
| | | this.ID = gParam.ID; |
| | | if (gParam.Db == null) gParam.Db = new Db(); |
| | | if (!string.IsNullOrEmpty(ConfigPath)) gParam.Db.Init(ConfigPath); |
| | | this.Db = gParam.Db; |
| | | if (gParam.Quene!=null) gParam.Quene.Dispose(); |
| | | gParam.Quene = new Quene(); |
| | | this.Quene= gParam.Quene; |
| | | //è·åå
¨å±é»è®¤è®¾ç½® |
| | | var globalConfig = gParam.Db.Connection.QueryFirstOrDefault<string>("SELECT FValue FROM MyConfig WHERE FKey='GlobalConfig'"); |
| | | gParam.GlobalConfig = JsonConvert.DeserializeObject<GlobalConfig>(globalConfig) ?? new GlobalConfig(); |
| | | this.GlobalConfig = gParam.GlobalConfig; |
| | | //return gParam; |
| | | } |
| | | public void Dispose() |
| | | { |
| | | onReportProgress = null; |
| | |
| | | |
| | | public int num; |
| | | public double BestOptValue; |
| | | public DoubleRange tolerance; |
| | | public MyDoubleRange tolerance; |
| | | public FinishEvent onFinished; |
| | | public FinishEvent onError; |
| | | public FinishEvent onReportProgress; |
| | | public SetEvent setVars; |
| | | |
| | | public Db Db; |
| | | //public SolutionDBHelper SolutionDBHelper = null; |
| | | public dynamic SolutionDBHelper = null; |
| | | public GlobalConfig GlobalConfig; |
| | | public Quene Quene; |
| | | public int Level; |
| | |
| | | public DateTime ScadaTime; |
| | | public List<TimePoint> TimePoints; |
| | | public double BestResult=double.MaxValue; |
| | | public void Dispose() |
| | | { |
| | | if (RequestQueues != null) |
| | | { |
| | | RequestQueues.Clear(); |
| | | RequestQueues = null; |
| | | } |
| | | if (RequestFinished != null) |
| | | { |
| | | RequestFinished.Clear(); |
| | | RequestFinished = null; |
| | | } |
| | | |
| | | if (ResultHash != null) |
| | | { |
| | | ResultHash.Clear(); |
| | | ResultHash = null; |
| | | } |
| | | if (ResultDictionary != null) |
| | | { |
| | | ResultDictionary.Clear(); |
| | | ResultDictionary = null; |
| | | } |
| | | if (ResultChrome != null) |
| | | { |
| | | ResultChrome.Clear(); |
| | | ResultChrome = null; |
| | | } |
| | | if (MissionQuene != null) |
| | | { |
| | | MissionQuene.Clear(); |
| | | MissionQuene = null; |
| | | } |
| | | if (TimePoints != null) |
| | | { |
| | | TimePoints.Clear(); |
| | | TimePoints = null; |
| | | } |
| | | |
| | | } |
| | | } |
| | | [Serializable] |
| | | |
| | |
| | | |
| | | public Guid ID; |
| | | public List<TimePoint> ScadaPoints { get; set; } = new List<TimePoint>(); |
| | | |
| | | public ConcurrentDictionary<string, TimePoint> dict_Scada_key = null; |
| | | public List<TimePoint> ConfigPoints { get; set; } = new List<TimePoint>(); |
| | | public List<TimePoint> ResultPoints { get; set; } = new List<TimePoint>(); |
| | | public double Fitness = -1; |
| | |
| | | } |
| | | } |
| | | |
| | | //[Serializable] |
| | | [Serializable] |
| | | |
| | | //public class TimePoint |
| | | //{ |
| | | // public TimePoint() |
| | | // { |
| | | public class TimePoint |
| | | { |
| | | public TimePoint() |
| | | { |
| | | |
| | | // } |
| | | // public TimePoint(string key, double value) |
| | | // { |
| | | // Key = key; |
| | | // Value = value; |
| | | // } |
| | | } |
| | | public TimePoint(string key, double value) |
| | | { |
| | | Key = key; |
| | | Value = value; |
| | | } |
| | | |
| | | // public string Name; |
| | | // public DateTime ValueTime { get; set; } |
| | | // public string Key { get; set; } |
| | | // public double Value { get; set; } |
| | | // public double[] Pattern { get; set; } = null; |
| | | // public string ModelObjectID { get; set; } |
| | | // public SettingCalcType CType { get; set; } = SettingCalcType.Add; |
| | | public string Name; |
| | | public DateTime ValueTime { get; set; } |
| | | public string Key { get; set; } |
| | | public double Value { get; set; } |
| | | public double[] Pattern { get; set; } = null; |
| | | public string ModelObjectID { get; set; } |
| | | public SettingCalcType CType { get; set; } = SettingCalcType.Add; |
| | | |
| | | // public double SearchRange = 0; |
| | | public double SearchRange = 0; |
| | | |
| | | // public bool isNeedtoSave = false; |
| | | public bool isNeedtoSave = false; |
| | | |
| | | // public string SaveKey = null; |
| | | public string SaveKey = null; |
| | | |
| | | // public override string ToString() |
| | | // { |
| | | // return $"{Name}\t[{Key}]\t{Value}"; |
| | | // } |
| | | //} |
| | | public override string ToString() |
| | | { |
| | | return $"{Name}\t[{Key}]\t{Value}"; |
| | | } |
| | | } |
| | | |
| | | |
| | | [Serializable] |
| | |
| | | public Dictionary<string, variable> dict_Name; |
| | | public Dictionary<int, variable> dict_ID; |
| | | |
| | | public string inputFileString; |
| | | //public string inputFileString; |
| | | |
| | | public void buildDict() |
| | | { |
| | |
| | | public class OBJFunction |
| | | { |
| | | public string Text_origin; |
| | | public string Text_change; |
| | | public string Text; |
| | | public string ExpressType; |
| | | public string Name; |
| | | |
| | | public double value; |
| | | public DoubleRange tolerance; |
| | | public MyDoubleRange tolerance; |
| | | public variable variable; |
| | | public List<variable> paramVariables; |
| | | public List<double> paramValues; |
| | |
| | | [assembly: AssemblyTitle("CommonBase")] |
| | | [assembly: AssemblyDescription("")] |
| | | [assembly: AssemblyConfiguration("")] |
| | | [assembly: AssemblyCompany("Administrator")] |
| | | [assembly: AssemblyCompany("")] |
| | | [assembly: AssemblyProduct("CommonBase")] |
| | | [assembly: AssemblyCopyright("Copyright © Administrator 2023")] |
| | | [assembly: AssemblyCopyright("Copyright © 2022")] |
| | | [assembly: AssemblyTrademark("")] |
| | | [assembly: AssemblyCulture("")] |
| | | |
| | |
| | | [assembly: ComVisible(false)] |
| | | |
| | | // 妿æ¤é¡¹ç®å COM å
¬å¼ï¼åä¸å GUID ç¨äºç±»ååºç ID |
| | | [assembly: Guid("84e17ba3-ba03-43c1-9d19-8ce64508f2b5")] |
| | | [assembly: Guid("9f7b845f-4b4d-40e5-bd8e-5afbc23deaca")] |
| | | |
| | | // ç¨åºéççæ¬ä¿¡æ¯ç±ä¸åå个å¼ç»æ: |
| | | // |
¶Ô±ÈÐÂÎļþ |
| | |
| | | //------------------------------------------------------------------------------ |
| | | // <auto-generated> |
| | | // æ¤ä»£ç ç±å·¥å
·çæã |
| | | // è¿è¡æ¶çæ¬:4.0.30319.42000 |
| | | // |
| | | // å¯¹æ¤æä»¶çæ´æ¹å¯è½ä¼å¯¼è´ä¸æ£ç¡®çè¡ä¸ºï¼å¹¶ä¸å¦æ |
| | | // éæ°çæä»£ç ï¼è¿äºæ´æ¹å°ä¼ä¸¢å¤±ã |
| | | // </auto-generated> |
| | | //------------------------------------------------------------------------------ |
| | | |
| | | namespace CommonBase.Properties { |
| | | using System; |
| | | |
| | | |
| | | /// <summary> |
| | | /// ä¸ä¸ªå¼ºç±»åçèµæºç±»ï¼ç¨äºæ¥æ¾æ¬å°åçå符串çã |
| | | /// </summary> |
| | | // æ¤ç±»æ¯ç± StronglyTypedResourceBuilder |
| | | // ç±»éè¿ç±»ä¼¼äº ResGen æ Visual Studio çå·¥å
·èªå¨çæçã |
| | | // è¥è¦æ·»å æç§»é¤æåï¼è¯·ç¼è¾ .ResX æä»¶ï¼ç¶åéæ°è¿è¡ ResGen |
| | | // (以 /str ä½ä¸ºå½ä»¤é项)ï¼æéæ°çæ VS 项ç®ã |
| | | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.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() { |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è¿åæ¤ç±»ä½¿ç¨çç¼åç ResourceManager å®ä¾ã |
| | | /// </summary> |
| | | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
| | | internal static global::System.Resources.ResourceManager ResourceManager { |
| | | get { |
| | | if (object.ReferenceEquals(resourceMan, null)) { |
| | | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CommonBase.Properties.Resources", typeof(Resources).Assembly); |
| | | resourceMan = temp; |
| | | } |
| | | return resourceMan; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éåå½å线ç¨ç CurrentUICulture 屿§ï¼å¯¹ |
| | | /// ä½¿ç¨æ¤å¼ºç±»åèµæºç±»çææèµæºæ¥æ¾æ§è¡éåã |
| | | /// </summary> |
| | | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
| | | internal static global::System.Globalization.CultureInfo Culture { |
| | | get { |
| | | return resourceCulture; |
| | | } |
| | | set { |
| | | resourceCulture = value; |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <root> |
| | | <!-- |
| | | Microsoft ResX Schema |
| | | |
| | | Version 1.3 |
| | | |
| | | The primary goals of this format is to allow a simple XML format |
| | | that is mostly human readable. The generation and parsing of the |
| | | various data types are done through the TypeConverter classes |
| | | associated with the data types. |
| | | |
| | | Example: |
| | | |
| | | ... ado.net/XML headers & schema ... |
| | | <resheader name="resmimetype">text/microsoft-resx</resheader> |
| | | <resheader name="version">1.3</resheader> |
| | | <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
| | | <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
| | | <data name="Name1">this is my long string</data> |
| | | <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
| | | <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
| | | [base64 mime encoded serialized .NET Framework object] |
| | | </data> |
| | | <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
| | | [base64 mime encoded string representing a byte array form of the .NET Framework object] |
| | | </data> |
| | | |
| | | There are any number of "resheader" rows that contain simple |
| | | name/value pairs. |
| | | |
| | | Each data row contains a name, and value. The row also contains a |
| | | type or mimetype. Type corresponds to a .NET class that support |
| | | text/value conversion through the TypeConverter architecture. |
| | | Classes that don't support this are serialized and stored with the |
| | | mimetype set. |
| | | |
| | | The mimetype is used for serialized objects, and tells the |
| | | ResXResourceReader how to depersist the object. This is currently not |
| | | extensible. For a given mimetype the value must be set accordingly: |
| | | |
| | | Note - application/x-microsoft.net.object.binary.base64 is the format |
| | | that the ResXResourceWriter will generate, however the reader can |
| | | read any of the formats listed below. |
| | | |
| | | mimetype: application/x-microsoft.net.object.binary.base64 |
| | | value : The object must be serialized with |
| | | : System.Serialization.Formatters.Binary.BinaryFormatter |
| | | : and then encoded with base64 encoding. |
| | | |
| | | mimetype: application/x-microsoft.net.object.soap.base64 |
| | | value : The object must be serialized with |
| | | : System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
| | | : and then encoded with base64 encoding. |
| | | |
| | | mimetype: application/x-microsoft.net.object.bytearray.base64 |
| | | value : The object must be serialized into a byte array |
| | | : using a System.ComponentModel.TypeConverter |
| | | : and then encoded with base64 encoding. |
| | | --> |
| | | |
| | | <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
| | | <xsd:element name="root" msdata:IsDataSet="true"> |
| | | <xsd:complexType> |
| | | <xsd:choice maxOccurs="unbounded"> |
| | | <xsd:element name="data"> |
| | | <xsd:complexType> |
| | | <xsd:sequence> |
| | | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
| | | <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
| | | </xsd:sequence> |
| | | <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> |
| | | <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
| | | <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
| | | </xsd:complexType> |
| | | </xsd:element> |
| | | <xsd:element name="resheader"> |
| | | <xsd:complexType> |
| | | <xsd:sequence> |
| | | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
| | | </xsd:sequence> |
| | | <xsd:attribute name="name" type="xsd:string" use="required" /> |
| | | </xsd:complexType> |
| | | </xsd:element> |
| | | </xsd:choice> |
| | | </xsd:complexType> |
| | | </xsd:element> |
| | | </xsd:schema> |
| | | <resheader name="resmimetype"> |
| | | <value>text/microsoft-resx</value> |
| | | </resheader> |
| | | <resheader name="version"> |
| | | <value>1.3</value> |
| | | </resheader> |
| | | <resheader name="reader"> |
| | | <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
| | | </resheader> |
| | | <resheader name="writer"> |
| | | <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
| | | </resheader> |
| | | </root> |
| | |
| | | using System.Data; |
| | | //using æä»¶è¯»å; |
| | | |
| | | |
| | | namespace CommonBase |
| | | { |
| | | |
| | |
| | | <packages> |
| | | <package id="AForge" version="2.2.5" targetFramework="net472" /> |
| | | <package id="BouncyCastle.Cryptography" version="2.2.1" targetFramework="net472" /> |
| | | <package id="Dapper" version="1.50.2" targetFramework="net472" /> |
| | | <package id="EntityFramework" version="6.4.4" targetFramework="net472" /> |
| | | <package id="Enums.NET" version="4.0.1" targetFramework="net472" /> |
| | | <package id="ExcelDataReader" version="3.6.0" targetFramework="net472" /> |
| | |
| | | <Reference Include="AForge, Version=2.2.5.0, Culture=neutral, PublicKeyToken=c1db6ff4eaa06aeb, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\AForge.2.2.5\lib\AForge.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="Dapper, Version=1.50.1.0, Culture=neutral, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\Dapper.1.50.1\lib\net451\Dapper.dll</HintPath> |
| | | <Reference Include="Dapper, Version=1.50.2.0, Culture=neutral, processorArchitecture=MSIL"> |
| | | <HintPath>..\packages\Dapper.1.50.2\lib\net451\Dapper.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="HydraulicHelper"> |
| | | <HintPath>..\Lib\HydraulicHelper.dll</HintPath> |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <packages> |
| | | <package id="AForge" version="2.2.5" targetFramework="net472" /> |
| | | <package id="Dapper" version="1.50.1" targetFramework="net472" /> |
| | | <package id="Dapper" version="1.50.2" targetFramework="net472" /> |
| | | <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" /> |
| | | </packages> |
| | |
| | | nozzles.ForEach(nozzle => { AddNozzle(nozzle); }); |
| | | } |
| | | |
| | | private void CheckNodesExist(NodeModel node) |
| | | private void CheckNodesExist(NodeCalcModel node) |
| | | { |
| | | if (Nodes.Any(d => d.ID == node.ID)) |
| | | throw new Exception("å·²åå¨éå¤ç对象"); |
| | | } |
| | | |
| | | private void CheckLinksExist(LinkModel link) |
| | | private void CheckLinksExist(LinkCalcModel link) |
| | | { |
| | | if (Links.Any(d => d.ID == link.ID)) |
| | | throw new Exception("å·²åå¨éå¤ç对象"); |
| | | } |
| | | |
| | | public List<NodeModel> Nodes { get; set; } = new List<NodeModel>(); |
| | | public List<LinkModel> Links { get; set; } = new List<LinkModel>(); |
| | | public List<NodeCalcModel> Nodes { get; set; } = new List<NodeCalcModel>(); |
| | | public List<LinkCalcModel> Links { get; set; } = new List<LinkCalcModel>(); |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®INPæä»¶çæ |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace CloudWaterNetwork |
| | | namespace Hydro.MapUI |
| | | { |
| | | public class GlobalObject |
| | | { |
| | |
| | | <Compile Include="ChartPump.Designer.cs"> |
| | | <DependentUpon>ChartPump.cs</DependentUpon> |
| | | </Compile> |
| | | <Compile Include="Magnifier\InputBox.cs"> |
| | | <Compile Include="WindowsForm\InputBox.cs"> |
| | | <SubType>Form</SubType> |
| | | </Compile> |
| | | <Compile Include="Magnifier\InputBox.designer.cs"> |
| | | <Compile Include="WindowsForm\InputBox.designer.cs"> |
| | | <DependentUpon>InputBox.cs</DependentUpon> |
| | | </Compile> |
| | | <Compile Include="WindowsForm\Progress.cs"> |
| | | <SubType>Form</SubType> |
| | | </Compile> |
| | | <Compile Include="WindowsForm\Progress.designer.cs"> |
| | | <DependentUpon>Progress.cs</DependentUpon> |
| | | </Compile> |
| | | <Compile Include="Map\MapViewer.Model.cs" /> |
| | | <Compile Include="Map\MapContainer.cs"> |
| | |
| | | <DependentUpon>propertyform.cs</DependentUpon> |
| | | </Compile> |
| | | <Compile Include="GlobalObject.cs" /> |
| | | <Compile Include="Magnifier\Form_Magnifier.cs"> |
| | | <Compile Include="WindowsForm\Form_Magnifier.cs"> |
| | | <SubType>Form</SubType> |
| | | </Compile> |
| | | <Compile Include="Magnifier\Form_Magnifier.Designer.cs"> |
| | | <Compile Include="WindowsForm\Form_Magnifier.Designer.cs"> |
| | | <DependentUpon>Form_Magnifier.cs</DependentUpon> |
| | | </Compile> |
| | | <Compile Include="Map\map_old.Model.cs" /> |
| | |
| | | <EmbeddedResource Include="ChartPump.resx"> |
| | | <DependentUpon>ChartPump.cs</DependentUpon> |
| | | </EmbeddedResource> |
| | | <EmbeddedResource Include="Magnifier\InputBox.resx"> |
| | | <EmbeddedResource Include="WindowsForm\InputBox.resx"> |
| | | <DependentUpon>InputBox.cs</DependentUpon> |
| | | </EmbeddedResource> |
| | | <EmbeddedResource Include="WindowsForm\Progress.resx"> |
| | | <DependentUpon>Progress.cs</DependentUpon> |
| | | </EmbeddedResource> |
| | | <EmbeddedResource Include="Map\MapContainer.resx"> |
| | | <DependentUpon>MapContainer.cs</DependentUpon> |
| | |
| | | <EmbeddedResource Include="WindowsForm\propertyform.resx"> |
| | | <DependentUpon>propertyform.cs</DependentUpon> |
| | | </EmbeddedResource> |
| | | <EmbeddedResource Include="Magnifier\Form_Magnifier.resx"> |
| | | <EmbeddedResource Include="WindowsForm\Form_Magnifier.resx"> |
| | | <DependentUpon>Form_Magnifier.cs</DependentUpon> |
| | | </EmbeddedResource> |
| | | <EmbeddedResource Include="Map\map_old.resx"> |
| | |
| | | namespace CloudWaterNetwork.Map |
| | | namespace Hydro.MapUI |
| | | { |
| | | partial class MapContainer |
| | | { |
| | |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace CloudWaterNetwork.Map |
| | | namespace Hydro.MapUI |
| | | { |
| | | public partial class MapContainer : UserControl |
| | | { |
| | |
| | | using System.ComponentModel; |
| | | using System.Drawing; |
| | | using System.Windows.Forms; |
| | | using CloudWaterNetwork.Magnifier; |
| | | //using CloudWaterNetwork.Magnifier; |
| | | using CommonBase; |
| | | using ConfigApp; |
| | | //using ConfigApp; |
| | | //using DevExpress.Diagram.Core.Layout; |
| | | //using DevExpress.DirectX.NativeInterop.Direct2D; |
| | | //using DevExpress.Utils.Extensions; |
| | |
| | | using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar; |
| | | using Cursor = System.Windows.Forms.Cursor; |
| | | |
| | | namespace CloudWaterNetwork |
| | | namespace Hydro.MapUI |
| | | { |
| | | partial class MapViewer |
| | | { |
| | |
| | | using CloudWaterNetwork.Magnifier; |
| | | //using CloudWaterNetwork.Magnifier; |
| | | //using dict_py_Inner; |
| | | using Hydro.MapView; |
| | | using Hydro.MapView.Base; |
| | |
| | | using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar; |
| | | using Cursor = System.Windows.Forms.Cursor; |
| | | |
| | | namespace CloudWaterNetwork |
| | | namespace Hydro.MapUI |
| | | { |
| | | public partial class empty |
| | | { |
| | |
| | | } |
| | | |
| | | private Template __template = null; |
| | | private Template _Template |
| | | [Browsable (false)] |
| | | public Template _Template |
| | | { |
| | | get { return __template; } |
| | | set |
| | |
| | | using CloudWaterNetwork.Magnifier; |
| | | //using CloudWaterNetwork.Magnifier; |
| | | using CommonBase; |
| | | using ConfigApp; |
| | | //using ConfigApp; |
| | | //using DevExpress.Diagram.Core.Layout; |
| | | //using DevExpress.DirectX.NativeInterop.Direct2D; |
| | | //using DevExpress.Utils.Extensions; |
| | |
| | | using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar; |
| | | using Cursor = System.Windows.Forms.Cursor; |
| | | |
| | | namespace CloudWaterNetwork |
| | | namespace Hydro.MapUI |
| | | { |
| | | public partial class MapViewer : UserControl |
| | | { |
| | |
| | | using CloudWaterNetwork.Magnifier; |
| | | //using CloudWaterNetwork.Magnifier; |
| | | //using dict_py_Inner; |
| | | using System; |
| | | using System.Collections; |
| | |
| | | using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar; |
| | | using Cursor = System.Windows.Forms.Cursor; |
| | | |
| | | namespace CloudWaterNetwork |
| | | namespace Hydro.MapUI |
| | | { |
| | | public partial class MapViewer_Old |
| | | { |
| | |
| | | using CloudWaterNetwork.Magnifier; |
| | | //using CloudWaterNetwork.Magnifier; |
| | | //using dict_py_Inner; |
| | | using Hydro.MapView; |
| | | using Hydro.MapView.Base; |
| | |
| | | using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar; |
| | | using Cursor = System.Windows.Forms.Cursor; |
| | | |
| | | namespace CloudWaterNetwork |
| | | namespace Hydro.MapUI |
| | | { |
| | | public partial class empty |
| | | { |
| | |
| | | using CloudWaterNetwork.Magnifier; |
| | | //using CloudWaterNetwork.Magnifier; |
| | | using CommonBase; |
| | | using ConfigApp; |
| | | //using ConfigApp; |
| | | //using DevExpress.Diagram.Core.Layout; |
| | | //using DevExpress.DirectX.NativeInterop.Direct2D; |
| | | //using DevExpress.Utils.Extensions; |
| | |
| | | using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar; |
| | | using Cursor = System.Windows.Forms.Cursor; |
| | | |
| | | namespace CloudWaterNetwork |
| | | namespace Hydro.MapUI |
| | | { |
| | | public partial class MapViewer_Old : UserControl |
| | | { |
| | |
| | | namespace CloudWaterNetwork |
| | | namespace Hydro.MapUI |
| | | { |
| | | partial class Form_EditFloors |
| | | { |
| | |
| | | using CommonBase; |
| | | using ConfigApp; |
| | | //using ConfigApp; |
| | | using Hydro.MapView; |
| | | //using DevExpress.XtraEditors; |
| | | //using DevExpress.XtraGrid.Views.Base; |
| | |
| | | using static System.Windows.Forms.VisualStyles.VisualStyleElement; |
| | | using TRegion = Hydro.MapView.TRegion; |
| | | |
| | | namespace CloudWaterNetwork |
| | | namespace Hydro.MapUI |
| | | { |
| | | public partial class Form_EditFloors : Form |
| | | { |
ÎļþÃû´Ó Hydro.MapBase/Magnifier/Form_Magnifier.Designer.cs ÐÞ¸Ä |
| | |
| | | namespace CloudWaterNetwork.Magnifier |
| | | namespace Hydro.MapUI |
| | | { |
| | | partial class Form_Magnifier |
| | | { |
ÎļþÃû´Ó Hydro.MapBase/Magnifier/Form_Magnifier.cs ÐÞ¸Ä |
| | |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace CloudWaterNetwork.Magnifier |
| | | namespace Hydro.MapUI |
| | | { |
| | | public partial class Form_Magnifier : Form |
| | | { |
| | |
| | | namespace CloudWaterNetwork |
| | | namespace Hydro.MapUI |
| | | { |
| | | partial class Form_importObjs |
| | | { |
| | |
| | | using System.Windows.Forms; |
| | | using static Hydro.MapView.MapViewEnum; |
| | | using Hydro.MapView.Common; |
| | | namespace CloudWaterNetwork |
| | | namespace Hydro.MapUI |
| | | { |
| | | public partial class Form_importObjs : Form |
| | | { |
ÎļþÃû´Ó Hydro.MapBase/Magnifier/InputBox.Designer.cs ÐÞ¸Ä |
| | |
| | |  |
| | | namespace ConfigApp |
| | | namespace Hydro.MapUI |
| | | { |
| | | partial class InputBox |
| | | { |
ÎļþÃû´Ó Hydro.MapBase/Magnifier/InputBox.cs ÐÞ¸Ä |
| | |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace ConfigApp |
| | | namespace Hydro.MapUI |
| | | { |
| | | public partial class InputBox : Form |
| | | { |
¶Ô±ÈÐÂÎļþ |
| | |
| | |  |
| | | using CommonBase; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Data; |
| | | using System.Diagnostics; |
| | | using System.Drawing; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | |
| | | |
| | | namespace Hydro.MapUI |
| | | { |
| | | public partial class ProgressForm_è®¡ç® : Form |
| | | { |
| | | private Thread progressThread; |
| | | public ProgressForm_计ç®() |
| | | { |
| | | InitializeComponent(); |
| | | } |
| | | |
| | | private void ProgressForm_Load(object sender, EventArgs e) |
| | | { |
| | | StartProgressThread(); |
| | | this.Activate(); |
| | | |
| | | } |
| | | private void StartProgressThread() |
| | | { |
| | | progressThread = new Thread(UpdateProgress); |
| | | progressThread.IsBackground = true; |
| | | progressThread.Start(); |
| | | } |
| | | |
| | | private void StopProgressThread() |
| | | { |
| | | if (progressThread != null && progressThread.IsAlive) |
| | | { |
| | | progressThread.Abort(); |
| | | } |
| | | } |
| | | bool isHided = false; |
| | | //public void reSetProgress() |
| | | //{ |
| | | // BeginInvoke(new Action(() => |
| | | // { |
| | | // progressBar1.Value = 0; |
| | | // })); |
| | | //} |
| | | private void UpdateProgress() |
| | | { |
| | | while (!GlobalProgress.NeedStop) |
| | | { |
| | | if (GlobalProgress.Hide ) |
| | | { |
| | | BeginInvoke(new Action(() => |
| | | { |
| | | this.Size = new System.Drawing.Size(0,0); |
| | | })); |
| | | } |
| | | else |
| | | if (!GlobalProgress.Hide) |
| | | { |
| | | BeginInvoke(new Action(() => |
| | | { |
| | | this.Size = new System.Drawing.Size(419, 178); |
| | | })); |
| | | } |
| | | |
| | | |
| | | string stateText = GlobalProgress.stateText; |
| | | int maxNum = GlobalProgress.MaxNum; |
| | | int currentNum = GlobalProgress.CurrentNum; |
| | | |
| | | |
| | | int childmaxNum = GlobalProgress.ChildMaxNum; |
| | | int childcurrentNum = GlobalProgress.ChildCurrentNum; |
| | | string childText = GlobalProgress.ChildText; |
| | | |
| | | lock (GlobalProgress.Instance) |
| | | { |
| | | stateText = GlobalProgress.stateText; |
| | | maxNum = GlobalProgress.MaxNum; |
| | | currentNum = GlobalProgress.CurrentNum; |
| | | |
| | | childmaxNum = GlobalProgress.ChildMaxNum; |
| | | childcurrentNum = GlobalProgress.ChildCurrentNum; |
| | | } |
| | | |
| | | // ä½¿ç¨ Invoke æ¹æ³è®© UI çº¿ç¨æ´æ°æ§ä»¶ |
| | | BeginInvoke(new Action(() => |
| | | { |
| | | |
| | | if (GlobalProgress.mode == 0) |
| | | { |
| | | label1.Text = $"{stateText}[{currentNum}/{maxNum}]"; |
| | | progressBar1.Maximum = maxNum * 150; |
| | | List<int> nums = new List<int>(); |
| | | nums.Add(0); |
| | | nums.Add(progressBar1.Maximum * 4 / 5); |
| | | |
| | | int span = 0; |
| | | if (maxNum>1) span=(int)( progressBar1.Maximum / 5.0 /(maxNum-1)); |
| | | for (int i = 1; i < maxNum; i++) |
| | | { |
| | | nums.Add(nums[i - 1] + span); |
| | | } |
| | | |
| | | if (currentNum < nums.Count && progressBar1.Value < nums[currentNum]) |
| | | { |
| | | progressBar1.Value = nums[currentNum]; |
| | | progressBar2.Value = 0; |
| | | } |
| | | |
| | | else if (currentNum + 1 < nums.Count && progressBar1.Value < (nums[currentNum + 1])) |
| | | progressBar1.Value = Math.Min(progressBar1.Value + 2, progressBar1.Maximum); |
| | | metroLabel1.Text = $"{childText}[{childcurrentNum}/{childmaxNum}]"; |
| | | progressBar2.Maximum = childmaxNum * 100; |
| | | if (progressBar2.Value < childcurrentNum * 100) |
| | | progressBar2.Value = childcurrentNum * 100; |
| | | else if (progressBar2.Value < (childcurrentNum + 1) * 100) |
| | | progressBar2.Value = Math.Min(progressBar2.Value + 4, progressBar2.Maximum); |
| | | } |
| | | else |
| | | { |
| | | label1.Text = $"{stateText}[{currentNum}/{maxNum}]"; |
| | | progressBar1.Maximum = maxNum; |
| | | progressBar1.Value = currentNum; |
| | | } |
| | | |
| | | //this.Activate(); |
| | | })); |
| | | |
| | | Thread.Sleep(100); // æ¯é0.1ç§æ£ç´¢ä¸æ¬¡ |
| | | } |
| | | BeginInvoke(new Action(() => |
| | | { |
| | | this.Hide(); |
| | | })); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | private void ProgressForm_FormClosing(object sender, FormClosingEventArgs e) |
| | | { |
| | | StopProgressThread(); |
| | | } |
| | | |
| | | private void label1_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace Hydro.MapUI |
| | | { |
| | | partial class ProgressForm_è®¡ç® |
| | | { |
| | | /// <summary> |
| | | /// Required designer variable. |
| | | /// </summary> |
| | | private System.ComponentModel.IContainer components = null; |
| | | |
| | | /// <summary> |
| | | /// Clean up any resources being used. |
| | | /// </summary> |
| | | /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
| | | protected override void Dispose(bool disposing) |
| | | { |
| | | if (disposing && (components != null)) |
| | | { |
| | | components.Dispose(); |
| | | } |
| | | base.Dispose(disposing); |
| | | } |
| | | |
| | | #region Windows Form Designer generated code |
| | | |
| | | /// <summary> |
| | | /// Required method for Designer support - do not modify |
| | | /// the contents of this method with the code editor. |
| | | /// </summary> |
| | | private void InitializeComponent() |
| | | { |
| | | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProgressForm_计ç®)); |
| | | this.progressBar1 = new System.Windows.Forms.ProgressBar(); |
| | | this.label1 = new System.Windows.Forms.Label(); |
| | | this.progressBar2 = new System.Windows.Forms.ProgressBar(); |
| | | this.metroLabel1 = new System.Windows.Forms.Label(); |
| | | this.SuspendLayout(); |
| | | // |
| | | // progressBar1 |
| | | // |
| | | this.progressBar1.Dock = System.Windows.Forms.DockStyle.Top; |
| | | //this.progressBar1.HideProgressText = false; |
| | | this.progressBar1.Location = new System.Drawing.Point(20, 49); |
| | | this.progressBar1.MarqueeAnimationSpeed = 250; |
| | | this.progressBar1.Name = "progressBar1"; |
| | | this.progressBar1.Size = new System.Drawing.Size(363, 25); |
| | | this.progressBar1.Step = 1; |
| | | this.progressBar1.TabIndex = 1; |
| | | // |
| | | // label1 |
| | | // |
| | | this.label1.Dock = System.Windows.Forms.DockStyle.Top; |
| | | this.label1.Location = new System.Drawing.Point(20, 30); |
| | | this.label1.Name = "label1"; |
| | | this.label1.Size = new System.Drawing.Size(363, 19); |
| | | this.label1.TabIndex = 2; |
| | | this.label1.Text = "åå§å[1/1]"; |
| | | this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; |
| | | this.label1.Click += new System.EventHandler(this.label1_Click); |
| | | // |
| | | // progressBar2 |
| | | // |
| | | this.progressBar2.Dock = System.Windows.Forms.DockStyle.Top; |
| | | this.progressBar2.ForeColor = System.Drawing.SystemColors.GradientActiveCaption; |
| | | //this.progressBar2.HideProgressText = false; |
| | | this.progressBar2.Location = new System.Drawing.Point(20, 93); |
| | | this.progressBar2.MarqueeAnimationSpeed = 250; |
| | | this.progressBar2.Maximum = 4; |
| | | this.progressBar2.Name = "progressBar2"; |
| | | this.progressBar2.Size = new System.Drawing.Size(363, 22); |
| | | this.progressBar2.Step = 1; |
| | | //this.progressBar2.Style = MetroFramework.MetroColorStyle.Green; |
| | | this.progressBar2.TabIndex = 1; |
| | | // |
| | | // metroLabel1 |
| | | // |
| | | this.metroLabel1.Dock = System.Windows.Forms.DockStyle.Top; |
| | | this.metroLabel1.Location = new System.Drawing.Point(20, 74); |
| | | this.metroLabel1.Name = "metroLabel1"; |
| | | this.metroLabel1.Size = new System.Drawing.Size(363, 19); |
| | | this.metroLabel1.TabIndex = 3; |
| | | this.metroLabel1.Text = "å项任å¡[1/1]"; |
| | | this.metroLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; |
| | | // |
| | | // ProgressForm |
| | | // |
| | | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); |
| | | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
| | | this.ClientSize = new System.Drawing.Size(403, 139); |
| | | this.Controls.Add(this.progressBar2); |
| | | this.Controls.Add(this.metroLabel1); |
| | | this.Controls.Add(this.progressBar1); |
| | | this.Controls.Add(this.label1); |
| | | //this.DisplayHeader = false; |
| | | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); |
| | | this.MaximizeBox = false; |
| | | this.MinimizeBox = false; |
| | | this.Name = "ProgressForm"; |
| | | this.Padding = new System.Windows.Forms.Padding(20, 30, 20, 20); |
| | | //this.Resizable = false; |
| | | this.ShowInTaskbar = false; |
| | | this.Text = "Progress"; |
| | | this.TopMost = true; |
| | | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ProgressForm_FormClosing); |
| | | this.Load += new System.EventHandler(this.ProgressForm_Load); |
| | | this.ResumeLayout(false); |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | public System.Windows.Forms.ProgressBar progressBar1; |
| | | public System.Windows.Forms.Label label1; |
| | | public System.Windows.Forms.ProgressBar progressBar2; |
| | | public System.Windows.Forms.Label metroLabel1; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <root> |
| | | <!-- |
| | | Microsoft ResX Schema |
| | | |
| | | Version 2.0 |
| | | |
| | | The primary goals of this format is to allow a simple XML format |
| | | that is mostly human readable. The generation and parsing of the |
| | | various data types are done through the TypeConverter classes |
| | | associated with the data types. |
| | | |
| | | Example: |
| | | |
| | | ... ado.net/XML headers & schema ... |
| | | <resheader name="resmimetype">text/microsoft-resx</resheader> |
| | | <resheader name="version">2.0</resheader> |
| | | <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
| | | <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
| | | <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
| | | <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
| | | <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
| | | <value>[base64 mime encoded serialized .NET Framework object]</value> |
| | | </data> |
| | | <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
| | | <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
| | | <comment>This is a comment</comment> |
| | | </data> |
| | | |
| | | There are any number of "resheader" rows that contain simple |
| | | name/value pairs. |
| | | |
| | | Each data row contains a name, and value. The row also contains a |
| | | type or mimetype. Type corresponds to a .NET class that support |
| | | text/value conversion through the TypeConverter architecture. |
| | | Classes that don't support this are serialized and stored with the |
| | | mimetype set. |
| | | |
| | | The mimetype is used for serialized objects, and tells the |
| | | ResXResourceReader how to depersist the object. This is currently not |
| | | extensible. For a given mimetype the value must be set accordingly: |
| | | |
| | | Note - application/x-microsoft.net.object.binary.base64 is the format |
| | | that the ResXResourceWriter will generate, however the reader can |
| | | read any of the formats listed below. |
| | | |
| | | mimetype: application/x-microsoft.net.object.binary.base64 |
| | | value : The object must be serialized with |
| | | : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
| | | : and then encoded with base64 encoding. |
| | | |
| | | mimetype: application/x-microsoft.net.object.soap.base64 |
| | | value : The object must be serialized with |
| | | : System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
| | | : and then encoded with base64 encoding. |
| | | |
| | | mimetype: application/x-microsoft.net.object.bytearray.base64 |
| | | value : The object must be serialized into a byte array |
| | | : using a System.ComponentModel.TypeConverter |
| | | : and then encoded with base64 encoding. |
| | | --> |
| | | <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
| | | <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
| | | <xsd:element name="root" msdata:IsDataSet="true"> |
| | | <xsd:complexType> |
| | | <xsd:choice maxOccurs="unbounded"> |
| | | <xsd:element name="metadata"> |
| | | <xsd:complexType> |
| | | <xsd:sequence> |
| | | <xsd:element name="value" type="xsd:string" minOccurs="0" /> |
| | | </xsd:sequence> |
| | | <xsd:attribute name="name" use="required" type="xsd:string" /> |
| | | <xsd:attribute name="type" type="xsd:string" /> |
| | | <xsd:attribute name="mimetype" type="xsd:string" /> |
| | | <xsd:attribute ref="xml:space" /> |
| | | </xsd:complexType> |
| | | </xsd:element> |
| | | <xsd:element name="assembly"> |
| | | <xsd:complexType> |
| | | <xsd:attribute name="alias" type="xsd:string" /> |
| | | <xsd:attribute name="name" type="xsd:string" /> |
| | | </xsd:complexType> |
| | | </xsd:element> |
| | | <xsd:element name="data"> |
| | | <xsd:complexType> |
| | | <xsd:sequence> |
| | | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
| | | <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
| | | </xsd:sequence> |
| | | <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
| | | <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
| | | <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
| | | <xsd:attribute ref="xml:space" /> |
| | | </xsd:complexType> |
| | | </xsd:element> |
| | | <xsd:element name="resheader"> |
| | | <xsd:complexType> |
| | | <xsd:sequence> |
| | | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
| | | </xsd:sequence> |
| | | <xsd:attribute name="name" type="xsd:string" use="required" /> |
| | | </xsd:complexType> |
| | | </xsd:element> |
| | | </xsd:choice> |
| | | </xsd:complexType> |
| | | </xsd:element> |
| | | </xsd:schema> |
| | | <resheader name="resmimetype"> |
| | | <value>text/microsoft-resx</value> |
| | | </resheader> |
| | | <resheader name="version"> |
| | | <value>2.0</value> |
| | | </resheader> |
| | | <resheader name="reader"> |
| | | <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
| | | </resheader> |
| | | <resheader name="writer"> |
| | | <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
| | | </resheader> |
| | | <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
| | | <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
| | | <value> |
| | | AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAABILAAASCwAAAAAAAAAA |
| | | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
| | | AAAAAAAASD85skg/Of9IPzn/SD85/0g/Of9IPzn/SD85/0g/Of9IPzn/SD85/0g/Of9IPzn/SD85/0g/ |
| | | Of9IPzn/SD85skg/Of/t6uj/7ero/+3q6P/t6uj/d2he/+3q6P/t6uj/7ero/+3q6P93aF7/7ero/+3q |
| | | 6P/t6uj/7ero/0g/Of9IPzn/5eDc/+Xg3P/l4Nz/5eDc/3doXv/l4Nz/5eDc/+Xg3P/l4Nz/d2he/+Xg |
| | | 3P/l4Nz/5eDc/+Xg3P9IPzn/SD85//j39v/49/b/+Pf2//j39v93aF7/+Pf2//j39v/49/b/+Pf2/3do |
| | | Xv/49/b/+Pf2//j39v/49/b/SD85/0g/ObJIPzn/SD85/0g/Of9IPzn/s2EK/7NhCv+zYQr/s2EK/7Nh |
| | | Cv+zYQr/d2he/3doXv93aF7/d2he/0g/Of8AAAAAAAAAAAAAAAAAAAAAAAAAALNhCv/o1q//6Nav/+jW |
| | | r//o1q//s2EK/+3q6P/t6uj/7ero/+3q6P9IPzn/AAAAAAAAAAAAAAAAAAAAAAAAAACzYQr/5tKo/+bS |
| | | qP/m0qj/5tKo/7NhCv/l4Nz/5eDc/+Xg3P/l4Nz/SD85/wAAAAAAAAAAAAAAAAAAAACzYQr/s2EK/7Nh |
| | | Cv/69ez/+vXs//r17P+zYQr/+Pf2//j39v/49/b/+Pf2/0g/Of8AAAAAAAAAAAAAAAAAAAAAs2EK/7Nh |
| | | Cv+zYQr/s2EK/7NhCv+zYQr/s2EK/7NhCv+zYQr/s2EK/7NhCv+zYQr/AAAAAAAAAAAAAAAAAAAAALNh |
| | | Cv+zYQr/s2EK/wAAAAAAAAAAAAAAALNhCv/o1q//6Nav/+jWr//o1q//s2EK/wAAAAAAAAAAAAAAAAAA |
| | | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzYQr/5tKo/+bSqP/m0qj/5tKo/7NhCv8AAAAAAAAAAAAA |
| | | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzYQr/s2EK/7NhCv/69ez/+vXs//r17P+zYQr/AAAAAAAA |
| | | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAs2EK/7NhCv+zYQr/s2EK/7NhCv+zYQr/s2EKsgAA |
| | | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALNhCv+zYQr/s2EK/wAAAAAAAAAAAAAAAAAA |
| | | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
| | | AAAAAAAAAAAAAP//AAD//wAA//8AAP//AAD//wAAB/8AAAf/AAAP/wAAD/8AAA4/MXcAPzJ3AH8AAAB/ |
| | | AAAAcAAAAAAAAA== |
| | | </value> |
| | | </data> |
| | | </root> |
| | |
| | | using static Hydro.MapView.MapViewEnum; |
| | | using Hydro.MapView.Common; |
| | | |
| | | namespace CloudWaterNetwork |
| | | namespace Hydro.MapUI |
| | | { |
| | | |
| | | |
| | |
| | | namespace CloudWaterNetwork |
| | | namespace Hydro.MapUI |
| | | { |
| | | partial class PropertyForm |
| | | { |
| | |
| | | namespace CloudWaterNetwork |
| | | namespace Hydro.MapUI |
| | | { |
| | | partial class 模æ¿ç®¡ç |
| | | { |
| | |
| | | using static Hydro.MapView.MapViewEnum; |
| | | using CommonBase; |
| | | |
| | | namespace CloudWaterNetwork |
| | | namespace Hydro.MapUI |
| | | { |
| | | public partial class 模æ¿ç®¡ç : Form |
| | | { |
| | |
| | | |
| | | namespace Hydro.MapView |
| | | { |
| | | public class LinkViewModel : LinkModel, IBaseViewModel |
| | | public class LinkViewModel : LinkCalcModel, IBaseViewModel |
| | | { |
| | | public LinkViewModel() |
| | | { |
| | |
| | | { |
| | | get |
| | | { |
| | | if (StartNode != null && Node1 != StartNode.ID) |
| | | if (StartNode != null && base.Node1 != StartNode.ID) |
| | | { |
| | | base.Node1 = StartNode.ID; |
| | | } |
| | |
| | | { |
| | | get |
| | | { |
| | | if (EndNode != null && Node2 != EndNode.ID) |
| | | if (EndNode != null && base.Node2 != EndNode.ID) |
| | | { |
| | | base.Node2 = EndNode.ID; |
| | | } |
| | |
| | | |
| | | namespace Hydro.MapView |
| | | { |
| | | public class NodeViewModel : NodeModel, IBaseViewModel |
| | | public class NodeViewModel : NodeCalcModel, IBaseViewModel |
| | | { |
| | | public NodeViewModel() |
| | | { |
| | |
| | | if (this is NozzleViewModel) return true; |
| | | return false; |
| | | } |
| | | public string ToEmitterString() |
| | | { |
| | | if (this is NozzleViewModel n) |
| | | { |
| | | if (n.FlowCoefficient > 0) |
| | | return $"{ID}\t{n.FlowCoefficient * Math.Pow(10 / 101.972, 0.5) / 1000 * 60}\r\n"; |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// æ ¸å¿æ¿è½½å段 |
| | | /// </summary> |
| | | public new List<NodeViewModel> Nodes = new List<NodeViewModel>(); |
| | | //public new List<NodeViewModel> Nodes = new List<NodeViewModel>(); |
| | | |
| | | /// <summary> |
| | | /// æ ¸å¿æ¿è½½å段 |
| | | /// </summary> |
| | | public new List<LinkViewModel> Links = new List<LinkViewModel>(); |
| | | //public new List<LinkViewModel> Links = new List<LinkViewModel>(); |
| | | |
| | | public Dictionary<string, Dataset> dict_dataset;// = new Dictionary<string, Dataset>(); |
| | | public HashSet<string> Hash_ID; |
| | |
| | | { |
| | | get |
| | | { |
| | | List<IBaseViewModel> objects = new List<IBaseViewModel>(); |
| | | List<BaseModel> objects = new List<BaseModel>(); |
| | | objects.AddRange(Nodes); |
| | | objects.AddRange(Links); |
| | | return objects; |
| | | return objects.Select(o=>(IBaseViewModel)o).ToList(); |
| | | } |
| | | } |
| | | public void Rename() |
| | |
| | | using Hydro.Core.Model; |
| | | using Hydro.MapView.Common; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Drawing; |
| | |
| | | using System.Text; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | using static Hydro.Core.ObjectEnum; |
| | | using static Hydro.MapView.RepeaterViewModel; |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | public void BuildToInp(string filePath, string userCoorString = null, string sourcePath = null, bool isReplace = false) |
| | | { |
| | | |
| | | if (sourcePath == null) sourcePath = filePath; |
| | | |
| | | string tempString = ""; |
| | | if (!isReplace) |
| | | { |
| | | var tempPath = Path.Combine(Directory.GetCurrentDirectory(), @"template\inp\å¯¼åºæ¨¡æ¿.inp"); |
| | | if (!File.Exists(tempPath)) |
| | | { |
| | | //MessageBox.Show($"æ¨¡æ¿æä»¶ä¸åå¨[{tempPath}]"); |
| | | return; |
| | | } |
| | | tempString = File.ReadAllText(tempPath); |
| | | } |
| | | else |
| | | { |
| | | tempString = File.ReadAllText(sourcePath); |
| | | } |
| | | |
| | | |
| | | Dictionary<string, string> dictExchange = new Dictionary<string, string>() { |
| | | {"{junctions}","{0}" }, |
| | | {"{reservoirs}","{1}" }, |
| | | {"{tanks}","{2}" }, |
| | | {"{pipes}","{3}" }, |
| | | {"{valves}","{4}" }, |
| | | {"{pumps}","{5}" }, |
| | | |
| | | {"{coor}","{6}" }, |
| | | {"{curve}","{7}" }, |
| | | }; |
| | | dictExchange.ToList().ForEach(m => tempString = tempString.Replace(m.Key, m.Value)); |
| | | |
| | | StringBuilder junctionStringBuilder = new StringBuilder(); |
| | | |
| | | junctionStringBuilder.AppendLine(";ID Elev Demand Pattern Type"); |
| | | |
| | | Nodes.ForEach(o => |
| | | { |
| | | if (!o.Visible) return; |
| | | if (o is JunctionViewModel j) |
| | | junctionStringBuilder.AppendLine(j.ToString() + $"{j.Level}\tJunction"); |
| | | else if (o is MeterViewModel m) |
| | | junctionStringBuilder.AppendLine(m.ToString() + $"{o.Level}\tMeter"); |
| | | else if (o is NozzleViewModel no) |
| | | junctionStringBuilder.AppendLine(no.ToString() + $"{o.Level}\tNozzle\t{no.FlowCoefficient}"); |
| | | }); |
| | | string junctionString = junctionStringBuilder.ToString(); |
| | | |
| | | StringBuilder reservoirStringBuilder = new StringBuilder(); |
| | | |
| | | reservoirStringBuilder.AppendLine(";ID Head Pattern "); |
| | | |
| | | reservoirs.ForEach(o => |
| | | { |
| | | if (!o.Visible) return; |
| | | reservoirStringBuilder.AppendLine(o.ToString() + $"{o.Level}\t{o.Elev}"); |
| | | }); |
| | | string reserverString = reservoirStringBuilder.ToString(); |
| | | |
| | | StringBuilder tankStringBuilder = new StringBuilder(); |
| | | |
| | | tankStringBuilder.AppendLine(";ID Elevation InitLevel MinLevel MaxLevel Diameter MinVol VolCurve Overflow"); |
| | | |
| | | tanks.ForEach(o => |
| | | { |
| | | if (!o.Visible) return; |
| | | tankStringBuilder.AppendLine(o.ToString() + $"{o.Level}"); |
| | | }); |
| | | string tankString = tankStringBuilder.ToString(); |
| | | |
| | | StringBuilder pipeStringBuilder = new StringBuilder(); |
| | | |
| | | pipeStringBuilder.AppendLine(";ID Node1 Node2 Length Diameter Roughness MinorLoss Status"); |
| | | |
| | | Links.ForEach(o => |
| | | { |
| | | if (!o.Visible) return; |
| | | if (o is PipeViewModel p) |
| | | pipeStringBuilder.AppendLine(p.ToString() + $"{p.Level}"); |
| | | else if (o is RepeaterViewModel r) |
| | | pipeStringBuilder.AppendLine(r.ToString()); |
| | | }); |
| | | string pipeString = pipeStringBuilder.ToString(); |
| | | |
| | | StringBuilder valveStringBuilder = new StringBuilder(); |
| | | |
| | | valveStringBuilder.AppendLine(";ID Node1 Node2 Diameter Type Setting MinorLoss "); |
| | | |
| | | valves.ForEach(o => |
| | | { |
| | | if (!o.Visible) return; |
| | | valveStringBuilder.AppendLine(o.ToString() + $"{o.Level}"); |
| | | }); |
| | | string valveString = valveStringBuilder.ToString(); |
| | | |
| | | StringBuilder pumpStringBuilder = new StringBuilder(); |
| | | |
| | | pumpStringBuilder.AppendLine(";ID Node1 Node2 Diameter Type Setting MinorLoss "); |
| | | |
| | | pumps.ForEach(o => |
| | | { |
| | | if (!o.Visible) return; |
| | | pumpStringBuilder.AppendLine(o.ToString() + $"{o.Level}"); |
| | | }); |
| | | string pumpString = pumpStringBuilder.ToString(); |
| | | |
| | | |
| | | StringBuilder curveStringBuilder = new StringBuilder(); |
| | | |
| | | |
| | | |
| | | //pumps.ForEach(o => |
| | | //{ |
| | | // if (!o.Visible || !o.Datasets.ContainsKey("æµéæ¬ç¨æ²çº¿")) return; |
| | | // curveStringBuilder.AppendLine(o.Datasets["æµéæ¬ç¨æ²çº¿"].ToString()); |
| | | //}); |
| | | if (dict_dataset != null) |
| | | foreach (var kp in dict_dataset) |
| | | { |
| | | curveStringBuilder.AppendLine(kp.Value.ToString()); |
| | | } |
| | | string curveString = curveStringBuilder.ToString(); |
| | | |
| | | |
| | | StringBuilder coorStringBuilder = new StringBuilder(); |
| | | if (userCoorString == null) |
| | | { |
| | | |
| | | coorStringBuilder.AppendLine(";Node X-Coord Y-Coord"); |
| | | Nodes.ForEach(o => coorStringBuilder.AppendLine(o.ToCoorString())); |
| | | } |
| | | else |
| | | { |
| | | coorStringBuilder.Append(userCoorString); |
| | | } |
| | | |
| | | |
| | | |
| | | string coorString = coorStringBuilder.ToString(); |
| | | string output = ""; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | StringBuilder emitterStringBuilder = new StringBuilder(); |
| | | emitterStringBuilder.AppendLine(";Junction \tCoefficient"); |
| | | Nodes.ForEach(o => emitterStringBuilder.Append(o.ToEmitterString())); |
| | | |
| | | |
| | | |
| | | string emitterString = emitterStringBuilder.ToString(); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | StringBuilder statusStringBuilder = new StringBuilder(); |
| | | statusStringBuilder.AppendLine(";ID \tStatus/Setting\r\n"); |
| | | Links.ForEach(o => statusStringBuilder.Append(o.ToStatusString())); |
| | | |
| | | |
| | | |
| | | string statusString = statusStringBuilder.ToString(); |
| | | |
| | | |
| | | |
| | | output = tempString; |
| | | |
| | | output = replaceContent(output, "JUNCTIONS", junctionString); |
| | | output = replaceContent(output, "RESERVOIRS", reserverString); |
| | | output = replaceContent(output, "TANKS", tankString); |
| | | output = replaceContent(output, "PIPES", pipeString); |
| | | output = replaceContent(output, "VALVES", valveString); |
| | | output = replaceContent(output, "PUMPS", pumpString); |
| | | output = replaceContent(output, "CURVES", curveString); |
| | | |
| | | |
| | | output = replaceContent(output, "COORDINATES", coorString); |
| | | output = replaceContent(output, "EMITTERS", emitterString); |
| | | output = replaceContent(output, "STATUS", statusString); |
| | | string backupFolderPath = Path.Combine(Path.GetDirectoryName(filePath), "bk"); |
| | | if (!Directory.Exists(backupFolderPath)) |
| | | { |
| | | Directory.CreateDirectory(backupFolderPath); |
| | | } |
| | | |
| | | string backupFileName = $"{Path.GetFileNameWithoutExtension(filePath)}_{DateTime.Now:yyyyMMddHHmmss}{Path.GetExtension(filePath)}"; |
| | | string backupFilePath = Path.Combine(backupFolderPath, backupFileName); |
| | | if (File.Exists(filePath)) File.Copy(filePath, backupFilePath, true); |
| | | |
| | | |
| | | // æ£æ¥æä»¶æ¯å¦åå¨ |
| | | try |
| | | { |
| | | Global.ClearFileReadOnly(filePath); |
| | | |
| | | File.WriteAllText(filePath, output); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show(ex.Message); |
| | | } |
| | | |
| | | //MessageBox.Show($"ä¿åæå!"); |
| | | } |
| | | |
| | | private string replaceContent(string text, string content, string replaceString) |
| | | { |
| | | |
| | | |
| | | string str = replaceString; |
| | | |
| | | string replacedText = ReplaceCoordinatesSection(text, content, str); |
| | | |
| | | return replacedText; |
| | | //Console.WriteLine(replacedText); |
| | | } |
| | | |
| | | public static string ReplaceCoordinatesSection(string text, string content, string str) |
| | | { |
| | | string pattern = $@"(\[{content}\]).*?(\[|$)"; |
| | | |
| | | string replacedText = Regex.Replace(text, pattern, match => |
| | | { |
| | | string section = match.Groups[2].Value.Trim(); |
| | | |
| | | if (!string.IsNullOrEmpty(section)) |
| | | { |
| | | return $"{match.Groups[1].Value}\n{str}\n["; |
| | | } |
| | | else |
| | | { |
| | | return $"{match.Groups[1].Value}\n{str}\n["; |
| | | } |
| | | }, RegexOptions.Singleline); |
| | | |
| | | return replacedText; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | public void AddTanks(List<WaterTankViewModel> tanks) |
| | | { |
| | | tanks.ForEach(tank => { AddTank(tank); }); |
| | | |
| | | |
| | | WaterTankViewModel kk=null; |
| | | Nodes.Select(n => (WaterTankViewModel)n).ToList().Sort(o => o.PositionJson); |
| | | WaterTankViewModels |
| | | |
| | | ((WaterTankViewModel) Nodes[0]).PositionJson |
| | | } |
| | | |
| | | public void AddPipe(PipeViewModel pipe) |
| | |
| | | nozzles.ForEach(nozzle => { AddNozzle(nozzle); }); |
| | | } |
| | | |
| | | private void CheckNodesExist(NodeModel node) |
| | | private void CheckNodesExist(NodeCalcModel node) |
| | | { |
| | | if (Nodes.Any(d => d.ID == node.ID)) |
| | | throw new Exception("å·²åå¨éå¤ç对象"); |
| | | } |
| | | |
| | | private void CheckLinksExist(LinkModel link) |
| | | private void CheckLinksExist(LinkCalcModel link) |
| | | { |
| | | if (Links.Any(d => d.ID == link.ID)) |
| | | throw new Exception("å·²åå¨éå¤ç对象"); |
| | |
| | | /// </summary> |
| | | private void InitializeComponent() |
| | | { |
| | | Hydro.MapView.Template template1 = new Hydro.MapView.Template(); |
| | | Hydro.MapView.MapOption mapOption1 = new Hydro.MapView.MapOption(); |
| | | Hydro.MapView.Template template2 = new Hydro.MapView.Template(); |
| | | Hydro.MapView.MapOption mapOption2 = new Hydro.MapView.MapOption(); |
| | | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); |
| | | this.map = new CloudWaterNetwork.MapViewer(); |
| | | this.map = new Hydro.MapUI.MapViewer(); |
| | | this.toolStrip1 = new System.Windows.Forms.ToolStrip(); |
| | | this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); |
| | | this.toolStrip1.SuspendLayout(); |
| | | this.SuspendLayout(); |
| | | // |
| | | // map |
| | | // |
| | | this.map._IsEditMode = true; |
| | | template1.CenterX = 0F; |
| | | template1.CenterY = 0F; |
| | | template1.filePath = null; |
| | | template1.ID = "00000000-0000-0000-0000-000000000000"; |
| | | template1.ImportExcelIndex = 0; |
| | | template1.ImportExcelPath = null; |
| | | mapOption1._ShowJunction = true; |
| | | mapOption1._ShowValve = true; |
| | | mapOption1.junction_multiply = 1F; |
| | | mapOption1.Link_multiply = 0.6667F; |
| | | template1.mapOption = mapOption1; |
| | | template1.MaxLevel = 99; |
| | | template1.Node1 = null; |
| | | template1.Node2 = null; |
| | | template1.Regions = null; |
| | | template1.rotation = 0D; |
| | | template1.rotationF = 90D; |
| | | template1.Type = Hydro.MapView.MapViewEnum.TemplateType.å
¨é¨; |
| | | template1.view = ((Hydro.MapView.MapDimensions)(resources.GetObject("template1.view"))); |
| | | template1.Visible = null; |
| | | template1.X = null; |
| | | template1.Y = null; |
| | | template1.zoom = 1F; |
| | | template1.åç§° = "临æ¶"; |
| | | this.map._newTemplate = template1; |
| | | template2.CenterX = 0F; |
| | | template2.CenterY = 0F; |
| | | template2.filePath = null; |
| | | template2.ID = "00000000-0000-0000-0000-000000000000"; |
| | | template2.ImportExcelIndex = 0; |
| | | template2.ImportExcelPath = null; |
| | | mapOption2._ShowJunction = true; |
| | | mapOption2._ShowValve = true; |
| | | mapOption2.junction_multiply = 1F; |
| | | mapOption2.Link_multiply = 0.6667F; |
| | | template2.mapOption = mapOption2; |
| | | template2.MaxLevel = 99; |
| | | template2.Node1 = null; |
| | | template2.Node2 = null; |
| | | template2.Regions = null; |
| | | template2.rotation = 0D; |
| | | template2.rotationF = 90D; |
| | | template2.Type = Hydro.MapView.MapViewEnum.TemplateType.å
¨é¨; |
| | | template2.view = ((Hydro.MapView.MapDimensions)(resources.GetObject("template2.view"))); |
| | | template2.Visible = null; |
| | | template2.X = null; |
| | | template2.Y = null; |
| | | template2.zoom = 1F; |
| | | template2.åç§° = "临æ¶"; |
| | | this.map._newTemplate = template2; |
| | | this.map._ShowJunction = true; |
| | | this.map._ShowValve = true; |
| | | this.map.BackColor = System.Drawing.Color.Transparent; |
| | | this.map.Dock = System.Windows.Forms.DockStyle.Fill; |
| | | this.map.junction_multiply = 1F; |
| | | this.map.Link_multiply = 1F; |
| | | this.map.Location = new System.Drawing.Point(0, 0); |
| | | this.map.MapCenter = ((System.Drawing.PointF)(resources.GetObject("map.MapCenter"))); |
| | | this.map.Location = new System.Drawing.Point(0, 25); |
| | | //this.map.MapCenter = ((System.Drawing.PointF)(resources.GetObject("map.MapCenter"))); |
| | | this.map.Name = "map"; |
| | | this.map.Rotation = 0D; |
| | | this.map.RotationF = 90D; |
| | | this.map.ShowStatusBar = true; |
| | | this.map.showToolBar = true; |
| | | this.map.Size = new System.Drawing.Size(800, 450); |
| | | this.map.Size = new System.Drawing.Size(800, 425); |
| | | this.map.TabIndex = 0; |
| | | this.map.zoom = 1F; |
| | | // |
| | | // toolStrip1 |
| | | // |
| | | this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { |
| | | this.toolStripButton1}); |
| | | this.toolStrip1.Location = new System.Drawing.Point(0, 0); |
| | | this.toolStrip1.Name = "toolStrip1"; |
| | | this.toolStrip1.Size = new System.Drawing.Size(800, 25); |
| | | this.toolStrip1.TabIndex = 1; |
| | | this.toolStrip1.Text = "toolStrip1"; |
| | | // |
| | | // toolStripButton1 |
| | | // |
| | | this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image"))); |
| | | this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; |
| | | this.toolStripButton1.Name = "toolStripButton1"; |
| | | this.toolStripButton1.Size = new System.Drawing.Size(52, 22); |
| | | this.toolStripButton1.Text = "计ç®"; |
| | | this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click); |
| | | // |
| | | // Form1 |
| | | // |
| | |
| | | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
| | | this.ClientSize = new System.Drawing.Size(800, 450); |
| | | this.Controls.Add(this.map); |
| | | this.Controls.Add(this.toolStrip1); |
| | | this.Name = "Form1"; |
| | | this.Text = "Form1"; |
| | | this.Load += new System.EventHandler(this.Form1_Load); |
| | | this.toolStrip1.ResumeLayout(false); |
| | | this.toolStrip1.PerformLayout(); |
| | | this.ResumeLayout(false); |
| | | this.PerformLayout(); |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | private CloudWaterNetwork.MapViewer map; |
| | | private Hydro.MapUI.MapViewer map; |
| | | private System.Windows.Forms.ToolStrip toolStrip1; |
| | | private System.Windows.Forms.ToolStripButton toolStripButton1; |
| | | } |
| | | } |
| | | |
| | |
| | | using CloudWaterNetwork; |
| | | using CommonBase; |
| | | using Hydro.MapUI; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | |
| | | using System.Drawing; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | private void toolStripButton1_Click(object sender, EventArgs e) |
| | | { |
| | | //var list=map._Template.network.Calc(); |
| | | //if (_selectTemp == null) return; |
| | | var _selectTemp = map._Template; |
| | | map.toolStripButton_save_ButtonClick(1, null); |
| | | |
| | | ProgressForm_è®¡ç® progressForm = null; |
| | | progressForm = new ProgressForm_计ç®(); |
| | | progressForm.StartPosition = FormStartPosition.Manual; |
| | | |
| | | progressForm.Location = new Point(this.Left + this.Width / 2 - progressForm.Width / 2, this.Top + this.Height / 2 - progressForm.Height / 2); // è®¡ç®æ°çªå£çä½ç½® |
| | | new Thread(() => |
| | | { |
| | | progressForm.ShowDialog(); |
| | | }).Start(); |
| | | |
| | | lock (GlobalProgress.Instance) |
| | | { |
| | | GlobalProgress.stateText = "计ç®ä¸"; |
| | | GlobalProgress.MaxNum = 1; |
| | | GlobalProgress.CurrentNum = 0; |
| | | GlobalProgress.Hide = false; |
| | | GlobalProgress.NeedStop = false; |
| | | GlobalProgress.ChildMaxNum = 100; |
| | | GlobalProgress.ChildCurrentNum = 0; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | var net = _selectTemp.network; |
| | | net.Calc(_selectTemp.FullPath); |
| | | lock (GlobalProgress.Instance) |
| | | { |
| | | GlobalProgress.NeedStop = true; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | <resheader name="writer"> |
| | | <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
| | | </resheader> |
| | | <data name="template1.view" mimetype="application/x-microsoft.net.object.binary.base64"> |
| | | <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
| | | <value>17, 17</value> |
| | | </metadata> |
| | | <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> |
| | | <data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
| | | <value> |
| | | AAEAAAD/////AQAAAAAAAAAMAgAAAERIeWRyby5NYXBWaWV3LCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1 |
| | | cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAwDAAAAUVN5c3RlbS5EcmF3aW5nLCBWZXJzaW9u |
| | | PTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUB |
| | | AAAAG0h5ZHJvLk1hcFZpZXcuTWFwRGltZW5zaW9ucwYAAAAXPENlbnRlcj5rX19CYWNraW5nRmllbGQV |
| | | PHpvb20+a19fQmFja2luZ0ZpZWxkGTxyb3RhdGlvbj5rX19CYWNraW5nRmllbGQaPHJvdGF0aW9uRj5r |
| | | X19CYWNraW5nRmllbGQaPFNob3dGbG9vcj5rX19CYWNraW5nRmllbGQaPGlzU2hvd1BpYz5rX19CYWNr |
| | | aW5nRmllbGQEAAAAAAAVU3lzdGVtLkRyYXdpbmcuUG9pbnRGAwAAAAsGBggBAgAAAAX8////FVN5c3Rl |
| | | bS5EcmF3aW5nLlBvaW50RgIAAAABeAF5AAALCwMAAAAAAAAAAAAAAAAAgD8AAAAAAAAAAAAAAAAAgFZA |
| | | AAAAgAEL |
| | | </value> |
| | | </data> |
| | | <data name="map.MapCenter" mimetype="application/x-microsoft.net.object.binary.base64"> |
| | | <value> |
| | | AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0 |
| | | dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJh |
| | | d2luZy5Qb2ludEYCAAAAAXgBeQAACwsCAAAAAAAAAAAAAAAL |
| | | iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 |
| | | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJOSURBVHhe7Zu/S1tRHMVjCm/qoiB0EtqtilNBkA4Fobja |
| | | uRQySStOurhbhC7t0n9AyNI/oUORImQK3ZKlU8XBUXmZQkI9B77fR6ENeT/u67v3m/uBw9d7b7gec04y |
| | | PVuRSCQSiUSaIpG5cDyCNqFtmVwvDI+hHagDHcrkmvvmWYVeQG+hD9AXmVxzn+dmWYI2oDfQGTSAfsnk |
| | | mvs85+tMws85q34MdZMkuR2Px9ecXMs+z01+H/yZPiv/s9vtfvsNOLmWfbMt+Cv96XR6xzeA03oLZqav |
| | | WG/BzPQVyy2Ym75itQVz01cstiB3+oq1FuROX7HUgsLpK1ZakCv9fr//XX7MsNCCXOmPRqNhu93GGA1l |
| | | KyP0FuRKv9Pp9HD+g1O2MkJuQaH0cf7ZWgsKpQ+dclppQeH0oQNOKy0ok/6ezOBbUDb95zKDb0HZ9J/I |
| | | DLoFVdJflhl0C6qkT4JuQdX0SdAtqJq+EmQLXKSvBNkCV+krQbXAZfpKUC1wnb4SRAvqSF8JogV1pa94 |
| | | 3YI601e8bkHZ9J+WkHctKJv+6wryqgVF0//oUI23oGj6qWs13YJc6U8mk5s0TQd1iffLr8r4Hy3IlX6T |
| | | 1N2CXOk3Sd0tWIe8TV/5RwvouzIPoC3oHXQOeZe+Ql/0Jz7pl77pvxIPIT7AeAR9hS57vd6Fr6I/8Um/ |
| | | 9E3/lXkG7UOfIF5+5bHojz7pl76dsAbtQrz0BHrvseiPPumXvp3By/iOvoReeSz6o0+nf7zCZ/tXIF7u |
| | | q+hvYf8HIRKJRCKRSBFarXtukdAAGDXysAAAAABJRU5ErkJggg== |
| | | </value> |
| | | </data> |
| | | </root> |