예제 #1
0
        public static T GetSetting <T>(string folder, string fileName)
        {
            T      result = default(T);
            string text   = SettingExtension.GetPath() + "\\TVDSetting";
            string text2  = text + "\\" + folder;
            bool   flag   = !Directory.Exists(text);

            if (flag)
            {
                Directory.CreateDirectory(text);
            }
            bool flag2 = !Directory.Exists(text2);

            if (flag2)
            {
                Directory.CreateDirectory(text2);
            }
            string path  = text2 + "\\" + fileName;
            bool   flag3 = File.Exists(path);

            if (flag3)
            {
                using (StreamReader streamReader = File.OpenText(path))
                {
                    JsonSerializer jsonSerializer = new JsonSerializer();
                    result = (T)((object)jsonSerializer.Deserialize(streamReader, typeof(T)));
                }
            }
            return(result);
        }
예제 #2
0
 public static void WriteListFamily(string textFile, List <FamilyInstance> instances)
 {
     foreach (FamilyInstance familyInstance in instances)
     {
         bool flag = familyInstance.LookupParameter("CONTROL_MARK") == null;
         if (!flag)
         {
             string text = familyInstance.Id + "-" + familyInstance.LookupParameter("CONTROL_MARK").AsString();
             SettingExtension.WriteToTxtFile(textFile, text);
         }
     }
 }
예제 #3
0
        public static void SaveSetting <T>(T setting, string folder, string fileName)
        {
            string text = SettingExtension.GetPath() + "\\TVDSetting\\" + folder;
            bool   flag = !Directory.Exists(text);

            if (flag)
            {
                Directory.CreateDirectory(text);
            }
            string path     = text + "\\" + fileName;
            string contents = string.Empty;

            contents = JsonConvert.SerializeObject(setting, Formatting.Indented);
            File.WriteAllText(path, contents);
        }
예제 #4
0
        // Token: 0x0600018B RID: 395 RVA: 0x0000FF90 File Offset: 0x0000E190
        public static BitmapImage GetBitmap(string name)
        {
            string uriString = SettingExtension.GetToolPath() + "Resources\\" + name;

            return(new BitmapImage(new Uri(uriString)));
        }