Beispiel #1
0
        public void Exclude_List_Scope()
        {
            var dto = new ExcludeList
            {
                Id       = 1234,
                Excludes = new List <Exclude>()
                {
                    new Exclude {
                        Id  = 2345,
                        Key = "Value"
                    },
                    new Exclude {
                        Id  = 3456,
                        Key = "Value"
                    }
                }
            };

            using (var config = JsConfig.BeginScope())
            {
                config.ExcludePropertyReferences = new[] { "ExcludeList.Id", "Exclude.Id" };
                Assert.That(dto.ToJson(), Is.EqualTo("{\"Excludes\":[{\"Key\":\"Value\"},{\"Key\":\"Value\"}]}"));
                Assert.That(dto.ToJsv(), Is.EqualTo("{Excludes:[{Key:Value},{Key:Value}]}"));
            }
        }
        private int GetFieldsMapping(string firstLine, IEnumerable <PropertyInfo> infos, IDictionary <int, PropertyInfo> mappedProperties)
        {
            var fields = firstLine.Split(new[] { Separator }, StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < fields.Length; i++)
            {
                var field = fields[i];
                //Find apropriate field in UserInfo
                foreach (var info in infos)
                {
                    var propertyField = field.Trim();
                    if (NameMapping != null && NameMapping.ContainsKey(propertyField))
                    {
                        propertyField = NameMapping[propertyField];
                    }
                    if (!string.IsNullOrEmpty(propertyField) && !ExcludeList.Contains(propertyField) && propertyField.Equals(info.Name, StringComparison.OrdinalIgnoreCase))
                    {
                        //Add to map
                        mappedProperties.Add(i, info);
                    }
                }
                if (!mappedProperties.ContainsKey(i))
                {
                    //No property was found
                    mappedProperties.Add(i, null);
                }
            }
            return(fields.Length);
        }
Beispiel #3
0
        public void CheckForDatabaseTablesNotInEF()
        {
            // Checks for tables defined in the database which are not defined in EF
            string errorMsg = "";

            // Create an exclude list
            ExcludeList excludes = new ExcludeList();

            excludes.Add("sysdiagrams");

            // Query the server for database tables
            var tableList = db.Database
                            .SqlQuery <string>("SELECT name FROM sysobjects WHERE xtype = 'U'")
                            .ToList();

            foreach (var tableName in tableList)
            {
                // Look for a code file for this table

                if (!excludes.IsExcluded(tableName))
                {
                    string fileName = SourceRoot + @"\Evolution.DAL\" + getEFTableFileName(tableName);
                    if (!File.Exists(fileName))
                    {
                        errorMsg += "  " + tableName + "\r\n";
                    }
                }
            }

            Assert.IsTrue(string.IsNullOrEmpty(errorMsg), $"Error: The following tables are defined in the database but haven't been imported to EF:\r\n{errorMsg}");
        }
Beispiel #4
0
    void Awake()
    {
        excludeList = GetComponent <ExcludeList>();

        ItemSlot.OnSelectedCallback += OnSlotSelected;
        ItemSlot.OnSubmitCallback   += OnSlotSubmit;
    }
Beispiel #5
0
 public static IEnumerable <T> GetEnumerableOfType <T>(params object[] constructorArgs) where T : class
 {
     return
         (Assembly.GetAssembly(typeof(T))
          .GetTypes()
          .Where(
              myType =>
              !ExcludeList.Exists(e => e == myType) && myType.IsClass && !myType.IsAbstract &&
              myType.IsSubclassOf(typeof(T)))
          .Select(type => (T)Activator.CreateInstance(type, constructorArgs))
          .ToList());
 }
        public bool IsModuleIncluded(string module)
        {
            // Use "Include" list.
            if (IsManualLoad)
            {
                return(IncludeList.Any(includePattern =>
                                       Regex.IsMatch(module, WildcardToRegex(includePattern),
                                                     RegexOptions.IgnoreCase)));
            }

            // Use "Exclude" list.
            return(!ExcludeList.Any(excludePattern =>
                                    Regex.IsMatch(module, WildcardToRegex(excludePattern),
                                                  RegexOptions.IgnoreCase)));
        }
 protected override void OnControlAdded(ControlEventArgs e)
 {
     //
     //Add Mouse Event Handlers for each control added into the form,
     //if Draggable property of the form is set to true and the control
     //name is not in the ExcludeList.Exclude list is the comma seperated
     //list of the Controls for which you do not require the mouse handler
     //to be added. For Example a button.
     //
     if (Draggable && (ExcludeList.IndexOf(e.Control.Name, StringComparison.OrdinalIgnoreCase) == -1))
     {
         e.Control.MouseDown += Control_MouseDown;
         e.Control.MouseUp   += Control_MouseUp;
         e.Control.MouseMove += Control_MouseMove;
     }
     base.OnControlAdded(e);
 }
Beispiel #8
0
        private int GetFieldsMapping(string firstLine, IEnumerable <PropertyInfo> infos, IDictionary <int, PropertyInfo> mappedProperties)
        {
            var fields = firstLine.Split(new string[] { Separators }, StringSplitOptions.RemoveEmptyEntries);

            for (var i = 0; i < fields.Length; i++)
            {
                var field = fields[i];
                foreach (var info in infos)
                {
                    var propertyField = field.Trim();
                    propertyField = propertyField.Trim(Convert.ToChar(TextDelmiter));
                    var title = info.GetCustomAttribute <ResourceAttribute>().Title;

                    if (NameMapping != null && NameMapping.ContainsKey(propertyField))
                    {
                        propertyField = NameMapping[propertyField];
                    }

                    propertyField.Replace(" ", "");

                    if (!string.IsNullOrEmpty(propertyField) &&
                        !ExcludeList.Contains(propertyField) &&
                        (propertyField.Equals(PeopleResource.ResourceManager.GetString(title), StringComparison.OrdinalIgnoreCase) ||
                         propertyField.Equals(info.Name, StringComparison.OrdinalIgnoreCase)))
                    {
                        mappedProperties.Add(i, info);
                    }
                }

                if (!mappedProperties.ContainsKey(i))
                {
                    mappedProperties.Add(i, null);
                }
            }

            return(fields.Length);
        }
Beispiel #9
0
        public bool ShouldDownload(Torrent item)
        {
            if (Enabled)
            {
                if (!DownloadedTorrents.Contains(item))
                {
                    string       title  = Utils.RemoveDiacritics(IgnoreCaps ? item.Title.ToLower() : item.Title);
                    RegexOptions option = IgnoreCaps ? RegexOptions.IgnoreCase : RegexOptions.None;

                    if (Regex.IsMatch(title, RegexPattern, option))
                    {
                        if (IncludeList.All(title.Contains))
                        {
                            if (!ExcludeList.Any(title.Contains))
                            {
                                if (IsTV)
                                {
                                    if (item.IsTV)
                                    {
                                        if (IsEpisodeToDownload(item))
                                        {
                                            return(true);
                                        }
                                    }
                                }
                                else
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }

            return(false);
        }
 public void Exclude_List_Scope() {
     var dto = new ExcludeList {
         Id = 1234,
         Excludes = new List<Exclude>() {
             new Exclude {
                 Id = 2345,
                 Key = "Value"
             },
             new Exclude {
                 Id = 3456,
                 Key = "Value"
             }
         }
     };
     using (var config = JsConfig.BeginScope())
     {
         config.ExcludePropertyReferences = new[] { "ExcludeList.Id", "Exclude.Id" };
         Assert.That(dto.ToJson(), Is.EqualTo("{\"Excludes\":[{\"Key\":\"Value\"},{\"Key\":\"Value\"}]}"));
         Assert.That(dto.ToJsv(), Is.EqualTo("{Excludes:[{Key:Value},{Key:Value}]}"));
     }
 }
 private Boolean NotInExcludeList(String folder)
 => (ExcludeList.Contains(folder) == false);
Beispiel #12
0
 public Options()
 {
     ExcludeList.Add(new ExcludeStruct(String.Empty, 0, 0));
     LocalExcludeList.Add(new ExcludeStruct("per-dir .cvsignore ", 0, 0));
     ServerExcludeList.Add(new ExcludeStruct("server ", 0, 0));
 }