private void PerformRAMCheck() { ulong check = (ulong)((ArraySize.Value * 4) / RatioVal.Value); if (check >= (installedMemory / 8)) { if ((check >= installedMemory) || ((RatioVal.Value == 1) && (GetRAMSize.Checked == true))) { WarningSign.Image = OmniMIDIConfigurator.Properties.Resources.wir; WarningLabel.Text = String.Format("ERROR:\nYou cannot use all the available memory!\n(Size: {0} ({1} DWORDs * 4 / {2}))", SoundFontListExtension.ReturnSoundFontSize(null, "evbuff", (long)ArraySize.Value * 4 / (long)RatioVal.Value), ArraySize.Value, RatioVal.Value ); ApplySettings.Enabled = false; } else { WarningSign.Image = OmniMIDIConfigurator.Properties.Resources.wi; WarningLabel.Text = String.Format("WARNING:\nYou should leave at least {0} of RAM available to Windows.\n(Size: {1} ({2} DWORDs * 4 / {3}))", SoundFontListExtension.ReturnSoundFontSize(null, "evbuff", (long)installedMemory / 6), SoundFontListExtension.ReturnSoundFontSize(null, "evbuff", (long)ArraySize.Value * 4 / (long)RatioVal.Value), ArraySize.Value, RatioVal.Value ); ApplySettings.Enabled = true; } } else if (check > 1 && check < 128) { WarningSign.Image = OmniMIDIConfigurator.Properties.Resources.wi; WarningLabel.Text = "WARNING: You might experience lag when going below 128 bytes."; ApplySettings.Enabled = true; } else if (check == 1) { WarningSign.Image = OmniMIDIConfigurator.Properties.Resources.wi; WarningLabel.Text = String.Format("The final size will be {0}.\n(({1} DWORDs * 4) / {2})\nGood luck.", SoundFontListExtension.ReturnSoundFontSize(null, "evbuff", (long)ArraySize.Value * 4 / (long)RatioVal.Value), ArraySize.Value, RatioVal.Value); ApplySettings.Enabled = true; } else if (check < 1) { WarningSign.Image = OmniMIDIConfigurator.Properties.Resources.infoicon; WarningLabel.Text = "ERROR:\nHooray, you found the easter egg! Now set a valid value."; ApplySettings.Enabled = false; } else { WarningSign.Image = OmniMIDIConfigurator.Properties.Resources.successicon; WarningLabel.Text = String.Format("The final size will be {0}.\n({1} DWORDs * 4) / {2})\nLooks good!", SoundFontListExtension.ReturnSoundFontSize(null, "evbuff", (long)ArraySize.Value * 4 / (long)RatioVal.Value), ArraySize.Value, RatioVal.Value); ApplySettings.Enabled = true; } }
private void WarningLabel_Click(object sender, EventArgs e) { MessageBox.Show(String.Format("Leave at least 1/8 of RAM ({0}) available to Windows, to avoid unexpected data loss and system crashes.\n\nRemember, you're responsible of anything that might happen after tampering with this setting.", SoundFontListExtension.ReturnSoundFontSize(null, "evbuff", (long)installedMemory / 8)), "What does this warning mean?", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
public InfoWindow() { InitializeComponent(); VerLabel.Text = ReturnDriverAssemblyVersion( "OmniMIDI", "CR", new int[] { Driver.FileMajorPart, Driver.FileMinorPart, Driver.FileBuildPart, Driver.FilePrivatePart } ); VerLabel.Cursor = Program.SystemHandCursor; BASSVer.Text = ReturnDriverAssemblyVersion( null, "U", new int[] { BASS.FileMajorPart, BASS.FileMinorPart, BASS.FileBuildPart, BASS.FilePrivatePart } ); BASSMIDIVer.Text = ReturnDriverAssemblyVersion( null, "U", new int[] { BASSMIDI.FileMajorPart, BASSMIDI.FileMinorPart, BASSMIDI.FileBuildPart, BASSMIDI.FilePrivatePart } ); int[] KDMAPIVerRef = { 0, 0, 0, 0 }; if (KDMAPI.ReturnKDMAPIVer(ref KDMAPIVerRef[0], ref KDMAPIVerRef[1], ref KDMAPIVerRef[2], ref KDMAPIVerRef[3]) != 0) { KDMAPIVer.Text = ReturnDriverAssemblyVersion( null, "U", KDMAPIVerRef ); } else { KDMAPIVer.Text = "N/A"; } CopyrightLabel.Text = String.Format(CopyrightLabel.Text, DateTime.Today.Year); CurBranch.Text = UpdateSystem.GetCurrentBranch(); CurBranch.ForeColor = UpdateSystem.GetCurrentBranchColor(); BranchToolTip.SetToolTip(CurBranch, UpdateSystem.GetCurrentBranchToolTip()); if (Properties.Settings.Default.PreRelease) { VerLabel.Text += " (PR)"; } OMBigLogo.Image = (DateTime.Today.Month == 4 && DateTime.Today.Day == 1) ? Properties.Resources.OMLauncherFish : Properties.Resources.OMLauncher; BB.Location = new Point(OMBigLogo.Size.Width - BB.Size.Width - 8, OMBigLogo.Size.Height - BB.Size.Height - 8); BB.Parent = OMBigLogo; BB.Image = Properties.Resources.BB; BB.BackColor = Color.Transparent; BecomePatron.Cursor = Program.SystemHandCursor; BecomePatron.Image = Properties.Resources.PatreonLogo; PayPalDonation.Cursor = Program.SystemHandCursor; PayPalDonation.Image = Properties.Resources.PayPalLogo; GitHubPage.Cursor = Program.SystemHandCursor; GitHubPage.Image = Properties.Resources.Octocat; OMLicense.Cursor = Program.SystemHandCursor; OMLicense.Image = Properties.Resources.TextLogo; WinName.Text = String.Format("{0}", OSInfo.Name.Replace("Microsoft ", "")); RAMAmount.Text = SoundFontListExtension.ReturnSoundFontSize(null, "ram", Convert.ToInt64((new ComputerInfo()).TotalPhysicalMemory)); switch (Environment.OSVersion.Version.Major) { case 10: WinVer.Text = String.Format( "Version {0} ({1})\nRelease {2}, Revision {3}", WVerKey.GetValue("ReleaseId", 0).ToString(), Environment.Is64BitOperatingSystem ? "64-bit" : "32-bit", Environment.OSVersion.Version.Build, WVerKey.GetValue("UBR", 0).ToString() ); break; case 6: if (Environment.OSVersion.Version.Minor > 1) { WinVer.Text = String.Format( "Version {0}.{1}\nBuild {2}", Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor, Environment.OSVersion.Version.Build ); } else { if (Int32.Parse(Regex.Match(Environment.OSVersion.ServicePack, @"\d+").Value, NumberFormatInfo.InvariantInfo) > 0) { WinVer.Text = String.Format("{0}.{1}\nBuild {2}, Service Pack {3}", Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor, Environment.OSVersion.Version.Build, Environment.OSVersion.ServicePack); } else { WinVer.Text = String.Format("{0}.{1}\nBuild {2}", Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor, Environment.OSVersion.Version.Build); } } break; } }