예제 #1
0
        public stats(string path)
        {
            file = path + "\\stats.csv";
            string stats = "";

            try
            {
                TextReader r = new StreamReader(file);
                stats = r.ReadToEnd();
                r.Close();
            }
            catch (Exception x) {
                if (x.Message.Contains("used by another process"))
                {
                    if (MessageBox.Show("Please close any programs using stats.csv and press OK, or else your stats will be erased", "Warning", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        stats temp = new stats(path);
                        this.pics = temp.pics;
                        this.file = temp.file;
                    }
                }
                return;
            }
            string[] statarr = stats.Split('\n');
            foreach (string s in statarr)
            {
                string[] temp = s.Split(',');
                if (temp.Length > 1)
                {
                    pics.Add(temp[0]);
                    pics.Add(temp[1]);
                }
            }
        }
예제 #2
0
 public stats(string path)
 {
     file = path + "\\stats.csv";
     string stats = "";
     try
     {
         TextReader r = new StreamReader(file);
         stats = r.ReadToEnd();
         r.Close();
     }
     catch (Exception x) {
         if(x.Message.Contains("used by another process"))
             if (MessageBox.Show("Please close any programs using stats.csv and press OK, or else your stats will be erased","Warning", MessageBoxButtons.OKCancel) == DialogResult.OK)
             {
                 stats temp = new stats(path);
                 this.pics = temp.pics;
                 this.file = temp.file;
             }
         return;
     }
     string[] statarr = stats.Split('\n');
     foreach (string s in statarr)
     {
         string[] temp = s.Split(',');
         if (temp.Length > 1)
         {
             pics.Add(temp[0]);
             pics.Add(temp[1]);
         }
     }
 }
예제 #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            addToLog("Loading...");

            menuStrip1.Visible = true;
            dualmon.Checked = desktops[0].Length > 1;
            timer.Tick += new EventHandler(timer_Tick);
            trayicon.Icon = this.Icon;
            denombox.SelectedIndex = 1;
            Utilities = new utilities("DesktopSwitcher");
            getSettings();
            log.Capacity = 50;
            if (progfilter == null)
                progfilter = "";
            if (startmintool.Checked)
                this.WindowState = FormWindowState.Minimized;
            if (useParse = alwaysparse.Checked)
                parseParse();
            else
            {
                autoparse.Checked = false;
                getdirpics();
            }
            if (autoparse.Checked)
                parsepics(false);
            getscreens();
            if (autostart.Checked)
                start_timer();
            Microsoft.Win32.SystemEvents.DisplaySettingsChanged += new System.EventHandler(displaySettingsChanged);
            stat = new stats(dirtb.Text);
            inputfrm = new InputForm(this);
            //dir = new directory(dirtb.Text);
            //lastpic = dir.getpic(0);
            if(update.Checked)
                checkForUpdate();

            addToLog("Loaded");
        }