예제 #1
0
        private string ExtractNotes(string notebook)
        {
            if (cancelled)
            {
                return(null);
            }
            syncStep = SyncStep.ExtractNotes;

            ENScriptWrapper enscript = new ENScriptWrapper();

            enscript.ENScriptPath = enscriptpath;

            string exportFile = Path.GetTempFileName();

#if DEBUG
            exportFile = @"D:\Development\evimsync\" + notebook + ".xml";
#endif
            if (enscript.ExportNotebook(notebook, exportFile))
            {
                return(exportFile);
            }

            // in case the selected notebook is empty, we don't get
            // an exportFile. But just to make sure the notebook
            // exists anyway, we check that here before giving up
            if (enscript.GetNotebooks().Contains(notebook))
            {
                return(string.Empty);
            }

            return(null);
        }
예제 #2
0
        public MainFrm()
        {
            InitializeComponent();
            this.synchronizationContext = SynchronizationContext.Current;
            string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            enscriptpath = ProgramFilesx86() + "\\Evernote\\Evernote\\ENScript.exe";

            if (!File.Exists(enscriptpath))
            {
                try
                {
                    RegistryKey key = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
                    RegistryKey cmdkey = key.OpenSubKey(@"SOFTWARE\Classes\evernote\shell\open\command", false);
                    //"\"C:\\Program Files (x86)\\Evernote\\Evernote\\Evernote.exe\" \"%1\""
                    enscriptpath = (string)cmdkey.GetValue("");
                    enscriptpath = enscriptpath.Substring(1, enscriptpath.Length - 1);
                    enscriptpath = enscriptpath.Substring(0, enscriptpath.IndexOf('"'));
                    enscriptpath = enscriptpath.Substring(0, enscriptpath.LastIndexOf('\\'));
                    enscriptpath += @"\ENScript.exe";
                    cmdkey.Close();
                    key.Close();
                }
                catch
                {
                    // just pass on
                }
            }

            if (!File.Exists(enscriptpath))
            {
                MessageBox.Show("Could not find the ENScript.exe file from Evernote!\nPlease select this file in the next dialog.", "Evernote2Onenote");
                OpenFileDialog openFileDialog1 = new OpenFileDialog();
                openFileDialog1.Filter = "Applications|*.exe";
                openFileDialog1.Title = "Select the ENScript.exe file";
                openFileDialog1.CheckPathExists = true;

                // Show the Dialog.
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    enscriptpath = openFileDialog1.FileName;
                }
                if (!File.Exists(enscriptpath))
                    this.Close();
            }
            ENScriptWrapper enscript = new ENScriptWrapper();
            enscript.ENScriptPath = enscriptpath;
            var notebooklist = enscript.GetNotebooks();
            foreach (string s in notebooklist)
                this.notebookCombo.Items.Add(s);
            this.notebookCombo.SelectedIndex = 0;
        }
예제 #3
0
        private string ExtractNotes(string notebook)
        {
            if (cancelled)
            {
                return null;
            }
            syncStep = SyncStep.ExtractNotes;

            ENScriptWrapper enscript = new ENScriptWrapper();
            enscript.ENScriptPath = enscriptpath;

            string exportFile = Path.GetTempFileName();
            #if DEBUG
            exportFile = @"D:\Development\evimsync\" + notebook + ".xml";
            #endif
            if (enscript.ExportNotebook(notebook, exportFile))
            {
                return exportFile;
            }

            // in case the selected notebook is empty, we don't get
            // an exportFile. But just to make sure the notebook
            // exists anyway, we check that here before giving up
            if (enscript.GetNotebooks().Contains(notebook))
                return string.Empty;

            return null;
        }
예제 #4
0
        public MainFrm(string cmdNotebook, string cmdDate)
        {
            InitializeComponent();
            this.synchronizationContext = SynchronizationContext.Current;
            string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            versionLabel.Text = string.Format("Version: {0}", version);

            if (cmdNotebook.Length > 0)
            {
                cmdNoteBook = cmdNotebook;
            }
            if (cmdDate.Length > 0)
            {
                try
                {
                    this.cmdDate = DateTime.Parse(cmdDate);
                }
                catch (Exception)
                {
                    MessageBox.Show(string.Format("The Datestring\n{0}\nis not valid!", cmdDate));
                }
            }
            try
            {
                importDatePicker.Value = this.cmdDate;
            }
            catch (Exception)
            {
                importDatePicker.Value = importDatePicker.MinDate;
            }

            enscriptpath = ProgramFilesx86() + "\\Evernote\\Evernote\\ENScript.exe";
            if (!File.Exists(enscriptpath))
            {
                MessageBox.Show("Could not find the ENScript.exe file from Evernote!\nPlease select this file in the next dialog.", "Evernote2Onenote");
                OpenFileDialog openFileDialog1 = new OpenFileDialog();
                openFileDialog1.Filter          = "Applications|*.exe";
                openFileDialog1.Title           = "Select the ENScript.exe file";
                openFileDialog1.CheckPathExists = true;

                // Show the Dialog.
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    enscriptpath = openFileDialog1.FileName;
                }
                if (!File.Exists(enscriptpath))
                {
                    this.Close();
                }
            }
            ENScriptWrapper enscript = new ENScriptWrapper();

            enscript.ENScriptPath = enscriptpath;
            var notebooklist = enscript.GetNotebooks();

            foreach (string s in notebooklist)
            {
                this.notebookCombo.Items.Add(s);
            }
            if (notebooklist.Count == 0)
            {
                MessageBox.Show("No Notebooks found in Evernote!\nMake sure you have at least one locally synched notebook.", "Evernote2Onenote");
                startsync.Enabled = false;
            }
            else
            {
                this.notebookCombo.SelectedIndex = 0;
            }

            if (cmdNotebook.Length > 0)
            {
                Startsync_Click(null, null);
            }
        }
예제 #5
0
파일: MainFrm.cs 프로젝트: gavioto/evimsync
        public MainFrm(string cmdNotebook, string cmdDate)
        {
            InitializeComponent();
            this.synchronizationContext = SynchronizationContext.Current;
            string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
            versionLabel.Text = string.Format("Version: {0}", version);

            if (cmdNotebook.Length > 0)
                cmdNoteBook = cmdNotebook;
            if (cmdDate.Length > 0)
            {
                try
                {
                    this.cmdDate = DateTime.Parse(cmdDate);
                }
                catch (Exception)
                {
                    MessageBox.Show(string.Format("The Datestring\n{0}\nis not valid!", cmdDate));
                }
            }
            try
            {
                importDatePicker.Value = this.cmdDate;
            }
            catch (Exception)
            {
                importDatePicker.Value = importDatePicker.MinDate;
            }

            enscriptpath = ProgramFilesx86() + "\\Evernote\\Evernote\\ENScript.exe";
            if (!File.Exists(enscriptpath))
            {
                MessageBox.Show("Could not find the ENScript.exe file from Evernote!\nPlease select this file in the next dialog.", "Evernote2Onenote");
                OpenFileDialog openFileDialog1 = new OpenFileDialog();
                openFileDialog1.Filter = "Applications|*.exe";
                openFileDialog1.Title = "Select the ENScript.exe file";
                openFileDialog1.CheckPathExists = true;

                // Show the Dialog.
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    enscriptpath = openFileDialog1.FileName;
                }
                if (!File.Exists(enscriptpath))
                    this.Close();
            }
            ENScriptWrapper enscript = new ENScriptWrapper();
            enscript.ENScriptPath = enscriptpath;
            var notebooklist = enscript.GetNotebooks();
            foreach (string s in notebooklist)
                this.notebookCombo.Items.Add(s);
            if (notebooklist.Count == 0)
            {
                MessageBox.Show("No Notebooks found in Evernote!\nMake sure you have at least one locally synched notebook.", "Evernote2Onenote");
                startsync.Enabled = false;
            }
            else
                this.notebookCombo.SelectedIndex = 0;

            if (cmdNotebook.Length > 0)
            {
                Startsync_Click(null, null);
            }
        }