Exemplo n.º 1
0
        public static bool SetSettingValueFromFile()
        {
            StreamReader streamReader = (StreamReader)null;

            try
            {
                string path = Path.Combine("C:\\Users", Environment.UserName, "AppData\\Local\\ScreenShot", "Save.txt");
                if (!File.Exists(path))
                {
                    return(false);
                }
                streamReader = new StreamReader(path);
                string str = streamReader.ReadLine();
                streamReader.Close();
                if (str == null)
                {
                    ScreenShortClass.SaveSettingValueToFile();
                    return(true);
                }
                string[] strArray = str.Split("|".ToCharArray());
                if (strArray.Length != 3)
                {
                    return(false);
                }
                Settings.Default.SleepTime       = Convert.ToInt32(strArray[0]);
                Settings.Default.SaveToClipboard = Convert.ToBoolean(strArray[1]);
                Settings.Default.PenWidth        = Convert.ToInt32(strArray[2]);
                return(true);
            }
            catch (Exception ex)
            {
                streamReader?.Close();
                return(false);
            }
        }
Exemplo n.º 2
0
        private void pictureBox5_Click(object sender, EventArgs e)
        {
            string ErrorMsg = string.Empty;

            if (!ScreenShortClass.CaptureScreenShort((Form)this, this.saveFileDialogImage, out ErrorMsg))
            {
                int num = (int)new ConformationUnSuccessfull().ShowDialog();
            }
            else if (!ErrorMsg.Contains("ok"))
            {
                new ConformationSucess().Show();
            }
        }
Exemplo n.º 3
0
 public static bool LoadFromFile()
 {
     try
     {
         string str = Path.Combine("C:\\Users", Environment.UserName, "AppData\\Local", "ScreenShot");
         Directory.CreateDirectory(str);
         if (File.Exists(Path.Combine(str, "Save.txt")))
         {
             ScreenShortClass.SetSettingValueFromFile();
         }
         else
         {
             ScreenShortClass.SaveSettingValueToFile();
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Exemplo n.º 4
0
 private void ScreenCapture_Load(object sender, EventArgs e) => ScreenShortClass.LoadFromFile();