コード例 #1
0
        static MainConfig()
        {
            string configPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), @"弹幕姬\plugins\ExtendNetease");

            if (!Directory.Exists(configPath))
            {
                Directory.CreateDirectory(configPath);
            }
            ConfigFullPath = Path.Combine(configPath, "MainConfig.cfg");
            if (File.Exists(ConfigFullPath))
            {
                string json = File.ReadAllText(ConfigFullPath);
                try
                {
                    Instance = JsonConvert.DeserializeObject <MainConfig>(json);
                }
                catch
                {
                    Instance = new MainConfig();
                }
            }
            else
            {
                Instance = new MainConfig();
            }
        }
コード例 #2
0
 static MainConfig()
 {
     try
     {
         string configPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), @"斗鱼弹幕姬\Plugins\ExtendNetease");
         if (!Directory.Exists(configPath))
         {
             Directory.CreateDirectory(configPath);
         }
         ConfigFullPath = Path.Combine(configPath, "MainConfig.cfg");
         if (File.Exists(ConfigFullPath))
         {
             string json = File.ReadAllText(ConfigFullPath);
             Instance = JsonConvert.DeserializeObject <MainConfig>(json);
             return;
         }
     }
     catch (Exception e)
     {
         //MessageBox.Show(e.ToString());
     }
     Instance = new MainConfig();
 }