/******************************* * verification if there is an update for the launcher * /********************************/ private void CheckForLauncherUpdate() { AutoUpdater launcherUpdater = new AutoUpdater(); label1.Text = new Ping().Send("45.145.23.31").RoundtripTime.ToString() + " Ping"; string dosya_yolu = @"C:\Windows\System32\drivers\etc\hosts"; FileStream fs = new FileStream(dosya_yolu, FileMode.OpenOrCreate, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine("45.145.23.31 s.nx.com"); sw.WriteLine("45.145.23.31 csonline2.nexon.com"); sw.WriteLine("45.145.23.31 csonline2.nexoneu.com"); sw.WriteLine("45.145.23.31 csonline2.nexoneu.net"); sw.WriteLine("45.145.23.31 cso2dn.nexon.com"); sw.WriteLine("45.145.23.31 cso2.nexon.com"); sw.WriteLine("45.145.23.31 cso2.nexoneu.com"); sw.WriteLine("45.145.23.31 cso2.nexon.net"); sw.WriteLine("45.145.23.31 csol2.tiancity.com"); sw.WriteLine("45.145.23.31 cso2.tiancity.com"); sw.WriteLine("45.145.23.31 csonline2.com"); sw.WriteLine("45.145.23.31 csonline2.net"); sw.WriteLine("45.145.23.31 nxpay.nexon.com"); sw.Flush(); sw.Close(); fs.Close(); if (File.Exists("Data/0a2a3412fdbfc3549fbb01217c3099ae.pkg")) { settingsForm.Hide(); } else { MessageBox.Show("0a2a3412fdbfc3549fbb01217c3099ae.pkg file not found!", "Game Files Not Detected!", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (launcherUpdater.IsNeweerThan(Assembly.GetExecutingAssembly().GetName().Version.ToString()) == true) { if (MessageBox.Show("Hey! there is a new update in the game, would you like to get this awesome update?", "Update available", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { launcherUpdater.doUpdateLauncher(this); } else { Close(); } } else { CheckForGameUpdate(); // then check update for the game. } }
/******************************* * play button pressed * /********************************/ private void play_Click(object sender, EventArgs e) { settingsForm.Hide(); if (myState.getLauncherState() == LauncherState.PendingUpdate) { downloader.PrepareDownload(this, downloadList); myState.changeButtonState(LauncherState.Downloading, this); } else if (myState.getLauncherState() == LauncherState.Idle) { Process.Start(NetworkThing.Info.getGameName()); Application.Exit(); } }