コード例 #1
0
        bool Test(Condition condition, string fileName, bool isDirectory)
        {
            string[] allowedStatus = condition.Properties["state"].Split(';');
            if (allowedStatus.Length == 0 || (allowedStatus.Length == 1 && allowedStatus[0].Length == 0))
            {
                return(true);
            }
            string status;

            if (isDirectory ? RegisterEventsCommand.CanBeVersionControlledDirectory(fileName)
                            : RegisterEventsCommand.CanBeVersionControlledFile(fileName))
            {
                status = OverlayIconManager.GetStatus(fileName).ToString();
            }
            else
            {
                status = "Unversioned";
            }

            /*if (status == "Unversioned") {
             *      PropertyDictionary pd = SvnClient.Instance.Client.PropGet("svn:ignore", Path.GetDirectoryName(fileName), Revision.Working, Recurse.None);
             *      if (pd != null) {
             *              string shortFileName = Path.GetFileName(fileName);
             *              foreach (Property p in pd.Values) {
             *                      using (StreamReader r = new StreamReader(new MemoryStream(p.Data))) {
             *                              string line;
             *                              while ((line = r.ReadLine()) != null) {
             *                                      if (string.Equals(line, shortFileName, StringComparison.OrdinalIgnoreCase)) {
             *                                              status = "Ignored";
             *                                              break;
             *                                      }
             *                              }
             *                      }
             *              }
             *      }
             * }*/
            //LoggingService.Debug("Status of " + fileName + " is " + status);
            return(Array.IndexOf(allowedStatus, status) >= 0);
        }
コード例 #2
0
        public bool IsValid(object caller, Condition condition)
        {
            FileNode node = ProjectBrowserPad.Instance.SelectedNode as FileNode;

            if (node != null)
            {
                return(RegisterEventsCommand.CanBeVersionControlledFile(node.FileName));
            }
            DirectoryNode dir = ProjectBrowserPad.Instance.SelectedNode as DirectoryNode;

            if (dir != null)
            {
                return(Commands.RegisterEventsCommand.CanBeVersionControlledDirectory(dir.Directory));
            }
            SolutionNode sol = ProjectBrowserPad.Instance.SelectedNode as SolutionNode;

            if (sol != null)
            {
                return(Commands.RegisterEventsCommand.CanBeVersionControlledDirectory(sol.Solution.Directory));
            }
            return(false);
        }