Esempio n. 1
0
            static void PerformAdd(
                List <string> paths,
                IPlasticAPI plasticApi)
            {
                AddOptions options = new AddOptions();

                options.AddPrivateParents     = true;
                options.CheckoutParent        = true;
                options.Recurse               = true;
                options.SearchForPrivatePaths = true;
                options.SkipIgnored           = true;

                IList checkouts;

                plasticApi.Add(paths.ToArray(), options, out checkouts);
            }
        static void AddIfNotControlled(
            string[] paths,
            IPlasticAPI api)
        {
            List <string> fullPaths = new List <string>();

            IgnoredFilesFilter ignoredFilter = new IgnoredFilesFilter(
                GlobalConfig.Instance);

            foreach (string path in paths)
            {
                string fullPath     = Path.GetFullPath(path);
                string fullPathMeta = MetaPath.GetMetaPath(fullPath);

                if (api.GetWorkspaceFromPath(fullPath) == null)
                {
                    return;
                }

                if (api.GetWorkspaceTreeNode(fullPath) == null &&
                    !ignoredFilter.IsIgnored(fullPath))
                {
                    fullPaths.Add(fullPath);
                }

                if (File.Exists(fullPathMeta) &&
                    api.GetWorkspaceTreeNode(fullPathMeta) == null &&
                    !ignoredFilter.IsIgnored(fullPath))
                {
                    fullPaths.Add(fullPathMeta);
                }
            }

            if (fullPaths.Count == 0)
            {
                return;
            }

            IList checkouts;

            api.Add(
                fullPaths.ToArray(),
                GetDefaultAddOptions(),
                out checkouts);
        }