private bool VerifyValidity(string DirectoryPath, string FileName) { if (FileName == "") { ActionCenter.Toast("Please enter a valid name", StartPoint(), 2); return(false); } if (Directory.Exists(DirectoryPath)) { ActionCenter.Toast("That name already exists, try again", StartPoint(), 2); return(false); } foreach (char Check in FileName) { foreach (char Illegal in Path.GetInvalidFileNameChars()) { if (Check == Illegal) { ActionCenter.Toast("Invalid character detected. Please remove '" + Check + "' and try again", StartPoint(), 2); return(false); } } } return(true); }
private void FormMain_Shown(object sender, EventArgs e) { if (!IsAdministrator()) { ActionCenter.Toast("Not running as admin, global hotkeys will not work while in game", StartPoint(), 2); } Updater.LaunchUpdater(); }
private void BtnManualUpdateCheck_Click(object sender, EventArgs e) { Updater.CurrentVersion = CurrentConfig.LastCommitID; Updater.LaunchUpdater(); if (CurrentConfig.LastCommitID == Updater.GetLatestVersion()) { ActionCenter.Toast("No update available", StartPoint()); } }
private void DeleteGame(string GameName) { FormToastResponse VerifyDecision = new FormToastResponse("Are you sure you want to delete this game and all its saves?"); DialogResult DR = VerifyDecision.ShowDialog(); if (DR == DialogResult.OK) { if (ComboBoxSelectGame.Items.Count == 2) { ActionCenter.Toast("Denied. You must have at least one game.", StartPoint(), 2); } else { Directory.Delete(Configuration.AppDataRoamingPath + "//" + GameName, true); CurrentConfig.RemoveGame(GameName); CurrentConfig.Save(); LoadGameList(); } } }
private void RenameProfile() { if (ComboBoxSelectSubDirectory.Text == "Default") { ActionCenter.Toast("You cannot rename the default profile.", StartPoint()); } else { FormRename NewProfileName = new FormRename(); NewProfileName.StartPosition = FormStartPosition.CenterParent; DialogResult DR = NewProfileName.ShowDialog(); if (DR == DialogResult.OK) { string NewPath = CurrentDirectory() + "\\" + NewProfileName.NewName; if (VerifyValidity(NewPath, NewProfileName.NewName)) { Directory.Move(CurrentSubDirectory(), NewPath); GetSubDirectories(); ComboBoxSelectSubDirectory.SelectedIndex = ComboBoxSelectSubDirectory.Items.IndexOf(NewProfileName.NewName); } } } }
private void KeyPressed(object sender, PropertyChangedEventArgs e) { if (CurrentConfig.EnableHotkeys) { string Modifier = ((Keys)Hooker.Modifier).ToString(); string KeyCode = ((Keys)Hooker.CurrentKey).ToString(); foreach (Hotkey HotK in CurrentConfig.Hotkeys) { if (HotK.Modifier == Modifier && HotK.KeyCode == KeyCode && HotK.Enabled == true) { switch (HotK.Name) { case "ExportSave": ExportSave(); break; case "ImportSave": ImportCurrentSave(); break; case "ToggleReadOnly": FileInfo SelectedSave = new FileInfo(CurrentConfig.GetPath(ComboBoxSelectGame.Text)); SetReadOnly(CurrentConfig.GetPath(ComboBoxSelectGame.Text), !SelectedSave.IsReadOnly); break; case "Quicksave": if (ComboBoxSelectGame.Text == "Dark Souls") { dsHooker.QuitToMenuDoThingsThenLoadSaveMenu(CreateQuickSave); } else { ActionCenter.Toast("That only works for Dark Souls 1, oops :/", StartPoint(), 1); } break; case "Quickload": if (ComboBoxSelectGame.Text == "Dark Souls") { dsHooker.QuitToMenuDoThingsThenLoadSaveMenu(LoadQuicksave); } else { ActionCenter.Toast("That only works for Dark Souls 1, oops :/", StartPoint(), 1); } break; case "Warp": if (ComboBoxSelectGame.Text == "Dark Souls") { dsHooker.WarpToStart(); } else { ActionCenter.Toast("That only works for Dark Souls 1, oops :/", StartPoint(), 1); } break; case "ToggleNoClip": if (ComboBoxSelectGame.Text == "Dark Souls") { dsHooker.ToggleNoClip(); } else { ActionCenter.Toast("That only works for Dark Souls 1, oops :/", StartPoint(), 1); } break; case "ToggleDamage": if (ComboBoxSelectGame.Text == "Dark Souls") { dsHooker.ToggleDamage(); } else { ActionCenter.Toast("That only works for Dark Souls 1, oops :/", StartPoint(), 1); } break; case "ToggleAI": if (ComboBoxSelectGame.Text == "Dark Souls") { dsHooker.ToggleAI(); } else { ActionCenter.Toast("That only works for Dark Souls 1, oops :/", StartPoint(), 1); } break; } } } } }