Esempio n. 1
0
        public void TrannyLoop()
        {
            while (true)
            {
                var added = DateTime.UtcNow.AddDays(1);
                var dt    = new DateTime(added.Year, added.Month, added.Day, 0, 0, 0);
                var wait  = (dt - DateTime.UtcNow);

                Console.WriteLine("Sleeping until {0} for {1}", dt, wait);

                Thread.Sleep(wait);

                lock (Transactions)
                {
                    Save(true);
                    Transactions.Clear();

                    string filename           = DateTime.Now.ToString("yyyy-MM-dd");
                    string yesterday_filename = DateTime.Now.AddDays(0).ToString("yyyy-MM-dd");

                    File.Move("./transactions", "./transaction-backups/transactions-" + filename);
                    File.Move("./save", "./transaction-backups/save-" + filename);

                    File.Move("./generator", Path.Combine(Config.GetString("generator.directory"), yesterday_filename + "-" + Program.Random.HashedName));
                    File.WriteAllText(Path.Combine(Config.GetString("generator.directory"), "latest.txt"), "http://hexafluoride.dryfish.net/audit-files/" + yesterday_filename + "-" + Program.Random.HashedName);

                    File.Copy(Path.Combine(Config.GetString("generator.directory"), yesterday_filename + "-" + Program.Random.HashedName), Path.Combine(Config.GetString("generator.directory"), "latest"), true);
                    File.WriteAllText(Path.Combine(Config.GetString("generator.directory"), "index.html"), IndexGenerator.FromDirectory(Config.GetString("generator.directory")));
                    Program.Random = GeneratorManager.Create();

                    Console.WriteLine("Cycled out transactions file");
                }

                Thread.Sleep(5000);
            }
        }
Esempio n. 2
0
 static void Reindex(string args, string source, string nick)
 {
     File.WriteAllText(Path.Combine(Config.GetString("generator.directory"), "index.html"), IndexGenerator.FromDirectory(Config.GetString("generator.directory")));
 }