Beispiel #1
0
        //---------- Save Remaining Time ----------


        //********* Save App Monitoring *********
        void SaveAppMonitoring()
        {
            try
            {
                Directory.CreateDirectory(PathMS + "/MonitoringReports/App/");
                save.Destroy();
                save = new SaveWriter(PathMS + "/MonitoringReports/App/" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ".apprep");
                save.AddItem("Count", appinfo.Count);
                for (int i = 0; i < appinfo.Count; i++)
                {
                    appinfo[i].CalcTime();
                    save.AddItem("Title_" + i, appinfo[i].ApplicationName);
                    save.AddItem("Module_" + i, appinfo[i].ExecutableName);
                    save.AddItem("TimeMin_" + i, appinfo[i].GetMinutes());
                    save.AddItem("TimeHours_" + i, appinfo[i].GetHours());
                }

                save.AddItem("PCTimeHour", PCHour);
                save.AddItem("PCTimeMinutes", PCMin);

                save.Save();
                save.Destroy();
            }catch (Exception ex)
            {
                DebugService.WriteError("" + ex);
            }
        }
Beispiel #2
0
        }//----- Form 1 Load -----

        //******* Get notice ********
        void GetNotice()
        {
            Directory.CreateDirectory(PathMS + "/MonitoringReports/Notes/");
            Directory.CreateDirectory(PathMS + "/Temp/");

            DirectoryInfo dir = new DirectoryInfo(PathMS + "/MonitoringReports/Notes/");

            SaveWriter load = new SaveWriter();

            if (File.Exists(PathMS + "/Temp/Rnotes.dat"))
            {
                File.Delete(PathMS + "/Temp/Rnotes.dat");
            }

            SaveWriter save = new SaveWriter(PathMS + "/Temp/Rnotes.dat");

            int k = 0;

            foreach (FileInfo file in dir.GetFiles("*.notesp"))
            {
                load.Destroy();
                load.PathToFile = file.FullName;
                load.Load();
                if (load.GetItemBool("Warn"))
                {
                    save.AddItem("NotePath" + k, file.FullName);
                    save.AddItem("NoteDate" + k, load.GetItem("WarnTimeDate"));
                    k++;
                }
            }
            save.AddItem("Count", k);
            save.Save();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(textBoxuser.Text))
            {
                if (!string.IsNullOrWhiteSpace(textBoxpass.Text))
                {
                    try
                    {
                        string     pass   = encrypt.EncryptText(textBoxpass.Text, "ZuhajoLafyNAYjCAw2VZfaYo");
                        XmppClient client = new XmppClient(Server, AppPrefix + textBoxuser.Text, pass);
                        client.Connect();

                        Debug.WriteLine("Logged in as: " + client.Jid);


                        XmppClient clientad = new XmppClient(Server, "Admin_" + AppPrefix + textBoxuser.Text, pass);
                        clientad.Connect();

                        Debug.WriteLine("Logged in as: " + clientad.Jid);

                        Directory.CreateDirectory(PathMS + "/Settings/");

                        if (File.Exists(PathMS + "/Settings/chat.dat"))
                        {
                            File.Delete(PathMS + "/Settings/chat.dat");
                        }

                        SaveWriter save = new SaveWriter(PathMS + "/Settings/chat.dat");

                        save.AddItem("Username", AppPrefix + textBoxuser.Text);
                        save.AddItem("Password", encryptpass.EncryptString(pass, "1cPOnaLrV2MusS4Cq3aU6dja"));
                        save.AddItem("Admin", radioButtonAdmin.Checked);
                        save.Save();
                        save.Destroy();

                        pass = "";
                        MessageBox.Show("Logged in", "OK");
                        Application.Exit();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("User not exist, or bad password", "Error");
                    }
                }
                else
                {
                    MessageBox.Show("Empty password");
                }
            }
            else
            {
                MessageBox.Show("Empty Username");
            }
        }
Beispiel #4
0
        void changelocation()
        {
            try
            {
                bool showw = bool.Parse(HelpClass.GETHtml("http://myspy.diodegames.eu/ShowWeather.txt"));
                if (showw)
                {
                    bool change = false;

                    if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/location.dat"))
                    {
                        File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/location.dat");
                    }

                    CityLocator city = new CityLocator();
                    city.GetGeoCoordByCityNameEmail(textBoxlocation.Text, "*****@*****.**");
                    SaveWriter Loc = new SaveWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/location.dat");
                    Loc.AddItem("City", city.PlaceDisplayName);
                    Loc.AddItem("Latitude", city.Latitude);
                    Loc.AddItem("Longtitude", city.Longtitude);
                    Loc.Save();

                    textBoxlocation.Text = city.PlaceDisplayName;
                    change = true;


                    if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weathersettings.dat"))
                    {
                        File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weathersettings.dat");
                    }

                    SaveWriter wsave = new SaveWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weathersettings.dat");
                    wsave.AddItem("Unit", radioButton2.Checked);
                    wsave.Save();

                    if (change)
                    {
                        if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weather.dat"))
                        {
                            File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weather.dat");
                        }

                        if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weathericon.dat"))
                        {
                            File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weathericon.dat");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("" + ex);
            }
        }
Beispiel #5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //Thread na zrychlenie nacitania niektorych veci
            new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;


                try
                {
                    Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/");

                    SaveWriter save = new SaveWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/appreport.dat");

                    try
                    {
                        if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/appreport.dat"))
                        {
                            File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/appreport.dat");
                        }
                    }
                    catch (Exception ex)
                    {
                    }

                    int k = 0;
                    Process[] processes = Process.GetProcesses();
                    foreach (Process pr in processes)
                    {
                        try
                        {
                            if (!string.IsNullOrEmpty(pr.MainWindowTitle))
                            {
                                // Debug.WriteLine(pr.MainWindowTitle + "   (" + pr.MainModule.ModuleName + ") " + pr.Id + " Session: " + pr.SessionId);
                                save.AddItem("Title_" + k, pr.MainWindowTitle);
                                save.AddItem("Module_" + k, pr.MainModule.ModuleName);
                                k++;
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }

                    save.AddItem("Count", k);
                    save.Save();
                }
                catch (Exception ex)
                {
                }
                Application.Exit();
            }).Start();
            //koniec threadu
        }
Beispiel #6
0
        private void imageButtonAlert_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show(ResourcesFiles.ProgramStrings.Cancelremindtext, ResourcesFiles.ProgramStrings.Cancelremind, MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                SaveWriter save = new SaveWriter(pthspc);
                save.Load();
                save.LoadedValuesToSaveValues();
                File.Delete(pthspc);
                save.RemoveItem("Warn");
                save.AddItem("Warn", false);
                save.Save();
                imageButtonAlert.Visible = false;
                HelpClass.NotesChange    = true;
            }
            else if (dialogResult == DialogResult.No)
            {
            }
        }
Beispiel #7
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            string password = encryption.DecryptString((string)registry.GetValue("Properties"), "2pqB7l4eRM6nHaZPtetkkHePguacGTvrMhvnE4fy");

            if (textBoxPassword.Text.Equals(password))
            {
                SaveWriter save = new SaveWriter(PathMS + "/Temp/secure.pas");
                save.AddItem("Token", encryption.EncryptString("M0F2s1Pwza", "BduIfxDmGPn5Xmk4DYqCHFkqg"));
                int time = (DateTime.Now.Hour * 60) + DateTime.Now.Minute;
                save.AddItem("Time", encryption.EncryptString("" + time, "f0Hy3j4tU5"));
                save.Save();
                backgroundWorker1.ReportProgress(0, "");
            }
            else
            {
                SoundPlayer player = new SoundPlayer(Properties.Resources.error);
                player.Play();
                backgroundWorker1.ReportProgress(1, "");
            }
            password = "";
        }
Beispiel #8
0
        void NewWeather(string latitude, string longtitude, string cityName)
        {
            if (File.Exists(PathMS + "/Temp/weather.dat"))
            {
                File.Delete(PathMS + "/Temp/weather.dat");
            }

            if (File.Exists(PathMS + "/Temp/weathericon.dat"))
            {
                File.Delete(PathMS + "/Temp/weathericon.dat");
            }


            if (weather.GetWeatherData(latitude, longtitude))
            {
                weather.weatherinfo.CityName = cityName;
                SaveWriter save = new SaveWriter(PathMS + "/Temp/weather.dat");
                save.AddItem("City", weather.weatherinfo.CityName);
                save.AddItem("Temperature", weather.weatherinfo.Temperature);
                save.AddItem("Clouds", weather.weatherinfo.Cloudiness);
                save.AddItem("Day", DateTime.Now.Day);
                save.AddItem("Hour", DateTime.Now.Hour);
                save.Save();


                if (DateTime.Now.Hour > 21 || DateTime.Now.Hour < 6)
                {
                    weathericon = weather.GetIcon(1);
                }
                else
                {
                    weathericon = weather.GetIcon(0);
                }

                weathericon.Save(PathMS + "/Temp/weathericon.dat", ImageFormat.Png);

                backgroundWorkerWeather.ReportProgress(0, "");
            }
        }
Beispiel #9
0
        //--------- Work With Running Applications ----------



        //********* Save Remaining Time *********
        void SaveRemainingTime()
        {
            try
            {
                Directory.CreateDirectory(PathMS + "/Block/");
                string rpath = PathMS + "/Block/RemTime.dat";

                if (File.Exists(rpath))
                {
                    File.Delete(rpath);
                }

                save.Destroy();
                save = new SaveWriter(rpath);
                save.AddItem("Day", DateTime.Now.Day);
                save.AddItem("Time", MaxTimePC);
                save.Save();
            }
            catch (Exception ex)
            {
                DebugService.WriteError("" + ex);
            }
        }
Beispiel #10
0
        void SaveStatistics()
        {
            try
            {
                if (StatsEn)
                {
                    Directory.CreateDirectory(PathMS + "/Stats/");

                    if (File.Exists(PathMS + "/Stats/Today.sts"))
                    {
                        SaveWriter savew = new SaveWriter(PathMS + "/Stats/Today.sts");
                        savew.Load();

                        if (savew.GetItemInt("Day") != DateTime.Now.Day)
                        {
                            int hrs = savew.GetItemInt("Hours");

                            short mns = (short)savew.GetItemInt("Mins");

                            bool Graphskip = false;

                            if (DateTime.Now.Day < savew.GetItemInt("Day"))
                            {
                                Graphskip = true;

                                if (File.Exists(PathMS + "/Stats/MonthOld.sts"))
                                {
                                    File.Delete(PathMS + "/Stats/MonthOld.sts");
                                }
                                if (File.Exists(PathMS + "/Stats/MonthGraphOld.sts"))
                                {
                                    File.Delete(PathMS + "/Stats/MonthGraphOld.sts");
                                }


                                if (File.Exists(PathMS + "/Stats/Month.sts"))
                                {
                                    File.Move(PathMS + "/Stats/Month.sts", PathMS + "/Stats/MonthOld.sts");
                                }
                                if (File.Exists(PathMS + "/Stats/MonthGraph.sts"))
                                {
                                    File.Move(PathMS + "/Stats/MonthGraph.sts", PathMS + "/Stats/MonthGraphOld.sts");
                                }
                            }

                            savew.Destroy();

                            savew.PathToFile = PathMS + "/Stats/Month.sts";
                            if (File.Exists(PathMS + "/Stats/Month.sts"))
                            {
                                savew.Load();
                                int   hrsm = hrs + savew.GetItemInt("Hours");
                                short mnsm = (short)(mns + (savew.GetItemInt("Mins")));
                                if (mnsm > 59)
                                {
                                    mnsm -= 60;
                                    hrsm++;
                                }

                                int cnt = savew.GetItemInt("Divide");
                                File.Delete(PathMS + "/Stats/Month.sts");
                                savew.Destroy();
                                savew.AddItem("Month", DateTime.Now.Month);
                                savew.AddItem("Hours", hrsm);
                                savew.AddItem("Mins", mnsm);
                                savew.AddItem("Divide", (cnt + 1));
                                savew.Save();
                            }
                            else
                            {
                                if (!Graphskip)
                                {
                                    savew.AddItem("Month", DateTime.Now.Month);
                                    savew.AddItem("Hours", hrs);
                                    savew.AddItem("Mins", mns);
                                    savew.AddItem("Divide", 1);
                                    savew.Save();
                                }
                            }


                            savew.Destroy();
                            savew.PathToFile = PathMS + "/Stats/MonthGraph.sts";
                            if (File.Exists(PathMS + "/Stats/MonthGraph.sts"))
                            {
                                savew.Load();
                                savew.LoadedValuesToSaveValues();
                                int cnt = savew.GetItemInt("Count");
                                cnt++;
                                savew.AddItem("Value" + cnt, ((hrs * 60) + mns));
                                savew.AddItem("Day" + cnt, (DateTime.Now.Day - 1));
                                savew.RemoveItem("Count");
                                savew.AddItem("Count", cnt);
                                savew.Save();
                            }
                            else
                            {
                                if (!Graphskip)
                                {
                                    savew.AddItem("Value1", ((hrs * 60) + mns));
                                    savew.AddItem("Day1", (DateTime.Now.Day - 1));
                                    savew.AddItem("Count", 1);
                                    savew.Save();
                                }
                            }

                            savew.Destroy();
                            savew.PathToFile = PathMS + "/Stats/AllTime.sts";
                            if (File.Exists(PathMS + "/Stats/AllTime.sts"))
                            {
                                savew.Load();
                                int   hrsa = savew.GetItemInt("Hours");
                                short mnsa = (short)savew.GetItemInt("Mins");
                                int   cnt  = savew.GetItemInt("Divide");


                                hrsa += hrs;
                                mnsa += mns;
                                cnt++;

                                if (mnsa >= 60)
                                {
                                    hrsa++;
                                    mnsa -= 60;
                                }

                                if (cnt > 30)
                                {
                                    long  tms     = (hrsa * 60) + mnsa;
                                    long  time    = (tms / cnt) * 5;
                                    int   hour    = (int)Math.Floor((decimal)(time / 60));
                                    short minutes = (short)(time - (hour * 60));
                                    hrsa = hour;
                                    mnsa = minutes;
                                    cnt  = 5;
                                }

                                File.Delete(PathMS + "/Stats/AllTime.sts");
                                savew.Destroy();
                                savew.AddItem("Hours", hrsa);
                                savew.AddItem("Mins", mnsa);
                                savew.AddItem("Divide", cnt);
                                savew.Save();
                            }
                            else
                            {
                                savew.AddItem("Hours", hrs);
                                savew.AddItem("Mins", mns);
                                savew.AddItem("Divide", 1);
                                savew.Save();
                            }
                            allhour = 0;
                            allmin  = 0;
                        }
                    }//ak existuje today.sts



                    if (File.Exists(PathMS + "/Stats/Today.sts"))
                    {
                        File.Delete(PathMS + "/Stats/Today.sts");
                    }

                    SaveWriter save = new SaveWriter(PathMS + "/Stats/Today.sts");
                    save.AddItem("Date", "" + DateTime.Now);
                    save.AddItem("Hours", allhour);
                    save.AddItem("Mins", allmin);
                    save.AddItem("Day", DateTime.Now.Day);
                    save.Save();
                    save.Destroy();
                }//StatsEn == true
            }catch (Exception ex)
            {
                DebugService.WriteError("" + ex);
            }
        }//SaveStatistics()
Beispiel #11
0
        private void button2_Click(object sender, EventArgs e)
        {
            Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/MonitoringReports/Notes/");
            string key   = HelpClass.RandomString(5);
            bool   close = true;
            bool   write = true;

            if (checkBox2.Checked)
            {
                RegistryKey registry = Registry.LocalMachine.OpenSubKey("Software\\My_Spy", false);
                if (!textBox1.Text.Equals(encryption.DecryptString((string)registry.GetValue("Properties"), "2pqB7l4eRM6nHaZPtetkkHePguacGTvrMhvnE4fy")))
                {
                    MessageBox.Show(ResourcesFiles.ProgramStrings.badpassword);
                    close = false;
                    write = false;
                }
            }

            if (write)
            {
                SaveWriter save = new SaveWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                                                 "/My Spy/MonitoringReports/Notes/note_" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + key + ".notesp");
                if (Edit)
                {
                    save.PathToFile = SPath;
                    File.Delete(SPath);
                    File.Delete(Path);
                }

                DateTime date = new DateTime(dateTimePicker1.Value.Year, dateTimePicker1.Value.Month, dateTimePicker1.Value.Day,
                                             dateTimePicker2.Value.Hour, dateTimePicker2.Value.Minute, 0);
                save.AddItem("Warn", checkBox1.Checked);
                save.AddItem("WarnTimeDate", date.ToString());
                save.AddItem("Password", checkBox2.Checked);
                if (Edit)
                {
                    save.AddItem("DateofCreate", "" + Createdate);
                }
                else
                {
                    save.AddItem("DateofCreate", "" + DateTime.Now.ToString());
                }

                save.AddItem("DateofEdit", "" + DateTime.Now.ToString());
                //save.AddItem("Text",richTextBox1.Text);
                save.Save();
                save.Clear();


                if (!Edit)
                {
                    using (StreamWriter writer = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                                                                  "/My Spy/MonitoringReports/Notes/note_" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + key + ".note"))
                    {
                        writer.WriteLine(richTextBox1.Text);
                    }
                }
                else
                {
                    using (StreamWriter writer = new StreamWriter(Path))
                    {
                        writer.WriteLine(richTextBox1.Text);
                    }
                }
            }

            if (close)
            {
                this.Close();
                HelpClass.NotesChange = true;
            }
        }