Exemplo n.º 1
0
        public bool CheckWindowsRestorePointisCreated()
        {
            string restorePointNr = "";
            bool   check          = false;

            try
            {
                foreach (string str in GetScriptHandling.GetWindowsRestorePoints())
                {
                    if (str.Contains(_restorePointDescription))
                    {
                        string[] splitStr = str.Split(' ');
                        restorePointNr = splitStr[0];
                        check          = true;
                        string path = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\ConfigFiles\restorePoint.inf";
                        File.Delete(path);
                        FileHandling fh = new FileHandling();
                        fh.CreateFile(path);
                        fh.AddLineToEndFile(path, restorePointNr);
                    }
                }
            }
            catch (Exception ex)
            {
                Actemium.Diagnostics.Trace.WriteError("({0})", "Check Windows Restore Point is created", CLASSNAME, ex);

                ErrorList.Add(new ConfigErrors(CLASSNAME, "Check Windows Restore Point is created", ex.Message));
            }
            return(check);
        }
Exemplo n.º 2
0
        public void RestoreSettings()
        {
            MessageBoxButtons buttons = MessageBoxButtons.OKCancel;
            DialogResult      result;

            result = MessageBox.Show("Windows will restore your system to the state it was before adding the security settings. \n Before you proceed, save any open files and close all programs", "System restore", buttons);

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                FileHandling fileHandling = new FileHandling();
                string       path         = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\ConfigFiles\restorePoint.inf";
                string       restorPoint  = fileHandling.ReadWholeFile(path)[0];
                GetScriptHandling.RestoreSettings(restorPoint);
            }
        }
Exemplo n.º 3
0
        public void CreateWindowsRestorePoint()
        {
            try
            {
                string   time;
                DateTime dt     = DateTime.Now;
                string   hour   = "";
                string   minute = "";
                string   second = "";
                if (dt.Hour < 10)
                {
                    hour = "0" + dt.Hour.ToString();
                }
                else
                {
                    hour = dt.Hour.ToString();
                }

                if (dt.Minute < 10)
                {
                    minute = "0" + dt.Minute.ToString();
                }
                else
                {
                    minute = dt.Minute.ToString();
                }

                if (dt.Second < 10)
                {
                    second = "0" + dt.Second.ToString();
                }
                else
                {
                    second = dt.Second.ToString();
                }
                time = (hour + "." + minute + "." + second + " hr");
                _restorePointDescription = "Actemium Security Checklist Application " + time;
                GetScriptHandling.CreateWindowsRestorePoint(_restorePointDescription);
            }
            catch (Exception ex)
            {
                Actemium.Diagnostics.Trace.WriteError("({0})", "Create Windows Restore Point", CLASSNAME, ex);
                ErrorList.Add(new ConfigErrors(CLASSNAME, "Create Windows Restore Point", ex.Message));
            }
        }