コード例 #1
0
        //********* Load App Monitoring *********
        public static List <ApplicationInfo> LoadAppMonitoring(string name)
        {
            List <ApplicationInfo> appinfo = new List <ApplicationInfo>();

            try
            {
                SaveWriter save = new SaveWriter();
                if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/MonitoringReports/App/" + name + ".apprep"))
                {
                    save = new SaveWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/MonitoringReports/App/" + name + ".apprep");
                    save.Load();
                    for (int i = 0; i < save.GetItemInt("Count"); i++)
                    {
                        ApplicationInfo inf = new ApplicationInfo(save.GetItem("Title_" + i), save.GetItem("Module_" + i));
                        inf.SetTime(save.GetItemInt("TimeHours_" + i), save.GetItemInt("TimeMin_" + i));
                        appinfo.Add(inf);
                    }
                    PCHour = save.GetItemInt("PCTimeHour");
                    PCMin  = save.GetItemInt("PCTimeMinutes");
                    save.Destroy();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("" + ex);
                return(appinfo);
            }
            return(appinfo);
        }
コード例 #2
0
ファイル: Service1.cs プロジェクト: yuktisatheesh/My-Spy
        //---------- Save App Monitoring ----------



        //********* Load App Monitoring *********
        void LoadAppMonitoring()
        {
            try
            {
                Directory.CreateDirectory(PathMS + "/MonitoringReports/App/");
                if (File.Exists(PathMS + "/MonitoringReports/App/" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ".apprep"))
                {
                    save = new SaveWriter(PathMS + "/MonitoringReports/App/" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ".apprep");
                    save.Load();
                    for (int i = 0; i < save.GetItemInt("Count"); i++)
                    {
                        ApplicationInfo inf = new ApplicationInfo(save.GetItem("Title_" + i), save.GetItem("Module_" + i));
                        inf.SetTime(save.GetItemInt("TimeHours_" + i), save.GetItemInt("TimeMin_" + i));
                        appinfo.Add(inf);
                    }

                    PCHour = save.GetItemInt("PCTimeHour");
                    PCMin  = save.GetItemInt("PCTimeMinutes");
                    save.Destroy();
                }
            }
            catch (Exception ex)
            {
                DebugService.WriteError("" + ex);
            }
        }
コード例 #3
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();
        }
コード例 #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            notifyIcon1.MouseClick += notifyIcon1_MouseClick;

            NotifyText  = notifyIcon1.Text;
            MinutesText = labelremtime.Text;

            if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Block/ComputerTime.dat"))
            {
                SaveWriter save = new SaveWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Block/ComputerTime.dat");
                save.Load();

                if (save.GetItemBool("Enable"))
                {
                    Time = save.GetItemInt("WarningTime");
                    labelremtime.Text = "" + Time + " " + MinutesText;
                    notifyIcon1.Text  = NotifyText + " " + Time + " " + MinutesText;
                }

                save.Destroy();
            }
            else
            {
                Application.Exit();
            }


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

            try
            {
                SoundPlayer player = new SoundPlayer(Properties.Resources.warning);
                player.Play();
            }catch (Exception ex)
            {
            }

            try
            {
                IntPtr lHwnd = FindWindow("Shell_TrayWnd", null);
                SendMessage(lHwnd, WM_COMMAND, (IntPtr)MIN_ALL, IntPtr.Zero);
                WindowState = FormWindowState.Normal;
            }
            catch (Exception ex)
            {
            }
        }
コード例 #5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            day = DateTime.Now.Day;

            keylogger = bool.Parse((string)registry.GetValue("Keylogger", "False"));

            internet = bool.Parse((string)registry.GetValue("Internet", "False"));

            if (keylogger)
            {
                ShowWarning();
            }

            if (internet)
            {
                try
                {
                    RegistryKey registryi = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
                    registryi.SetValue("ProxyEnable", 1);
                    registryi.SetValue("ProxyServer", "127.0.0.1:8333");

                    InternetReports.BlockSites       = bool.Parse((string)registry.GetValue("InternetBlockList", "False"));
                    InternetReports.BlockSocialSites = bool.Parse((string)registry.GetValue("InternetBlockSocial", "False"));

                    if (InternetReports.BlockSites)
                    {
                        if (File.Exists(PathMS + "/Block/BlockWebsites.dat"))
                        {
                            SaveWriter set = new SaveWriter(PathMS + "/Block/BlockWebsites.dat");
                            set.Load();
                            for (int i = 0; i < set.GetItemInt("Count"); i++)
                            {
                                InternetReports.WebBlock.Add(set.GetItem("Website" + i));
                            }
                        }
                    }

                    Directory.CreateDirectory(PathMS + "/MonitoringReports/Internet/");

                    InternetReports.save = new StreamWriter(PathMS + "/MonitoringReports/Internet/" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ".dat", true);

                    int port = 8333;
                    //const bool bUseIPv6 = false;

                    TcpServer Server = new TcpServer(port, false);

                    Server.Start(TransparentProxy.CreateProxy);
                }catch (Exception ex)
                {
                    Debug.WriteLine("" + ex);
                }
            }
        }
コード例 #6
0
ファイル: Service1.cs プロジェクト: yuktisatheesh/My-Spy
        //----- Start Worker -----



        //********  Work With Running Applications ********
        //Skontroluje spustene aplikacie
        void WorkWithRunningApplications()
        {
            if (day != ((short)DateTime.Now.Day))
            {
                PCHour = 0;
                PCMin  = 0;
                appinfo.Clear();
                day = (short)DateTime.Now.Day;
            }

            if (File.Exists(PathMS + "/Temp/appreport.dat"))
            {
                try
                {
                    save.Destroy();
                    save = new SaveWriter(PathMS + "/Temp/appreport.dat");
                    save.Load();
                    int count = save.GetItemInt("Count");
                    for (int i = 0; i < count; i++)
                    {
                        bool   found      = false;
                        string executable = save.GetItem("Module_" + i);
                        for (int j = 0; j < appinfo.Count; j++)
                        {
                            if (appinfo[j].ExecutableName.Equals(executable))
                            {
                                found = true;
                                appinfo[j].AddTime(5);
                            }
                        }

                        if (!found)
                        {
                            appinfo.Add(new ApplicationInfo(save.GetItem("Title_" + i), executable));
                        }
                    }
                    save.Destroy();
                }
                catch (Exception ex)
                {
                    ApplicationLoader.PROCESS_INFORMATION procInfos;
                    ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/GetRunningApplications.exe", out procInfos);
                    DebugService.WriteError("Bad load data:   " + ex);
                    return;
                }
            }

            ApplicationLoader.PROCESS_INFORMATION procInfo;
            ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/GetRunningApplications.exe", out procInfo);
        }
コード例 #7
0
ファイル: Service1.cs プロジェクト: yuktisatheesh/My-Spy
        //---------- Load App Monitoring ----------



        void LoadStatistics()
        {
            try
            {
                if (File.Exists(PathMS + "/Stats/Today.sts"))
                {
                    SaveWriter save = new SaveWriter(PathMS + "/Stats/Today.sts");
                    save.Load();
                    if (save.GetItemInt("Day") == DateTime.Now.Day)
                    {
                        allhour = save.GetItemInt("Hours");
                        allmin  = save.GetItemShort("Mins");
                    }
                }
            }catch (Exception ex)
            {
                DebugService.WriteError("" + ex);
            }
        }
コード例 #8
0
ファイル: NoteForm.cs プロジェクト: yuktisatheesh/My-Spy
        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)
            {
            }
        }
コード例 #9
0
ファイル: NoteForm.cs プロジェクト: yuktisatheesh/My-Spy
        private void NoteForm_Load(object sender, EventArgs e)
        {
            if (remindshow)
            {
                TopMost = true;
            }

            this.Paint    += NoteForm_Paint;
            labelText.Text = File.ReadAllText(Path);
            pthspc         = Path.Replace(".note", ".notesp");

            save = new SaveWriter(pthspc);
            save.Load();
            password = save.GetItemBool("Password");

            tt.InitialDelay = 10;
            if (save.GetItemBool("Warn"))
            {
                imageButtonAlert.Visible     = true;
                imageButtonAlert.MouseHover += PictureBoxAlert_MouseHover;
            }


            if (password)
            {
                groupBox1.Visible = true;
            }


            if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/FavoriteNote.dat"))
            {
                if (File.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/FavoriteNote.dat").Equals(Path))
                {
                    FavoriteClick = true;
                    imageButtonfavorite.normalImage = Properties.Resources.starfull;
                    imageButtonfavorite.NormalImage = Properties.Resources.starfull;
                    imageButtonfavorite.HoverImage  = Properties.Resources.starfullhover;
                    imageButtonfavorite.ClickImage  = Properties.Resources.starfullclick;
                }
            }
        }
コード例 #10
0
        private void AddNote_Load(object sender, EventArgs e)
        {
            if (Edit)
            {
                SaveWriter save = new SaveWriter(SPath);
                save.Load();
                richTextBox1.Text = File.ReadAllText(Path);
                this.Text         = ResourcesFiles.ProgramStrings.EditNote;
                button2.Text      = ResourcesFiles.ProgramStrings.EditNote;
                this.Icon         = Properties.Resources.noteediticon;

                dateTimePicker1.Value = DateTime.Parse(save.GetItem("WarnTimeDate"));
                dateTimePicker2.Value = DateTime.Parse(save.GetItem("WarnTimeDate"));
                Createdate            = DateTime.Parse(save.GetItem("DateofCreate"));

                checkBox1.Checked = save.GetItemBool("Warn");
                checkBox2.Checked = save.GetItemBool("Password");

                save.Clear();

                //dateTimePicker1.Value = DateTime.Parse(save.GetItem("WarnTimeDate"));
            }
        }
コード例 #11
0
ファイル: Service1.cs プロジェクト: yuktisatheesh/My-Spy
        //------------- On Start ---------------


        //******* Get notice ********
        void ReadNotice()
        {
            notice.Clear();
            try
            {
                Directory.CreateDirectory(PathMS + "/Temp/");

                if (File.Exists(PathMS + "/Temp/Rnotes.dat"))
                {
                    SaveWriter save = new SaveWriter(PathMS + "/Temp/Rnotes.dat");
                    save.Load();
                    int cnt = save.GetItemInt("Count");

                    for (int i = 0; i < cnt; i++)
                    {
                        notice.Add(new NoteRemind(save.GetItem("NotePath" + i), DateTime.Parse(save.GetItem("NoteDate" + i))));
                    }
                    //notice.Add
                }
            }catch (Exception ex)
            {
                DebugService.WriteError("" + ex);
            }
        }
コード例 #12
0
ファイル: Service1.cs プロジェクト: yuktisatheesh/My-Spy
        void SetRemainingPCTime()
        {
            if (!ShutDownVerify)
            {
                bool custommaxtimepc = false;

                if (File.Exists(PathMS + "/Block/RemTime.dat"))
                {
                    save = new SaveWriter(PathMS + "/Block/RemTime.dat");
                    save.Load();
                    if (save.GetItemInt("Day") == DateTime.Now.Day)
                    {
                        MaxTimePC       = save.GetItemInt("Time");
                        custommaxtimepc = true;
                    }
                    else
                    {
                        File.Delete(PathMS + "/Block/RemTime.dat");
                    }
                }

                if (File.Exists(PathMS + "/Block/ComputerTime.dat"))
                {
                    SaveWriter save = new SaveWriter(PathMS + "/Block/ComputerTime.dat");
                    save.Load();

                    if (save.GetItemBool("Enable"))
                    {
                        PCTime = true;

                        DateTime time = DateTime.Parse(save.GetItem("Time"));

                        if (!custommaxtimepc)
                        {
                            MaxTimePC = (time.Hour * 60) + time.Minute;
                        }

                        warning     = save.GetItemBool("Warning");
                        warningtime = save.GetItemInt("WarningTime");

                        if (MaxTimePC <= 1)
                        {
                            if (File.Exists(PathMS + "/Temp/ExpiredTime.dat"))
                            {
                                File.Delete(PathMS + "/Temp/ExpiredTime.dat");
                            }

                            File.WriteAllText(PathMS + "/Temp/ExpiredTime.dat", "" + DateTime.Now.Day);
                            PCTime         = false;
                            ShutDownVerify = true;
                            ApplicationLoader.PROCESS_INFORMATION procInfo;
                            ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/VerifyUser.exe", out procInfo);
                        }
                    }

                    save.Destroy();
                }
                else
                {
                    PCTime = false;
                }
            }
        }
コード例 #13
0
        private void backgroundWorkerWeather_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                bool showw = bool.Parse(HelpClass.GETHtml("http://myspy.diodegames.eu/ShowWeather.txt"));

                if (showw)
                {
                    SaveWriter Loc = new SaveWriter(PathMS + "/Temp/location.dat");
                    Loc.Load();
                    string Latitude = "", Longtitude = "", CityName = "";

                    Latitude   = Loc.GetItem("Latitude");
                    Longtitude = Loc.GetItem("Longtitude");
                    CityName   = Loc.GetItem("City");


                    if (File.Exists(PathMS + "/Temp/weather.dat"))
                    {
                        SaveWriter save = new SaveWriter(PathMS + "/Temp/weather.dat");
                        save.Load();

                        if (save.GetItemInt("Day") != DateTime.Now.Day || DateTime.Now.Hour >= save.GetItemInt("Hour") + 3)
                        {
                            Debug.WriteLine("New Weather: Day: " + save.GetItemInt("Day") + "   Hour: " + save.GetItemInt("Hour"));
                            NewWeather(Latitude, Longtitude, CityName);
                        }
                        else
                        {
                            Debug.WriteLine("Weather from file");
                            weather.weatherinfo.Temperature = save.GetItem("Temperature");
                            weather.weatherinfo.Cloudiness  = save.GetItem("Clouds");
                            weather.weatherinfo.CityName    = save.GetItem("City");
                            weathericon = (Bitmap)Bitmap.FromFile(PathMS + "/Temp/weathericon.dat");

                            SaveWriter wsave = new SaveWriter(PathMS + "/Temp/weathersettings.dat");
                            wsave.Load();
                            bool wunit = wsave.GetItemBool("Unit");

                            if (wunit)
                            {
                                weather.weatherinfo.TemperatureUnit = "F";
                            }
                            else
                            {
                                weather.weatherinfo.TemperatureUnit = "C";
                            }

                            backgroundWorkerWeather.ReportProgress(0, "");
                        }
                    }
                    else
                    {
                        Debug.WriteLine("New Weather because file not found");
                        NewWeather(Latitude, Longtitude, CityName);
                    }
                }
            }catch (Exception ex)
            {
                Debug.WriteLine("" + ex);
            }
        }
コード例 #14
0
ファイル: Form1.cs プロジェクト: yuktisatheesh/My-Spy
        private void Form1_Load(object sender, EventArgs e)
        {
            if (!File.Exists(PathMS + "/Settings/chat.dat"))
            {
                MessageBox.Show("Login or register to continue.", "Not logged in");
                RegisterLoginForm frm = new RegisterLoginForm();
                frm.Show();
            }
            else
            {
                SaveWriter save = new SaveWriter(PathMS + "/Settings/chat.dat");

                save.Load();
                string usr  = save.GetItem("Username");
                string pass = encryptpass.DecryptString(save.GetItem("Password"), "1cPOnaLrV2MusS4Cq3aU6dja");

                Administrator = save.GetItemBool("Admin");


                if (Administrator)
                {
                    label1.Visible = true;
                }



                if (Administrator)
                {
                    ReceiverJID = usr + "@" + XmppConnection.Server;
                    usr         = "******" + usr;
                }
                else
                {
                    ReceiverJID = "Admin_" + usr + "@" + XmppConnection.Server;
                }


                //connection.Login(usr, pass);
                //connection.Connect();


                connection.ConnectToXMPPIM(usr, pass);

                /*
                 * XmppIm xmppim = new XmppIm("", "", "");
                 * xmppim;*/

                //Debug.WriteLine(connection.GetXmppClient().Authenticated);
                //Debug.WriteLine(connection.IsConnected());

                Debug.WriteLine("Connected as " + connection.GetXmppIm().Jid);
                connection.GetXmppIm().Message += Connection_Message;


                Debug.WriteLine("Size: " + connection.Rostersize());
                connection.AddToRoster(ReceiverJID);

                connection.GetXmppIm().RequestSubscription(ReceiverJID);
                connection.ApproveRequest(ReceiverJID);

                connection.GetXmppIm().Status += Connection_Status;


                Debug.WriteLine("ReceiverJID: " + ReceiverJID);
            }

            /*
             * RegisterLoginForm frm = new RegisterLoginForm();
             * frm.Show();
             */
        }
コード例 #15
0
ファイル: Service1.cs プロジェクト: yuktisatheesh/My-Spy
        //********* ONSTART ***********
        protected override void OnStart(string[] args)
        {
            DebugService.Write("*******   " + DateTime.Now + "   ********");
            DebugService.Write("Start");

            //nacitaju sa nastavenia
            MonApp    = bool.Parse((string)registry.GetValue("MonitorApplications", "False"));
            Keylogger = bool.Parse((string)registry.GetValue("Keylogger", "False"));
            StatsEn   = bool.Parse((string)registry.GetValue("Statistics", "True"));
            Internet  = bool.Parse((string)registry.GetValue("Internet", "False"));

            DebugService.Write("Monitoring Applications: " + MonApp + "  Keylogger: " + Keylogger + "  Statistics: " + StatsEn);


            day      = (short)DateTime.Now.Day;
            RestartD = DateTime.Now.Day;

            //kazdych 5 minut
            timer1          = new System.Timers.Timer();
            timer1.Elapsed += new ElapsedEventHandler(OnTimer1_Tick);
            timer1.Interval = 300000;
            timer1.Enabled  = true;

            //kazdu minutu
            timer2          = new System.Timers.Timer();
            timer2.Elapsed += new ElapsedEventHandler(OnTimer2_Tick);
            timer2.Interval = 60000;
            timer2.Enabled  = true;


            //timer pre odosielanie dat na Web - 20 minut
            timerWeb          = new System.Timers.Timer();
            timerWeb.Elapsed += new ElapsedEventHandler(OnTimerWeb_Tick);
            timerWeb.Interval = 1200000;
            timerWeb.Enabled  = true;

            if (File.Exists(PathMS + "/Temp/ExpiredTime.dat"))
            {
                short TimeDay = short.Parse(File.ReadAllText(PathMS + "/Temp/ExpiredTime.dat"));
                if (TimeDay == day)
                {
                    ShutDownVerify = true;
                    ApplicationLoader.PROCESS_INFORMATION procInfo;
                    ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/VerifyUser.exe", out procInfo);
                }
                else
                {
                    ShutDownVerify = false;
                    File.Delete(PathMS + "/Temp/ExpiredTime.dat");
                }
            }


            if (MonApp)
            {
                ApplicationLoader.PROCESS_INFORMATION procInfo;
                ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/GetRunningApplications.exe", out procInfo);

                LoadAppMonitoring();
            }


            if (Keylogger || Internet)
            {
                StartWorker();
            }


            if (StatsEn)
            {
                LoadStatistics();
            }


            ReadNotice();

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


            SetRemainingPCTime();

            if (File.Exists(PathMS + "/Block/BlockApps.dat"))
            {
                SaveWriter set = new SaveWriter(PathMS + "/Block/BlockApps.dat");
                set.Load();
                BlockApps = set.GetItemBool("Enabled");
                for (int i = 0; i < set.GetItemInt("Count"); i++)
                {
                    blockapplist.Add(set.GetItem("Pr" + i));
                }
            }

            DebugService.Write("PCTime: " + PCTime);



            client.BaseAddress = new Uri("http://myspy.diodegames.eu");


            Newtonsoft.Json.Serialization.DefaultContractResolver dcr = new Newtonsoft.Json.Serialization.DefaultContractResolver();
            dcr.DefaultMembersSearchFlags |= System.Reflection.BindingFlags.NonPublic;
            jss.ContractResolver           = dcr;
        }
コード例 #16
0
ファイル: Service1.cs プロジェクト: yuktisatheesh/My-Spy
        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()
コード例 #17
0
        //***** Nacitanie Formu
        private void Form1_Load(object sender, EventArgs e)
        {
            //Nacitam si vlastny font
            try
            {
                prfontc = new PrivateFontCollection();

                prfontc.AddFontFile(AppDomain.CurrentDomain.BaseDirectory + "/Resources/font.ttf");

                fontsmall  = new Font(prfontc.Families[0], 14.0F);
                fontmedium = new Font(prfontc.Families[0], 15.0F);
                font       = new Font(prfontc.Families[0], 18.0F);
                fontbig    = new Font(prfontc.Families[0], 26.0F);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                fontsmall  = new Font(label1.Font.FontFamily, 14.0F);
                fontmedium = new Font(label1.Font.FontFamily, 15.0F);
                font       = new Font(label1.Font.FontFamily, 18.0F);
                fontbig    = new Font(label1.Font.FontFamily, 26.0F);
            }


            try
            {
                if (registry == null)
                {
                    Process.Start(AppDomain.CurrentDomain.BaseDirectory + "/Apps/Welcome.exe");
                    Application.Exit();
                }
                else
                {
                    if (registry.GetValue("Properties", null) == null)
                    {
                        Process.Start(AppDomain.CurrentDomain.BaseDirectory + "/Apps/Welcome.exe");
                        Application.Exit();
                    }
                }
            }catch (Exception ex)
            {
                Debug.WriteLine("" + ex);
                Application.Exit();
            }


            pictureBox3.MouseEnter += PictureBox3_MouseEnter;
            pictureBox3.MouseLeave += PictureBox3_MouseLeave;
            pictureBox4.MouseEnter += PictureBox4_MouseEnter;
            pictureBox4.MouseLeave += PictureBox4_MouseLeave;
            pictureBox5.MouseDown  += PictureBox5_MouseDown;
            pictureBox5.MouseUp    += PictureBox5_MouseUp;

            ImageList tabimage = new ImageList();

            tabimage.Images.Add("img1", Properties.Resources.home);
            tabimage.Images.Add("img2", Properties.Resources.login);
            tabimage.Images.Add("img3", Properties.Resources.task);

            tabControl1.ImageList            = tabimage;
            tabControl1.TabPages[0].ImageKey = "img1";
            tabControl1.TabPages[1].ImageKey = "img3";
            tabControl1.TabPages[2].ImageKey = "img2";

            label2.Font  = fontbig;
            button1.Font = font;

            backgroundWorker1.ProgressChanged       += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
            backgroundWorkerWeather.ProgressChanged += new ProgressChangedEventHandler(BackgroundWorkerWeather_ProgressChanged);

            try {
                if (File.Exists(PathMS + "/Temp/secure.pas"))
                {
                    File.Delete(PathMS + "/Temp/secure.pas");
                }
            } catch (Exception exc)
            {
                Debug.WriteLine(exc);
            }

            AddNotesToPanel();

            backgroundWorkerWeather.RunWorkerAsync();

            textBoxPassword.KeyDown += new KeyEventHandler(TextBoxPassword_KeyPress);

            new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;

                try
                {
                    if (File.Exists(PathMS + "/Temp/FavoriteNote.dat"))
                    {
                        string pathn = File.ReadAllText(PathMS + "/Temp/FavoriteNote.dat");

                        string shorttext = "";

                        using (StreamReader str = new StreamReader(pathn))
                        {
                            for (int i = 0; i < 91; i++)
                            {
                                int ch = str.Read();
                                if (str.EndOfStream)
                                {
                                    break;
                                }

                                shorttext += (char)ch;
                            }
                        }

                        noteMain.SetNoteText(shorttext);

                        noteMain.Tag    = pathn;
                        noteMain.Click += new EventHandler(this.Note_Click);

                        this.Invoke((MethodInvoker) delegate
                        {
                            panelNote.Visible = true;
                        });
                    }


                    if (File.Exists(PathMS + "/Block/BlockApps.dat"))
                    {
                        SaveWriter set = new SaveWriter(PathMS + "/Block/BlockApps.dat");
                        set.Load();

                        if (set.GetItemBool("Enabled"))
                        {
                            set.Destroy();
                            set.PathToFile = PathMS + "/Block/RemTime.dat";
                            if (File.Exists(PathMS + "/Block/RemTime.dat"))
                            {
                                set.Load();
                                int timerem = set.GetItemInt("Time");
                                int hrs     = 0, mns = 0;
                                if (timerem > 0)
                                {
                                    hrs = (int)Math.Floor((decimal)(timerem / 60));
                                    mns = (timerem - (hrs * 60));
                                }

                                this.Invoke((MethodInvoker) delegate
                                {
                                    panelRemTime.Visible = true;

                                    if (timerem > 0)
                                    {
                                        labelRemTime.Text = hrs.ToString("00") + ":" + mns.ToString("00");
                                    }
                                });
                            }
                        }
                    }



                    if (bool.Parse("" + registrysettings.GetValue("Statistics", false)))
                    {
                        if (File.Exists(PathMS + "/Stats/Today.sts"))
                        {
                            SaveWriter svs = new SaveWriter(PathMS + "/Stats/Today.sts");
                            svs.Load();
                            string time = svs.GetItemInt("Hours").ToString("00") + ":" + svs.GetItemInt("Mins").ToString("00");
                            svs.Destroy();

                            bool month     = false;
                            string monthav = "";

                            if (File.Exists(PathMS + "/Stats/Month.sts"))
                            {
                                month          = true;
                                svs.PathToFile = PathMS + "/Stats/Month.sts";
                                svs.Load();
                                int avgh    = ((svs.GetItemInt("Hours") * 60) + svs.GetItemInt("Mins")) / svs.GetItemInt("Divide");
                                int hour    = (int)Math.Floor((decimal)(avgh / 60));
                                int minutes = (avgh - (hour * 60));
                                monthav     = hour.ToString("00") + ":" + minutes.ToString("00");
                                svs.Destroy();
                            }

                            this.Invoke((MethodInvoker) delegate
                            {
                                panelTime.Visible = true;
                                label8.Text       = time;
                                label10.Text      = monthav;
                            });
                        }
                    }
                }catch (Exception ex)
                {
                    Debug.WriteLine("" + ex);
                }
            }).Start();
            //koniec threadu


            if (File.Exists(PathMS + "/Settings/chat.dat"))
            {
                longButtonchat.Visible = true;
            }

            bool keylogger = false;

            try
            {
                keylogger = bool.Parse((string)registrysettings.GetValue("Keylogger", "false"));
            }
            catch
            {
                keylogger = false;
            }

            panel3.Visible = keylogger;

            label4.Font       = fontmedium;
            labelRemTime.Font = fontsmall;
            label5.Font       = font;
            label8.Font       = fontsmall;
            label9.Font       = font;
            label10.Font      = fontsmall;
            label11.Font      = fontmedium;
        }//----- Form 1 Load -----