}//On change no button private void button4_Click(object sender, EventArgs e) { Form1.editXml(Form1.appdata + "\\skymin\\config\\user.xml", "User", "Java-patch", java_patch_txt.Text); java_patch = java_patch_txt.Text; Form1.editXml(Form1.appdata + "\\skymin\\config\\user.xml", "User", "Java-args", java_args_txt.Text); //Save console settings if (console_yes.Checked) { Form1.editXml(Form1.appdata + "\\skymin\\config\\user.xml", "User", "Console", "true"); if (Konsola.Instance == null) { ShowConsoleWindow(); HideConsoleWindow(); Konsola kns = new Konsola(); kns.Show(); } else { Konsola.Instance.Visible = true; } consola_tray.Text = "Showaj konsole"; } else if (console_no.Checked) { editXml(appdata + "\\skymin\\config\\user.xml", "User", "Console", "false"); if (Konsola.Instance != null) { Konsola.Instance.Visible = false; } consola_tray.Text = "Pokarz konsole"; } //Save launcher settings if (launcher_1.Checked == true) { launcher_state = 1; editXml(appdata + "\\skymin\\config\\user.xml", "User", "Launch_Setting", "1"); } else if (launcher_2.Checked == true) { launcher_state = 2; editXml(appdata + "\\skymin\\config\\user.xml", "User", "Launch_Setting", "2"); } else if (launcher_3.Checked == true) { launcher_state = 3; editXml(appdata + "\\skymin\\config\\user.xml", "User", "Launch_Setting", "3"); } //Save changelog settings if (yes_changelog.Checked) { editXml(appdata + "\\skymin\\config\\user.xml", "User", "Show_Changelog", "true"); } else { editXml(appdata + "\\skymin\\config\\user.xml", "User", "Show_Changelog", "false"); } Form1.WriteLine("Ustawienia zostalu zapisane"); MessageBox.Show("Ustawienia zostały poprawnie zapisane", "Ustawienia", MessageBoxButtons.OK, MessageBoxIcon.Information); } //Save Button
private void consola_tray_Click(object sender, EventArgs e) { if (Konsola.Instance != null) { if (Konsola.Instance.Visible == true) { Konsola.Instance.Visible = false; console_no.Checked = true; consola_tray.Text = "Pokarz konsole"; } else { Konsola.Instance.Visible = true; console_yes.Checked = true; consola_tray.Text = "Showaj konsole"; } } else { Konsola kns = new Konsola(); kns.Show(); console_yes.Checked = true; consola_tray.Text = "Showaj konsole"; } }
private void Form1_Load(object sender, EventArgs e) { instance = this; onLoadXml(); if (File.Exists(Form1.appdata + "\\skymin\\config\\user.xml") == false) { createXmlUser(); } if (readXml(appdata + "\\skymin\\config\\user.xml", "Console") == "true") { ShowConsoleWindow(); HideConsoleWindow(); Konsola kns = new Konsola(); kns.Show(); consola_tray.Text = "Showaj konsole"; } WriteLine("Ladowanie aplikacji"); version_launcher = readXml(appdata + "\\skymin\\config\\launcher.xml", "Launcher_Version"); version_minecraft = readXml(appdata + "\\skymin\\config\\launcher.xml", "Minecraft_Version"); version_pack = readXml(appdata + "\\skymin\\config\\launcher.xml", "ModPack_Version"); version_forge = readXml(appdata + "\\skymin\\config\\launcher.xml", "Forge_Version"); version_pack = readXml(appdata + "\\skymin\\config\\launcher.xml", "ModPack_Version"); if (IsConnectedToInternet() == true) { isOnline = true; string readMinecraft = webClient.DownloadString("https://raw.githubusercontent.com/dom133/SkyMin-Launcher/master/minecraft_version.txt"); string readlauncher = webClient.DownloadString("https://raw.githubusercontent.com/dom133/SkyMin-Launcher/master/launcher_version.txt"); string readModPack = webClient.DownloadString("https://raw.githubusercontent.com/dom133/SkyMin-Launcher/master/pack_version.txt"); string readForge = webClient.DownloadString("https://raw.githubusercontent.com/dom133/SkyMin-Launcher/master/forge_version.txt"); if (version_minecraft != readMinecraft || readXml(appdata + "\\skymin\\config\\launcher.xml", "Instaled_Minecraft") == "false") { updater = "Minecraft"; if (readXml(appdata + "\\skymin\\config\\launcher.xml", "Instaled_Minecraft") == "false") { Form1.WriteLine("Nie znaleziono minecraft'a"); MessageBox.Show("Nie masz pobranego minecraft", "Aktualizacja", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { Form1.WriteLine("Znaleziono nowa wersje minecraft"); MessageBox.Show("Dostepna jest nowa wersja minecraft", "Aktualizacja", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (readMinecraft[readMinecraft.Length - 1] == 'F') { version_forge = readForge; version_pack = readModPack; } version_minecraft = readMinecraft; if (frm2.ShowDialog() == DialogResult.OK) { } } else if (readlauncher != version_launcher) { Form1.WriteLine("Znaleziono nowa wersje launchera"); editXml(Form1.appdata + "\\skymin\\config\\launcher.xml", "Launcher", "App_Loc", Directory.GetCurrentDirectory() + "\\" + Process.GetCurrentProcess().ProcessName + ".exe"); MessageBox.Show("Dostepna jest nowa wersja launchera", "Aktualizacja", MessageBoxButtons.OK, MessageBoxIcon.Information); System.Diagnostics.Process.Start(appdata + "//skymin//assets//updater.exe"); Application.Exit(); } if (version_minecraft[version_minecraft.Length - 1] == 'F') //sprawdzanie wersji modack i forge { if (readModPack != version_pack) { Form1.WriteLine("Znaleziono nowa wersje modpacka"); updater = "ModPack"; MessageBox.Show("Dostepna jest nowa wersja modpacka", "Aktualizacja", MessageBoxButtons.OK, MessageBoxIcon.Information); version_pack = readModPack; if (frm2.ShowDialog() == DialogResult.OK) { } } else if (version_forge != readForge) { Form1.WriteLine("Znaleziono nowa wersje forga"); updater = "Forge"; MessageBox.Show("Dostepna jest nowa wersja forga", "Aktualizacja", MessageBoxButtons.OK, MessageBoxIcon.Information); version_forge = readForge; if (frm2.ShowDialog() == DialogResult.OK) { } } } if (readXml(appdata + "\\skymin\\config\\user.xml", "Remember") == "True" && readXml(appdata + "\\skymin\\config\\user.xml", "account_type") == "Premium") //Logowanie do Mojang { WriteLine("Trwa laczenie z serwerami mojang"); var response = Minecraft.getResponse(Form1.readXml(Form1.appdata + "\\skymin\\config\\user.xml", "Email"), Form1.readXml(Form1.appdata + "\\skymin\\config\\user.xml", "Haslo")); dynamic decoded = SimpleJson.DeserializeObject(response); if (response == "403") { MessageBox.Show("Podałeś błędny login lub/i hasło", "Logowanie", MessageBoxButtons.OK, MessageBoxIcon.Warning); WriteLine("Bledny login lub/i haslo"); } else if (decoded["availableProfiles"].Count == 0) { WriteLine("Podany login i hasło nie posiada premium"); log.ShowDialog(); } else { WriteLine("Poprawnie zalogowano na serwerze mojang"); editXml(appdata + "\\skymin\\config\\user.xml", "User", "Nick", Convert.ToString(decoded["selectedProfile"]["name"])); editXml(appdata + "\\skymin\\config\\user.xml", "User", "uuid", Convert.ToString(decoded["selectedProfile"]["id"])); editXml(appdata + "\\skymin\\config\\user.xml", "User", "accessToken", Convert.ToString(decoded["accessToken"])); this.Activate(); } } else { log.ShowDialog(); } nick = readXml(appdata + "\\skymin\\config\\user.xml", "Nick"); accesToken = readXml(appdata + "\\skymin\\config\\user.xml", "accessToken"); uuid = readXml(appdata + "\\skymin\\config\\user.xml", "uuid"); java_patch = readXml(appdata + "\\skymin\\config\\user.xml", "Java-patch"); nick_log.Text = string.Format("Witaj, {0}", nick); loadRam(); loadSettings(); this.Text = "Skymin " + version_launcher + "V"; if (version_minecraft[version_minecraft.Length - 1] != 'F') { tabControl1.TabPages.Remove(Dodatki); } } else { this.Text = "Skymin " + version_launcher + "V" + " (Offline)"; MessageBox.Show("Brak polaczenia z internetem, włączam w trybie offline", "Internet", MessageBoxButtons.OK, MessageBoxIcon.Warning); isOnline = false; Form1.WriteLine("Brak polaczenia z internetem"); log.ShowDialog(); nick = readXml(appdata + "\\skymin\\config\\user.xml", "Nick"); accesToken = readXml(appdata + "\\skymin\\config\\user.xml", "accessToken"); uuid = readXml(appdata + "\\skymin\\config\\user.xml", "uuid"); java_patch = readXml(appdata + "\\skymin\\config\\user.xml", "Java-patch"); nick_log.Text = string.Format("Witaj, {0}", nick); loadRam(); loadSettings(); tabControl1.TabPages.Remove(tabPage1); tabControl1.TabPages.Remove(Dodatki); } }//On Load Form1