//--------------------------------------------------------------------------- #include #pragma hdrstop #include "Main.h" #include "define.h" #include "PathUnit.h" #include "HttpUnit.h" #include // For process count of Windows XP #include "Maintain.h" #include "stdio.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "RzButton" #pragma link "RzEdit" #pragma link "RzLabel" #pragma link "RzPrgres" #pragma link "RzRadChk" #pragma link "IdBaseComponent" #pragma link "IdComponent" #pragma link "IdHTTP" #pragma link "IdTCPClient" #pragma link "IdTCPConnection" #pragma resource "*.dfm" TMainForm *MainForm; //--------------------------------------------------------------------------- __fastcall TMainForm::TMainForm(TComponent* Owner) : TForm(Owner) { Step = INIT_MODE; Repair_Agreement = false; due_date = 0; MainPanel->Left = 0; MainPanel->Top = 0; ProgressPanel->Left = 0; ProgressPanel->Top = 0; MainPanel->BringToFront(); ClientWidth = MainPanel->Width; ClientHeight = MainPanel->Height; if (ParamCount()) { if (ParamStr(0).Length() != 0) ApplicationExeName = ParamStr(0); if (ParamStr(1).Length() != 0) Program = ParamStr(1); if (ParamStr(2).Length() != 0) Version = ParamStr(2); try { Load_Default_Path(Program); } catch(...) { goto fail; } InfoMemo->Clear(); if (Language == "Korean") { InfoMemo->Lines->Add("ÀÌ ÇÁ·Î±×·¥Àº ÀÚµ¿ Update ÇÁ·Î±×·¥ÀÔ´Ï´Ù."); InfoMemo->Lines->Add("\r"); InfoMemo->Lines->Add("Update¸¦ ¿øÇϽøé \"Next\" ¹öưÀ» ´©¸£½Ã±â ¹Ù¶ø´Ï´Ù."); AgreeCkBox->Caption = "µ¿ÀÇÇÔ"; mNextBtn->Caption = "´ÙÀ½"; mCancelBtn->Caption = "Ãë¼Ò"; pNextBtn->Caption = "´ÙÀ½"; pCancelBtn->Caption = "Ãë¼Ò"; } else { InfoMemo->Lines->Add("It is Youngwoo auto update program."); InfoMemo->Lines->Add("\r"); InfoMemo->Lines->Add("Click \"Next\" button for program update, please."); AgreeCkBox->Caption = "Agreement"; mNextBtn->Caption = "Next"; mCancelBtn->Caption = "Canael"; pNextBtn->Caption = "Next"; pCancelBtn->Caption = "Canael"; } Download_URL_List = new TStringList; Info_Content = new TStringList; return; } fail: mNextBtn->Enabled = false; InfoMemo->Clear(); if (Language == "Korean") { InfoMemo->Lines->Add("ÇÁ·Î±×·¥ Á¤º¸°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù."); } else { InfoMemo->Lines->Add("Invalid program informaion."); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::FormDestroy(TObject *Sender) { if (Download_URL_List) delete Download_URL_List; if (Info_Content) delete Info_Content; if (AgreeCkBox->Checked) { } } //--------------------------------------------------------------------------- void __fastcall TMainForm::mNextBtnClick(TObject *Sender) { DWORD milliseconds; switch(Step) { case INIT_MODE: Step = CHECK_MODE; Info_Content->Clear(); if (GetCountExecutingProgram() > 0) {//ÇÁ·Î±×·¥ÀÌ ÇöÀç ½ÇÇàÁßÀ̸é fail¸®ÅÏ Step = INIT_MODE; if (Language == "Korean") { Info_Content->Add(Program.UpperCase() + " ÇÁ·Î±×·¥ÀÌ ÇöÀç ½ÇÇàÁßÀÔ´Ï´Ù."); Info_Content->Add("\r"); Info_Content->Add(Program.UpperCase() + " ÇÁ·Î±×·¥À» Á¾·á ÇϽŠÈÄ¿¡ \"Next\" ¹öưÀ» ´­·¯"); Info_Content->Add("\r"); Info_Content->Add("ÁÖ¼¼¿ä."); } else { Info_Content->Add(Program.UpperCase() + " program is running."); Info_Content->Add("\r"); Info_Content->Add("Please, click \"Next\" button after closing " + Program.UpperCase() + " program."); } Updata_Info_Box(); return; } mNextBtn->Enabled = false; if (!Get_Own_InformationFrom()) { Step = INIT_MODE; if (Language == "Korean") { Info_Content->Add("ÇÁ·Î±×·¥ Á¤º¸°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù."); } else { Info_Content->Add("Program information is invalid."); } Updata_Info_Box(); return; } if (!Get_XML_From_Server()) { Step = INIT_MODE; Updata_Info_Box(); return; } Updata_Info_Box(); InfoMemo->ScrollBars = ssVertical; AgreeCkBox->Visible = true; break; case CHECK_MODE: Step = AGREE_MODE; ProgressPanel->Left = 0; ProgressPanel->Top = 0; InfoMemo->ScrollBars = ssNone; Updata_Info_Box(); ProgressPanel->BringToFront(); AgreeCkBox->Visible = false; AgreeCkBox->Checked = false; break; case AGREE_MODE: Step = DOWNLOAD_MODE; Updata_Info_Box(); Download_Files_From_Server(); break; case DOWNLOAD_MODE: Step = UPDATE_MODE; pProgressBar->Percent = 0; Updata_Info_Box(); milliseconds = 1000; Sleep(milliseconds); Update_New_Files(); break; case UPDATE_MODE: Step = NONE_MODE; Updata_Info_Box(); break; } } //--------------------------------------------------------------------------- void __fastcall TMainForm::mCancelBtnClick(TObject *Sender) { if (AgreeCkBox->Checked) { Visible = false; MaintainForm = new TMaintainForm(MainForm); MaintainForm->ShowModal(); delete MaintainForm; } Close(); } //--------------------------------------------------------------------------- bool __fastcall TMainForm::Get_Own_InformationFrom() { TRegIniFile *RegIniFile = NULL; RegIniFile = new TRegIniFile(RegFilename); RegIniFile->RootKey = HKEY_LOCAL_MACHINE; RegIniFile->OpenKey(RegFilename + "\\",true); // yw if (RegIniFile) { Serial = RegIniFile->ReadString("Common", "Serial", ""); delete RegIniFile; } //serial Á¤º¸°¡ ¾øÀ» °æ¿ì if (Serial.Length() == 0) return false; /////////////////////////////////////////////////////////////////////////// if (Version.Length() == 0) return false; String strVerInfo = "FileVersion"; String strTemp; char *pBuf = NULL; LPVOID pValue = NULL; DWORD dwFileVersionInfoSize; unsigned int nLen; WORD *dwID = NULL; dwFileVersionInfoSize = GetFileVersionInfoSize(ApplicationExeName.c_str(), &dwFileVersionInfoSize); if (dwFileVersionInfoSize > 0) { pBuf = new char[dwFileVersionInfoSize]; if (pBuf) { GetFileVersionInfo(Application->ExeName.c_str(), 0, dwFileVersionInfoSize, pBuf); strTemp = "VarFileInfo\\Translation"; VerQueryValue(pBuf, strTemp.c_str(), &pValue, &nLen); dwID = (WORD *)pValue; strTemp = "StringFileInfo\\" + IntToHex(dwID[0], 4) + IntToHex(dwID[1], 4) + "\\" + strVerInfo; if (VerQueryValue(pBuf, strTemp.c_str(), &pValue, &nLen)) { Version = String((char *)pValue); } delete []pBuf; pBuf = NULL; } return true; } else { //file version Á¤º¸°¡ ¾øÀ» °æ¿ì return false; } } //--------------------------------------------------------------------------- ///ÇöÀç ½ÇÇà ÁßÀÎ TextileÀÇ °³¼ö¸¦ È®ÀÎ ÇÏ´Â ÇÔ¼ö int __fastcall TMainForm::GetCountExecutingProgram() { int number=0; // Initialization 0 HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); // This function has system information AnsiString name; AnsiString compare_p_name = Program.LowerCase() + ".exe"; if(snap) // Excution snapshat handle { BOOL p_Count; // For count process PROCESSENTRY32 p_Entry; // Declare process struct p_Entry.dwSize = sizeof(PROCESSENTRY32); // A Function of PROCESSENTRY32 p_Count = Process32First(snap, &p_Entry); // Search a executing process while(p_Count) { p_Count = Process32Next(snap, &p_Entry); // Repeat to search executing process name = p_Entry.szExeFile; name = name.LowerCase(); if (name == compare_p_name) number++; // Increase number of executing process } CloseHandle(snap); // Close snapshot handle } return number; } //-------------------------------------------------------------------------- void __fastcall TMainForm::AgreeCkBoxClick(TObject *Sender) { if (AgreeCkBox->Checked) { if (mNextBtn->Visible) { mNextBtn->Enabled = true; mNextBtn->SetFocus(); } else { mCancelBtn->SetFocus(); } } else { mNextBtn->Enabled = false; } } //--------------------------------------------------------------------------- String __fastcall TMainForm::MakeDirectory(String Path, String Root) { Char temp_char; String temp_string; String directory_path = Root;//AutoUpdateBin + "\\" + Program + "\\"; for (int i = 0; i < Path.Length(); i++) { temp_char = Path.c_str()[i]; if (i == 0 && (temp_char == '/' || temp_char == '\\')) continue; else if (temp_char == '/' || temp_char == '\\') { directory_path += temp_string; if (!DirectoryExists(directory_path)) { if (!CreateDir(directory_path)) throw Exception("Cannot create " + directory_path); } directory_path += "\\"; temp_string = ""; continue; } temp_string += temp_char; } return directory_path + temp_string; } //--------------------------------------------------------------------------- bool __fastcall TMainForm::Update_New_Files() { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; String Downloaded_Path = AutoUpdateBin + "\\" + Program + "\\"; String Real_Path = DefaultDir + "\\"; String path, copy_path, root_path, temp_string; int current_file_num, Process_Percent, count; Process_Percent = 100 / Download_URL_List->Count; count = Download_URL_List->Count; for (int i = 0; i < count; i++) { path = Download_URL_List->Strings[i]; root_path = MakeDirectory(path, Downloaded_Path); copy_path = MakeDirectory(path, Real_Path); current_file_num = i+1; if (Language == "Korean") { temp_string = "Update ÆÄÀÏ " + IntToStr(current_file_num) + " / " + IntToStr(count); } else { temp_string = "Update file " + IntToStr(current_file_num) + " / " + IntToStr(count); } pMemo->Lines->Strings[2] = temp_string; if (!CopyFile(root_path.c_str(), copy_path.c_str(), false)) goto fail; pProgressBar->Percent += Process_Percent; } pProgressBar->Percent = 100; if (Language == "Korean") { pMemo->Lines->Strings[0] = "Update°¡ ¿Ï·áµÇ¾ú½À´Ï´Ù. \"Next\"¹öưÀ» ´©¸£¼¼¿ä."; } else { pMemo->Lines->Strings[0] = "Update is finished. Click \"Next\" button."; } Screen->Cursor = cur; return true; fail: pMemo->Clear(); if (Language == "Korean") { pMemo->Lines->Add("Update ½ÇÆÐ Çß½À´Ï´Ù."); pMemo->Lines->Add("\r"); pMemo->Lines->Add("\"Retry\"¹öưÀ» ´­·¯ ´Ù½Ã ½Ãµµ ÇϽʽÿä."); } else { pMemo->Lines->Add("Update failed"); pMemo->Lines->Add("\r"); pMemo->Lines->Add("Click \"Retry\" button. Try again, please."); } pProgressBar->Percent = 0; Step = DOWNLOAD_MODE; pNextBtn->Caption = "Retry"; pNextBtn->SetFocus(); Screen->Cursor = cur; return false; } //--------------------------------------------------------------------------- bool __fastcall TMainForm::Get_XML_From_Server() { String response; String address = "http://www.texclub.com/cms2/autoup_check.php"; TIdHTTP *IdHTTP = new TIdHTTP(MainForm); TIdMultiPartFormDataStream* pData = NULL; pData = new TIdMultiPartFormDataStream(); try { pData->AddFormField("serial", Serial); // pData->AddFormField("version", Version); // pData->AddFormField("name", Program); // response = IdHTTP->Post(address, pData); } catch (...) { response = GetLastError(); if (pData != NULL) delete pData; pData = NULL; delete IdHTTP; Info_Content->Clear(); if (Language == "Korean") { Info_Content->Add("¼­¹ö¿¡ ¿¬°áÀÌ µÇÁö ¾Ê½À´Ï´Ù."); Info_Content->Add("\r"); Info_Content->Add("´ã´çÀÚ ¶Ç´Â (ÁÖ)¿µ¿ì¾¾¿£¾ÆÀÌ·Î ¹®ÀÇ ÇϽñ⠹ٶø´Ï´Ù."); } else { Info_Content->Add("Cannot connect to the server."); Info_Content->Add("\r"); Info_Content->Add("Please, contact YoungWoo CNI."); } return false; } if (pData != NULL) delete pData; pData = NULL; delete IdHTTP; if (response.Length() == 0) return false; if (!Process_XML_File(response)) { return false; } return true; } //--------------------------------------------------------------------------- bool __fastcall TMainForm::Process_XML_File(String xml) { String program_path, temp_string; int _version[4]; int _newest_version[4]; int _last_version[4]; swscanf(Version.c_str(), L"%d.%d.%d.%d", &_version[0], &_version[1], &_version[2], &_version[3]); program_path = AutoUpdateBin + "\\" + Program; if (!DirectoryExists(program_path)) { if (!CreateDir(program_path)) throw Exception("Cannot create " + program_path); } TXMLDocument* XMLDoc = XMLDocument1; XMLDoc->LoadFromXML(xml); //XMLDoc->LoadFromFile("C:\\Documents and Settings\\¹Ú»óÈÆ\\Application Data\\YoungWoo\\Texpro10.0\\AutoUpdate\\Textile\\updata.xml"); String NodeText, NodeName; _di_IXMLNode XmlNode, ChildNode, AttrNode, FileNode; XmlNode = XMLDoc->DocumentElement; NodeName = XmlNode->GetNodeName(); if (!XmlNode->HasChildNodes) { delete XMLDoc; return false; } for (int i = 0; i < XmlNode->ChildNodes->Count; i++) { ChildNode = XmlNode->ChildNodes->Nodes[i]; NodeName = ChildNode->NodeName; if (NodeName == "key") { AttrNode = ChildNode->GetAttributeNodes()->Get(1);//0:type="HASP/NetHASP", 1:value=serial NodeName = AttrNode->GetNodeName(); NodeText = AttrNode->Text; if (NodeText == "NONE") goto fail; AttrNode = ChildNode->GetAttributeNodes()->Get(2);//1:version="10.0" NodeName = AttrNode->GetNodeName(); NodeText = AttrNode->Text; if (NodeText == "NONE") goto fail; if (NodeText.SubString(1,4) != Version.SubString(1,4)) { Info_Content->Clear(); if (Language == "Korean") { Info_Content->Add("¹öÀü Á¤º¸°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù."); Info_Content->Add("\r"); Info_Content->Add("´ã´çÀÚ ¶Ç´Â (ÁÖ)¿µ¿ì¾¾¿£¾ÆÀÌ·Î ¹®ÀÇ ÇϽñ⠹ٶø´Ï´Ù."); } else { Info_Content->Add("Program version is invalid."); Info_Content->Add("\r"); Info_Content->Add("Please, contact YoungWoo CNI."); } goto fail; } } else if (NodeName == "contract") { AttrNode = ChildNode->GetAttributeNodes()->Get(0);//valid:true(Àåºñ°è¾à yes) NodeName = AttrNode->GetNodeName(); NodeText = AttrNode->Text; if (NodeText == "TRUE") Repair_Agreement = true; else Repair_Agreement = false; AttrNode = ChildNode->GetAttributeNodes()->Get(1);//type:GRATIS(¹«»ó±â°£) NodeName = AttrNode->GetNodeName(); NodeText = AttrNode->Text; if (NodeText == "NONE") { Info_Content->Clear(); if (Language == "Korean") { Info_Content->Add("Á¤ºñ°è¾àÀÌ µÇ¾î ÀÖÁö ¾Ê½À´Ï´Ù."); Info_Content->Add("\r"); Info_Content->Add("Update¸¦ ÇÒ ¼ö ¾ø½À´Ï´Ù."); Info_Content->Add("\r"); Info_Content->Add("´ã´çÀÚ ¶Ç´Â (ÁÖ)¿µ¿ì¾¾¿£¾ÆÀÌ·Î ¹®ÀÇ ÇϽñ⠹ٶø´Ï´Ù."); } else { Info_Content->Add("Setup cannot update because you did not renew the maintenance contract."); Info_Content->Add("\r"); Info_Content->Add("Please, contact YoungWoo CNI."); } goto fail; } AttrNode = ChildNode->GetAttributeNodes()->Get(2);//duedate:±â°£ NodeName = AttrNode->GetNodeName(); NodeText = AttrNode->Text; due_date = NodeText.ToInt(); if (due_date == 0) Repair_Agreement = false; else Repair_Agreement = true; } //postÇÑ ¹öÀü°ú ºñ±³ÇÏ¿© °°Àº ¹öÀü¿¡¼­ ÃֽйöÀüÀ» ¸®ÅÏ //post version: 10.0.0.21, update version: 10.0.0.55ÀÏ °æ¿ì //10.0.0.55 ¸®ÅÏ else if (NodeName == "newest-version") { AttrNode = ChildNode->GetAttributeNodes()->Get(0);//0:valid=true NodeName = AttrNode->GetNodeName(); NodeText = AttrNode->Text; AttrNode = ChildNode->GetAttributeNodes()->Get(1);//1:version=10.0.0.21 NodeName = AttrNode->GetNodeName(); Newest_Version = AttrNode->Text; swscanf(Newest_Version.c_str(), L"%d.%d.%d.%d", &_newest_version[0], &_newest_version[1], &_newest_version[2], &_newest_version[3]); if (Version == Newest_Version || NodeText == "FALSE") { Info_Content->Clear(); if (Language == "Korean") { Info_Content->Add("ÇöÀç ÃֽйöÀüÀÔ´Ï´Ù."); Info_Content->Add("\r"); Info_Content->Add("Update ÇÏ½Ç Çʿ䰡 ¾ø½À´Ï´Ù."); } else { Info_Content->Add("It is the last version."); Info_Content->Add("\r"); Info_Content->Add("You don't have to upate the program."); } goto fail; } if (_newest_version[0] > _version[0] || _newest_version[1] > _version[1]) { bNew_Version = true; } else bNew_Version = false; } //postÇÑ ¹öÀü¿¡¼­ °¡Àå ¸¶Áö¸·¿¡ ¿Ã·ÁÁø ¹öÀüÀ» ¸®ÅÏ //post version: 11.0.0.0, update version: 10.0.0.55ÀÏ °æ¿ì false ¸®ÅÏ //11.0.0.0 ¹öÀü Áß¿¡ ÃÖ±Ù ¿Ã·ÁÁø ¹öÀüÀÌ ¾ø±â ¶§¹®¿¡ false ¸®ÅÏÇÑ´Ù. else if (NodeName == "last-version") { AttrNode = ChildNode->GetAttributeNodes()->Get(0);//0:valid=true NodeName = AttrNode->GetNodeName(); NodeText = AttrNode->Text; AttrNode = ChildNode->GetAttributeNodes()->Get(1);//1:version=10.0.0.21 NodeName = AttrNode->GetNodeName(); Last_Version = AttrNode->Text; swscanf(Last_Version.c_str(), L"%d.%d.%d.%d", &_last_version[0], &_last_version[1], &_last_version[2], &_last_version[3]); if (Version == Last_Version || NodeText == "FALSE") { Info_Content->Clear(); if (Language == "Korean") { Info_Content->Add("ÇöÀç ÃֽйöÀüÀÔ´Ï´Ù."); Info_Content->Add("\r"); Info_Content->Add("Update ÇÏ½Ç Çʿ䰡 ¾ø½À´Ï´Ù."); } else { Info_Content->Add("It is the last version."); Info_Content->Add("\r"); Info_Content->Add("You don't have to upate the program."); } goto fail; } NodeText = ChildNode->ChildNodes->Nodes[0]->Text; Info_Content->Clear(); if (Language == "Korean") { temp_string = "¼­¹ö¿¡ " + Program.UpperCase() + " " + Last_Version + " Update ÆÄÀÏÀÌ Á¸ÀçÇÕ´Ï´Ù."; Info_Content->Add(temp_string); Info_Content->Add("\r"); Info_Content->Add("¼öÁ¤ ³»¿ëÀº ¾Æ·¡¿Í °°½À´Ï´Ù."); temp_string = "-----------------------------------------------------------------------------------------------"; Info_Content->Add(temp_string); temp_string = ""; for (int j = 0; j < NodeText.Length(); j++) { if (NodeText.c_str()[j] == '\n') { Info_Content->Add(temp_string); temp_string = ""; continue; } temp_string += NodeText.c_str()[j]; } if (temp_string.Length() > 0) { Info_Content->Add(temp_string); } //Info_Content->Add(NodeText); temp_string = "-----------------------------------------------------------------------------------------------"; Info_Content->Add(temp_string); Info_Content->Add("\r"); Info_Content->Add("Update¸¦ ÇϽñâ À§Çؼ­´Â \"µ¿ÀÇÇÔ\"¸¦ ¼±ÅÃÇϽðí"); Info_Content->Add("\r"); Info_Content->Add("\"Next\"¹öưÀ» Ŭ¸¯Çϼ¼¿ä."); } else { temp_string = "You have to download files for the update from server."; Info_Content->Add("\r"); Info_Content->Add("Click \"Agree\" checkbox and push \"Next\" button"); Info_Content->Add("\r"); Info_Content->Add("for next step."); } } else if (NodeName == "update") { AttrNode = ChildNode->GetAttributeNodes()->Get(0);//0:valid=true NodeName = AttrNode->GetNodeName(); NodeText = AttrNode->Text; Download_URL_List->Clear(); if (NodeText == "TRUE") { for (int j = 0; j < ChildNode->ChildNodes->Count; j++) { FileNode = ChildNode->ChildNodes->Nodes[j]; NodeName = FileNode->GetNodeName(); if (NodeName == "file") { AttrNode = FileNode->GetAttributeNodes()->Get(0);//path:download file path NodeText = AttrNode->Text; Download_URL_List->Add(NodeText); } } } else { Info_Content->Clear(); if (Language == "Korean") { Info_Content->Add("ÇöÀç ÃֽйöÀüÀÔ´Ï´Ù."); Info_Content->Add("\r"); Info_Content->Add("Update ÇÏ½Ç Çʿ䰡 ¾ø½À´Ï´Ù."); } else { Info_Content->Add("It is the last version."); Info_Content->Add("\r"); Info_Content->Add("You don't have to upate the program."); } goto fail; } } } //XMLDoc->SaveToFile(program_path + "\\update.xml"); XMLDoc->Active = false; return true; fail: return false; } //--------------------------------------------------------------------------- bool __fastcall TMainForm::Download_Files_From_Server() { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; THttpControl *httpControl = new THttpControl; String path, url, save_path, temp_string; url = "http://www.texclub.com/auto_update/TexPro" + Version.SubString(1,4); int current_file_num, Process_Percent; String Downloaded_Path = AutoUpdateBin + "\\" + Program + "\\"; Process_Percent = 100 / Download_URL_List->Count; for (int i = 0; i < Download_URL_List->Count; i++) { path = Download_URL_List->Strings[i]; save_path = MakeDirectory(path, Downloaded_Path); current_file_num = i+1; if (Language == "Korean") { temp_string = "´Ù¿î·Îµå ÆÄÀÏ " + IntToStr(current_file_num) + " / " + IntToStr(Download_URL_List->Count); } else { temp_string = "Downloading file " + IntToStr(current_file_num) + " / " + IntToStr(Download_URL_List->Count); } pMemo->Lines->Strings[2] = temp_string; if (!httpControl->HTTPDown((url+path).c_str(), save_path.c_str(), (void*)pProgressBar, Process_Percent)) { goto fail; } } pProgressBar->Percent = 100; delete httpControl; Info_Content->Clear(); if (Language == "Korean") { temp_string = "Update¸¦ Çϱâ À§Çؼ­ " + IntToStr(Download_URL_List->Count) + "°³ÀÇ ÆÄÀÏÀ» ¸ðµÎ ´Ù¿î ¹Þ¾Ò½À´Ï´Ù."; Info_Content->Add(temp_string); Info_Content->Add("\r"); Info_Content->Add("\"Next\"¹öưÀ» ´©¸£½Ã¸é Update°¡ ÁøÇàµË´Ï´Ù."); } else { Info_Content->Add("Downloading is finished."); Info_Content->Add("\r"); Info_Content->Add("Click \"Next\" button. Update is going to progress."); } pMemo->Clear(); pMemo->Lines = Info_Content; Screen->Cursor = cur; return true; fail: Info_Content->Clear(); if (Language == "Korean") { temp_string = "´Ù¿î·Îµå ÆÄÀÏ " + IntToStr(current_file_num) + " / " + IntToStr(Download_URL_List->Count) + " ´Ù¿î·Îµå µÇÁö ¾Ê¾Ò½À´Ï´Ù."; Info_Content->Add(temp_string); Info_Content->Add("\r"); Info_Content->Add("ÆÄÀÏ ´Ù¿î·Îµå¸¦ ½ÇÆÐ ÇÏ¿´½À´Ï´Ù."); Info_Content->Add("\r"); Info_Content->Add("\"Retry\"¹öưÀ» ´­·¯ ´Ù½Ã ½Ãµµ ÇϽʽÿä."); Info_Content->Add("\r"); Info_Content->Add("´Ù¿î·Îµå°¡ °è¼Ó ½ÇÆÐÇÏ¸é ´ã´çÀÚ ¶Ç´Â (ÁÖ)¿µ¿ì¾¾¿£¾ÆÀÌ·Î"); Info_Content->Add("\r"); Info_Content->Add("¹®ÀÇ ÇϽñ⠹ٶø´Ï´Ù."); } else { Info_Content->Add("File download failed."); Info_Content->Add("\r"); Info_Content->Add("Click \"Retry\" button. Try again, please."); Info_Content->Add("\r"); Info_Content->Add("If file download fails again, contact YoungWoo CNI."); } pMemo->Clear(); pMemo->Lines = Info_Content; pNextBtn->Caption = "Retry"; Step = AGREE_MODE; pProgressBar->Percent = 0; pNextBtn->SetFocus(); Screen->Cursor = cur; return false; } //--------------------------------------------------------------------------- void __fastcall TMainForm::Updata_Info_Box() { String temp_string; switch(Step) { case INIT_MODE: case CHECK_MODE: InfoMemo->Clear(); InfoMemo->Lines = Info_Content; break; case AGREE_MODE: Info_Content->Clear(); if (Language == "Korean") { temp_string = "Update¸¦ Çϱâ À§Çؼ­ " + IntToStr(Download_URL_List->Count) + "°³ÀÇ ÆÄÀÏÀ» ´Ù¿î ¹Þ¾Æ¾ß ÇÕ´Ï´Ù."; Info_Content->Add(temp_string); Info_Content->Add("\r"); Info_Content->Add("\"Next\" ¹öưÀ» ´©¸£½Ã¸é ÆÄÀÏ ´Ù¿î·Îµå°¡ ÁøÇàµË´Ï´Ù."); } else { temp_string = "You have to download " + IntToStr(Download_URL_List->Count) + " files."; Info_Content->Add(temp_string); Info_Content->Add("\r"); Info_Content->Add("Push \"Next\" button."); } pMemo->Clear(); pMemo->Lines = Info_Content; break; case DOWNLOAD_MODE: Info_Content->Clear(); if (Language == "Korean") { Info_Content->Add("ÆÄÀÏ ´Ù¿î·Îµå°¡ ÁøÇàÁßÀÔ´Ï´Ù. Àá½Ã ±â´Ù¸®½Ê½Ã¿ä."); Info_Content->Add("\r"); temp_string = "´Ù¿î·Îµå ÆÄÀÏ 1 / " + IntToStr(Download_URL_List->Count); Info_Content->Add(temp_string); } else { Info_Content->Add("Files are downloading. Please, wait some minutes."); Info_Content->Add("\r"); temp_string = "Downloading file 1 / " + IntToStr(Download_URL_List->Count); } pMemo->Clear(); pMemo->Lines = Info_Content; break; case UPDATE_MODE: Info_Content->Clear(); if (Language == "Korean") { Info_Content->Add("Update°¡ ÁøÇàÁßÀÔ´Ï´Ù. Àá½Ã ±â´Ù¸®½Ê½Ã¿ä."); Info_Content->Add("\r"); temp_string = "Update ÆÄÀÏ 1 / " + IntToStr(Download_URL_List->Count); Info_Content->Add(temp_string); } else { Info_Content->Add("Update on progress. Please, wait some minutes."); Info_Content->Add("\r"); temp_string = "Update file 1 / " + IntToStr(Download_URL_List->Count); } pMemo->Clear(); pMemo->Lines = Info_Content; break; case NONE_MODE: MainPanel->BringToFront(); InfoMemo->Clear(); if (Language == "Korean") { InfoMemo->Lines->Add("Update¸¦ ¼º°øÀûÀ¸·Î ³¡³Â½À´Ï´Ù."); //if (due_date >= 0 && due_date <=30) { if (due_date > 0) { InfoMemo->Lines->Add("\r"); temp_string = "Á¤ºñ ¹«»ó±â°£ÀÌ " + IntToStr(due_date) + "³²¾Ò½À´Ï´Ù."; InfoMemo->Lines->Add(temp_string); AgreeCkBox->Visible = true; AgreeCkBox->Checked = true; AgreeCkBox->Caption = "Á¤ºñ°è¾à½Ã ƯÇý Á¤º¸ º¸±â"; } if (bNew_Version) { InfoMemo->Lines->Add("\r"); temp_string = "»õ·Î¿î ÇÁ·Î±×·¥ ¹öÀü " + Newest_Version + "ÀÌ Ãâ½Ã µÇ¾ú½À´Ï´Ù."; InfoMemo->Lines->Add(temp_string); InfoMemo->Lines->Add("\r"); InfoMemo->Lines->Add("´ã´çÀÚ ¶Ç´Â (ÁÖ)¿µ¿ì¾¾¿£¾ÆÀÌ·Î ¹®ÀÇ ÇϽñ⠹ٶø´Ï´Ù."); } } else { InfoMemo->Lines->Add("Update is successful."); //if (due_date >= 0 && due_date <=30) { if (due_date > 0) { InfoMemo->Lines->Add("\r"); temp_string = "Free maintenance contract remains " + IntToStr(due_date) + " days."; InfoMemo->Lines->Add(temp_string); AgreeCkBox->Visible = true; AgreeCkBox->Checked = true; AgreeCkBox->Caption = "View special information for maintenance contract"; } } mNextBtn->Visible = false; if (Language == "Korean") { mCancelBtn->Caption = "Á¾·á"; } else { mCancelBtn->Caption = "Finish"; } mCancelBtn->SetFocus(); break; } } //---------------------------------------------------------------------------