Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!



   1253

C# Updater/Project File Downloader (Please like!!!)

by sfouh123asdA - 13 August, 2021 - 04:50 AM
This post is by a banned member (sfouh123asdA) - Unhide
835
Posts
106
Threads
4 Years of service
#1
(This post was last modified: 13 August, 2021 - 04:50 AM by sfouh123asdA. Edited 1 time in total.)
Don't forget to like the post, don't just leech! Thank you very much!!
Code:
using System;
using System.Drawing;
using Console = Colorful.Console;
using System.Net;
using System.Diagnostics;
using System.IO;

namespace Volt_Updater
{
    class Program
    {

        static void Main(string[] args)
        {
            Console.Title = "<PROJECT NAME> - Updater";
            Title();
            Console.Write("\n > [", Color.White);
            Console.Write("1", ColorTranslator.FromHtml("#3BB9EB"));
            Console.Write("]", Color.White);
            Console.Write(" Download Files", ColorTranslator.FromHtml("#F9F9F9"));
            Console.Write("\n > [", Color.White);
            Console.Write("2", ColorTranslator.FromHtml("#3BB9EB"));
            Console.Write("]", Color.White);
            Console.Write(" Update <PROJECT NAME>}", ColorTranslator.FromHtml("#F9F9F9"));
            Console.Write("\n > [", Color.White);
            Console.Write("3", ColorTranslator.FromHtml("#3BB9EB"));
            Console.Write("]", Color.White);
            Console.Write(" Exit\n\n", ColorTranslator.FromHtml("#F9F9F9"));
            Console.Write(" Choose an option: ", ColorTranslator.FromHtml("#F9F9F9"));
            string update = Console.ReadLine();

            if (update.Contains("1"))
            {
                WebClient downloadupdater = new WebClient();
                Console.Clear(); 
                downloadupdater.DownloadFile("http://yourdomain.wtf/Files/Latest/ProjectName.exe", "ProjectName.exe"); //Just replace the end of the link with the file name & then change the 2nd part over to the file name
                downloadupdater.DownloadFile("http://yourdomain.wtf/Files/Latest/ProjectName.exe", "ProjectName.exe");
                downloadupdater.DownloadFile("http://yourdomain.wtf/Files/Latest/ProjectName.exe", "ProjectName.exe");
                downloadupdater.DownloadFile("http://yourdomain.wtf/Files/Latest/ProjectName.exe", "ProjectName.exe");
                downloadupdater.DownloadFile("http://yourdomain.wtf/Files/Latest/ProjectName.exe", "ProjectName.exe");
                
                Console.Clear();
                Console.WriteLine("All files are downloaded, enjoy <PROJECT NAME>!", ColorTranslator.FromHtml("#3BB9EB"));
                Console.ReadLine();
            }
            if (update.Contains("2"))
            {
                WebClient downloadupadate = new WebClient();
                string file = "<PROJECT NAME>.exe";
                Console.WriteLine("Deleting old <PROJECT NAME>.exe! [PRESS ENTER]", ColorTranslator.FromHtml("#3BB9EB"));
                File.Delete(Path.Combine(file));
                Console.ReadKey();
                Console.Clear();
                Console.WriteLine("Download update.....");
                downloadupadate.DownloadFile("http://yourdomain.wtf/Files/Latest/ProjectName.exe", "<Project Name>.exe"); //Update just .exe
            }
            if (update.Contains("3"))
            {
                Environment.Exit(0);
            }
        }
        public static void Title()
        {
//Change ASCII if you please.
            Console.WriteLine(" ", ColorTranslator.FromHtml("#FD0000"));
            Console.WriteLine("██╗   ██╗ ██████╗ ██╗  ████████╗", ColorTranslator.FromHtml("#3BB9EB"));
            Console.WriteLine("██║   ██║██╔═══██╗██║  ╚══██╔══╝", ColorTranslator.FromHtml("#3BB9EB"));
            Console.WriteLine("██║   ██║██║   ██║██║     ██║   ", ColorTranslator.FromHtml("#3BB9EB"));
            Console.WriteLine("╚██╗ ██╔╝██║   ██║██║     ██║   ", ColorTranslator.FromHtml("#3BB9EB"));
            Console.WriteLine(" ╚████╔╝ ╚██████╔╝███████╗██║   ", ColorTranslator.FromHtml("#3BB9EB"));
            Console.WriteLine("  ╚═══╝   ╚═════╝ ╚══════╝╚═╝", ColorTranslator.FromHtml("#3BB9EB"));
            Console.WriteLine(" ", ColorTranslator.FromHtml("#FD0000"));
        }
//This will close the program if the user running it has HTTP Debugger Pro installed (Doesn't matter if it's running or not. You can gladly add more to this, I don't care too.
        public static void debugger()
        {
            if (Process.GetProcessesByName("httpdebuggerpro").Length > 1)
            {
                System.Environment.Exit(0);
            }
        }
    }
This post is by a banned member (bold) - Unhide
This post is by a banned member (sfouh123asdA) - Unhide
835
Posts
106
Threads
4 Years of service
#3
(25 August, 2021 - 02:25 AM)Juury Wrote: Show More
You can make an auto updater if you make a string called version and set it as the current version ex: V1.0 // 1.0 and then make a pastebin or on ur own site a blank page that contains the newest version ex: V2.0 // 2.0 then on the main loop do if (version == newest) and download ur shit, also obviously download the string using a webclient or wtv. Remember to set the new version to the last exe string.

I know, I just did a more simple type of updater. I will build an auto-updater when ever I get the time.
This post is by a banned member (sfouh123asdA) - Unhide
835
Posts
106
Threads
4 Years of service
#4
This is a bump

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 1 Guest(s)