#include #include "functions.h" #include "stdafx.h" #include "AboutForm.h" #pragma once namespace L2ZeusUpdater { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace System::Net; using namespace std; /// /// Summary for Form1 /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// /// Clean up any resources being used. /// ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::Button^ launch; private: System::Windows::Forms::Button^ update; private: System::Windows::Forms::Button^ web; private: System::Windows::Forms::Label^ label1; private: System::Windows::Forms::Label^ howto; private: System::Windows::Forms::PictureBox^ pictureBox1; private: System::Windows::Forms::Label^ aboutclick; private: System::ComponentModel::IContainer^ components; protected: protected: private: /// /// Required designer variable. /// #pragma region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// void InitializeComponent(void) { System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid)); this->launch = (gcnew System::Windows::Forms::Button()); this->update = (gcnew System::Windows::Forms::Button()); this->web = (gcnew System::Windows::Forms::Button()); this->label1 = (gcnew System::Windows::Forms::Label()); this->howto = (gcnew System::Windows::Forms::Label()); this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox()); this->aboutclick = (gcnew System::Windows::Forms::Label()); (cli::safe_cast(this->pictureBox1))->BeginInit(); this->SuspendLayout(); // // launch // this->launch->BackColor = System::Drawing::SystemColors::ButtonShadow; this->launch->Cursor = System::Windows::Forms::Cursors::Default; this->launch->FlatAppearance->BorderColor = System::Drawing::Color::Black; this->launch->FlatAppearance->MouseDownBackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(224)), static_cast(static_cast(224)), static_cast(static_cast(224))); this->launch->FlatAppearance->MouseOverBackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(192)), static_cast(static_cast(0)), static_cast(static_cast(0))); this->launch->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->launch->Font = (gcnew System::Drawing::Font(L"Calibri", 8, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, static_cast(0))); this->launch->Location = System::Drawing::Point(12, 60); this->launch->Name = L"launch"; this->launch->Size = System::Drawing::Size(75, 23); this->launch->TabIndex = 0; this->launch->Text = L"Play Game"; this->launch->UseVisualStyleBackColor = false; this->launch->Click += gcnew System::EventHandler(this, &Form1::button1_Click); // // update // this->update->BackColor = System::Drawing::SystemColors::ButtonShadow; this->update->FlatAppearance->BorderColor = System::Drawing::Color::Black; this->update->FlatAppearance->MouseDownBackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(224)), static_cast(static_cast(224)), static_cast(static_cast(224))); this->update->FlatAppearance->MouseOverBackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(192)), static_cast(static_cast(0)), static_cast(static_cast(0))); this->update->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->update->Font = (gcnew System::Drawing::Font(L"Calibri", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, static_cast(0))); this->update->Location = System::Drawing::Point(93, 60); this->update->Name = L"update"; this->update->Size = System::Drawing::Size(75, 23); this->update->TabIndex = 1; this->update->Text = L"Update IP"; this->update->UseVisualStyleBackColor = false; this->update->Click += gcnew System::EventHandler(this, &Form1::button2_Click); // // web // this->web->BackColor = System::Drawing::SystemColors::ButtonShadow; this->web->Cursor = System::Windows::Forms::Cursors::Default; this->web->FlatAppearance->BorderColor = System::Drawing::Color::Black; this->web->FlatAppearance->MouseDownBackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(224)), static_cast(static_cast(224)), static_cast(static_cast(224))); this->web->FlatAppearance->MouseOverBackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(192)), static_cast(static_cast(0)), static_cast(static_cast(0))); this->web->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->web->Font = (gcnew System::Drawing::Font(L"Calibri", 8, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, static_cast(0))); this->web->Location = System::Drawing::Point(174, 60); this->web->Name = L"web"; this->web->Size = System::Drawing::Size(75, 23); this->web->TabIndex = 2; this->web->Text = L"L][Zeus Web"; this->web->UseVisualStyleBackColor = false; this->web->Click += gcnew System::EventHandler(this, &Form1::web_Click); // // label1 // this->label1->AutoSize = true; this->label1->BackColor = System::Drawing::Color::Transparent; this->label1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; this->label1->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->label1->Font = (gcnew System::Drawing::Font(L"Trebuchet MS", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, static_cast(0))); this->label1->ForeColor = System::Drawing::SystemColors::ButtonFace; this->label1->Location = System::Drawing::Point(9, 9); this->label1->Name = L"label1"; this->label1->RightToLeft = System::Windows::Forms::RightToLeft::No; this->label1->Size = System::Drawing::Size(201, 18); this->label1->TabIndex = 3; this->label1->Text = L"Lineage || Zeus Updater by AresXP"; this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click); // // howto // this->howto->AutoSize = true; this->howto->BackColor = System::Drawing::Color::Transparent; this->howto->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; this->howto->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->howto->Font = (gcnew System::Drawing::Font(L"Trebuchet MS", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, static_cast(0))); this->howto->ForeColor = System::Drawing::SystemColors::ButtonFace; this->howto->Location = System::Drawing::Point(9, 26); this->howto->Name = L"howto"; this->howto->RightToLeft = System::Windows::Forms::RightToLeft::No; this->howto->Size = System::Drawing::Size(138, 18); this->howto->TabIndex = 4; this->howto->Text = L"How to use the updater"; this->howto->Click += gcnew System::EventHandler(this, &Form1::howto_Click); // // pictureBox1 // this->pictureBox1->BackColor = System::Drawing::Color::Transparent; this->pictureBox1->Image = (cli::safe_cast(resources->GetObject(L"pictureBox1.Image"))); this->pictureBox1->Location = System::Drawing::Point(328, 13); this->pictureBox1->Name = L"pictureBox1"; this->pictureBox1->Size = System::Drawing::Size(35, 31); this->pictureBox1->TabIndex = 5; this->pictureBox1->TabStop = false; this->pictureBox1->MouseEnter += gcnew System::EventHandler(this, &Form1::pictureBox1_MouseEnter); // // aboutclick // this->aboutclick->AutoSize = true; this->aboutclick->BackColor = System::Drawing::Color::Transparent; this->aboutclick->ForeColor = System::Drawing::Color::White; this->aboutclick->Location = System::Drawing::Point(325, 18); this->aboutclick->MinimumSize = System::Drawing::Size(20, 30); this->aboutclick->Name = L"aboutclick"; this->aboutclick->Size = System::Drawing::Size(34, 30); this->aboutclick->TabIndex = 6; this->aboutclick->Text = L"Click!"; this->aboutclick->TextAlign = System::Drawing::ContentAlignment::MiddleCenter; this->aboutclick->Visible = false; this->aboutclick->MouseLeave += gcnew System::EventHandler(this, &Form1::aboutclick_MouseLeave); this->aboutclick->Click += gcnew System::EventHandler(this, &Form1::aboutclick_Click); // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->BackgroundImage = (cli::safe_cast(resources->GetObject(L"$this.BackgroundImage"))); this->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Center; this->ClientSize = System::Drawing::Size(375, 99); this->Controls->Add(this->aboutclick); this->Controls->Add(this->pictureBox1); this->Controls->Add(this->howto); this->Controls->Add(this->label1); this->Controls->Add(this->web); this->Controls->Add(this->update); this->Controls->Add(this->launch); this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedSingle; this->Icon = (cli::safe_cast(resources->GetObject(L"$this.Icon"))); this->Name = L"Form1"; this->Opacity = 0.9; this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen; this->Text = L"L][Zeus Updater"; (cli::safe_cast(this->pictureBox1))->EndInit(); this->ResumeLayout(false); this->PerformLayout(); } #pragma endregion private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { //normal fstream l2; l2.open("system/L2.exe", ios::in|ios::binary); fstream l2_default; l2_default.open("C:\\Program Files\\Lineage II\\system\\L2.exe", ios::in|ios::binary); if(l2.is_open()) { WinExec("system/L2.exe", SW_SHOWNORMAL); l2.close(); Application::Exit(); } else if(l2_default.is_open()) { WinExec("C:\\Program Files\\Lineage II\\system\\L2.exe", SW_SHOWNORMAL); l2_default.close(); Application::Exit(); } else { MessageBox::Show("L2.exe not found! Make sure you put this application\nin your Lineage 2 install directory.", "Failure"); } } private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) { //ip System::Net::IPHostEntry^ ip = System::Net::Dns::GetHostEntry("www.leaked.ca"); string s_ip; To_string(ip->AddressList[0]->ToString(), s_ip); char* windir = getenv("windir"); string _windir = string(windir); string _hosts = _windir+"\\system32\\drivers\\etc\\hosts"; string _backup = _hosts+".bak"; string _original = _hosts+".original"; /* Check If Original Exists */ fstream check; check.open(_original.c_str(), ios::in); if(check.is_open()) { check.close(); copyFile(_hosts, _backup); /* Update... */ ifstream check_hosts(_hosts.c_str()); string in1; check_hosts >> in1; if(in1.find(s_ip)) { MessageBox::Show("Already up-to-date!", "Success"); } else { ofstream update1(_hosts.c_str()); if(update1.is_open()) { update1 << "#------------------\n"; update1 << "#-www.l2-zeus.com-\n"; update1 << "#------------------\n"; update1 << "127.0.0.1 localhost\n"; update1 << s_ip+" l2authd.lineage2.com\n"; update1 << s_ip+" l2testauthd.lineage2.com\n"; update1.close(); } MessageBox::Show("hosts.original already exists\nCopying to hosts.bak\nIP Updated.", "Success"); } } else { check.close(); copyFile(_hosts, _original); /* Update... */ ofstream update2(_hosts.c_str()); if(update2.is_open()) { update2 << "#------------------\n"; update2 << "#-www.l2-zeus.com-\n"; update2 << "#------------------\n"; update2 << "127.0.0.1 localhost\n"; update2 << s_ip+" l2authd.lineage2.com\n"; update2 << s_ip+" l2testauthd.lineage2.com\n"; update2.close(); } MessageBox::Show("hosts copied to hosts.original\nIP Updated.", "Success"); } this->update->Hide(); //move the L2Zeus Web button to update's spot... this->web->Location = System::Drawing::Point(93, 60); } private: System::Void web_Click(System::Object^ sender, System::EventArgs^ e) { System::Diagnostics::Process::Start("http://www.l2-zeus.com"); this->web->Text = L"Again!"; } private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) { MessageBox::Show("Did you know you could trade 500m adena for one gold bar on L][Zeus?\nZeus lives in Canada\nThis program was coded in MS Visual C++ 2005", "Little tip..."); } private: System::Void howto_Click(System::Object^ sender, System::EventArgs^ e) { MessageBox::Show("Click \"Update IP\" to update your hosts file to the latest IP if it ever changes,\nthen click Play Game :)", "How To...."); } private: System::Void aboutclick_Click(System::Object^ sender, System::EventArgs^ e) { AboutForm^ about = gcnew AboutForm(); about->Show(); } private: System::Void pictureBox1_MouseEnter(System::Object^ sender, System::EventArgs^ e) { this->pictureBox1->Hide(); this->aboutclick->Show(); } private: System::Void aboutclick_MouseLeave(System::Object^ sender, System::EventArgs^ e) { this->aboutclick->Hide(); this->pictureBox1->Show(); } }; }