| | |
| | | { |
| | | get |
| | | { |
| | | if (data == null) |
| | | string configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, SETTINGFILE); |
| | | if (File.Exists(configPath)) |
| | | { |
| | | string configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, SETTINGFILE); |
| | | if (File.Exists(configPath)) |
| | | using (StreamReader reader = new StreamReader(configPath, System.Text.Encoding.UTF8)) |
| | | { |
| | | using (StreamReader reader = new StreamReader(configPath, System.Text.Encoding.UTF8)) |
| | | { |
| | | string dataStr = reader.ReadToEnd(); |
| | | data = JsonConvert.DeserializeObject<JObject>(dataStr); |
| | | } |
| | | string dataStr = reader.ReadToEnd(); |
| | | data = JsonConvert.DeserializeObject<JObject>(dataStr); |
| | | } |
| | | } |
| | | |
| | |
| | | return codes; |
| | | } |
| | | |
| | | public static List<string> AddNewProductionCode(string code) |
| | | { |
| | | List<string> codes = GetProcessCodes(); |
| | | if (!codes.Contains(code)) |
| | | { |
| | | codes.Add(code); |
| | | } |
| | | if (Data != null && Data.ContainsKey(PROPERTY_PRODUCTIONCODES)) |
| | | { |
| | | Data[PROPERTY_PRODUCTIONCODES] = new JArray(codes); |
| | | string newDataStr = JsonConvert.SerializeObject(Data, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.Auto }); |
| | | using (StreamWriter writer = new StreamWriter(GetSettingFilePath(), false, System.Text.Encoding.UTF8)) |
| | | { |
| | | writer.Write(newDataStr); |
| | | writer.Flush(); |
| | | writer.Close(); |
| | | } |
| | | } |
| | | |
| | | return GetProcessCodes(); |
| | | } |
| | | |
| | | public static string GetConfigFilePath() |
| | | { |
| | | string path = ""; |
| | |
| | | return path; |
| | | } |
| | | |
| | | public static string GetSettingFilePath() |
| | | { |
| | | string path = ""; |
| | | |
| | | if (Data != null && Data.ContainsKey(SETTINGFILE)) |
| | | { |
| | | path = Data.Value<string>(SETTINGFILE); |
| | | } |
| | | |
| | | return path; |
| | | } |
| | | |
| | | public static string GetProgramDescription() |
| | | { |
| | | string desc = "伯肯森自动化技术有限公司"; |