Ejemplo n.º 1
0
        private static IEntity GetPresentationEntity(List <IEntity> originals, List <IEntity> presItems, int itemIndex, IEntity demo, int entityId)
        {
            try
            {
                if (presItems == null)
                {
                    return(null);
                }

                // Try to find presentationList entity
                var presentationId =
                    presItems.Count - 1 >= itemIndex && presItems[itemIndex] != null &&
                    originals.Has(presItems[itemIndex].EntityId)
                        ? presItems[itemIndex].EntityId
                        : new int?();

                // If there is no presentationList entity, take default entity
                if (presentationId.HasValue)
                {
                    return(originals.One(presentationId.Value));
                }

                presentationId = demo != null && originals.Has(demo.EntityId)
                    ? demo.EntityId
                    : new int?();

                return(presentationId.HasValue ? originals.One(presentationId.Value) : null);
            }
            catch (Exception ex)
            {
                throw new Exception("trouble adding presentationList of " + entityId, ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a boolean value indicating whether the specified element has the specified attribute or not.
        /// </summary>
        /// <param name="name">The attributes name.</param>
        /// <returns>The return value of true or false.</returns>
        public Boolean HasAttribute(String name)
        {
            if (_namespace == Namespaces.HtmlUri)
            {
                name = name.ToLowerInvariant();
            }

            return(_attributes.Has(name));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// This method assumes that RemoteRepo.Load() was already called.
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        public List <RemoteVsLocalFile> GroupFilesByName
            (string localFoldrPath, IRepository <SyncableFileRemote> repo, SyncDirection syncDirection)
        {
            var list   = new List <RemoteVsLocalFile>();
            var locals = _fileSeeker.GetFiles(localFoldrPath);


            foreach (var loc in locals)
            {
                var rem = repo.One(x => x.Name == loc.Name);
                list.Add(RemVsLoc(loc, rem, syncDirection));
            }


            foreach (var rem in repo.Any(r
                                         => !list.Has(l => l.Filename == r.Name)))
            {
                var loc = locals.One(x => x.Name == rem.Name);
                list.Add(RemVsLoc(loc, rem, syncDirection));
            }


            //  if no files in folder, or no folder at all,
            //    - assume that it's a first run : download all
            //
            if (locals.Count == 0)
            {
                list.ForEach(x => x.DoNext(Target.Local, FileTask.Create));
            }


            return(list);
        }
Ejemplo n.º 4
0
        public void TestCombineWithAnd()
        {
            List <AnEntity> al = CreateList1();

            al.Has().All(e => e.PropertyB == "B")
            .And.One(e => e.PropertyA == "A").Assert();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// This method assumes that RemoteRepo.Load() was already called.
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        public List<RemoteVsLocalFile> GroupFilesByName
            (string localFoldrPath, IRepository<SyncableFileRemote> repo, SyncDirection syncDirection)
        {
            var list   = new List<RemoteVsLocalFile>();
            var locals = _fileSeeker.GetFiles(localFoldrPath);


            foreach (var loc in locals)
            {
                var rem = repo.One(x => x.Name == loc.Name);
                list.Add(RemVsLoc(loc, rem, syncDirection));
            }


            foreach (var rem in repo.Any(r
                => !list.Has(l => l.Filename == r.Name)))
            {
                var loc = locals.One(x => x.Name == rem.Name);
                list.Add(RemVsLoc(loc, rem, syncDirection));
            }


            //  if no files in folder, or no folder at all,
            //    - assume that it's a first run : download all
            //
            if (locals.Count == 0)
                list.ForEach(x => x.DoNext(Target.Local, FileTask.Create));


            return list;
        }
Ejemplo n.º 6
0
 public bool AddTackle(Transform tackle)
 {
     if (tackles.Has(tackle))
     {
         return(false);
     }
     tackles.Add(tackle);
     return(true);
 }
Ejemplo n.º 7
0
        public override bool CheckOptionString(string option_string)
        {
            if (option_string_patterns.Has(p => option_string.RegexIsMatch(p)))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 8
0
        public override bool CheckOptionString(string option_string)
        {
            if (option_strings.Has(option_string.StyleAsWord()))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 9
0
 public static bool AddUnique(this List <Project> projects, Project proj)
 {
     if (!projects.Has(proj))
     {
         projects.Add(proj);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 10
0
            public override bool IsAuthority(NetworkActor to_check)
            {
                if (to_check.IsServer() || authorities.Has(to_check))
                {
                    return(true);
                }

                return(false);
            }
Ejemplo n.º 11
0
 public void List_T_NoMatch()
 {
     var sut = new List<SampleType>
     {
         new SampleType { Text = "a" },
         new SampleType { Text = "b" },
         new SampleType { Text = "c" },
     };
     Assert.False(sut.Has(x => x.Text == "d"));
 }
Ejemplo n.º 12
0
 public void List_T_Happy()
 {
     var sut = new List<SampleType>
     {
         new SampleType { Text = "a" },
         new SampleType { Text = "b" },
         new SampleType { Text = "c" },
     };
     Assert.True(sut.Has(x => x.Text == "b"));
 }
Ejemplo n.º 13
0
 public static bool Fits(this List <Int2> data, int xPos, int yPos, int xSize, int ySize)
 {
     for (int y = yPos; y < yPos + ySize; y++)
     {
         for (int x = xPos; x < xPos + xSize; x++)
         {
             if (data.Has(x, y))
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Ejemplo n.º 14
0
        public void List_T_NoMatch()
        {
            var sut = new List <SampleType>
            {
                new SampleType {
                    Text = "a"
                },
                new SampleType {
                    Text = "b"
                },
                new SampleType {
                    Text = "c"
                },
            };

            Assert.False(sut.Has(x => x.Text == "d"));
        }
Ejemplo n.º 15
0
        public void List_T_Happy()
        {
            var sut = new List <SampleType>
            {
                new SampleType {
                    Text = "a"
                },
                new SampleType {
                    Text = "b"
                },
                new SampleType {
                    Text = "c"
                },
            };

            Assert.True(sut.Has(x => x.Text == "b"));
        }
Ejemplo n.º 16
0
        public bool IsLabeledAs(string label)
        {
            if (singular_name.AreSymbolInvariantsEqual(label))
            {
                return(true);
            }

            if (plural_name.AreSymbolInvariantsEqual(label))
            {
                return(true);
            }

            if (abbreviations.Has(a => a.AreSymbolInvariantsEqual(label)))
            {
                return(true);
            }

            return(false);
        }
 public bool GetRawValue()
 {
     return(buttons.Has(b => b.GetRawValue()));
 }
Ejemplo n.º 18
0
 /// <summary>
 /// 指定要素が存在しないかどうか
 /// </summary>
 /// <typeparam name="T">型</typeparam>
 /// <param name="list">リスト</param>
 /// <param name="elem">要素</param>
 /// <returns>存在しなければTrue</returns>
 static public bool DontHave <T>(this List <T> list, T elem)
 {
     return(!list.Has(elem));
 }
Ejemplo n.º 19
0
 /// <summary>
 /// 指定要素が存在しないかどうか
 /// </summary>
 /// <typeparam name="T">型</typeparam>
 /// <param name="list">リスト</param>
 /// <param name="match">合致条件</param>
 /// <returns>存在しなければTrue</returns>
 static public bool DontHave <T>(this List <T> list, Predicate <T> match)
 {
     return(!list.Has(match));
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Indicates whether this instance has any exceptions.
 /// </summary>
 /// <param name="logEvents">The log events to consider.</param>
 /// <returns>True if this instance has the specified events. False otherwise.</returns>
 public static bool HasExceptions(
     this List <IBdoLogEvent> logEvents)
 {
     return(logEvents.Has(EventKinds.Exception));
 }
Ejemplo n.º 21
0
        public void TestFirstAll()
        {
            List <AnEntity> al = CreateList1();

            al.Has().All(e => e.PropertyB == "B").Assert();
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Indicates whether this instance has any messages.
 /// </summary>
 /// <param name="logEvents">The log events to consider.</param>
 /// <returns>True if this instance has the specified events. False otherwise.</returns>
 public static bool HasMessages(
     this List <IBdoLogEvent> logEvents)
 {
     return(logEvents.Has(EventKinds.Message));
 }
Ejemplo n.º 23
0
 /// <summary>
 /// 指定要素が存在しないかどうか
 /// </summary>
 /// <typeparam name="T">型</typeparam>
 /// <param name="list">リスト</param>
 /// <param name="match">合致条件</param>
 /// <returns>存在しなければTrue</returns>
 static public bool DontHave <T>(this List <T> list, Func <int, T, bool> match)
 {
     return(!list.Has(match));
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Indicates whether this instance has any warnings, errors or exceptions.
 /// </summary>
 /// <param name="logEvents">The log events to consider.</param>
 /// <returns>True if this instance has the specified events. False otherwise.</returns>
 public static bool HasErrorOrExceptionOrWarnings(
     this List <IBdoLogEvent> logEvents)
 {
     return(logEvents.Has(EventKinds.Warning, EventKinds.Error, EventKinds.Exception));
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Indicates whether this instance has any errors.
 /// </summary>
 /// <param name="logEvents">The log events to consider.</param>
 /// <returns>True if this instance has the specified events. False otherwise.</returns>
 public static bool HasErrors(
     this List <IBdoLogEvent> logEvents)
 {
     return(logEvents.Has(EventKinds.Error));
 }
Ejemplo n.º 26
0
 public bool  WillAdd(Func <T, bool> filter) => _toAddNodes.Has(filter);
Ejemplo n.º 27
0
 /// <summary>
 /// Indicates whether this instance has any warnings.
 /// </summary>
 /// <param name="logEvents">The log events to consider.</param>
 /// <returns>True if this instance has the specified events. False otherwise.</returns>
 public static bool HasWarnings(
     this List <IBdoLogEvent> logEvents)
 {
     return(logEvents.Has(EventKinds.Warning));
 }