コード例 #1
0
ファイル: SiteObject.cs プロジェクト: StudyWithJeffrey/lunet
        /// <summary>
        /// Checks if the specified path is included or excluded
        /// </summary>
        public bool IsHandlingPath(UPath path)
        {
            if (path.IsNull)
            {
                return(false);
            }

            // e.g always exclude .lunet/build, can't be overriden by the users
            var isForceExcluded = ForceExcludes.IsMatch(path);

            if (isForceExcluded)
            {
                return(false);
            }

            // If we have an explicit include, it overrides any excludes
            var isIncluded = Includes.IsMatch(path);

            if (isIncluded)
            {
                return(true);
            }

            var isExcluded = Excludes.IsMatch(path);

            return(!isExcluded);
        }
コード例 #2
0
ファイル: core.cs プロジェクト: ovg1985/sync
        private bool TrySkip(FileSystemEventArgs ev)
        {
            if (ev.FullPath.Contains("~"))
            {
                Log.Debug("IN: Skip tilda: {0}", ev.FullPath);
                return(true);
            }

            /// todo regexp
            foreach (var part in ev.FullPath.Split(Path.DirectorySeparatorChar))
            {
                if (Excludes.Contains(part))
                {
                    Log.Debug("IN: Skip exclusion: {0}", ev.FullPath);
                    return(true);
                }
            }

            if (ev.ChangeType == Changes.Changed)
            {
                if (Utils.IsDirectory(ev.FullPath))
                {
                    Log.Debug("IN: Skip directory update: {0}", ev.FullPath);
                    return(true);
                }
            }

            return(false);
        }
コード例 #3
0
        public async Task ListFilterWordExcludes(CommandContext ctx)
        {
            if (ctx.Member.GetRole().IsModOrHigher())
            {
                StringBuilder sb = new StringBuilder();

                // Cancels:
                if (Excludes.GetWordCount() == 0)
                {
                    await ctx.Channel.SendMessageAsync(
                        ChatObjects.GetNeutralMessage(@"There are no filter excludes..."));

                    return;
                }

                foreach (string word in Excludes.GetWords())
                {
                    sb.AppendLine(word);
                }

                DiscordEmbedBuilder deb = new DiscordEmbedBuilder()
                {
                    Color       = DiscordColor.LightGray,
                    Description = sb.ToString(),
                    Title       = "FILTER LIST EXCLUDES"
                };

                await ctx.Channel.SendMessageAsync(embed : deb.Build());
            }
        }
コード例 #4
0
        public async Task FilterExclude(CommandContext ctx, string word)
        {
            if (ctx.Member.GetRole().IsSeniorModOrHigher())
            {
                await ctx.TriggerTypingAsync();

                // Cancels:
                if (FilterSystem.IsWord(word))
                {
                    await ctx.Channel.SendMessageAsync(
                        ChatObjects.GetErrMessage(@"Cannot add that word. It's a filter word..."));

                    return;
                }
                if (Excludes.IsExcluded(word))
                {
                    await ctx.Channel.SendMessageAsync(
                        ChatObjects.GetErrMessage(@"Cannot add that word. It's already excluded..."));

                    return;
                }

                Excludes.AddWord(word);
                Excludes.Save();

                await ctx.Channel.SendMessageAsync(
                    ChatObjects.GetSuccessMessage(
                        String.Format("I excluded the word {0}!", word)));
            }
        }
コード例 #5
0
 protected override void Initialize()
 {
     base.Initialize();
     if (DefaultExcludes)
     {
         // add default exclude patterns
         Excludes.Add("**/.svn");
         Excludes.Add("**/.svn/**");
         Excludes.Add("**/_svn");
         Excludes.Add("**/_svn/**");
         Excludes.Add("**/.git");
         Excludes.Add("**/.git/**");
         Excludes.Add("**/.git*"); // eg .gitignore
         Excludes.Add("**/.hg");
         Excludes.Add("**/.hg/**");
         Excludes.Add("**/.hg*"); // eg .hgignore
         Excludes.Add("**/SCCS");
         Excludes.Add("**/SCCS/**");
         Excludes.Add("**/vssver.scc");
         Excludes.Add("**/vssver2.scc");
         Excludes.Add("**/_vti_cnf/**");
         Excludes.Add("**/*~");
         Excludes.Add("**/#*#");
         Excludes.Add("**/.#*");
         Excludes.Add("**/%*%");
         Excludes.Add("**/CVS");
         Excludes.Add("**/CVS/**");
         Excludes.Add("**/.cvsignore");
         Excludes.Add("**/._*");
         Excludes.Add("**/.bzr");
         Excludes.Add("**/.bzr/**");
         Excludes.Add("**/.bzr*");
         Excludes.Add("**/.DS_Store");
     }
 }
コード例 #6
0
 /// <summary>
 /// Returns a hash-code based on the current value of this object.
 /// </summary>
 public override int GetHashCode()
 {
     return
         ((Description ?? String.Empty).GetHashCode() ^
          (Includes != null ? Includes.GetHashCode() : 0) ^
          (Excludes != null ? Excludes.GetHashCode() : 0));
 }
コード例 #7
0
        private bool validAfterFilters(string file)
        {
            if (Excludes.Any() == false && Includes.Any() == false)
            {
                // Default match when nothing has been added
                return(true);
            }

            // If Exclude has been define, guard everything against it
            // If Include has been defined, do the same
            // If both then check exclude then include first

            if (Excludes.Any())
            {
                if (_matchesFilter(Excludes, file))
                {
                    return(false);
                }
            }

            if (Includes.Any())
            {
                if (_matchesFilter(Includes, file))
                {
                    return(true);
                }

                // Otherwise let filter fail
                return(false);
            }

            return(true);
        }
コード例 #8
0
 /// <summary>
 /// Checks whether the specified object equals the current one
 /// (does not take the <see cref="IsDefault"/> property into account).
 /// </summary>
 /// <param name="other">Object to compare with.</param>
 /// <returns>true, if the specified object equals the current one; otherwise false.</returns>
 public bool Equals(LogWriterConfiguration other)
 {
     return(mBaseLevel == other.mBaseLevel &&
            NamePatterns.SequenceEqual(other.NamePatterns) &&
            TagPatterns.SequenceEqual(other.TagPatterns) &&
            Includes.SequenceEqual(other.Includes) &&
            Excludes.SequenceEqual(other.Excludes));
 }
コード例 #9
0
 public KnowledgeBase()
 {
     Excludes      = new Excludes();
     Spliters      = new Spliters();
     Transforms    = new Transforms();
     Rules         = new Rules();
     FeaturedRules = new FeaturedRules();
 }
コード例 #10
0
 protected override void Initialize()
 {
     base.Initialize();
     if (DefaultExcludes)
     {
         // add default exclude patterns
         Excludes.Add("**/*.nupkg");
         Excludes.Add("**/*.nuspec");
     }
 }
コード例 #11
0
        private void listModifiedFiles(string origPath, string dest, DateTime from, DateTime to)
        {
            DirectoryInfo dir  = new DirectoryInfo(origPath);
            string        temp = dest.EndsWith("\\") ? dest : dest + "\\";

            try
            {
                foreach (DirectoryInfo subDir in dir.GetDirectories())
                {
                    listModifiedFiles(subDir.FullName, temp + subDir.Name, from, to);
                }

                foreach (FileInfo file in dir.GetFiles())
                {
                    bool moveFile    = false;
                    bool excludeFile = false;
                    foreach (string item in Excludes.Split(';'))
                    {
                        if (file.FullName.ToLower().Contains(item.ToLower()))
                        {
                            excludeFile = true;
                            break;
                        }
                    }
                    if (!excludeFile)
                    {
                        foreach (string item in Filters.Split(';'))
                        {
                            if (file.Name.ToLower().EndsWith(item.ToLower()))
                            {
                                moveFile = true;
                                break;
                            }
                        }
                    }

                    if (
                        (moveFile) &&
                        (file.LastWriteTime.CompareTo(from) >= 0) &&
                        (file.LastWriteTime.CompareTo(to) <= 0)
                        )
                    {
                        if (ScanReadOnly ||
                            (file.Attributes & FileAttributes.ReadOnly) != FileAttributes.ReadOnly)
                        {
                            FilesModified.Add(file.FullName);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #12
0
ファイル: FromToValue.cs プロジェクト: naylamp6/TuringMachine
 /// <summary>
 /// Return if are between from an To
 /// </summary>
 /// <param name="o">Object</param>
 public bool ItsValid(T o)
 {
     if (From.CompareTo(o) <= 0 && To.CompareTo(o) >= 0)
     {
         if (Excludes.Contains(o))
         {
             return(false);
         }
         return(true);
     }
     return(false);
 }
コード例 #13
0
        /// <inheritdoc />
        public override string ToString()
        {
            var stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("{");
            stringBuilder.AppendLine($"\t\"Includes\": [ {string.Join(",", Includes.Select(x => $"\"{x}\""))} ], ");
            stringBuilder.AppendLine($"\t\"Excludes\": [ {string.Join(",", Excludes.Select(x => $"\"{x}\""))} ], ");
            stringBuilder.AppendLine($"\t\"CaseSensitive\": {CaseSensitive}, ");
            stringBuilder.AppendLine($"\t\"BasePath\": {BasePath.FullPath}");
            stringBuilder.AppendLine("}");
            return(stringBuilder.ToString());
        }
コード例 #14
0
 public static string[] GetExcludeList(this Excludes excludes)
 {
     Debug.Log($"Looking up platform url for {Application.platform}...");
     if (Application.isEditor || Application.platform == RuntimePlatform.Android)
     {
         return(excludes.android);
     }
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         return(excludes.iphone);
     }
     return(null);
 }
コード例 #15
0
        public async Task FilterAddWords(CommandContext ctx, params string[] words)
        {
            // Check if the user can use commands.
            if (ctx.Member.GetRole().IsSeniorModOrHigher())
            {
                await ctx.TriggerTypingAsync();

                StringBuilder       sb_fail    = new StringBuilder(); // A list of words we haven't been able to add.
                StringBuilder       sb_success = new StringBuilder(); // A list of words we were able to add.
                DiscordEmbedBuilder deb;

                foreach (string word in words)
                {
                    // Check if this is in the filter list or exclude list. If it is, we were unsuccessful at adding it to the list.
                    bool success = !FilterSystem.IsWord(word) && !Excludes.IsExcluded(word);

                    if (success)
                    {
                        FilterSystem.AddWord(word);
                        sb_success.Append(word + @", ");
                    }
                    else
                    {
                        sb_fail.Append(word + @", ");
                    }
                }

                // DEB!
                deb = new DiscordEmbedBuilder()
                {
                    Description = ChatObjects.GetNeutralMessage(@"I attempted to add those words you gave me."),
                    Color       = DiscordColor.LightGray
                };

                deb.WithThumbnailUrl(ChatObjects.URL_FILTER_ADD);

                // For each of these lists, we want to remove the last two characters, because every string will have an ", " at the end of it.
                if (sb_success.Length > 0)
                {
                    deb.AddField(@"Successfully added:", sb_success.Remove(sb_success.Length - 2, 2).ToString());
                }
                if (sb_fail.Length > 0)
                {
                    deb.AddField(@"Not added:", sb_fail.Remove(sb_fail.Length - 2, 2).ToString());
                }

                FilterSystem.Save();

                await ctx.Channel.SendMessageAsync(embed : deb.Build());
            }
        }
コード例 #16
0
        internal void Apply(TestRun testRun, TestRunnerOptions normalized) {
            ActivateDefaultTestSet(testRun);

            Excludes.Apply(testRun, SKIP);
            FocusPatterns.Apply(testRun, FOCUS);

            // If any focused nodes, then only run focused nodes
            if (!normalized.IgnoreFocus && testRun.ContainsFocusedUnits) {
                ApplyFocussing(testRun);
            }

            InheritBiasToChildren(testRun);
            SealRecursive(testRun);
        }
コード例 #17
0
ファイル: DirectoriesViewModel.cs プロジェクト: Insire/FS
        private async Task Exclude(CancellationToken token)
        {
            var root = Root
                       .TrimEnd('\\')
                       .TrimEnd('/');

            var pathWithOutRoot = SelectedItem.FullPath
                                  .Replace(root, string.Empty)
                                  .Trim('\\')
                                  .Trim('/');

            await Excludes.Add(new Pattern(CommandBuilder, CommandManager, this, $"**/{pathWithOutRoot}")).ConfigureAwait(false);

            await Remove().ConfigureAwait(false);
        }
コード例 #18
0
 private bool IsMatch(string file)
 {
     if (Exclusive)
     {
         if (!Includes.Any(include => Regex.IsMatch(file, include)))
         {
             return(false);
         }
     }
     if (Filtered)
     {
         return(Excludes.All(exclude => !Regex.IsMatch(file, exclude)));
     }
     return(true);
 }
コード例 #19
0
        /// <summary>
        /// Initialize the <see cref="CvsFileSet"/> object and locate the .cvsignore
        /// files to add to the exclude list.
        /// </summary>
        protected override void Initialize()
        {
            if (UseCvsIgnore)
            {
                ArrayList ignoreFiles = new ArrayList();
                this.ScanCvsIgnores(base.BaseDirectory, ignoreFiles);

                foreach (string ignoreFile in ignoreFiles)
                {
                    Excludes.Add(ignoreFile);
                }
            }

            base.Initialize();
        }
コード例 #20
0
 protected override void ReadXmlElements(XmlReader reader)
 {
     base.ReadXmlElements(reader);
     while (reader.IsStartElement(Include.XmlElementName))
     {
         Include include = new Include();
         (include as IXmlSerializable).ReadXml(reader);
         Includes.Add(include);
     }
     while (reader.IsStartElement(Exclude.XmlElementName))
     {
         Exclude exclude = new Exclude();
         (exclude as IXmlSerializable).ReadXml(reader);
         Excludes.Add(exclude);
     }
 }
コード例 #21
0
        public override bool handleOption(string key, string value)
        {
            switch (key)
            {
            case "exclude":
                Excludes.Add(value);
                return(true);

            case "references":
                DllDirs.Add(value);
                return(true);

            default:
                return(base.handleOption(key, value));
            }
        }
コード例 #22
0
 public bool ExcludePath(string path)
 {
     if (Excludes != null)
     {
         if (Excludes.FirstOrDefault(e =>
                                     (!e.Path.Contains("*") && path.Equals(e.Path, StringComparison.CurrentCultureIgnoreCase)) ||
                                     (e.Path.StartsWith("*") && e.Path.EndsWith("*") && path.IndexOf(e.Path.Replace("*", ""), StringComparison.CurrentCultureIgnoreCase) >= 0) ||
                                     (e.Path.StartsWith("*") && path.EndsWith(e.Path.Replace("*", ""), StringComparison.CurrentCultureIgnoreCase)) ||
                                     (e.Path.EndsWith("*") && path.StartsWith(e.Path.Replace("*", ""), StringComparison.CurrentCultureIgnoreCase))
                                     ) != null)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #23
0
 public override void Init()
 {
     Excludes.Add(typeof(OutsiderProfile));
     Mapper.Class <Client>(x => x.Schema("Customers"));
     Mapper.Class <User>(x => { x.Schema("Customers"); });
     Mapper.Class <Outsider>(x => {
         x.Schema("Customers");
         x.Table("webftpoutsiders");
     });
     Mapper.Class <Admin>(x => {
         x.Schema("AccessRight");
         x.Table("RegionalAdmins");
         x.Id(y => y.Id, y => y.Column("RowId"));
         x.Property(o => o.Login, om => om.Column("UserName"));
         x.Property(o => o.Name, om => om.Column("ManagerName"));
     });
     base.Init();
 }
コード例 #24
0
        /// <summary>
        ///     Поиск всех вхождений по указанным инклукдам
        /// </summary>
        /// <returns>
        ///     Перечисление путей файлов, подходящих по маске
        ///     к списку инклудов
        /// </returns>
        public IEnumerable <string> Collect()
        {
            var directincludes = Includes.Where(File.Exists).Select(_ => _.NormalizePath()).ToArray();

            foreach (var directinclude in directincludes)
            {
                yield return(directinclude);
            }
            foreach (var root in Roots)
            {
                foreach (var mask in SearchMasks)
                {
                    foreach (var f in
                             Directory.GetFiles(root, mask, SearchOption.AllDirectories)
                             )
                    {
                        var normalized = f.Replace(root, "").Replace("\\", "/");
                        if (Includes.Any())
                        {
                            if (directincludes.Contains(normalized))
                            {
                                continue;
                            }

                            if (!Includes.Any(normalized.Contains))
                            {
                                continue;
                            }
                        }
                        if (Excludes.Any())
                        {
                            if (Excludes.Any(normalized.Contains))
                            {
                                continue;
                            }
                        }
                        yield return(f);
                    }
                }
            }
        }
コード例 #25
0
        List <TypeDefinition> ApplyIncludeExcludeRules(IEnumerable <TypeDefinition> typeList)
        {
            var types       = new HashSet <TypeDefinition> ();
            var notExcluded = Excludes.Excluding(typeList, typeDefinition => typeDefinition.FullName);

            foreach (var type in notExcluded)
            {
                if (type.IsAbstract)
                {
                    continue;
                }
                types.Add(type);
            }
            var reallyInclude = Includes.Including(typeList, typeDefinition => typeDefinition.FullName);

            foreach (var type in reallyInclude)
            {
                types.Add(type);
            }
            return(types.ToList());
        }
コード例 #26
0
        /// <summary>
        /// Returns a string describing this schedule entry,
        /// using the specified <see cref="CultureInfo"/>.
        /// </summary>
        public string ToString(CultureInfo culture)
        {
            if (Includes != null && Includes.Count > 0)
            {
                if (Excludes != null && Excludes.Count > 0)
                {
                    // Format string with includes and excludes
                    return(String.Format(culture,
                                         Properties.Resources.ScheduleToStringFormatIncludesAndExcludes,
                                         Includes.ToString(culture), Excludes.ToString(culture)));
                }

                // Format string with includes only
                return(String.Format(culture,
                                     Properties.Resources.ScheduleToStringFormatIncludesOnly,
                                     Includes.ToString(culture)));
            }

            // Format string with no schedule items
            return(String.Format(culture, Properties.Resources.ScheduleToStringFormatNone));
        }
コード例 #27
0
        public async Task FilterInclude(CommandContext ctx, string word)
        {
            if (ctx.Member.GetRole().IsSeniorModOrHigher())
            {
                await ctx.TriggerTypingAsync();

                if (!Excludes.IsExcluded(word))
                {
                    await ctx.Channel.SendMessageAsync(
                        ChatObjects.GetErrMessage(@"Cannot un-exclude that word. It's not already excluded..."));
                }
                else
                {
                    Excludes.RemoveWord(word);
                    Excludes.Save();

                    await ctx.Channel.SendMessageAsync(
                        ChatObjects.GetSuccessMessage(@"I removed that word from exclusion!"));
                }
            }
        }
コード例 #28
0
        /// <summary>添加排除项</summary>
        /// <param name="value"></param>
        public void AddExclude(String value)
        {
            if (value.IsNullOrEmpty())
            {
                return;
            }

            var es = new List <String>();
            var ss = Excludes?.Split(",");

            if (ss != null)
            {
                es.AddRange(ss);
            }

            if (!es.Contains(value))
            {
                es.Add(value);

                Excludes = es.Distinct().Join();
            }
        }
コード例 #29
0
 protected override void InitializeElement(XmlNode elementNode)
 {
     if (DefaultExcludes)
     {
         // add default exclude patterns
         Excludes.Add("**/*~");
         Excludes.Add("**/#*#");
         Excludes.Add("**/.#*");
         Excludes.Add("**/%*%");
         Excludes.Add("**/CVS");
         Excludes.Add("**/CVS/**");
         Excludes.Add("**/.svn");
         Excludes.Add("**/.svn/**");
         Excludes.Add("**/_svn");
         Excludes.Add("**/_svn/**");
         Excludes.Add("**/.cvsignore");
         Excludes.Add("**/SCCS");
         Excludes.Add("**/SCCS/**");
         Excludes.Add("**/vssver.scc");
         Excludes.Add("**/_vti_cnf/**");
     }
     base.InitializeElement(elementNode);
 }
コード例 #30
0
        /************************************************************************************************************/
        /************************************************************************************************************/
        private bool AbhereSynchronizationRules(FileFolder file, bool recursive, bool children)
        {
            if (!children && !recursive && !(file.Folder.FullName.Equals(VaultPath, StringComparison.InvariantCultureIgnoreCase) || (file.Folder.FullName + "/" + file.File.Name).Equals(VaultPath, StringComparison.InvariantCultureIgnoreCase)))
            {
                return(false);
            }

            if (!children && !(file.Folder.FullName + "/" + file.File.Name).ToLower().Contains(VaultPath.ToLower()))
            {
                return(false);
            }

            if (((PatternsToSynchronize.Count() > 0) && (!PatternsToSynchronize.Any(s => file.File.Name.ToLower().EndsWith(s.ToLower())))) && !((PatternsToSynchronize.Count() == 1) && (PatternsToSynchronize[0].Equals("/", StringComparison.InvariantCultureIgnoreCase))))
            {
                return(false);
            }

            if ((Excludes.Count() > 0) && (Excludes.Any(s => (file.Folder.FullName + "/" + file.File.Name).ToLower().Contains(s.ToLower()))))
            {
                return(false);
            }

            return(true);
        }