예제 #1
0
        void menuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menu = (ToolStripMenuItem)sender;

            Variables.Filenames.Clear();
            Variables.Filenames.Add(menu.Text);
            RecentFiles.SaveRecentFiles();
            btnGo.Enabled = true;
        }
예제 #2
0
        internal static bool DecryptFile()
        {
#if DRM
            try
            {
                if (Properties.Settings.Default.Decrypt && IsEncrypted && !FileDecrypted)
                {
                    FolderBrowserDialog save = new FolderBrowserDialog();
                    save.Description = "Please select the folder to save the Decrypted files into.";

                    if (string.IsNullOrEmpty(SaveDirectory))
                    {
                        if (save.ShowDialog() == DialogResult.OK)
                        {
                            SaveDirectory = save.SelectedPath;
                        }
                        else
                        {
                            return(false);
                        }
                    }

                    string NewFilePath = Path.Combine(SaveDirectory, Variables.BookName);
                    if (File.Exists(NewFilePath) &&
                        MessageBox.Show("File Already Exists, Do you want to replace it?\n\"" + Variables.BookName + "\"",
                                        "File Exists", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
                    {
                        return(false);
                    }

                    string ProtectedFilePath = Variables.Filename;
                    Variables.Filename = NewFilePath;
                    Variables.Filenames[Variables.Filenames.IndexOf(ProtectedFilePath)] = NewFilePath;
                    using (new HourGlass())
                    {
                        FileDecrypted = Drm.Adept.Epub.Strip(ProtectedFilePath, NewFilePath);
                        if (FileDecrypted)
                        {
                            Properties.Settings.Default.RecentFiles2 = Properties.Settings.Default.RecentFiles2.AddSettings(NewFilePath);
                            RecentFiles.SaveRecentFiles();
                        }
                        return(FileDecrypted);
                    }
                }
                return(false);
            }
            catch (Exception e)
            {
                FileDecrypted = false;
                MessageBox.Show("File could not be decrypted\n" + e.Message, "Decryption Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
#else
            return(false);
#endif
        }
예제 #3
0
 private void SelectFolders()
 {
     if (folderBrowser.ShowDialog() == DialogResult.OK)
     {
         Variables.Filenames.Clear();
         string[] files = Directory.GetFiles(folderBrowser.SelectedPath, "*.epub", SearchOption.AllDirectories);
         Variables.Filenames.AddRange(files);
         RecentFiles.SaveRecentFiles();
         btnGo.Enabled = true;
     }
 }
예제 #4
0
 private void SelectFiles()
 {
     openFileDialog1.Filter      = ".epub | *.epub";
     openFileDialog1.Multiselect = true;
     openFileDialog1.FileName    = "";
     if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         Variables.Filenames.Clear();
         string[] files = openFileDialog1.FileNames;
         Variables.Filenames.AddRange(files);
         RecentFiles.SaveRecentFiles();
         btnGo.Enabled = true;
     }
 }
예제 #5
0
        private static void GetArgument(string[] args)
        {
            foreach (string item in args)
            {
                //Argument is a directory search for epub
                if (Directory.Exists(item))
                {
                    Variables.Filenames.AddRange(Directory.GetFiles(item, "*.epub", SearchOption.AllDirectories));
                }
                else
                {
                    if (Path.GetExtension(item) == ".epub")
                    {
                        Variables.Filenames.Add(item);
                    }
                }
            }

            RecentFiles.SaveRecentFiles();
        }