cloudflight
2023-12-02 c0f9915265878e56e91ee97f7f8d925db1e12626
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
using AForge;
using Newtonsoft.Json;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
//using System.Windows.Forms;
//using System.Windows.Forms;
 
namespace CommonBase
{
 
 
    public class EncryState
    {
        /// <summary>
        /// true表示已锁定,false表示已经解锁。
        /// </summary>
        public static bool encryLockState = false;
 
    }
    public class GlobalPath
    {
        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 static string resultPath { get { string p = Path + @"\result\"; if (!Directory.Exists(p)) Directory.CreateDirectory(p); return p; } }
 
        public static string savePath { get { string p = Path + @"\save\"; if (!Directory.Exists(p)) Directory.CreateDirectory(p); return p; } }
 
        public static string bakPath { get { string p = Path + @"\config_bk\"; if (!Directory.Exists(p)) Directory.CreateDirectory(p); return p; } }
        public static string recordPath { get { string p = Path + @"\Record\"; if (!Directory.Exists(p)) Directory.CreateDirectory(p); return p; } }
    }
    public class GlobalConfig
    {
 
 
        public static GlobalConfig Instance { get; set; }
      
 
        /// <summary>
        /// 用户名
        /// </summary>
        public string ModelFilePath { get; set; } = "";
 
        /// <summary>
        /// 密码
        /// </summary>
        public string ModelObjectID { get; set; }
 
        /// <summary>
        /// 共享剪切板
        /// </summary>
        public bool ConnectSession0 { get; set; } = false;
 
        /// <summary>
        /// 共享所有磁盘
        /// </summary>
        public bool ShareAllDisk { get; set; } = true;
 
        /// <summary>
        /// 共享磁盘列表,当 ShareAllDisk = false 时使用
        /// </summary>
        public List<string> ShareDiskList { get; set; } = new List<string>();
 
 
        ///// <summary>
        ///// 截图快捷键
        ///// </summary>
        //public Keys HotKeys { get; set; } = Keys.Control | Keys.Alt | Keys.A;
 
        ///// <summary>
        ///// 截图快捷键
        ///// </summary>
        //public Keys RealKeys { get; set; }
 
        ///// <summary>
        ///// 截图辅助键
        ///// </summary>
        //public List<Keys> ModifyKeys { get; set; }
 
        /// <summary>
        /// 延时截图时间
        /// </summary>
        public int PrintScreenDelayTime { get; set; } = 2;
 
 
        public bool ISencryption { get; set; } =false;
 
        /// <summary>
        /// 显示本机任务栏
        /// </summary>
        public bool ShowTaskBar { get; set; } = false;
 
        ///// <summary>
        ///// 连接时自动全屏
        ///// </summary>
        //public int MaxThread { get; set; } =1;
 
        public string ExtJson { get; set; } = "";
        private CalcExt _ext;
        /// <summary>
        /// 计算默认配置
        /// </summary>
        public CalcExt Ext=> _ext ?? (_ext = JsonConvert.DeserializeObject<CalcExt>(ExtJson) ?? new CalcExt());
 
 
 
        public Dictionary<string, SaveSettings> saveSettings { get; set; } = new Dictionary<string, SaveSettings>();
 
    }
    public class SaveSettings
    {
 
        public List<int> Length_Ds=null;
        public List<MyDoubleRange> list_Range=null;
        public ConcurrentDictionary<ulong, double> saveDatas = null;
        public string savePath=null;
 
 
        public int COUNT_D { get { return Length_Ds==null ? -1: Length_Ds.Count; } }
 
        public int SumLength { 
            get 
            {
                if (Length_Ds == null) return -1;
                int sumLength = 0;
                Length_Ds.ForEach(d => sumLength += d);
                return sumLength;
            } 
        }
 
        [Category("2、存储")]
        [Description("一组自然数值,表示每一位向量的二进制长度,用“,”隔开")]
        [DisplayName("4、长度组")]
        public string str_list_Length
        {
            get
            {
 
                if (Length_Ds == null) return null;
                return string.Join(",", Length_Ds);
            }
            set
            {
                try
                {
                    if (value == null) return;
                    
                    Length_Ds = value.Split(',').ToList().Select(n => int.Parse(n)).ToList();
                }
                catch
                {
 
                }
 
            }
        }
 
        [Category("2、存储")]
        [Description("一组Range值,表示每一位向量的范围,举例:1,2|2,3|0.3,0.4")]
        [DisplayName("5、范围组")]
        public string str_list_Range
        {
            get
            {
                if (list_Range == null) return null;
                return string.Join("|", list_Range.Select(n => $"{n.Min},{n.Max}"));
            }
            set
            {
                try
                {
                    if (value == null) return;
                   
                    list_Range = value.Split('|').ToList().Select(n => new MyDoubleRange(double.Parse(n.Split(',')[0]), double.Parse(n.Split(',')[1]))).ToList();
 
 
                }
                catch
                {
                }
 
            }
        }
    }
}