Exemple #1
0
 private static void StopServices(Updater updater, Server server, BazaarUpdater bazzar)
 {
     Console.WriteLine("Stopping");
     server.Stop();
     Indexer.Stop();
     updater.Stop();
     bazzar.Stop();
     System.Threading.Thread.Sleep(500);
     Console.WriteLine("done");
 }
Exemple #2
0
        static void Main(string[] args)
        {
            StripeKey                  = SimplerConfig.Config.Instance["stripeKey"];
            StripeSigningSecret        = SimplerConfig.Config.Instance["stripeSecret"];
            StripeConfiguration.ApiKey = Program.StripeKey;

            Console.CancelKeyPress += delegate
            {
                Console.WriteLine("\nAbording");
                onStop?.Invoke();

                var cacheCount = StorageManager.CacheItems;
                StorageManager.Stop();
                Indexer.Stop();

                var t = StorageManager.Save();
                Console.WriteLine("Saving");
                t.Wait();
                Console.WriteLine($"Saved {cacheCount}");
            };

            if (args.Length > 0)
            {
                FileController.dataPaht = args[0];
                Directory.CreateDirectory(FileController.dataPaht);
                Directory.CreateDirectory(FileController.dataPaht + "/users");
                Directory.CreateDirectory(FileController.dataPaht + "/auctions");

                if (args.Length > 1)
                {
                    runSubProgram(args[1][0]);
                    return;
                }
            }

            displayMode = true;

            while (true)
            {
                //try {

                Console.WriteLine("1) List Auctions");
                Console.WriteLine("2) List Bids");
                Console.WriteLine("3) Display");
                Console.WriteLine("4) List Won Bids");
                Console.WriteLine("5) Search For auction");
                Console.WriteLine("6) Avherage selling price in the last 2 weeks");
                Console.WriteLine("9) End");

                var res = Console.ReadKey();
                if (runSubProgram(res.KeyChar))
                {
                    return;
                }

                //} catch(Exception e)
                //{
                //    Console.WriteLine("Error Occured: "+ e.Message);
                //    throw e;
                //}
            }
        }