Всем добрый вечер. Решил выложить свой исходник Updater.
Вот ссылка: [Ссылки могут видеть только зарегистрированные пользователи. ]
Скрин: [Ссылки могут видеть только зарегистрированные пользователи. ]
ВТ: [Ссылки могут видеть только зарегистрированные пользователи. ]
Вряд ли, ты сначала пишешь, что это легко, а потом перебрасываешь дело на своего знакомого, выдав отмазку школьника, типа ты не на пк, а пишешь ты с калькулятора?
System.Net.WebClient webClient = new System.Net.WebClient();
Uri uri = new Uri("Ссылка на вх");//Ссылка на WallHack
webClient.DownloadFileAsync(uri, @"dxhook.dll");//Под каким именем сохраняем например : Game.dll или dxhook.dll
if (progressBar1.Value == progressBar1.Minimum)
{
progressBar1.Value = progressBar1.Maximum;
}
MessageBox.Show("Успешно!");
Опять бредо-код.
________________
We are Ducks. We are birds. We like bread. We cryack. Cryack.
System.Net.WebClient webClient = new System.Net.WebClient();
Uri uri = new Uri("Ссылка на файл!");
webClient.DownloadFileAsync(uri, @"Имя файла!");
if (progressBar1.Value == progressBar1.Minimum)
{
progressBar1.Value = progressBar1.Maximum;
}
MessageBox.Show("Скачано");
System.Net.WebClient webClient = new System.Net.WebClient();
Uri uri = new Uri("Ссылка на вх");//Ссылка на WallHack
webClient.DownloadFileAsync(uri, @"dxhook.dll");//Под каким именем сохраняем например : Game.dll или dxhook.dll
if (progressBar1.Value == progressBar1.Minimum)
{
progressBar1.Value = progressBar1.Maximum;
}
MessageBox.Show("Успешно!");
Опять бредо-код.
Чем тебя не устраивает данный код?
У меня на подобном уже давно апдейтер для збт сервера крутится
Код:
static void Main(string[] args)
{
try
{
WebClient wb = new WebClient();
// Versions //
Console.WriteLine("Checking Files... Please wait...");
///////// URLS /////
string data_url = "https://dl.dropboxusercontent.com/u/33968340/SkyDev/update_test/data.7z";
string pck_url = "https://dl.dropboxusercontent.com/u/33968340/SkyDev/update_test/pck.list";
string main_pck_url = "https://dl.dropboxusercontent.com/u/33968340/SkyDev/update_test/";
//string data_url = "http://91.212.124.130/update/data.7z";
//string pck_url = "http://91.212.124.130/update/pck.list";
//string main_pck_url = "http://91.212.124.130/update/";
///////////////////
if (!File.Exists("data.list")) File.AppendAllText("data.list", "0");
if (!File.Exists("pck.list")) File.AppendAllText("pck.list", "0");
if (!File.Exists("..//element//7za.exe")) wb.DownloadFile("https://dl.dropboxusercontent.com/u/33968340/SkyDev/update_test/7za.exe", "..//element//7za.exe");
if (!File.Exists("..//element//data//7za.exe")) wb.DownloadFile("https://dl.dropboxusercontent.com/u/33968340/SkyDev/update_test/7za.exe", "..//element//data//7za.exe");
if (!File.Exists("..//element//sPCK.exe")) wb.DownloadFile("https://dl.dropboxusercontent.com/u/33968340/SkyDev/update_test/sPCK.exe", "..//element//sPCK.exe");
string current_data_version = File.ReadAllText("data.list");
int current_pck_version = Int32.Parse(File.ReadAllText("pck.list"));
string current_dir = Directory.GetCurrentDirectory();
Console.WriteLine("Files Checked Successfully");
///////////// Delete .7.z and old files //////
string[] file_7z_list = new string[Directory.GetFiles("..//element//", "*.7z").Count()];
string[] files_7z = Directory.GetFiles("..//element//", "*.7z");
string[] directory_pck_files = new string[Directory.GetDirectories("..//element//", "*.pck.files").Count()];
string[] directory_files = Directory.GetDirectories("..//element//", "*.pck.files");
Console.WriteLine("Unpacked archives (*.pck.files) count : " + directory_pck_files.Count());
Console.WriteLine("Count of *.7za archives " + file_7z_list.Count());
foreach (string f in files_7z) File.Delete(f);
foreach (string f in directory_files)
{
Console.WriteLine(f.Replace("..//element//", ""));
Directory.Delete(f, true);
}
/////////// End of Delete /////////////
///////////////////
wb.OpenRead(data_url);
string server_data_version = wb.ResponseHeaders["ETag"];
Console.WriteLine("Server Checksum : " + server_data_version);
Console.WriteLine("Client Checksum : " + current_data_version);
/// Checking Data //
if (current_data_version != server_data_version)
{
string size = wb.ResponseHeaders["Content-Length"];
float size_i = (long.Parse(size) / 1024f) / 1024f;
Console.WriteLine("Donwloading Data Update... " + Math.Round(size_i, 2) + " MB");
Directory.SetCurrentDirectory("..//element//data");
wb.DownloadFile(data_url, "update.7z");
///////////////////////
//////UnPacking ///////
///////////////////////
ProcessStartInfo pi = new ProcessStartInfo();
pi.FileName = "7za.exe";
pi.UseShellExecute = false;
pi.CreateNoWindow = true;
pi.Arguments = "x -y update.7z";
Process.Start(pi).WaitForExit();
File.Delete("update.7z");
////////////////////////
////////////////////////
Directory.SetCurrentDirectory(current_dir);
/// Downloading Files //
File.Delete("data.list");
File.AppendAllText("data.list", server_data_version);
}
/////////////////////
///// Checking data.list //////
int server_pck_version = Int32.Parse(wb.DownloadString(pck_url));
if (current_pck_version != server_pck_version)
{
for (int z = current_pck_version; z < server_pck_version; z++)
{
Directory.SetCurrentDirectory("..//element//");
string size = wb.ResponseHeaders["Content-Length"];
float size_i = (long.Parse(size) / 1024f) / 1024f;
Console.WriteLine("Downloading Patch (pck) : " + (z + 1) + Math.Round(size_i, 2) + " MB");
wb.DownloadFile(main_pck_url + (z + 1) + ".7z", (z + 1) + ".7z");
Console.WriteLine("Unpacking Patch (pck) : " + (z + 1) + ".7z");
///////////////////////
//////UnPacking .7z///////
///////////////////////
ProcessStartInfo pi = new ProcessStartInfo();
pi.FileName = "7za.exe";
pi.UseShellExecute = false;
pi.CreateNoWindow = true;
pi.Arguments = "x -y " + (z + 1) + ".7z";
Process.Start(pi).WaitForExit();
File.Delete((z + 1) + ".7z");
Directory.SetCurrentDirectory(current_dir);
////////////////////////
}
//// Getting new list of pck.files ////
string[] new_directory_pck_files = new string[Directory.GetDirectories("..//element//", "*.pck.files").Count()];
string[] new_directory_files = Directory.GetDirectories("..//element//", "*.pck.files");
foreach (string f in new_directory_files)
{
Directory.SetCurrentDirectory("..//element//");
ProcessStartInfo pi = new ProcessStartInfo();
pi.FileName = "sPCK.exe";
pi.UseShellExecute = false;
pi.CreateNoWindow = true;
Console.WriteLine("Adding files to " + f.Replace("..//element//", ""));
pi.Arguments = "-pw -a " + f.Replace("..//element//", "");
Process.Start(pi).WaitForExit();
Directory.Delete(f.Replace("..//element//", ""), true);
}
Directory.SetCurrentDirectory(current_dir);
File.Delete("pck.list");
File.AppendAllText("pck.list", server_pck_version.ToString());
}
Console.WriteLine("Completed");
/// Starting PW ///
Directory.SetCurrentDirectory("..//element//");
// Process.Start("elementclient.exe", " game:cpw");
Console.ReadKey();
}
catch (Exception e)
{
Console.WriteLine(e);
Console.ReadKey();
}
}
________________
[Ссылки могут видеть только зарегистрированные пользователи. ]