lixiaojun
2024-12-11 e47f92df1569e16a19deed592f773591da02d890
WinFrmUI/Yw.WinFrmUI.Hydro.Q3d.Core/MapView/Common/dict.cs
@@ -1,26 +1,26 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using Newtonsoft.Json;
using System.Diagnostics;
using System.Data;
using System.Threading.Tasks;
//using NPOI.SS.Formula.Functions;
//using 文件读写;
namespace Yw.WinFrmUI.Q3D
namespace Yw.WinFrmUI.Q3d
{
    [Serializable]
    public class dict<TKey, TValue> : Dictionary<TKey, TValue>
    {
        private List<TKey> keys
        private List<TKey> keys
        {
            get
            {
@@ -59,7 +59,7 @@
        {
            return this.Keys.ToArray();
        }
        public List<TempForEnum<TKey,TValue>> items()
        public List<TempForEnum<TKey, TValue>> items()
        {
            var temp_list = new List<TempForEnum<TKey, TValue>>();
            foreach (var Pair in this)
@@ -139,7 +139,7 @@
                                return default(TValue);
                        }
                    }
                }
                }
                return base[key];
            }
@@ -173,7 +173,7 @@
                    key = (TKey)(object)index;
                else
                    key = keys[index];
                if (!base.ContainsKey(key))
                if (!base.ContainsKey(key))
                    base.Add(key, default(TValue));
                return base[key];
@@ -186,17 +186,17 @@
                    key = (TKey)(object)index;
                    base[key] = value;
                }
                else
                {
                    if (index<keys.Count)
                    if (index < keys.Count)
                    {
                        key = keys[index];
                        base[key] = value;
                    }
                }
            }
        }
@@ -206,13 +206,13 @@
        }
        public void LoadFromString(string s)
        {
            dict<TKey,TValue> d= JsonConvert.DeserializeObject<dict<TKey,TValue>>(s);
            dict<TKey, TValue> d = JsonConvert.DeserializeObject<dict<TKey, TValue>>(s);
            this.Clear();
            foreach(var kp in d)
            foreach (var kp in d)
            {
                this.Add(kp.Key,kp.Value);
                this.Add(kp.Key, kp.Value);
            }
        }
        //public void ExportToExcel()
        //{
@@ -240,9 +240,9 @@
        private DateTime 发送计时;
        private string msgList = "";
        private System.Timers.Timer t = new System.Timers.Timer();
        public dict<TKey,TValue> ctx
        public dict<TKey, TValue> ctx
        {
            get { return this; }
        }
@@ -265,7 +265,7 @@
        #endregion
    }
    public class TempForEnum<TKey,TValue>
    public class TempForEnum<TKey, TValue>
    {
        public TKey Item1;
        public TValue Item2;
@@ -275,7 +275,7 @@
            Item2 = value;
        }
    }
}