Пример #1
0
        public SettingsForm()
        {
            InitializeComponent();
            m_strDesktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            string strIniPath = System.IO.Path.Combine(m_strDesktopPath, IniConstants.CONST_SECTION);

            m_strIniFile           = System.IO.Path.Combine(strIniPath, IniConstants.CONST_INIFILENAME);
            data.strScreenshotPath = System.IO.Path.Combine(strIniPath, IniConstants.CONST_SCREENS);
            ini = new IniHandler();

            if (!Directory.Exists(strIniPath))
            {
                DirectoryInfo di = Directory.CreateDirectory(data.strScreenshotPath);
                di.Attributes        = FileAttributes.Directory | FileAttributes.Hidden;
                cbShowWord.Checked   = false;
                cbSaveWord.Checked   = false;
                cbSavePDF.Checked    = false;
                cbSavePNG.Checked    = false;
                cbAddCaption.Checked = false;
                cbAddTitle.Checked   = false;
            }
            else
            {
                if (File.Exists(m_strIniFile))
                {
                    data = ini.readIni();
                }
                else
                {
                    if (tbOutputPath.Text.Length == 0)
                    {
                        tbOutputPath.Text  = m_strDesktopPath;
                        data.strOutputPath = m_strDesktopPath;
                    }
                    if (tbScreenshotPath.Text.Length == 0)
                    {
                        tbScreenshotPath.Text = data.strScreenshotPath;
                    }
                    cbAddCaption.Checked = false;
                    cbAddTitle.Checked   = false;
                    cbSavePDF.Checked    = false;
                    cbSavePNG.Checked    = false;
                    cbSaveWord.Checked   = false;
                    cbShowWord.Checked   = false;

                    data.bAddCaption = false;
                    data.bAddTitle   = false;
                    data.bSavePDF    = false;
                    data.bSavePNG    = false;
                    data.bSaveWord   = false;
                    data.bShowWord   = false;

                    ini.writeIni(data);
                }
            }
        }
Пример #2
0
 private void Capture_Click(object sender, EventArgs e)
 {
     if (m_bSettingsOpened)
     {
         ini.readIni();
         m_bSettingsOpened = false;
     }
     btnSettings.Enabled = false;
     this.Hide();
     saveScreenshot(data.strScreenshotPath);
     this.Show();
 }
Пример #3
0
        public CaptureTool()
        {
            InitializeComponent();
            ini = new IniHandler();
            string strDesktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            string strPath        = System.IO.Path.Combine(strDesktopPath, IniConstants.CONST_SECTION);

            m_strIniFile       = System.IO.Path.Combine(strPath, IniConstants.CONST_INIFILENAME);
            data.strOutputPath = strDesktopPath;
            m_bSettingsOpened  = false;

            if (!Directory.Exists(strPath))
            {
                DirectoryInfo di = Directory.CreateDirectory(strPath);
                di.Attributes          = FileAttributes.Directory | FileAttributes.Hidden;
                data.strScreenshotPath = System.IO.Path.Combine(strPath, IniConstants.CONST_SCREENS);
            }
            else
            {
                if (File.Exists(m_strIniFile))
                {
                    data = ini.readIni();
                }
                else
                {
                    data.bAddCaption       = false;
                    data.bAddTitle         = false;
                    data.bSaveWord         = false;
                    data.bShowWord         = false;
                    data.bSavePDF          = false;
                    data.bSavePNG          = false;
                    data.strScreenshotPath = System.IO.Path.Combine(strPath, IniConstants.CONST_SCREENS);
                }
            }
            m_Files    = new Queue <string>();
            m_Captions = new Queue <string>();
        }