public override void ReadFrom(XElement xE)
 {
     base.ReadFrom(xE);
     Included = null;
     Excluded = null;
     foreach (var xItem in xE.Elements())
     {
         var localName = xItem.Name.LocalName;
         if (localName == "included")
         {
             if (Included == null)
             {
                 Included = new List <string>();
             }
             Included.Add(xItem.Value);
         }
         else if (localName == "excluded")
         {
             if (Excluded == null)
             {
                 Excluded = new List <string>();
             }
             Excluded.Add(xItem.Value);
         }
     }
 }
Ejemplo n.º 2
0
 private static bool IsNewLocation(
     IImmutableList <PersistedLocation> persistedLocations,
     Included location
     )
 {
     return(!persistedLocations.Select(selector: p => p.CheckInsLocationId).Contains(value: location.Id));
 }
Ejemplo n.º 3
0
        private Expression ParseKeyword_NEW(string Keyword)
        {
            ConsumeWS();
            string Name = Getstr(Reg_Any);

            List <Expression> Arguments = ParseArgExpList();
            var Params = Arguments.Select(x => x.Type).ToList();

            var Dest = Included.SelectMany(x => x.ExportedTypes).Concat(IncludedType).FirstOrDefault(x => x.FullName.ToUpper() == Name.ToUpper());

            if (Dest == default(Type))
            {
                throw new AutoitException(AutoitExceptionType.CLASSDOESNOTEXIXTS, LineNumber, Cursor, Name);
            }
            var Candidates = Dest.GetTypeInfo().DeclaredConstructors.Where(x => x.GetParameters().Length == Params.Count);

            if (Candidates.Count() == 0)
            {
                throw new AutoitException(AutoitExceptionType.CONSTRUCTORMISMATCH, LineNumber, Cursor);
            }
            var Selected = Candidates.FirstOrDefault(x => x.GetParameters().Select(y => y.ParameterType).SequenceEqual(Params));

            if (Selected == default(ConstructorInfo))
            {
                Selected = Candidates.First();
            }
            return(Expression.New(Selected,
                                  Arguments.Zip(Selected.GetParameters().Select(z => z.ParameterType), (x, y) => x.ConvertTo(y))));
        }
Ejemplo n.º 4
0
 public bool MatchesUser(User user)
 {
     if (user.Key != null)
     {
         if (Included != null && Included.Contains(user.Key))
         {
             return(true);
         }
         if (Excluded != null && Excluded.Contains(user.Key))
         {
             return(false);
         }
         if (Rules != null)
         {
             foreach (var rule in Rules)
             {
                 if (rule.MatchesUser(user, this.Key, this.Salt))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Ejemplo n.º 5
0
        public Roster(Included inc, List <Participant> participants)
        {
            Id = inc.Id;
            foreach (var participant in inc.Relationships.Participants.Data)
            {
                Participants.Add(participants.Find(x => x.Id == participant.Id));
            }
//            Participants = participants;
        }
Ejemplo n.º 6
0
 public Asset(Included inc)
 {
     Id          = inc.Id;
     CreatedAt   = inc.Attributes.CreatedAt;
     Description = inc.Attributes.Description;
     Name        = inc.Attributes.Name;
     URL         = inc.Attributes.URL;
     ShardID     = inc.Attributes.ShardId;
 }
Ejemplo n.º 7
0
        public Round(Included inc /*, List<Participant> participants*/)
        {
            Id      = inc.Id;
            Ordinal = inc.Attributes.Ordinal;
//            foreach (var participant in inc.Relationships.Participants.Data) {
//                Participants.Add(participants.Find(x => x.Id == participant.Id));
//            }
            WinningTeam = inc.Attributes.Stats.WinningTeam;
            Duration    = inc.Attributes.Duration;
        }
 public async Task LoadIconsAsync()
 {
     await Task.Run(() =>
     {
         foreach (JumpListItemViewModel item in Included.Concat(NotIncluded).ToArray())
         {
             item.SetIconImageSource();
         }
     });
 }
Ejemplo n.º 9
0
 public bool IsLikelyValid()
 {
     if (TestName == null || Included == null || Testers == null || Required == null)
     {
         return(false);
     }
     TestDescription ??= "";
     Included.ForEach(o => Path.GetFileName(o));
     Testers.ForEach(o => Path.GetFileName(o));
     Required.ForEach(o => Path.GetFileName(o));
     return(true);
 }
Ejemplo n.º 10
0
 public void AppendIncluded(Resource resource)
 {
     if (resource == null)
     {
         return;
     }
     if (Included == null)
     {
         Included = new HashSet <Resource>();
     }
     Included.Add(resource);
 }
Ejemplo n.º 11
0
    private static LocationUpdate MapLocationUpdate(
        Included location,
        IImmutableList <Attendee> attendees
        )
    {
        var attendee = attendees.FirstOrDefault(predicate: a
                                                => a.Relationships?.Locations?.Data?.SingleOrDefault()?.Id == location.Id);

        return(new(
                   checkInsLocationId : location.Id,
                   name : location.Attributes?.Name ?? string.Empty,
                   eventId : attendee?.Relationships?.Event?.Data?.Id ?? 0));
    }
Ejemplo n.º 12
0
        public Participant(Included inc)
        {
            Id                = inc.Id;
            Type              = inc.Type;
            ActorId           = inc.Attributes.Actor;
            ParticipantPlayer = new Player(inc.Relationships.Player.Data.Id);
            var stats = inc.Attributes.Stats;

            Stats = new ParticipantStats(Id, stats.Side, stats.WinningTeam, stats.Score, stats.Kills, stats.Deaths,
                                         stats.TimeAlive, stats.DamageDone, stats.DamageReceived,
                                         stats.HealingDone, stats.HealingReceived, stats.DisablesDone, stats.DisablesReceived,
                                         stats.EnergyGained, stats.EnergyUsed, stats.AbilityUses, stats.Attachment,
                                         stats.Outfit, stats.Emote, stats.Mount);
        }
Ejemplo n.º 13
0
        }//ToXml()

        public JObject ToJson()
        {
            //JObject Ret = new JObject();

            JObject RootPropObj = new JObject();

            //Ret[CswEnumNbtViewXmlNodeName.TreeView.ToString()] = RootPropObj;

            RootPropObj["nodename"]           = CswEnumNbtViewXmlNodeName.TreeView.ToString().ToLower();
            RootPropObj["viewname"]           = ViewName;
            RootPropObj["version"]            = "1.0";
            RootPropObj["iconfilename"]       = IconFileName;
            RootPropObj["selectable"]         = Selectable.ToString().ToLower();
            RootPropObj["mode"]               = ViewMode.ToString();
            RootPropObj["width"]              = (Width > 0) ? Width.ToString() : "";
            RootPropObj["viewid"]             = (ViewId.isSet()) ? ViewId.get().ToString() : "";
            RootPropObj["category"]           = Category;
            RootPropObj["visibility"]         = Visibility.ToString();
            RootPropObj["visibilityroleid"]   = (VisibilityRoleId != null) ? VisibilityRoleId.PrimaryKey.ToString() : "";
            RootPropObj["visibilityrolename"] = (VisibilityRoleId != null) ? _CswNbtResources.Nodes[VisibilityRoleId].NodeName : "";
            RootPropObj["visibilityuserid"]   = (VisibilityUserId != null) ? VisibilityUserId.PrimaryKey.ToString() : "";
            RootPropObj["visibilityusername"] = (VisibilityUserId != null) ? _CswNbtResources.Nodes[VisibilityUserId].NodeName : "";
            RootPropObj["groupbysiblings"]    = GroupBySiblings;
            RootPropObj["included"]           = Included.ToString().ToLower();
            RootPropObj["isdemo"]             = IsDemo.ToString().ToLower();
            RootPropObj["issystem"]           = IsSystem.ToString().ToLower();
            RootPropObj["includetempnodes"]   = IncludeTempNodes.ToString().ToLower();
            RootPropObj["gridgroupbycol"]     = GridGroupByCol.ToString().ToLower();
            RootPropObj["showdelete"]         = false; //for ViewContentTree - don't show the "X" on view root

            JObject ChildObject = new JObject();

            if (null == RootPropObj[_ChildRelationshipsName] ||
                RootPropObj[_ChildRelationshipsName].Type != JTokenType.Object)
            {
                RootPropObj[_ChildRelationshipsName] = ChildObject;

                // Recurse on child ViewNodes
                foreach (CswNbtViewRelationship ChildRelationship in ChildRelationships)
                {
                    JProperty ChildRelationshipProp = ChildRelationship.ToJson();
                    if (null == ChildObject[ChildRelationshipProp.Name])
                    {
                        ChildObject.Add(ChildRelationshipProp);
                    }
                }
            }
            //return Ret;
            return(RootPropObj);
        }//ToXml()
Ejemplo n.º 14
0
 public void AppendIncluded(ResourceCollection resources)
 {
     if (resources == null)
     {
         return;
     }
     if (Included == null)
     {
         Included = new HashSet <Resource>();
     }
     foreach (var res in resources)
     {
         Included.Add(res as dynamic);
     }
 }
Ejemplo n.º 15
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Included.GetHashCode();
         hashCode = (hashCode * 397) ^ (SteamName?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ VerifiedFinite.GetHashCode();
         hashCode = (hashCode * 397) ^ SteamPlaytime.GetHashCode();
         hashCode = (hashCode * 397) ^ MainPlaytime.GetHashCode();
         hashCode = (hashCode * 397) ^ ExtrasPlaytime.GetHashCode();
         hashCode = (hashCode * 397) ^ CompletionistPlaytime.GetHashCode();
         hashCode = (hashCode * 397) ^ (HltbName?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ VerifiedCorrelation.GetHashCode();
         return(hashCode);
     }
 }
Ejemplo n.º 16
0
 public void AppendIncluded(HashSet <Resource> included)
 {
     if (included == null)
     {
         return;
     }
     if (Included == null)
     {
         Included = included;
         return;
     }
     foreach (var inc in included)
     {
         Included.Add(inc);
     }
 }
Ejemplo n.º 17
0
 public Round(Included inc, List <Roster> rosters)
 {
     Id      = inc.Id;
     Ordinal = inc.Attributes.Ordinal;
     foreach (var roster in rosters)
     {
         foreach (var participant in roster.Participants)
         {
             Participants.Add(participant);
         }
     }
     //            foreach (var participant in inc.Relationships.Participants.Data) {
     //                Participants.Add(participants.Find(x => x.Id == participant.Id));
     //            }
     WinningTeam = inc.Attributes.Stats.WinningTeam;
     Duration    = inc.Attributes.Duration;
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Populates the Included Property with ResourceObjects
        /// </summary>
        /// <param name="dataSet">The data conatining the properties</param>
        /// <param name="includedProperties">Defines which properties are to be included</param>
        private void SetupIncludes(IEnumerable <T> dataSet, IEnumerable <PropertyInfo> includedProperties, Uri queryString = null)
        {
            // ignore if no data is present
            if (!includedProperties.Any())
            {
                return;
            }

            if (Included == null)
            {
                Included = new JsonApiResourceObjectDictionary();
            }
            // process each item in data
            foreach (var data in dataSet)
            {
                // iterate over all of the items' properties and look for the requested properties
                var propertiesArray = data.GetType().GetProperties();
                foreach (var propertyInfo in propertiesArray)
                {
                    if (includedProperties.Any(x => x.Name == propertyInfo.Name))
                    {
                        if (typeof(IJsonApiDataModel).IsAssignableFrom(propertyInfo.PropertyType))
                        {
                            var rawData = propertyInfo.GetValue(data) as IJsonApiDataModel;
                            Included.AddResource(JsonApiResourceBuilder.Build(rawData, false));
                        }
                        else if (propertyInfo.PropertyType.IsNonStringEnumerable() && propertyInfo.GetValue(data) is IEnumerable <IJsonApiDataModel> rawData)
                        {
                            foreach (var item in rawData)
                            {
                                Included.AddResource(JsonApiResourceBuilder.Build(item, false));
                            }
                        }
                    }
                }
            }
            if (Included.ResourceObjectDictionary.Count < 1)
            {
                Included = null;
            }
        }
Ejemplo n.º 19
0
        public static string FindTXTContent(TAGBlock block)
        {
            if (block == null || block.Name == null)
            {
                return(string.Empty);
            }
            string ret = string.Empty;

            if (Included.Contains(block.Name) && !Excluded.Contains(block.Name))
            {
                ret += (SplitHtml.GetAllInsideContent(block));
            }
            else if (block.FirstInside != null && !Excluded.Contains(block.Name))
            {
                ret += FindTXTContent(block.FirstInside);
            }
            if (block.NextBlock != null)
            {
                ret += FindTXTContent(block.NextBlock);
            }
            return(ret);
        }
Ejemplo n.º 20
0
        protected override List <AphidExpression> MutateCore(AphidExpression expression, out bool hasChanged)
        {
            LoadScriptExpression loadExp;
            AphidExpression      scriptExp;

            if (expression.Type != AphidExpressionType.LoadScriptExpression)
            {
                hasChanged = false;

                return(null);
            }
            else if ((loadExp = (LoadScriptExpression)expression).FileExpression.Type !=
                     AphidExpressionType.StringExpression)
            {
                var constantFolder = new ConstantFoldingMutator();
                var mutated        = constantFolder.Mutate(new List <AphidExpression> {
                    loadExp.FileExpression
                });

                if (mutated.Count != 1 || (scriptExp = mutated[0]).Type != AphidExpressionType.StringExpression)
                {
                    hasChanged = false;

                    return(null);
                    //throw new AphidParserException("Invalid load script operand", loadExp);
                }
            }
            else
            {
                scriptExp = loadExp.FileExpression;
            }

            var scriptStr = StringParser.Parse(((StringExpression)scriptExp).Value);

            var script = Loader.FindScriptFile(_applicationDirectory, scriptStr);

            if (!File.Exists(script))
            {
                throw new AphidParserException(
                          string.Format(
                              "Could not find script {0}",
                              scriptStr),
                          scriptExp);
            }

            Included.Add(script);

            List <AphidExpression> ast;

            if (AphidConfig.Current.ScriptCaching && !DisableCaching)
            {
                AphidByteCodeCache cache;

                if (UseImplicitReturns)
                {
                    cache = new AphidByteCodeCache(Loader.SearchPaths.ToArray());
                }
                else
                {
                    cache = new AphidByteCodeCache(Loader.SearchPaths.ToArray(), 0x1);
                }

                ast = cache.Read(script, out var cacheSources);

                for (var i = 0; i < cacheSources.Length; i++)
                {
                    Included.Add(cacheSources[i].Name);
                }
            }
            else
            {
                var code = AphidScript.Read(script);
                ast = AphidParser.Parse(code, script, useImplicitReturns: UseImplicitReturns);
            }

            if (PerformCommonTransformations)
            {
                var mutatedAst = new PartialOperatorMutator().Mutate(ast);
                mutatedAst = new AphidMacroMutator().Mutate(mutatedAst);
                mutatedAst = new AphidPreprocessorDirectiveMutator().Mutate(mutatedAst);
                mutatedAst = new ConstantFoldingMutator().Mutate(mutatedAst);
                hasChanged = true;

                return(mutatedAst);
            }

            hasChanged = true;

            return(ast);
        }
Ejemplo n.º 21
0
        public XmlNode ToXml(XmlDocument XmlDoc)
        {
            XmlNode RootXmlNode = XmlDoc.CreateNode(XmlNodeType.Element, CswEnumNbtViewXmlNodeName.TreeView.ToString(), "");

            XmlAttribute ViewNameAttribute = XmlDoc.CreateAttribute("viewname");

            ViewNameAttribute.Value = ViewName;
            RootXmlNode.Attributes.Append(ViewNameAttribute);

            //bz #5157
            XmlAttribute ViewVersionAttribute = XmlDoc.CreateAttribute("version");

            ViewVersionAttribute.Value = "1.0";
            RootXmlNode.Attributes.Append(ViewVersionAttribute);

            XmlAttribute IconFileNameAttribute = XmlDoc.CreateAttribute("iconfilename");

            IconFileNameAttribute.Value = IconFileName;
            RootXmlNode.Attributes.Append(IconFileNameAttribute);

            XmlAttribute SelectableAttribute = XmlDoc.CreateAttribute("selectable");

            SelectableAttribute.Value = Selectable.ToString().ToLower();
            RootXmlNode.Attributes.Append(SelectableAttribute);

            XmlAttribute ModeAttribute = XmlDoc.CreateAttribute("mode");

            ModeAttribute.Value = ViewMode.ToString();
            RootXmlNode.Attributes.Append(ModeAttribute);

            XmlAttribute WidthAttribute = XmlDoc.CreateAttribute("width");

            if (Width > 0)
            {
                WidthAttribute.Value = Width.ToString();
            }
            else
            {
                WidthAttribute.Value = "";
            }
            RootXmlNode.Attributes.Append(WidthAttribute);

            XmlAttribute ViewIdAttribute = XmlDoc.CreateAttribute("viewid");

            if (ViewId.isSet())
            {
                ViewIdAttribute.Value = ViewId.get().ToString();
            }
            else
            {
                ViewIdAttribute.Value = "";
            }
            RootXmlNode.Attributes.Append(ViewIdAttribute);

            XmlAttribute CategoryAttribute = XmlDoc.CreateAttribute("category");

            CategoryAttribute.Value = Category.ToString();
            RootXmlNode.Attributes.Append(CategoryAttribute);

            XmlAttribute VisibilityAttribute = XmlDoc.CreateAttribute("visibility");

            VisibilityAttribute.Value = Visibility.ToString();
            RootXmlNode.Attributes.Append(VisibilityAttribute);

            XmlAttribute VisibilityRoleIdAttribute = XmlDoc.CreateAttribute("visibilityroleid");

            if (VisibilityRoleId != null)
            {
                VisibilityRoleIdAttribute.Value = VisibilityRoleId.PrimaryKey.ToString();
            }
            RootXmlNode.Attributes.Append(VisibilityRoleIdAttribute);

            XmlAttribute VisibilityUserIdAttribute = XmlDoc.CreateAttribute("visibilityuserid");

            if (VisibilityUserId != null)
            {
                VisibilityUserIdAttribute.Value = VisibilityUserId.PrimaryKey.ToString();
            }
            RootXmlNode.Attributes.Append(VisibilityUserIdAttribute);

            XmlAttribute GroupBySiblingsAttribute = XmlDoc.CreateAttribute("groupbysiblings");

            GroupBySiblingsAttribute.Value = GroupBySiblings.ToString().ToLower();
            RootXmlNode.Attributes.Append(GroupBySiblingsAttribute);

            XmlAttribute IncludedAttribute = XmlDoc.CreateAttribute("included");

            IncludedAttribute.Value = Included.ToString().ToLower();
            RootXmlNode.Attributes.Append(IncludedAttribute);

            XmlAttribute IsDemoAttribute = XmlDoc.CreateAttribute("isdemo");

            IsDemoAttribute.Value = IsDemo.ToString().ToLower();
            RootXmlNode.Attributes.Append(IsDemoAttribute);

            XmlAttribute IsSystemAttribute = XmlDoc.CreateAttribute("issystem");

            IsSystemAttribute.Value = IsSystem.ToString().ToLower();
            RootXmlNode.Attributes.Append(IsSystemAttribute);

            XmlAttribute IncludeTempNodesAttribute = XmlDoc.CreateAttribute("includetempnodes");

            IncludeTempNodesAttribute.Value = IncludeTempNodes.ToString().ToLower();
            RootXmlNode.Attributes.Append(IncludeTempNodesAttribute);

            XmlAttribute GridGroupByColAttribute = XmlDoc.CreateAttribute("gridgroupbycol");

            GridGroupByColAttribute.Value = GridGroupByCol.ToString().ToLower();
            RootXmlNode.Attributes.Append(GridGroupByColAttribute);

            // Recurse on child ViewNodes
            foreach (CswNbtViewRelationship ChildRelationship in this.ChildRelationships)
            {
                XmlNode ChildXmlNode = ChildRelationship.ToXml(XmlDoc);
                RootXmlNode.AppendChild(ChildXmlNode);
            }

            return(RootXmlNode);
        }//ToXml()
        private Expression ParseUltraPrimary()
        {
            ConsumeWS();
            char       ch = Read()[0];
            string     szTemp;
            Expression Ret;

            switch (ch)
            {
            case ']':
                throw new AutoitException(AutoitExceptionType.UNBALANCEDSUBSCRIPT, LineNumber, Cursor);

            case '(':
                Ret = ParseBoolean();
                if (Peek() != ")")
                {
                    throw new AutoitException(AutoitExceptionType.UNBALANCEDPAREN, LineNumber, Cursor);
                }
                Consume();
                return(Ret);

            case ')':
                throw new AutoitException(AutoitExceptionType.UNBALANCEDPAREN, LineNumber, Cursor);

            case ';':
                return(null);

            case '$':
                szTemp = Getstr(Reg_AlphaNum);
                Type t;

                if (szTemp == "")
                {
                    throw new AutoitException(AutoitExceptionType.LEXER_BADFORMAT, LineNumber, Cursor);
                }

                List <Expression> SubScript = new List <Expression>();
                while (TryParseSubscript(out Ret))
                {
                    SubScript.Add(Ret);
                }
                TryParseCast(out t);
                ConsumeWS();
                return(VarAutExpression.VariableAccess(szTemp, null, t, SubScript.ToArray()));

            case '@':
                var CPos = Cursor - 1;
                szTemp = Getstr(Reg_AlphaNum);

                if (szTemp == "")
                {
                    throw new AutoitException(AutoitExceptionType.LEXER_BADFORMAT, LineNumber, Cursor);
                }
                return(Expression.Call(BasicMacro.GetMacroInfo, Expression.Constant(szTemp, typeof(string))));

            case '"':
            case '\'':
                SeekRelative(-1);
                return(Expression.Constant(Lexer_CSString(), typeof(string)));

            default:

                SeekRelative(-1);
                szTemp = GetNbr();
                if (szTemp != "")
                {
                    if (szTemp.Contains(".") || Math.Abs(double.Parse(szTemp, CultureInfo.InvariantCulture)) > long.MaxValue)
                    {
                        return(Expression.Constant(double.Parse(szTemp, CultureInfo.InvariantCulture), typeof(double)));
                    }
                    else if (Math.Abs(double.Parse(szTemp, CultureInfo.InvariantCulture)) > int.MaxValue)
                    {
                        return(Expression.Constant(long.Parse(szTemp, CultureInfo.InvariantCulture), typeof(long)));
                    }
                    else
                    {
                        return(Expression.Constant(int.Parse(szTemp, CultureInfo.InvariantCulture), typeof(int)));
                    }
                }
                szTemp = Getstr(Reg_Any);
                if (szTemp != "")
                {
                    if (szTemp.Contains("."))
                    {
                        var AType = Included.SelectMany(x => x.ExportedTypes).Concat(IncludedType).FirstOrDefault(
                            x => {
                            var Nr = x.FullName.ToUpper().Split('.');
                            return(Nr.SequenceEqual(szTemp.ToUpper().Split('.').Take(Nr.Count())));
                        });
                        if (AType != default(Type))
                        {
                            SeekRelative(AType.FullName.Length - szTemp.Length);
                            return(Expression.Constant(null, AType.GetTypeInfo().IsValueType ? typeof(Nullable <>).MakeGenericType(AType) : AType));
                        }
                    }
                    else
                    {
                        return(ParseKeywordOrFunc(szTemp));
                    }
                }
                throw new AutoitException(AutoitExceptionType.LEXER_NOTRECOGNISED, LineNumber, Cursor, "" + ch);
            }
        }
Ejemplo n.º 23
0
 // note this glosses over some format issues, like if there are multiple included resources with the same identifier
 public JsonApiResource GetIncludedResourceByIdentifier(JsonApiResourceIdentifier id)
 {
     return(Included.FirstOrDefault(jsonApiResource => jsonApiResource.ResourceIdentifier.Equals(id)));
 }
 private void OnExclude(char?symbol)
 {
     Included.Remove(symbol);
     Excluded.Insert(0, symbol);
 }