diff --git a/AM2RLauncher/AM2RLauncher/Language/Text.Designer.cs b/AM2RLauncher/AM2RLauncher/Language/Text.Designer.cs index d5efb6a..c4b1e8a 100644 --- a/AM2RLauncher/AM2RLauncher/Language/Text.Designer.cs +++ b/AM2RLauncher/AM2RLauncher/Language/Text.Designer.cs @@ -19,7 +19,7 @@ namespace AM2RLauncher.Language { // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Text { @@ -366,6 +366,15 @@ namespace AM2RLauncher.Language { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die $NAME is an invalid git URL! ähnelt. + /// + public static string InvalidGitURL { + get { + return ResourceManager.GetString("InvalidGitURL", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Java not found! Cannot generate an APK without a Java installation. Please make sure that Java is installed and added to PATH. ähnelt. /// diff --git a/AM2RLauncher/AM2RLauncher/Language/Text.resx b/AM2RLauncher/AM2RLauncher/Language/Text.resx index cf80e4d..1ba47a2 100644 --- a/AM2RLauncher/AM2RLauncher/Language/Text.resx +++ b/AM2RLauncher/AM2RLauncher/Language/Text.resx @@ -219,6 +219,9 @@ Couldn't establish an internet connection! Try again later! + + $NAME is an invalid git URL! + Java not found! Cannot generate an APK without a Java installation. Please make sure that Java is installed and added to PATH. diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs index 61ac52a..13292f3 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs @@ -846,8 +846,18 @@ namespace AM2RLauncher /// private void CustomMirrorTextBoxLostFocus(object sender, EventArgs e) { + // Check first, if the text is a valid git repo + Regex gitURLRegex = new Regex("https://.*\\.git"); + string mirrorText = customMirrorTextBox.Text; + if (!gitURLRegex.IsMatch(mirrorText)) + { + log.Info("User used " + mirrorText + " as a custom Mirror, didn't pass git validation test."); + //TODO: Localize these + MessageBox.Show(Language.Text.InvalidGitURL.Replace("$NAME", mirrorText), Language.Text.ErrorWindowTitle, MessageBoxType.Error); + return; + } - currentMirror = customMirrorTextBox.Text; + currentMirror = mirrorText; CrossPlatformOperations.WriteToConfig("CustomMirrorText", currentMirror); log.Info("Overwriting mirror in gitconfig."); @@ -856,7 +866,6 @@ namespace AM2RLauncher string gitConfigPath = CrossPlatformOperations.CURRENTPATH + "/PatchData/.git/config"; if (!File.Exists(gitConfigPath)) return; string gitConfig = File.ReadAllText(gitConfigPath); - Regex gitURLRegex = new Regex("https://.*\\.git"); Match match = gitURLRegex.Match(gitConfig); gitConfig = gitConfig.Replace(match.Value, currentMirror); File.WriteAllText(gitConfigPath, gitConfig); diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs index dc9de28..a5500de 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs @@ -140,7 +140,6 @@ namespace AM2RLauncher log.Info("Set Launcher CWD to " + Environment.CurrentDirectory); // But log actual folder location nonetheless - // TODO: test if this logs correctly on windows now log.Info("Actual Launcher location: " + Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory)); // Set the language to what User wanted or choose local language @@ -150,7 +149,6 @@ namespace AM2RLauncher log.Info("Language has been set to: " + Thread.CurrentThread.CurrentUICulture.EnglishName); - #region VARIABLE INITIALIZATION log.Info("Beginning UI initialization...");