Ejemplo n.º 1
0
        private async void GUI_Shown(object sender, EventArgs e)
        {
            OPT.LoadSettings();
            DesCipher = new XDes(OPT.GetString("des.key"));

            Statistics.SetIO();
            Statistics.StartUptime();

            clientList = new Dictionary <int, Client>();

            Output.Write(new Structures.Message()
            {
                Text = "Indexing legacy file names..."
            });
            OPT.LoadLegacyIndex();
            Output.Write(new Structures.Message()
            {
                Text = string.Format("[OK]\n\t- {0} legacy files indexed!", OPT.LegacyCount), AddBreak = true
            });

            Output.Write(new Structures.Message()
            {
                Text = "Indexing delete file names..."
            });
            OPT.LoadDeleteFiles();
            Output.Write(new Structures.Message()
            {
                Text = string.Format("[OK]\n\t- {0} delete files indexed!", OPT.DeleteCount), AddBreak = true
            });

            await Task.Run(() => { IndexManager.Build(false); });

            Output.Write(new Structures.Message()
            {
                Text = "Checking for tmp directory..."
            });
            if (!Directory.Exists(tmpPath))
            {
                Directory.CreateDirectory(tmpPath);
            }
            Output.Write(new Structures.Message()
            {
                Text = "[OK]", AddBreak = true
            });

            clearTmp();

            Output.Write(new Structures.Message()
            {
                Text = string.Format("Initializing client listener...{0}", (ClientManager.Instance.Start()) ? "[OK]" : "[FAIL]"), AddBreak = true
            });

            Output.Write(new Structures.Message()
            {
                Text = "Initializing Index Rebuild Service..."
            });
            int rebuildInterval = OPT.GetInt("rebuild.interval") * 1000;

            indexTimer = new Timer()
            {
                Enabled = true, Interval = rebuildInterval
            };
            indexTimer.Tick += indexTick;
            indexTimer.Start();
            Output.Write(new Structures.Message()
            {
                Text = "[OK]", AddBreak = true
            });

            Output.Write(new Structures.Message()
            {
                Text = "Initializing OTP Reset Service..."
            });
            otpTimer = new Timer()
            {
                Enabled = true, Interval = 300000
            };
            otpTimer.Tick += otpTick;
            Output.Write(new Structures.Message()
            {
                Text = "[OK]", AddBreak = true
            });

            Output.Write(new Structures.Message()
            {
                Text = "Initializing Statistics Update Service..."
            });
            Statistics.StartUpdating();
            Output.Write(new Structures.Message()
            {
                Text = "[OK]", AddBreak = true
            });

            toolTip.SetToolTip(setWTBtn, "Sets the Updates folder last write time to the current time");
        }