コード例 #1
0
ファイル: IniFileIssue.cs プロジェクト: santoshmenon/x360ce
 public override void FixTask()
 {
     if (FixType == 1)
     {
         AppHelper.CheckExplicitAccessRulesAndAllowToModify(SettingsManager.IniFileName, true);
     }
 }
コード例 #2
0
ファイル: IniFileIssue.cs プロジェクト: xiyuancichu/x360ce
 public override void Fix()
 {
     lock (checkLock)
     {
         if (FixType == 1)
         {
             AppHelper.CheckExplicitAccessRulesAndAllowToModify(SettingsManager.IniFileName, true);
         }
     }
     RaiseFixApplied();
 }
コード例 #3
0
ファイル: GdbFileClass.cs プロジェクト: shagged/nucleuscoop
 public override void Check()
 {
     lock (checkLock)
     {
         if (!enableCheck)
         {
             return;
         }
         var gdb = GameDatabaseManager.Current.GdbFile;
         var md5 = GameDatabaseManager.Current.Md5File;
         //var xml = SettingsFile.Current.XmlFile;
         FixType = 0;
         // If file exist then.
         if (gdb.Exists)
         {
             var rulesMustBeFixed = AppHelper.CheckExplicitAccessRulesAndAllowToModify(gdb.FullName, false);
             if (rulesMustBeFixed)
             {
                 Description = string.Format("Can't write or modify '{0}' file.", gdb.FullName);
                 Severity    = IssueSeverity.Critical;
                 FixType     = 1;
             }
         }
         if (FixType == 0 && md5.Exists)
         {
             var rulesMustBeFixed = AppHelper.CheckExplicitAccessRulesAndAllowToModify(md5.FullName, false);
             if (rulesMustBeFixed)
             {
                 Description = string.Format("Can't write or modify '{0}' file.", md5.FullName);
                 Severity    = IssueSeverity.Critical;
                 FixType     = 2;
             }
         }
         //if (FixType == 0 && xml.Exists)
         //{
         //	var rulesMustBeFixed = AppHelper.CheckExplicitAccessRulesAndAllowToModify(xml.FullName, false);
         //	if (rulesMustBeFixed)
         //	{
         //		Description = string.Format("Can't write or modify '{0}' file.", xml.FullName);
         //		Severity = IssueSeverity.Critical;
         //		FixType = 3;
         //	}
         //}
         if (FixType == 0)
         {
             Severity    = IssueSeverity.None;
             Description = "";
             FixType     = 0;
             enableCheck = false;
         }
     }
 }
コード例 #4
0
 public override void FixTask()
 {
     if (FixType == 1)
     {
         var file = GameDatabaseManager.Current.GdbFile;
         AppHelper.CheckExplicitAccessRulesAndAllowToModify(file.FullName, true);
     }
     else if (FixType == 2)
     {
         var file = GameDatabaseManager.Current.Md5File;
         AppHelper.CheckExplicitAccessRulesAndAllowToModify(file.FullName, true);
     }
 }
コード例 #5
0
 public override void Check()
 {
     lock (checkLock)
     {
         if (!enableCheck)
         {
             return;
         }
         var required = SettingsManager.UserGames.Items.Any(x => x.EmulationType == (int)EmulationType.Library);
         if (!required)
         {
             SetSeverity(IssueSeverity.None);
             return;
         }
         var gdb = GameDatabaseManager.Current.GdbFile;
         var md5 = GameDatabaseManager.Current.Md5File;
         // If file exist then.
         if (gdb.Exists)
         {
             var rulesMustBeFixed = AppHelper.CheckExplicitAccessRulesAndAllowToModify(gdb.FullName, false);
             if (rulesMustBeFixed)
             {
                 SetSeverity(
                     IssueSeverity.Critical, 1,
                     string.Format("Can't write or modify '{0}' file.", gdb.FullName)
                     );
                 return;
             }
         }
         if (md5.Exists)
         {
             var rulesMustBeFixed = AppHelper.CheckExplicitAccessRulesAndAllowToModify(md5.FullName, false);
             if (rulesMustBeFixed)
             {
                 SetSeverity(
                     IssueSeverity.Critical, 2,
                     string.Format("Can't write or modify '{0}' file.", md5.FullName)
                     );
                 return;
             }
         }
         enableCheck = false;
         SetSeverity(IssueSeverity.None);
     }
 }
コード例 #6
0
ファイル: GdbFileClass.cs プロジェクト: shagged/nucleuscoop
 public override void Fix()
 {
     lock (checkLock)
     {
         if (FixType == 1)
         {
             var file = GameDatabaseManager.Current.GdbFile;
             AppHelper.CheckExplicitAccessRulesAndAllowToModify(file.FullName, true);
         }
         else if (FixType == 2)
         {
             var file = GameDatabaseManager.Current.Md5File;
             AppHelper.CheckExplicitAccessRulesAndAllowToModify(file.FullName, true);
         }
         //else if (FixType == 3)
         //{
         //	var file = SettingsFile.Current.XmlFile;
         //	AppHelper.CheckExplicitAccessRulesAndAllowToModify(file.FullName, true);
         //}
     }
     RaiseFixApplied();
 }
コード例 #7
0
ファイル: IniFileIssue.cs プロジェクト: santoshmenon/x360ce
        public override void CheckTask()
        {
            // Note: further check will be disabled if no issues were found.
            if (!enableCheck)
            {
                return;
            }
            var required = SettingsManager.UserGames.Items.Any(x => x.EmulationType == (int)EmulationType.Library);

            if (!required)
            {
                SetSeverity(IssueSeverity.None);
                return;
            }
            // If temp file exist then.
            var iniFile = new FileInfo(SettingsManager.IniFileName);
            var tmpFile = new FileInfo(SettingsManager.TmpFileName);

            if (tmpFile.Exists)
            {
                // It means that application crashed. Restore INI from temp.
                if (AppHelper.CopyFile(tmpFile.FullName, SettingsManager.IniFileName))
                {
                    enableCheck = false;
                    SetSeverity(IssueSeverity.None);
                }
                else
                {
                    SetSeverity(
                        IssueSeverity.Critical, 0,
                        string.Format("Failed to restore '{0}' file from '{1}' file.", SettingsManager.IniFileName, tmpFile.Name)
                        );
                }
            }
            else if (iniFile.Exists)
            {
                var rulesMustBeFixed = AppHelper.CheckExplicitAccessRulesAndAllowToModify(SettingsManager.IniFileName, false);
                if (rulesMustBeFixed)
                {
                    SetSeverity(
                        IssueSeverity.Critical, 1,
                        string.Format("Can't write or modify '{0}' file.", SettingsManager.IniFileName)
                        );
                }
                // Create temp file to store original settings.
                else if (AppHelper.CopyFile(SettingsManager.IniFileName, SettingsManager.TmpFileName))
                {
                    enableCheck = false;
                    SetSeverity(IssueSeverity.None);
                }
                else
                {
                    SetSeverity(
                        IssueSeverity.Critical, 0,
                        string.Format("Failed to backup '{0}' file to '{1}' file.", SettingsManager.IniFileName, tmpFile.Name)
                        );
                }
            }
            else
            {
                // Create temp file to store original settings.
                var resourceName = typeof(Program).Namespace + ".Presets." + SettingsManager.IniFileName;
                if (AppHelper.WriteFile(resourceName, SettingsManager.IniFileName))
                {
                    enableCheck = false;
                    SetSeverity(IssueSeverity.None);
                }
                else
                {
                    SetSeverity(
                        IssueSeverity.Critical, 0,
                        string.Format("Failed create '{0}' file.", SettingsManager.IniFileName)
                        );
                }
            }
        }
コード例 #8
0
ファイル: IniFileIssue.cs プロジェクト: xiyuancichu/x360ce
 public override void Check()
 {
     lock (checkLock)
     {
         // Note: further check will be disabled if no issues were found.
         if (!enableCheck)
         {
             return;
         }
         // Description = string.Format("'{0}' was not found.\r\nThis file is required for emulator to function properly.\r\n\r\nDo you want to create this file?", SettingManager.IniFileName);
         // If temp file exist then.
         var iniFile = new FileInfo(SettingsManager.IniFileName);
         var tmpFile = new FileInfo(SettingsManager.TmpFileName);
         if (tmpFile.Exists)
         {
             // It means that application crashed. Restore INI from temp.
             if (AppHelper.CopyFile(tmpFile.FullName, SettingsManager.IniFileName))
             {
                 Severity    = IssueSeverity.None;
                 Description = "";
                 FixType     = 0;
                 enableCheck = false;
             }
             else
             {
                 Description = string.Format("Failed to restore '{0}' file from '{1}' file.", SettingsManager.IniFileName, tmpFile.Name);
                 Severity    = IssueSeverity.Critical;
                 FixType     = 0;
             }
         }
         else if (iniFile.Exists)
         {
             var rulesMustBeFixed = AppHelper.CheckExplicitAccessRulesAndAllowToModify(SettingsManager.IniFileName, false);
             if (rulesMustBeFixed)
             {
                 Description = string.Format("Can't write or modify '{0}' file.", SettingsManager.IniFileName);
                 Severity    = IssueSeverity.Critical;
                 FixType     = 1;
             }
             // Create temp file to store original settings.
             else if (AppHelper.CopyFile(SettingsManager.IniFileName, SettingsManager.TmpFileName))
             {
                 Severity    = IssueSeverity.None;
                 Description = "";
                 FixType     = 0;
                 enableCheck = false;
             }
             else
             {
                 Description = string.Format("Failed to backup '{0}' file to '{1}' file.", SettingsManager.IniFileName, tmpFile.Name);
                 Severity    = IssueSeverity.Critical;
                 FixType     = 0;
             }
         }
         else
         {
             // Create temp file to store original settings.
             var resourceName = typeof(Program).Namespace + ".Presets." + SettingsManager.IniFileName;
             if (AppHelper.WriteFile(resourceName, SettingsManager.IniFileName))
             {
                 Severity    = IssueSeverity.None;
                 Description = "";
                 FixType     = 0;
                 enableCheck = false;
             }
             else
             {
                 Description = string.Format("Failed create '{0}' file.", SettingsManager.IniFileName);
                 Severity    = IssueSeverity.Critical;
                 FixType     = 0;
             }
         }
     }
 }