Пример #1
0
        static void ProcessStartsWithClient()
        {
            Console.Clear();
            Console.Title = "Custom Copy Server";

            Console.WriteLine(@"  _____                 _                            _____                         ");
            Console.WriteLine(@" / ____|               | |                          / ____|                        ");
            Console.WriteLine(@"| |       _   _   ___  | |_    ___    _ __ ___     | |        ___    _ __    _   _ ");
            Console.WriteLine(@"| |      | | | | / __| | __|  / _ \  | '_ ` _ \    | |       / _ \  | '_ \  | | | |");
            Console.WriteLine(@"| |____  | |_| | \__ \ | |_  | (_) | | | | | | |   | |____  | (_) | | |_) | | |_| |");
            Console.WriteLine(@" \_____|  \__,_| |___/  \__|  \___/  |_| |_| |_|    \_____|  \___/  | .__/   \__, |");
            Console.WriteLine(@"                                                                    | |       __/ |");
            Console.WriteLine(@"                                                                    |_|      |___/ ");

            Console.WriteLine($"Copyright (C) 2020. Custom Copy Project.");
            Console.WriteLine($"E-Mail: [email protected]");
            Console.WriteLine($"Source-code: https://github.com/rollrat/custom-copy-project");
            Console.WriteLine($"Version: {Version.Text} (Build: {Internals.GetBuildDate().ToLongDateString()})");
            Console.WriteLine("");

            // Check Required Datas

            if (!HitomiData.Instance.CheckMetadataExist())
            {
                const string index_metadata_url = @"https://github.com/rollrat/custom-copy-project/releases/download/database/index-metadata.compress";
                const string original_title_url = @"https://github.com/rollrat/custom-copy-project/releases/download/database/origin-title.compress";

                Logs.Instance.Push("Welcome to Custom Copy!\r\n\tDownload the necessary data before running the program!");

                var file1 = download_data(index_metadata_url, "index-metadata.compress");
                Logs.Instance.Push("Unzip to index-metadata.json...");
                File.WriteAllBytes("index-metadata.json", file1.UnzipByte());

                var file2 = download_data(original_title_url, "original-title.compress");
                Logs.Instance.Push("Unzip to original-title.json...");
                File.WriteAllBytes("original-title.json", file2.UnzipByte());
            }

            Logs.Instance.Push("Load index-metdata.json...");
            HitomiData.Instance.Load();
            HitomiData.Instance.OptimizeMetadata();
            HitomiData.Instance.RebuildTagData();
            GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);

            // Check Server Update
            Logs.Instance.Push("Checking custom-copy-backend-server version...");
            // Check Client Update
            Logs.Instance.Push("Checking custom-copy-client-ui version...");

            // Load Scripts
            Logs.Instance.Push("Loading scripts...");
            ScriptManager.Instance.Initialization();

            // Start Server
            Server.Server.Instance.Start();

            // Start Client

            while (true)
            {
                Thread.Sleep(1000 * 60 * 10);
            }
        }
Пример #2
0
 public static void PrintVersion()
 {
     Console.WriteLine($"{Version.Name} {Version.Text}");
     Console.WriteLine($"Build Date: " + Internals.GetBuildDate().ToLongDateString());
 }