public override AuctionResult GetElement(string id, string parentUuid) { return(new AuctionResult(StorageManager.GetOrCreateAuction(id))); }
public override IEnumerable <string> GetAllIds(string id) { return(StorageManager.GetOrCreateUser(id).auctionIds); }
public static async Task LastHourIndex() { DateTime indexStart; string targetTmp, pullPath; VariableSetup(out indexStart, out targetTmp, out pullPath); //DeleteDir(targetTmp); if (!Directory.Exists(pullPath) && !Directory.Exists(targetTmp)) { // update first if (!Program.FullServerMode) { Console.WriteLine("nothing to build indexes from, run again with option u first"); } return; } // only copy the pull path if there is no temp work path yet if (!Directory.Exists(targetTmp)) { Directory.Move(pullPath, targetTmp); } else { Console.WriteLine("Resuming work"); } try { Console.WriteLine("working"); var work = PullData(); var earlybreak = 100; foreach (var item in work) { await ToDb(item); if (earlybreak-- <= 0) { break; } } Console.WriteLine($"Indexing done, Indexed: {count} Saved: {StorageManager.SavedOnDisc} \tcache: {StorageManager.CacheItems} NameRequests: {Program.RequestsSinceStart}"); if (!abort) { // successful made this index save the startTime FileController.SaveAs("lastIndex", indexStart); } } catch (System.AggregateException e) { // oh no an error occured Logger.Instance.Error($"An error occured while indexing, abording: {e.Message} {e.StackTrace}"); return; //FileController.DeleteFolder("auctionpull"); //Directory.Move(FileController.GetAbsolutePath("awork"),FileController.GetAbsolutePath("auctionpull")); } var saveTask = StorageManager.Save(); saveTask.Wait(); LastFinish = DateTime.Now; DeleteDir(targetTmp); }
public override IEnumerable <string> GetAllIds(string id) { return(StorageManager.GetOrCreateUser(id).Bids.Select(b => b.auctionId)); }
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; //} } }
/// <summary> /// returns true if application should be closed /// </summary> /// <param name="mode"></param> /// <returns></returns> static bool runSubProgram(char mode) { switch (mode) { case 't': // test //NotificationService.Instance.NotifyAsync("dPRj0dnG2NcY_kMTdNbpjz:APA91bHJINgv1SjuUlv-sGM21wLlHX5ISC5nYgl8DKP2r0fm273Cs0ujcESW6NR1RyGvFDtTBdQLK0SSq5TY_guLgc57VylKk8AAnH_xKq3zDIrdA1F6UhJNTu-Q0wNDKKIIQkYoVcyj","test","click me","https://sky.coflnet.com").Wait(); SetGoogleIdCommand.ValidateToken("eyJhbGciOiJSUzI1NiIsImtpZCI6IjI1MmZjYjk3ZGY1YjZiNGY2ZDFhODg1ZjFlNjNkYzRhOWNkMjMwYzUiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJhY2NvdW50cy5nb29nbGUuY29tIiwiYXpwIjoiNTcwMzAyODkwNzYwLW5sa2dkOTliNzFxNGQ2MWFtNGxwcWRoZW4xcGVuZGR0LmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwiYXVkIjoiNTcwMzAyODkwNzYwLW5sa2dkOTliNzFxNGQ2MWFtNGxwcWRoZW4xcGVuZGR0LmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwic3ViIjoiMTAxOTkzNTcwNzI0MDg4NDMyMjk4IiwiZW1haWwiOiJ0by5jb2ZsbmV0QGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJhdF9oYXNoIjoiYWdLN21RM2YySFZQclZNQ3l1UVVmdyIsIm5hbWUiOiJFa3dhdiBDb2ZsbmV0IiwicGljdHVyZSI6Imh0dHBzOi8vbGgzLmdvb2dsZXVzZXJjb250ZW50LmNvbS9hLS9BT2gxNEdobEx6TjV5U1o3VDZWYnpYRnFhUlR4c3dNRXJLaW1VQk1uem41Nz1zOTYtYyIsImdpdmVuX25hbWUiOiJFa3dhdiIsImZhbWlseV9uYW1lIjoiQ29mbG5ldCIsImxvY2FsZSI6ImRlIiwiaWF0IjoxNjEwMjk4MTE5LCJleHAiOjE2MTAzMDE3MTksImp0aSI6ImIzMWYzODUwNDMwYjNhOWMxNTQ5YTRjMDFiNTFiNTBlZjBhZTkwYTAifQ.cvsqp0GaYca---qkBAm-nS3QI-x_ZTGkzZh7sk-SsYctubikHqJz9VpafY_ih88ouOFTg_CWHKPMvS9dTrR8T4W_iY65cYp2hxsc-iMignDBgxbP6KlUCm3MvpRTHTdLAtL3Eq4JeXAL6_BN21AetRMaOhsWMgvz6yprhTkirOgFSuDt386Q8NXr19csjDhAW6bb2bRwEYJp4ZlBXD77zfzP_kZaF2y671M_lZUXnrqKrDqF7sFL2Jx4r6htKV_e86IuKhx0N1ttNTuEOeqccIZHdRQasivVO9Nq0twjhFIWn-5-azkPyz0VstxzIuYc7mTi2LSVjF4QDl-aLiOlPQ"); break; case 'b': //var key = System.Text.Encoding.UTF8.GetString (FileController.ReadAllBytes ("apiKey")).Trim (); BazaarUpdater.NewUpdate(apiKey).Wait(); break; case 'f': FullServer(); break; case 's': var server = new Server(); server.Start().Wait(); break; case 'u': var updater = new Updater(apiKey); updater.Update().Wait(); break; case '7': displayMode = false; StorageManager.Migrate(); var auction = StorageManager.GetOrCreateAuction("00e45a19c27848829612be8edf53bd71"); Console.WriteLine(auction.ItemName); //Console.WriteLine(ItemReferences.RemoveReforges("Itchy Bat man")); break; case 'i': Flipper.FlipperEngine.Instance.Test(); break; case 'p': Indexer.LastHourIndex().Wait(); //StorageManager.Migrate(); break; case 'n': Console.WriteLine(NBT.Pretty("H4sIAAAAAAAAAHVUS28jRRAux8mu4ywbxIkLohdtRCKvkxnb49cByXGcxIJ1IvJYblbPTHmmyUyP6elxyJEbJ84cFgkJpEgcOSMh5afkhyCqZ5woHLjMo/qrr756dRVgHUqiCgClFVgRfqlegrVhkkldqkJZ82AdVlF64RJRjhYRlHMkVKAEGxfSVcivuBthqQzrx8LHw4gHKcH/qcJzX6TziN8QyVeJwgpZP4FP7247R8gVO/PI1md3t75j9+jV3bYbVmsnB5xphTLQoTn2araTH9eand2es0MsNkGOkUcFgNcalsOOT+kTt2stiz53CgfH7u62zdEOfE4uBzhDmWLh07UKfMNaghtWY5fCdwk4lhqjSASU+hJtN42G3vYEPZVo4bGa/ejYbNm7Tq6LgvQon7vb6J1I/SRml2+M1wHOdcgoJyqPYuPxGF6R9RC5Dun/kFMoGbBvcuyRSq4JfAnm55RioadFIpdMX+O32QIl10gIgK272/ZhFkXsDDXbT2SW9tloNhOeQKmZVlxIYobPKKXRAtUNUbgmj86Qa+4lsZuyCBcYpW9MuI4ORcq4ihPF5gI9ZAERpKxGBWhswQt6ESjVXKe7FNywHikuNfn4vjAqecRcowJT5vIU/RxD4m+STLEUI8oFfeZnMkCyehFP01fE9Jpk7aNKUV0R3hS8QzG9hnX/yw/sYRRgSCjTdFRPQNy2tswndV8h9QsVz8vFpf9A0yKa31kxLqZi7lse4BMK17Hu3//EnvYcqIsdOjnn8qki3iSqH9lyjMiWh1HoZx5l7POYiMExheRXKJlb1DvXN6OaIvfCZWGpICzkC2T4XSbmTMxgj0DGyhWyUGjjTNPBUh4jixOZapqUa0EdkmZsbQte0su0A71E+tSQLyjWQHnhf8rTc+5//o0NFREOQ06ZPdhtOvi1ODgodAN8fHdL4qPR6XjIDi4mR6OTCds/OTk/K8Oal0SJgr//+rMCqxPSZCrkPC7DwOdzLSid/SShcaCpvH//x/89oQqbo+9pOAeaNsLNNKZl+DBM9HSe0GwlU8/cP6SnWnmIu2H37L7d7fbtTrcClTjxxUyggopcKijDR8upmgqN8TSfaqJYq8B6okQg5DkP4PnF5MvJybtJJb/AXg4OBqfn48vRNE+yCi/MTUfzHNPykKQPfLO207RYWyIrl2Ezi7SIaf2m1/mCmxBknRWrPJ0Vq2y0l6GqHpe1gD0L8t0ufqrzx902BrpOV7OMVL3mLbvddjtOHTvYrrfsZrfOXR/rnPdmlt12vRl3yZ3LhYimZtXIfYPSJF1IuxnPYbO713D2GhZr922bDd4CrMCzxy7Dvy+PLTX1BQAA")); //Console.WriteLine (JsonConvert.SerializeObject (.Instance.Items.Where (item => item.Value.AltNames != null && item.Value.AltNames.Count > 3 && !item.Key.Contains("DRAGON")).Select((item)=>new P(item.Value)))); break; case 'g': var ds = new DataSyncer(); ds.Sync("e5bac11a8cc04ca4bae539aed6500823"); break; case 'm': Migrator.Migrate(); break; default: return(true); } return(false); }