private void LauncherUpdate_Completed(object sender, AsyncCompletedEventArgs e) { if (e.Cancelled) { PercentageLabel.Text = "업데이트가 취소되었습니다."; this.TopMost = true; this.TopMost = false; SetButtonsToDefault(); } else if (GetInitLevel() > 0) { GameStart.Start(); } else { RunNewLauncher(); } }
private void DownloadPatchFiles_Completed(object sender, AsyncCompletedEventArgs e) { PatchFileIndex++; if (e.Cancelled) { PercentageLabel.Text = "패치가 취소되었습니다."; this.TopMost = true; this.TopMost = false; SetButtonsToDefault(); } else if (PatchFileIndex >= PatchFileList.Length) { GameStart.Start(); } else { DownloadPatchFiles(PatchFileHost, PatchFileDest, PatchFileList, PatchFileIndex); } }
static void Main(string[] args) { GameStart.Start(Controller = new WooferController()); }
private void StartUpdate() { Uri url; HttpWebRequest request; HttpWebResponse response; HttpStatusCode statuscode; string newhash; PercentageLabel.Text = "업데이트 확인중"; Button_1_1.Text = "종료"; SetButtonEvent(Button_1_1, ButtonEvent_Exit); ShowButtons(1); try { // 최신 런처의 Hash를 가져옴 url = new Uri(Program.LauncherURL + "/getfilehash.do?name=launcher/" + Program.LauncherFileName); request = (HttpWebRequest)WebRequest.Create(url); request.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore); response = (HttpWebResponse)request.GetResponse(); statuscode = response.StatusCode; newhash = (new StreamReader(response.GetResponseStream(), Encoding.UTF8)).ReadToEnd().ToUpper(); response.Close(); } catch { alert("런처 서버에 연결할 수 없습니다.", false); return; } if (statuscode != HttpStatusCode.OK || newhash == string.Empty) // 최신 런처를 확인할 수 없는 경우 { PercentageLabel.Text = "최신 버전의 런처를 내려받으세요."; Button_2_1.Text = "인포웹"; Button_2_2.Text = "종료"; SetButtonEvent(Button_2_1, ButtonEvent_OpenInfoweb); SetButtonEvent(Button_2_2, ButtonEvent_Exit); ShowButtons(2); this.TopMost = true; this.TopMost = false; return; } // 현재 버전의 Hash를 가져옴 string ehash = GetMD5OfFile(Application.ExecutablePath).ToUpper(); if ((string.Compare(newhash, ehash, true) == 0 && Program.IsExecutedByLauncher()) || Program.TestMode) // 런처가 최신 버전인 경우 { if (GetInitLevel() > 0) { GameStart.Start(); } else { SetStatusMessageToDefault(); SetButtonsToDefault(); } } else // 런처 업데이트가 필요한 경우 // Progress Bar 초기화 { SetProgressBar(0, 0); SetProgressBar(1, 0); // 런처 업데이트 UpdateLauncher(); } }
private void StartGame() { InitLevel = 1; GameStart.Start(); }
private void GameStart_Tick(object sender, EventArgs e) { GameStart.Stop(); KillGameProcess(); Debug.Print("InitLevel - " + InitLevel + " - "); switch (InitLevel) { case 1: // 서버 연결 확인 HttpWebRequest request; HttpWebResponse response; HttpStatusCode[] statuscode = new HttpStatusCode[2]; try { request = (HttpWebRequest)WebRequest.Create(new Uri(Program.InfowebURL)); request.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore); response = (HttpWebResponse)request.GetResponse(); statuscode[0] = response.StatusCode; response.Close(); request = (HttpWebRequest)WebRequest.Create(new Uri(Program.LauncherURL)); request.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore); response = (HttpWebResponse)request.GetResponse(); statuscode[1] = response.StatusCode; response.Close(); } catch { statuscode[0] = statuscode[1] = HttpStatusCode.NotFound; } if (statuscode[0] != HttpStatusCode.OK && statuscode[1] != HttpStatusCode.OK) { PercentageLabel.Text = "서버에 연결할 수 없습니다."; Button_2_1.Text = "인포웹"; Button_2_2.Text = "종료"; SetButtonEvent(Button_2_1, ButtonEvent_OpenInfoweb); SetButtonEvent(Button_2_2, ButtonEvent_Exit); ShowButtons(2); this.TopMost = true; this.TopMost = false; } else { GameStart.Start(); } break; case 2: // 런처 업데이트 StartUpdate(); break; case 3: // 게임 구성 파일 변조 검사 및 패치 // 비인가 프로그램 차단 (파일 변조 검사 제외) ResetAuthorizedFiles(); LoadAuthorizedFilesFromServer(Program.LauncherURL + "/getfilelist.do?type=allowedfiles"); LoadAuthorizedFilesFromServer(Program.LauncherURL + "/getfilelist.do?type=patch"); LoadAuthorizedFilesFromServer(Program.LauncherURL + "/getfilelist.do?type=launcher"); if (BlockUnauthorizedPrograms()) { return; } // 검사 및 패치 if (!CompareMD5OfGameFile(Program.LauncherURL + "/getfilelist.do?type=patch")) { StartPatch(Program.LauncherURL + "/patch", GetDissimilarFiles()); } else { // 게임 실행 단계 진행 GameStart.Start(); } break; case 4: // 게임 실행 // 비인가 프로그램 차단 (파일 변조 검사 포함) if (BlockUnauthorizedPrograms()) { return; } // 닉네임 레지스트리 동기화 SaveUsernameToRegistry(); if (GetNewLauncherPath() != String.Empty) { // URL Scheme CreateUrlSchemeRegistry(); // 최신 런처 실행 RunNewLauncher(); } else if (string.Compare(GetUsername(), "NULL") == 0) { Button_2_1.Text = "인포웹"; Button_2_2.Text = "종료"; SetButtonEvent(Button_2_1, ButtonEvent_OpenInfoweb); SetButtonEvent(Button_2_2, ButtonEvent_Exit); ShowButtons(2); alert("설치 완료", false); } else if (!GenerateToken(ref CToken, Program.LauncherURL + "/auth.do", "conn")) { Button_1_1.Text = "종료"; SetButtonEvent(Button_1_1, ButtonEvent_Exit); ShowButtons(1); alert("접속 인증 실패", false); } else { PercentageLabel.Text = "게임에 접속중입니다."; // IP 등록 RegisterIP(); // SAMP 실행 StartedGamePath = GetGamePath(); Process.Start(Path.Combine(StartedGamePath, "samp.exe"), "server.la-rp.co.kr"); GameExit.Start(); GameAuth.Start(); } break; } InitLevel++; }