public Language(string lang) { if (File.Exists("Languages\\" + lang + ".txt")) { LanguageContent = new string[size]; LanguageContent = File.ReadAllLines("Languages\\" + lang + ".txt", Encoding.UTF8); if (LanguageContent.Length != size) { LanguageContent = new string[size]; ShowMode.Error("Language file is corrupted. Default is set to English."); SetEnglishLanguage(); } else { ExtractValues(); SaveToConfig(lang); if (lang.Equals("Turkish")) { SelectedLanguage = "Türkçe"; } } } else { ShowMode.Error("File not found. Default is set to English."); LanguageContent = new string[size]; SetEnglishLanguage(); } }
private void deleteButton_Click(object sender, EventArgs e) { Button button = sender as Button; int index = panel2.Controls.IndexOf(button), buttonRowCount = 8, deleteValueCounter = 0; if (index != -1) { for (int i = index; deleteValueCounter < buttonRowCount; i--) { panel2.Controls.RemoveAt(i); deleteValueCounter++; } buttons.RemoveAt(index / buttonRowCount); paths.RemoveAt(index / buttonRowCount); currentButtonCount--; } else { ShowMode.Error(Manage_Beatmap.language.LanguageContent[Language.buttonNotFound]); } }
private bool validate() { double startOffset, endOffset; if (!wholeMapCheckBox.Checked) { if (!startOffsetTextBox.IsValidOffsetInput()) { ShowMode.Error("Start offset: " + MainForm.language.LanguageContent[Language.timeExpressionDoesNotMatch]); Values.Reset(); return(false); } else if (!endOffsetTextBox.IsValidOffsetInput()) { ShowMode.Error("End offset: " + MainForm.language.LanguageContent[Language.timeExpressionDoesNotMatch]); Values.Reset(); return(false); } else { startOffset = startOffsetTextBox.GetOffsetMillis(); endOffset = endOffsetTextBox.GetOffsetMillis(); } } else { startOffset = 0; endOffset = 0; } Values.StartOffset = startOffset; Values.EndOffset = endOffset; Values.IsAllTaikoDiffs = allTaikoDiffsCheckBox.Checked; Values.IsWholeMap = wholeMapCheckBox.Checked; Values.IsSnapGreenLines = snapGreenLinesCheckBox.Checked; return(true); }
private void button1_Click(object sender, EventArgs e) { if (panel2.Controls.Count < 5) { ShowMode.Error(Manage_Beatmap.language.LanguageContent[Language.noHitsounds]); return; } if (ShowMode.QuestionWithYesNo(Manage_Beatmap.language.LanguageContent[Language.areYouSureToSaveHitsounds]) == DialogResult.Yes) { if (beatmapPath != string.Empty) { DialogResult res = ShowMode.QuestionWithYesNoCancel(Manage_Beatmap.language.LanguageContent[Language.saveSongFolder]); if (res == DialogResult.Yes) { SaveHitSounds(beatmapPath); } else if (res == DialogResult.No) { ShowMode.Information(Manage_Beatmap.language.LanguageContent[Language.selectTheFolder]); FolderBrowserDialog dialog = new FolderBrowserDialog(); if (dialog.ShowDialog() == DialogResult.OK) { SaveHitSounds(dialog.SelectedPath); } } } else { ShowMode.Information(Manage_Beatmap.language.LanguageContent[Language.selectTheFolder]); FolderBrowserDialog dialog = new FolderBrowserDialog(); if (dialog.ShowDialog() == DialogResult.OK) { SaveHitSounds(dialog.SelectedPath); } } } }
private void Check() { if (string.IsNullOrWhiteSpace(textBox1.Text)) { ShowMode.Error(MainForm.language.LanguageContent[Language.oneOrMoreValuesEmpty]); return; } else if (textBox1.Text.Any(char.IsLetter)) { ShowMode.Error(MainForm.language.LanguageContent[Language.onlyNumbersAndComma]); return; } else if (!comboBox1.IsDisposed && comboBox1.SelectedIndex == -1) { ShowMode.Error(MainForm.language.LanguageContent[Language.comboBoxSelectedIndex]); return; } DialogResult res = MessageBox.Show(MainForm.language.LanguageContent[Language.areYouSure], "Status", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (res == DialogResult.Yes) { value = Convert.ToDouble(textBox1.Text); formStatus = true; ComboBoxSelectedIndex = comboBox1.SelectedIndex; InvokeAction(); } else if (res == DialogResult.Cancel) { value = 0; } else { value = 0; formStatus = true; InvokeAction(); } }
private void button_Click(object sender, EventArgs e) { string title, titleUnicode, artist, artistUnicode, bookmarks, source, tags; bookmarks = bookmarksTextBox.Text.Replace(" ", ""); if (bookmarks[0] >= 48 && bookmarks[0] <= 57 && bookmarks[bookmarks.Length - 1] >= 48 && bookmarks[bookmarks.Length - 1] <= 57) { for (int i = 0; i < bookmarks.Length; i++) { if (bookmarks[i] >= 48 && bookmarks[i] <= 57) { } else if (bookmarks[i] == ',') { } else { ShowMode.Error(MainForm.language.LanguageContent[Language.wrongbookmarkformat]); return; } } } else { ShowMode.Error(MainForm.language.LanguageContent[Language.wrongbookmarkformat]); return; } title = titleTextBox.Text.TrimStart().TrimEnd(); titleUnicode = romanisedTitleTextBox.Text.TrimStart().TrimEnd(); artist = artistTextBox.Text.TrimStart().TrimEnd(); artistUnicode = romanisedArtistTextBox.Text.TrimStart().TrimEnd(); source = sourceTextBox.Text.TrimStart().TrimEnd(); tags = tagsTextBox.Text.TrimStart().TrimEnd(); if (string.IsNullOrEmpty(title) || string.IsNullOrEmpty(artist)) { ShowMode.Error(MainForm.language.LanguageContent[Language.artistOrTitleMissing]); } else { string[] lines; ShowMode.Information(MainForm.language.LanguageContent[Language.multiSelectionTags]); OpenFileDialog dialog = new OpenFileDialog(); dialog.InitialDirectory = path.Substring(0, path.LastIndexOf('\\')); dialog.Filter = MainForm.language.LanguageContent[Language.osuFiles] + " (*.osu,*.OSU) | *.osu;*.OSU"; dialog.Multiselect = true; dialog.Title = MainForm.language.LanguageContent[Language.selectFiles]; if (dialog.ShowDialog() == DialogResult.OK) { string[] paths = dialog.FileNames; string[] fileNames = dialog.SafeFileNames; List <string> mapper = new List <string>(); List <string> version = new List <string>(); for (int i = 0; i < fileNames.Length; i++) { string currentFileName = fileNames[i]; if (currentFileName.IndexOf('(') != -1 && currentFileName.IndexOf(')') != -1) { mapper.Add(currentFileName.Substring(currentFileName.IndexOf('(') + 1, currentFileName.IndexOf(')') - currentFileName.IndexOf('(') - 1)); } if (currentFileName.IndexOf('[') != -1 && currentFileName.IndexOf(']') != -1) { version.Add(currentFileName.Substring(currentFileName.IndexOf('[') + 1, currentFileName.IndexOf(']') - currentFileName.IndexOf('[') - 1)); } } int slashCount = paths[0].SearchCharCount('\\'); string directoryFolder = paths[0].Substring(0, paths[0].LastIndexOf('\\')); for (int i = 0; i < paths.Length; i++) { lines = File.ReadAllLines(paths[i]); lines = setValues(lines.ToList(), title, titleUnicode, artist, artistUnicode, bookmarks, source, tags); if (lines != null) { File.WriteAllLines(paths[i], lines); } else { ShowMode.Error(MainForm.language.LanguageContent[Language.metadatatagmissing] + " " + MainForm.language.LanguageContent[Language.currentFile] + paths[i]); } } Thread.Sleep(150); if (mapper.Count == paths.Length && version.Count == paths.Length) { for (int i = 0; i < paths.Length; i++) { File.Copy(paths[i], directoryFolder + "\\" + artistUnicode + " - " + titleUnicode + " (" + mapper[i] + ") [" + version[i] + "].osu", true); } Thread.Sleep(500); for (int i = 0; i < paths.Length; i++) { try { File.Delete(paths[i]); } catch (InvalidOperationException ex) { ShowMode.Error(ex.Message); } } ShowMode.Information(MainForm.language.LanguageContent[Language.processComplete]); isSuccess = true; InvokeAction(); } } else { ShowMode.Error(MainForm.language.LanguageContent[Language.noFilesSelected]); } } }
private void SaveHitSounds(string path) { bool isChecked = false; for (int i = 0; i < buttons.Count; i++) { string saveLine = string.Empty; if (comboBox1.SelectedIndex == 0) { string sample = panel2.Controls[4 + i * 8].Text; string hitSoundType = panel2.Controls[2 + i * 8].Text; string noteLine = panel2.Controls[6 + i * 8].Text.TrimStart().TrimEnd(); string extension = paths[i].Substring(paths[i].Length - 4); int box1SelectedIndex = -1, box2SelectedIndex = -1; if (!isChecked) { var currentHitsoundsVar = Directory.GetFiles(path, "*.*", SearchOption.TopDirectoryOnly). Where(s => s.EndsWith(".wav")); string[] currentHitsounds = currentHitsoundsVar.ToArray(); if (currentHitsounds.Length != 0) { for (int j = 0; j < currentHitsounds.Length; j++) { if (!currentHitsounds[j].Contains("taiko")) { stdOrCtbHitsounds.Add(currentHitsounds[j]); } } } if (stdOrCtbHitsounds.Count != 0) { for (int j = 0; j < stdOrCtbHitsounds.Count; j++) { string safeFileName = stdOrCtbHitsounds[j].Substring(stdOrCtbHitsounds[j].LastIndexOf('\\') + 1); string firstPart = safeFileName.Substring(0, safeFileName.IndexOf('-')); string secondPart = safeFileName.Substring(safeFileName.IndexOf('-') + 1, safeFileName.IndexOf('.') - safeFileName.IndexOf('-')); int number; if (secondPart.Any(char.IsDigit)) { number = int.Parse(Regex.Match(secondPart, @"\d+").Value); } else { number = 1; } if (firstPart == "normal") { box1SelectedIndex = 0; } else if (firstPart == "soft") { box1SelectedIndex = 1; } else if (firstPart == "drum") { box1SelectedIndex = 2; } if (secondPart.Contains("hitnormal")) { box2SelectedIndex = 0; } else if (secondPart.Contains("hitclap")) { box2SelectedIndex = 1; } else if (secondPart.Contains("hitwhistle")) { box2SelectedIndex = 2; } else if (secondPart.Contains("hitfinisher")) { box2SelectedIndex = 3; } if (hitSoundCounts[box1SelectedIndex, box2SelectedIndex] < number) { hitSoundCounts[box1SelectedIndex, box2SelectedIndex] = number; } } } box1SelectedIndex = -1; box2SelectedIndex = -1; isChecked = true; } if (sample == "Normal") { box1SelectedIndex = 0; } else if (sample == "Soft") { box1SelectedIndex = 1; } else if (sample == "Drum") { box1SelectedIndex = 2; } if (hitSoundType == "Normal") { box2SelectedIndex = 0; } else if (hitSoundType == "Clap") { box2SelectedIndex = 1; } else if (hitSoundType == "Whistle") { box2SelectedIndex = 2; } else if (hitSoundType == "Finisher") { box2SelectedIndex = 3; } saveLine = sample.ToLower() + "-hit" + hitSoundType.ToLower(); if (hitSoundCounts[box1SelectedIndex, box2SelectedIndex] != 1) { saveLine += hitSoundCounts[box1SelectedIndex, box2SelectedIndex].ToString(); } saveLine += extension; if (!string.IsNullOrWhiteSpace(noteLine)) { notes.Add(saveLine + ": " + noteLine); } File.Copy(paths[i], path + "\\" + saveLine, true); hitSoundCounts[box1SelectedIndex, box2SelectedIndex]++; } else if (comboBox1.SelectedIndex == 1) { string sample = panel2.Controls[4 + i * 8].Text; string hitSoundType = panel2.Controls[2 + i * 8].Text; string noteLine = panel2.Controls[6 + i * 8].Text.TrimStart().TrimEnd(); string extension = paths[i].Substring(paths[i].Length - 4); int box1SelectedIndex = -1, box2SelectedIndex = -1; if (!isChecked) { var currentHitsoundsVar = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories). Where(s => s.EndsWith(".ogg") || s.EndsWith(".wav")); string[] currentHitsounds = currentHitsoundsVar.ToArray(); if (currentHitsounds.Length != 0) { for (int j = 0; j < currentHitsounds.Length; j++) { if (currentHitsounds[j].Contains("taiko")) { taikoHitsounds.Add(currentHitsounds[j]); } } } if (taikoHitsounds.Count != 0) { for (int j = 0; j < taikoHitsounds.Count; j++) { string safeFileName = taikoHitsounds[j].Substring(taikoHitsounds[j].LastIndexOf('\\') + 1); string firstPart = safeFileName.Substring(safeFileName.IndexOf('-') + 1, safeFileName.IndexOfWithCount('-', 2) - safeFileName.IndexOf('-') - 2); string secondPart = safeFileName.Substring(safeFileName.IndexOfWithCount('-', 2), safeFileName.IndexOf('.') - safeFileName.IndexOfWithCount('-', 2)); int number; if (secondPart.Any(char.IsDigit)) { number = Int32.Parse(Regex.Match(secondPart, @"\d+").Value); } else { number = 1; } if (firstPart == "normal") { box1SelectedIndex = 0; } else if (firstPart == "soft") { box1SelectedIndex = 1; } else if (firstPart == "drum") { box1SelectedIndex = 2; } if (secondPart.Contains("hitnormal")) { box2SelectedIndex = 0; } else if (secondPart.Contains("hitclap")) { box2SelectedIndex = 1; } else if (secondPart.Contains("hitwhistle")) { box2SelectedIndex = 2; } else if (secondPart.Contains("hitfinisher")) { box2SelectedIndex = 3; } if (hitSoundCounts[box1SelectedIndex, box2SelectedIndex] < number) { hitSoundCounts[box1SelectedIndex, box2SelectedIndex] = number + 1; } } } box1SelectedIndex = -1; box2SelectedIndex = -1; isChecked = true; } if (sample == "Normal") { box1SelectedIndex = 0; } else if (sample == "Soft") { box1SelectedIndex = 1; } else if (sample == "Drum") { box1SelectedIndex = 2; } if (hitSoundType == "Normal") { box2SelectedIndex = 0; } else if (hitSoundType == "Clap") { box2SelectedIndex = 1; } else if (hitSoundType == "Whistle") { box2SelectedIndex = 2; } else if (hitSoundType == "Finisher") { box2SelectedIndex = 3; } saveLine = "taiko-" + sample.ToLower() + "-hit" + hitSoundType.ToLower(); if (hitSoundCounts[box1SelectedIndex, box2SelectedIndex] != 1) { saveLine += hitSoundCounts[box1SelectedIndex, box2SelectedIndex].ToString(); } saveLine += extension; if (!string.IsNullOrWhiteSpace(noteLine)) { notes.Add(saveLine + ": " + noteLine); } try { File.Copy(paths[i], path + "\\" + saveLine, true); } catch (FileNotFoundException e) { ShowMode.Error(e.Message); } hitSoundCounts[box1SelectedIndex, box2SelectedIndex]++; } } ShowMode.Information(Manage_Beatmap.language.LanguageContent[Language.hitsoundsSaved]); if (notes.Count > 0) { File.WriteAllLines(path + "\\notes.txt", notes.ToArray()); if (ShowMode.QuestionWithYesNo(Manage_Beatmap.language.LanguageContent[Language.notesSaved]) == DialogResult.Yes) { Process.Start(path + "\\notes.txt"); } } for (int i = 0; i < 4; i++) { for (int j = 0; j < 3; j++) { hitSoundCounts[j, i] = 1; } } stdOrCtbHitsounds.Clear(); taikoHitsounds.Clear(); notes.Clear(); }
private bool checkVariables() { foreach (Control c in this.Controls) { if (c is TextBox) { if ((string.IsNullOrEmpty(c.Text) || string.IsNullOrWhiteSpace(c.Text)) && c.Name != "bpmTextBox") { ShowMode.Error(Manage_Beatmap.language.LanguageContent[Language.oneOrMoreValuesEmpty]); return(false); } } } if (Regex.IsMatch(timeTextBox.Text, @"\d{2}[:]\d{2}[:]\d{3}") || Regex.IsMatch(timeTextBox.Text, @"[1-9]+[0-9]*[:]\d{2}[:]\d{2}[:]\d{3}")) { string decimalSeparator = Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator; if (Regex.IsMatch(firstTextBox.Text, @"^[0-9]+$") || Regex.IsMatch(firstTextBox.Text, @"^[0-9]+[" + decimalSeparator + "][0-9]+$") || Regex.IsMatch(lastTextBox.Text, @"^[0-9]+$") || Regex.IsMatch(lastTextBox.Text, @"^[0-9]+[" + decimalSeparator + "][0-9]+$")) { if (checkBox2.Checked) { if (!(Regex.IsMatch(countOrLastTimeTextBox.Text, @"\d{2}[:]\d{2}[:]\d{3}") || Regex.IsMatch(countOrLastTimeTextBox.Text, @"[1-9]+[0-9]*[:]\d{2}[:]\d{2}[:]\d{3}"))) { ShowMode.Information(Manage_Beatmap.language.LanguageContent[Language.timeExpressionDoesNotMatch]); return(false); } } else { if (!Regex.IsMatch(countOrLastTimeTextBox.Text, @"^[1-9]+[0-9]*$")) { ShowMode.Error(Manage_Beatmap.language.LanguageContent[Language.enterPositiveToCount]); return(false); } } if (comboBox.SelectedIndex == -1 && !checkBox1.Checked) { ShowMode.Error(Manage_Beatmap.language.LanguageContent[Language.selectGridSnap]); return(false); } if (!Regex.IsMatch(bpmTextBox.Text, @"^[1-9]+[0-9]*$") && !Regex.IsMatch(bpmTextBox.Text, @"^[1-9]+[0-9]*[,][0-9]+$") && !string.IsNullOrWhiteSpace(bpmTextBox.Text) && bpmTextBox.Text != Manage_Beatmap.language.LanguageContent[Language.optionalInitialIsFirst]) { ShowMode.Error(Manage_Beatmap.language.LanguageContent[Language.BPMwrong]); return(false); } if (timeTextBox.Text.SearchCharCount(':') == 2) { string first = timeTextBox.Text.Substring(0, 2); string second = timeTextBox.Text.Substring(timeTextBox.Text.IndexOfWithCount(':', 1), 2); string third = timeTextBox.Text.Substring(timeTextBox.Text.IndexOfWithCount(':', 2), 3); FirstTimeInMilliSeconds = Convert.ToInt32(first) * 60000 + Convert.ToInt32(second) * 1000 + Convert.ToInt32(third); if (checkBox2.Checked) { first = countOrLastTimeTextBox.Text.Substring(0, 2); second = countOrLastTimeTextBox.Text.Substring(countOrLastTimeTextBox.Text.IndexOfWithCount(':', 1), 2); third = countOrLastTimeTextBox.Text.Substring(countOrLastTimeTextBox.Text.IndexOfWithCount(':', 2), 3); LastTimeInMilliSeconds = Convert.ToInt32(first) * 60000 + Convert.ToInt32(second) * 1000 + Convert.ToInt32(third); } } else { string first = timeTextBox.Text.Substring(0, timeTextBox.Text.IndexOf(':')); string second = timeTextBox.Text.Substring(timeTextBox.Text.IndexOfWithCount(':', 1), 2); string third = timeTextBox.Text.Substring(timeTextBox.Text.IndexOfWithCount(':', 2), 2); string fourth = timeTextBox.Text.Substring(timeTextBox.Text.IndexOfWithCount(':', 3), 3); FirstTimeInMilliSeconds = Convert.ToInt32(first) * 3600000 + Convert.ToInt32(second) * 60000 + Convert.ToInt32(third) * 1000 + Convert.ToInt32(fourth); if (checkBox2.Checked) { first = countOrLastTimeTextBox.Text.Substring(0, timeTextBox.Text.IndexOf(':')); second = countOrLastTimeTextBox.Text.Substring(countOrLastTimeTextBox.Text.IndexOfWithCount(':', 1), 2); third = countOrLastTimeTextBox.Text.Substring(countOrLastTimeTextBox.Text.IndexOfWithCount(':', 2), 2); fourth = countOrLastTimeTextBox.Text.Substring(countOrLastTimeTextBox.Text.IndexOfWithCount(':', 3), 3); LastTimeInMilliSeconds = Convert.ToInt32(first) * 3600000 + Convert.ToInt32(second) * 60000 + Convert.ToInt32(third) * 1000 + Convert.ToInt32(fourth); } } if (checkBox2.Checked && LastTimeInMilliSeconds <= FirstTimeInMilliSeconds) { ShowMode.Error(Manage_Beatmap.language.LanguageContent[Language.lastTimeCannotBeSmaller]); return(false); } isNoteMode = checkBox1.Checked; isBetweenTimeMode = checkBox2.Checked; if (!isNoteMode) { FirstGridValue = Convert.ToDouble(comboBox.Items[comboBox.SelectedIndex].ToString().Substring(0, comboBox.Items[comboBox.SelectedIndex].ToString().IndexOf('/'))); LastGridValue = Convert.ToDouble(comboBox.Items[comboBox.SelectedIndex].ToString().Substring(comboBox.Items[comboBox.SelectedIndex].ToString().IndexOf('/') + 1)); } FirstSV = Convert.ToDouble(firstTextBox.Text); LastSV = Convert.ToDouble(lastTextBox.Text); if (!checkBox2.Checked) { Count = Convert.ToInt32(countOrLastTimeTextBox.Text); } if (bpmTextBox.Text != Manage_Beatmap.language.LanguageContent[Language.optionalInitialIsFirst] && !string.IsNullOrWhiteSpace(bpmTextBox.Text)) { TargetBPM = Double.Parse(bpmTextBox.Text); } else { TargetBPM = 0; } } else { ShowMode.Error(Manage_Beatmap.language.LanguageContent[Language.SVchangesWrong]); return(false); } } else { ShowMode.Information(Manage_Beatmap.language.LanguageContent[Language.timeExpressionDoesNotMatch]); return(false); } if (checkBox1.Checked) { Status = ShowMode.QuestionWithYesNoCancel(Manage_Beatmap.language.LanguageContent[Language.rememberSnappingNotes]); } else { Status = ShowMode.QuestionWithYesNoCancel(Manage_Beatmap.language.LanguageContent[Language.areYouSureToContinue]); } return(true); }
private void applyTimingButton_Click(object sender, EventArgs e) { List <string> timingContent = timingTextBox.Lines.ToList(); bool isFormatValid = true; for (int i = 0; i < timingContent.Count; i++) { if (string.IsNullOrWhiteSpace(timingContent[i])) { timingContent.RemoveAt(i--); } } if (timingContent.Count != 0) { for (int i = 0; i < timingContent.Count; i++) { string currentLine = timingContent[i]; for (int j = 0; j < currentLine.Length; j++) { if (!((currentLine[j] >= '0' && currentLine[j] <= '9') || currentLine[j] == '.' || currentLine[j] == ',' || currentLine[j] == '\n' || currentLine[j] == '-')) { ShowMode.Error(Manage_Beatmap.language.LanguageContent[Language.timingFormatWrong] + (j + 1).ToString()); timingTextBox.Focus(); if (!string.IsNullOrEmpty(timingTextBox.Text)) { timingTextBox.Select(getSelectionLine(timingContent, j), timingTextBox.Lines[j].Length); } isFormatValid = false; break; } } if (!isFormatValid) { break; } } if (isFormatValid) { if (comboBox.SelectedIndex != -1) { bool isAllTimingPoints = true; for (int i = 0; i < timingContent.Count; i++) { string currentLine = timingContent[i]; if (currentLine.Substring(currentLine.IndexOfWithCount(',', 6), 1) == "0") { ShowMode.Error(Manage_Beatmap.language.LanguageContent[Language.onlyTimingPoints] + (i + 1).ToString()); timingTextBox.Focus(); if (!string.IsNullOrEmpty(timingTextBox.Text)) { timingTextBox.Select(getSelectionLine(timingContent, i), timingTextBox.Lines[i].Length); } isAllTimingPoints = false; break; } } if (isAllTimingPoints) { if (ShowMode.QuestionWithYesNo(Manage_Beatmap.language.LanguageContent[Language.areYouSure]) == DialogResult.Yes) { this.timingContent = timingContent; isValid = true; Close(); } } } else { ShowMode.Error(Manage_Beatmap.language.LanguageContent[Language.noFunctionSelected]); } } } else { ShowMode.Error(Manage_Beatmap.language.LanguageContent[Language.noInputDetected]); } }
private void button1_Click(object sender, EventArgs e) { decimal d = 0; decimal f = 0; if (!Decimal.TryParse(textBox1.Text, out d) && comboBox1.SelectedIndex == -1) { ShowMode.Error(Manage_Beatmap.language.LanguageContent[Language.BPMonlyNumberAndSeperatedComma]); } else { if (textBox2.Text != "1" && textBox2.Text != "Default is 1.00x") { if (!decimal.TryParse(textBox2.Text, out f)) { ShowMode.Error(Manage_Beatmap.language.LanguageContent[Language.SVvalueFormat]); } else if (comboBox1.SelectedIndex == 0) { if (ShowMode.QuestionWithYesNo(Manage_Beatmap.language.LanguageContent[Language.removeAllSVchanges]) == DialogResult.Yes) { Bpm_value = (double)d; if (f != 0) { SV_value = (double)f; } IsValueSet = true; editType = comboBox1.SelectedIndex; this.Close(); } } else { if ((ShowMode.QuestionWithYesNo(Manage_Beatmap.language.LanguageContent[Language.selectSVwithBPM]) == DialogResult.Yes)) { Bpm_value = (double)d; if (f != 0) { SV_value = (double)f; } IsValueSet = true; editType = comboBox1.SelectedIndex; this.Close(); } } } else if (comboBox1.SelectedIndex == 0) { if (ShowMode.QuestionWithYesNo(Manage_Beatmap.language.LanguageContent[Language.removeAllSVchanges]) == DialogResult.Yes) { Bpm_value = (double)d; SV_value = 1; IsValueSet = true; editType = comboBox1.SelectedIndex; this.Close(); } } else { if ((ShowMode.QuestionWithYesNo(Manage_Beatmap.language.LanguageContent[Language.selectSVwithBPM]) == DialogResult.Yes)) { Bpm_value = (double)d; SV_value = 1; IsValueSet = true; editType = comboBox1.SelectedIndex; this.Close(); } } } }
private void button1_Click(object sender, EventArgs e) { double bpmValue; double svValue; double startOffset; double endOffset; if (!bpmTextBox.IsValidDecimalInput()) { ShowMode.Error("The BPM format is not correct. Example: \"120\" or \"135" + Program.GetDecimalSeparator() + "46\"."); return; } else { bpmValue = Convert.ToDouble(bpmTextBox.Text.Trim()); } if (!svTextBox.IsValidDecimalInput()) { if (svTextBox.Text == defaultText) { svValue = 1; } else { ShowMode.Error("The SV format is not correct. Example: \"1\" or \"1" + Program.GetDecimalSeparator() + "35\"."); return; } } else { svValue = Convert.ToDouble(svTextBox.Text.Trim()); } if (!applyFullyCheckBox.Checked && !fromPointsCheckBox.Checked) { if (!startOffsetTextBox.IsValidOffsetInput()) { ShowMode.Error("The start offset is wrong. " + MainForm.language.LanguageContent[Language.timeExpressionDoesNotMatch]); return; } else { startOffset = startOffsetTextBox.GetOffsetMillis(); } if (!endOffsetTextBox.IsValidOffsetInput()) { ShowMode.Error("The end offset is wrong. " + MainForm.language.LanguageContent[Language.timeExpressionDoesNotMatch]); return; } else { endOffset = endOffsetTextBox.GetOffsetMillis(); } } else { startOffset = 0; endOffset = 0; } string questionText = applyTaikoMapsCheckBox.Checked ? "This operation will equalize the SV for the selected region, for all taiko difficulties in the mapset. Are you sure you want to continue?" : "This operation will equalize the SV for the selected region. Are you sure you want to continue?"; // If we made it here, it means all values are correct. // Ask the confirmation and continue if agreed. if (ShowMode.QuestionWithYesNo(questionText) == DialogResult.Yes) { BpmValue = bpmValue; SvValue = svValue; StartOffset = startOffset; EndOffset = endOffset; ApplyToAllTaikoDiffs = applyTaikoMapsCheckBox.Checked; ApplyToWholeRange = applyFullyCheckBox.Checked; FindFromSelectedPoints = fromPointsCheckBox.Checked; InvokeAction(); } }