예제 #1
0
        static void Main()
        {
            //enable application styles
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //add header to log file
            string dat = Environment.NewLine;

            for (int i = 0; i < 80; ++i)
            {
                dat += '*';
            }
            dat += Environment.NewLine;
            System.IO.File.AppendAllText(LocalDirectory.GetLogFile(), dat);

            //load user-names
            LocalDatabase.usernames = RegistryAccess.GetAllUsers();
            if (string.IsNullOrEmpty(RegistryAccess.DefaultUsername) ||
                Properties.Settings.Default.AskForUsernameEverytime)
            {
                UsernameForm uf = new UsernameForm();
                Application.Run(uf);
            }

            //task queue
            TaskQueue.StartTimer();

            try
            {
                //launch application
                Interactivity.mainForm = new MainForm();
                Application.Run(Interactivity.mainForm);
            }
            catch (Exception ex)
            {
                Logger.Add("Error in main form => ", ex.Message + " => " + ex.StackTrace);
                Application.Exit();
            }

            //end of application works
            Interactivity.CloseAllOpenedForms();
            Properties.Settings.Default.Save();

            UVA_Arena.Elements.CodeCompiler.ForceStopTask();
        }
예제 #2
0
        public static void Add(string text, string source)
        {
            //add to current context
            LogData ld = new LogData();

            ld.time   = DateTime.Now;
            ld.source = source;
            ld.status = text;
            LOG.Add(ld);

            //save log
            string dat = "";

            dat += DateTime.Now.ToLongDateString() + " | " + DateTime.Now.ToLongTimeString();
            dat += " => " + text + " => " + source + Environment.NewLine;
            if (LOG.Count == 0)
            {
                text = Environment.NewLine + text;
            }
            System.IO.File.AppendAllText(LocalDirectory.GetLogFile(), dat);
        }