Example #1
0
        private VegasDirectoryStatus EvalScriptDir()
        {
            // check for existing directories
            string appExtDir = Path.Combine(cbAppSrc.Text, Str.AppExtDirName);

            if (!Directory.Exists(appExtDir))
            {
                return(VegasDirectoryStatus.None);
            }

            if (JunctionPoint.Exists(Path.Combine(appExtDir, Str.AppJunctionDirName)))
            {
                return(VegasDirectoryStatus.DirectoryExists | VegasDirectoryStatus.JunctionExists);
            }
            return(VegasDirectoryStatus.DirectoryExists);
        }
Example #2
0
        private void btnJunction_Click(object sender, EventArgs e)
        {
            string selectedDir;

            using (var dlg = new FolderBrowserDialog {
                SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
            })
            {
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                selectedDir = dlg.SelectedPath;
            }
            // appext
            string vegasDir = cbAppSrc.Text;

            string appTarget = Path.Combine(selectedDir, Str.AppExtDirName);
            string appextDir = Path.Combine(vegasDir, Str.AppExtDirName);
            //appextDir = Path.Combine(appextDir, Str.AppJunctionDirName);

            string scrTarget = Path.Combine(selectedDir, Str.ScrMenuDirName);
            string scrDir    = Path.Combine(vegasDir, Str.ScrMenuDirName);

            scrDir = Path.Combine(scrDir, Str.AppJunctionDirName);

            try
            {
                if (!Directory.Exists(appextDir) && !JunctionPoint.Exists(appextDir))
                {
                    CreateJunction(appextDir, appTarget);
                }
                if (!Directory.Exists(scrDir) && !JunctionPoint.Exists(scrDir))
                {
                    CreateJunction(scrDir, scrTarget);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #3
0
        private void CreateJunction(string Source, string Dest)
        {
            if (string.IsNullOrEmpty(Source) || string.IsNullOrEmpty(Dest))
            {
                throw (new ArgumentNullException("Junction failed. One of the paths is empty."));
            }

            if (IsSubPath(Source, Dest))
            {
                throw new InvalidOperationException("Creating this junction would cause a circular reference.");
            }

            String Message = String.Format("A link to {0} will be created in {1}.\nReview this carefully before proceeding.",
                                           Dest, Source);
            DialogResult Rslt = MessageBox.Show(Message, "Really continue?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (Rslt != DialogResult.Yes)
            {
                return;
            }
            JunctionPoint.Create(Source, Dest, true);
            LogWrite(String.Format(@"{0} --> {1}", Source, Dest));
        }