Exemplo n.º 1
0
 public AboutForm(FileForm parent)
 {
     InitializeComponent();
     this.parent   = parent;
     this.KeyDown += new KeyEventHandler(handleKeyDown);
     loadStrings();
 }
Exemplo n.º 2
0
 public OpenForm(FileForm parent)
 {
     InitializeComponent();
     this.parent = parent;
     this.path   = System.IO.Directory.GetCurrentDirectory();
     setup();
 }
Exemplo n.º 3
0
 public OpenForm(FileForm parent, string path)
 {
     InitializeComponent();
     this.parent = parent;
     this.path   = path;
     setup();
 }
Exemplo n.º 4
0
 public SaveForm(FileForm parent, File file, bool exitApplicationAfterSaving)
 {
     InitializeComponent();
     this.exitApplicationAfterSaving = exitApplicationAfterSaving;
     this.parent = parent;
     this.file   = file;
     if (!file.IsNew())
     {
         saveFileDialog.FileName         = System.IO.Path.GetFileNameWithoutExtension(file.Path);
         saveFileDialog.InitialDirectory = System.IO.Path.GetDirectoryName(file.Path);
     }
     else
     {
         saveFileDialog.InitialDirectory = System.IO.Directory.GetCurrentDirectory();
     }
     this.KeyDown += new KeyEventHandler(handleKeyDown);
     loadStrings();
 }
Exemplo n.º 5
0
        public SettingsForm(FileForm parent)
        {
            InitializeComponent();
            this.parent = parent;
            //loading list of languages
            foreach (Settings.Language language in Enum.GetValues(typeof(Settings.Language)))
            {
                languageCombobox.Items.Add(language);
            }
            languageCombobox.SelectedItem = Settings.SelectedLanguage;

            //loading list of encrypters
            foreach (Encrypter encrypter in Encrypter.ENCRYPTERS)
            {
                encrypterComboBox.Items.Add(encrypter);
            }
            try
            {
                encrypterComboBox.SelectedItem = Settings.SelectedEncrypter;
            }
            catch (EncrypterException exception)
            {
                encrypterComboBox.SelectedItem = Encrypter.ENCRYPTERS[0];
                ShowError(
                    Settings.GetString(exception.Error) + "\n\n" +
                    exception.Source + "\n\n" +
                    Settings.GetString(this, String.CHOOSE_ENCRYPTER.ToString())
                    );
            }

            //loading clipboard timeout
            minutesNumeric.Value = Settings.ClipboardTimeout / 60; //total number of minutes
            secondsNumeric.Value = Settings.ClipboardTimeout % 60; //60 seconds in a minute
            this.KeyDown        += new KeyEventHandler(handleKeyDown);
            loadStrings();
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            CommandLine cl = new CommandLine(args);

            if (cl.DisplayUI() || cl.ReceivedNoArguments())
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                FileForm form = new FileForm();

                if (cl.HasErrors())
                {
                    form.ShowError(cl.ErrorMessages);
                }
                else
                {
                    try
                    {
                        //opening a file
                        if (cl.HasFile() && cl.HasDecryptInfo())
                        {
                            form.OpenFile(cl.File, cl.Password, cl.Encrypter);
                        }
                        else if (cl.HasFile())
                        {
                            form.CreateOpenForm(cl.File);
                        }
                        else if (cl.CreateNewFile())
                        {
                            form.OpenNewFile();
                        }
                        //fetching a field
                        if (cl.HasField())
                        {
                            form.CopyValueToClipboard(cl.Field);
                        }
                    }
                    catch (FileException e) { form.ShowError(Settings.GetString(e.Error)); }
                    catch (EncrypterException e) { form.ShowError(Settings.GetString(e.Error)); }
                }
                Application.Run(form);
            }
            else if (cl.HasFile() && cl.HasDecryptInfo())
            {
                if (cl.HasErrors())
                {
                    Clipboard.SetText(cl.ErrorMessages);
                }
                else
                {
                    try
                    {
                        File file = File.Open(cl.File, cl.Password, cl.Encrypter);
                        if (cl.HasField())
                        {
                            file.CopyToClipboard(cl.Field, Settings.ClipboardTimeout);
                        }
                    }
                    catch (FileException e) { Clipboard.SetText(Settings.GetString(e.Error)); }
                    catch (EncrypterException e) { Clipboard.SetText(Settings.GetString(e.Error)); }
                }
            }
        }