Esempio n. 1
0
        void UpdateWarning(WarningItem result)
        {
            var item = Warnings.FirstOrDefault(x => x.Name == result.Name);

            if (result.Severity == IssueSeverity.None && item != null)
            {
                Warnings.Remove(item);
            }
            else if (result.Severity != IssueSeverity.None && item == null)
            {
                Warnings.Add(result);
            }
        }
		void UpdateWarning(WarningItem result)
		{
			var item = Warnings.FirstOrDefault(x => x.Name == result.Name);
			if (result.Severity == IssueSeverity.None && item != null) Warnings.Remove(item);
			else if (result.Severity != IssueSeverity.None && item == null) Warnings.Add(result);
		}
Esempio n. 3
0
        void CheckAll()
        {
            var result = new WarningItem("Check");
            try
            {
                var result2 = IsDirectXInstalled();
                UpdateWarning(result2);

                var architectures = new Dictionary<string, ProcessorArchitecture>();
                var architecture = Assembly.GetExecutingAssembly().GetName().ProcessorArchitecture;
                var exes = System.IO.Directory.GetFiles(".", "*.exe", System.IO.SearchOption.TopDirectoryOnly);
                foreach (var exe in exes)
                {
                    var pa = Engine.Win32.PEReader.GetProcessorArchitecture(exe);
                    architectures.Add(exe, pa);
                }
                var fi = new FileInfo(Application.ExecutablePath);
                // Select all architectures of executables.
                var archs = architectures.Where(x => !x.Key.ToLower().Contains("x360ce")).Select(x => x.Value).ToArray();
                var x86Count = archs.Count(x => x == ProcessorArchitecture.X86);
                var x64Count = archs.Count(x => x == ProcessorArchitecture.Amd64);
                // If executables are 32-bit, but this program is 64-bit then warn user.
                var result86 = new WarningItem("32-bit Game");
                if (x86Count > 0 && x64Count == 0 && architecture == ProcessorArchitecture.Amd64)
                {
                    result86.Description = "This folder contains 32-bit game. You should use 32-bit X360CE Application:\r\n" +
                    "http://www.x360ce.com/Files/x360ce.zip";
                    result86.FixAction = delegate () { EngineHelper.OpenUrl("http://www.x360ce.com/Files/x360ce.zip"); };
                    result86.FixName = "Download";
                }
                UpdateWarning(result86);
                var result64 = new WarningItem("64-bit Game");
                // If executables are 64-bit, but this program is 32-bit then warn user.
                if (x64Count > 0 && x86Count == 0 && architecture == ProcessorArchitecture.X86)
                {
                    result64.Description = "This folder contains 64-bit game. You should use 64-bit X360CE Application:\r\n" +
                    "http://www.x360ce.com/Files/x360ce_x64.zip";
                    result64.FixAction = delegate () { EngineHelper.OpenUrl("http://www.x360ce.com/Files/x360ce_x64.zip"); };
                    result64.FixName = "Download";
                }
                UpdateWarning(result64);
                // Get list of debug files.
                var pdbs = System.IO.Directory.GetFiles(".", "*.pdb", System.IO.SearchOption.TopDirectoryOnly);
                // If debug files were found then...
                if (pdbs.Length > 0)
                {
                    var result3 = IsMdkInstalled();
                    UpdateWarning(result3);
                    var result4 = IsLeakDetectorInstalled();
                    UpdateWarning(result4);
                }
            }
            catch (Exception ex)
            {
                result.Description = ex.Message;
                result.FixName = "";
            }
            UpdateWarning(result);
            MainForm.Current.BeginInvoke((MethodInvoker)delegate ()
            {
                if (Warnings.Count > 0 && !Visible && !IgnoreAll)
                {

                    StartPosition = FormStartPosition.CenterScreen;
                    ShowDialog(MainForm.Current);
                }
                else if (Warnings.Count == 0 && Visible)
                {
                    DialogResult = DialogResult.OK;
                }
            });
        }
Esempio n. 4
0
 void UpdateWarning(WarningItem result)
 {
     var item = Warnings.FirstOrDefault(x => x.Name == result.Name);
     if (result.Description == null && item != null) Warnings.Remove(item);
     else if (result.Description != null && item == null) Warnings.Add(result);
 }
Esempio n. 5
0
 WarningItem IsMdkInstalled()
 {
     var result = new WarningItem("Microsoft SDK");
     using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SDKs\Windows"))
     {
         string versionString = key.GetValue("CurrentVersion") as string;
         Version version;
         if (Version.TryParse(versionString, out version))
         {
             if (version.Major >= 7) return result;
         }
     }
     result.Description = "You are using debug version of XInput Library. Microsoft SDK not found You can click the link below to download Microsoft SDK:\r\n" +
         "https://msdn.microsoft.com/en-us/microsoft-sdks-msdn.aspx";
     result.FixAction = delegate () { EngineHelper.OpenUrl("https://msdn.microsoft.com/en-us/microsoft-sdks-msdn.aspx"); };
     result.FixName = "Download";
     return result;
 }
Esempio n. 6
0
 WarningItem IsLeakDetectorInstalled()
 {
     var result = new WarningItem("Leak Detector");
     using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"))
     {
         foreach (string subkey_name in key.GetSubKeyNames())
         {
             using (RegistryKey subkey = key.OpenSubKey(subkey_name))
             {
                 var displayName = (string)subkey.GetValue("DisplayName", "");
                 if (displayName.StartsWith("Visual Leak Detector"))
                 {
                     return result;
                 }
             }
         }
     }
     result.Description = "You are using debug version of XInput Library. Visual Leak Detector not found You can click the link below to download Visual Leak Detector:\r\n" +
         "https://vld.codeplex.com";
     result.FixAction = delegate () { EngineHelper.OpenUrl("https://vld.codeplex.com"); };
     result.FixName = "Download";
     return result;
 }
Esempio n. 7
0
 WarningItem IsDirectXInstalled()
 {
     var result = new WarningItem("DirectX");
     using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\DirectX"))
     {
         string versionString = key.GetValue("Version") as string;
         Version version;
         if (Version.TryParse(versionString, out version))
         {
             if (version.Minor == 9) return result;
         }
     }
     result.Description = "Microsoft DirectX 9 not found You can click the link below to download Microsoft DirectX:\r\n" +
         "http://www.microsoft.com/en-us/download/details.aspx?id=35";
     result.FixAction = delegate () { EngineHelper.OpenUrl("http://www.microsoft.com/en-us/download/details.aspx?id=35"); };
     result.FixName = "Download";
     return result;
 }