Esempio n. 1
0
        public bool AddToSavedFolders(FilePath <FileNameSimple> current, FilePath <FileNameSimple> revision)
        {
            SavedFolderProject sf;

            SavedFolderPair sfp =
                SetgMgr.Instance.FindSavedProjectByPaths(current, revision, SavedFolderType, out sf);

            // already in history
            if (sfp != null)
            {
                return(true);
            }

            // combo of current and revision is not in history
            // check one - is project in history

            sf = SetgMgr.Instance.FindFolderProjectByRootFolder(current, SavedFolderType);

            bool result;

            // already exists?
            if (sf == null)
            {
                // add full boat
                result = SetgMgr.Instance.NewFolderProject(current, revision, SavedFolderType) == null;
            }
            else
            {
                result = SetgMgr.Instance.AddFolderPair(sf, current, revision);
            }

            SetgMgr.WriteUsr();

            return(result);
        }
Esempio n. 2
0
        private void OnAddFavorite(object sender, EventArgs e)
        {
            // add a fav

            SavedFolderProject sf = SetgMgr.Instance.FindFolderProjectByKey(
                savedWinInstance.SelectedFolderProject.Key, SavedFolderType.FAVORITES);

            FilePath <FileNameSimple> current =
                savedWinInstance.SelectedFolderProject.SavedFolderPairs[0]?.Current;

            FilePath <FileNameSimple> revision =
                savedWinInstance.SelectedFolderProject.SavedFolderPairs[0]?.Revision;

            if (sf == null)
            {
                sf = SetgMgr.Instance.NewFolderProject(current, revision, SavedFolderType.FAVORITES);
            }
            else
            {
                SetgMgr.Instance.AddFolderPair(sf, current, revision);
            }

            if (savedWinInstance.SelectedFolderProject.SavedFolderPairs.Count > 1)
            {
                for (int i = 1; i < savedWinInstance.SelectedFolderProject.SavedFolderPairs.Count; i++)
                {
                    current =
                        savedWinInstance.SelectedFolderProject.SavedFolderPairs[i]?.Current;

                    revision =
                        savedWinInstance.SelectedFolderProject.SavedFolderPairs[i]?.Revision;

                    SetgMgr.Instance.AddFolderPair(sf, current, revision);
                }
            }


            SetgMgr.WriteUsr();
        }