Example #1
0
        public static Any Of(IEvaluatable argument)
        {
            var newJunction = new Disjunction();

            JunctionHelper.AddArgumentToJunction <Disjunction>(newJunction, argument);
            return(new Any(newJunction));
        }
Example #2
0
        public static All Of(IEvaluatable argument)
        {
            var newJunction = new Conjunction();

            JunctionHelper.AddArgumentToJunction <Conjunction>(newJunction, argument);
            return(new All(newJunction));
        }
Example #3
0
        public static bool CreateJunctions(string ProjectName, List <JunctionData> SourceFolders, IModuleData moduleData, bool overrideExisting = false, bool makeReadOnly = false)
        {
            if (SourceFolders != null && SourceFolders.Count > 0)
            {
                string repositoryProjectDirectory = Path.Combine(moduleData.ModuleSettings.GitRootDirectory, ProjectName);

                Log.Here().Activity("Creating junctions for {0} at {1}.", ProjectName, repositoryProjectDirectory);

                int junctionsCreated = 0;
                int maxJunctions     = SourceFolders.Count;

                foreach (var junctionData in SourceFolders)
                {
                    var junctionTargetDirectory = Path.Combine(repositoryProjectDirectory, junctionData.BasePath);

                    Log.Here().Activity("Looking for directory at {0}", junctionData.SourcePath);

                    //Create the directory for future file adding (this is better than adding it later).
                    Directory.CreateDirectory(junctionData.SourcePath);

                    if (Directory.Exists(junctionData.SourcePath))
                    {
                        Log.Here().Important("Directory \"{0}\" found. Creating junction.", junctionData.BasePath);

                        if (!JunctionHelper.Exists(junctionTargetDirectory) || overrideExisting)
                        {
                            try
                            {
                                JunctionHelper.Create(junctionData.SourcePath, junctionTargetDirectory, overrideExisting, makeReadOnly);
                                junctionsCreated++;
                                Log.Here().Important("Junction successfully created at {0}", junctionTargetDirectory);
                            }
                            catch (Exception ex)
                            {
                                Log.Here().Error("Error creating junction at {0}: {1}", junctionTargetDirectory, ex.ToString());
                            }
                        }
                        else
                        {
                            Log.Here().Important("Junction already exists at \"{0}\". Skipping.", junctionTargetDirectory);
                            if (maxJunctions > 0)
                            {
                                maxJunctions--;
                            }
                        }
                    }
                }

                return(junctionsCreated >= maxJunctions);
            }
            return(false);
        }
Example #4
0
 public Any Or(IEvaluatable argument)
 {
     JunctionHelper.AddArgumentToJunction <Disjunction>(_state, argument);
     return(this);
 }
Example #5
0
 public All And(IEvaluatable argument)
 {
     JunctionHelper.AddArgumentToJunction <Conjunction>(_state, argument);
     return(this);
 }