Ejemplo n.º 1
0
 public ITag Parse(string tag)
 {
     var tokenizer = new Tokenizer(tag, true, true, null, TagLibConstants.SEPERATORS, TagLibConstants.LITERALS, null);
     var helper = new ParseHelper(tokenizer);
     helper.Init();
     return Construct(helper,_factory.GetNewLocator()).Parse();
 }
Ejemplo n.º 2
0
 public ITagLibParser Construct(ParseHelper helper, IResourceLocator locator)
 {
     var mode = _lib.Mode;
     if(mode==TagLibMode.Strict) return new StrictTagLibParser(_lib, _expressionLib,helper, locator, _factory, _tagValidator);
     if (mode == TagLibMode.StrictResolve) return new StrictResolveTagLibParser(_lib, _expressionLib, helper, locator, _factory, _tagValidator);
     if (mode == TagLibMode.RelaxedResolve) return new RelaxedResolveTagLibParser(_lib, _expressionLib, helper, locator, _factory, _tagValidator);
     if (mode == TagLibMode.IgnoreResolve) return new IgnoreResolveTagLibParser(_lib, _expressionLib, helper, locator, _factory, _tagValidator);
     return null;
 }
Ejemplo n.º 3
0
 public AbstractTagLibParser(TagLibForParsing lib, ExpressionLib expressionLib, ParseHelper helper, IResourceLocator locator, IResourceLocatorFactory factory, ITagValidator tagValidator)
 {
     _lib = lib;
     _expressionLib = expressionLib;
     _helper = helper;
     _locator = locator;
     _factory = factory;
     _tagValidator = tagValidator;
 }
        public IActionResult SendAxpTemplate(string companyIds, string axpTemplate, string environmentLevel)
        {
            var input = new FileInputModel();
            // Send Axp Template
            SendTemplate template = new SendTemplate();
            ParseHelper parser = new ParseHelper();
            var CompanyIDTest = parser.SplitCompanyIDs(companyIds);


            template.SendAxpTemplate(CompanyIDTest, axpTemplate, environmentLevel);
            return Json(new { success = true });
        }
Ejemplo n.º 5
0
 public ITag Parse(ParseHelper helper, IResourceLocator locator)
 {
     helper.PushNewTokenConfiguration(true, true, null, TagLibConstants.SEPERATORS, null, TagLibConstants.LITERALS,
                                      ResetIndex.CurrentAndLookAhead);
     try
     {
         return Construct(helper, locator).Parse();
     }
     finally
     {
         helper.PopTokenConfiguration(ResetIndex.LookAhead);
     }
 }
Ejemplo n.º 6
0
        public void ToXml_removes_IContent_attributes_that_cant_be_updated()
        {
            var validXmlAttributes = new List<XAttribute>
            {
                new XAttribute(XName.Get("id"), 1078),
                new XAttribute(XName.Get("parentID"), 1077),
                new XAttribute(XName.Get("sortOrder"), 7),
                new XAttribute(XName.Get("createDate"), "2016-04-23T13:37:59"),
                new XAttribute(XName.Get("nodeName"), "My firstpage"),
                new XAttribute(XName.Get("creatorID"), 45),
                new XAttribute(XName.Get("path"), "-1,1077,1078"),
                new XAttribute(XName.Get("level"), 3),
                new XAttribute(XName.Get("key"), "6d28d0a4-6874-42d2-8c36-0bff8f00d686"),
                new XAttribute(XName.Get("template"), 1234)
            };

            var invalidXmlAttributes = new List<XAttribute>
            {
                new XAttribute(XName.Get("updateDate"), "2016-06-13T22:06:22"),
                new XAttribute(XName.Get("urlName"), "root"),
                new XAttribute(XName.Get("isDoc"), ""),
                new XAttribute(XName.Get("nodeType"), 1060),
                new XAttribute(XName.Get("creatorName"), "Lorem Ipsum"),
                new XAttribute(XName.Get("writerName"), "Lorem Ipsum"),
                new XAttribute(XName.Get("writerID"), 0),
                new XAttribute(XName.Get("nodeTypeAlias"), "Site"),
            };

            var xmlDocument = XElement.Parse("<Site></Site>");
            xmlDocument.Add(validXmlAttributes);
            xmlDocument.Add(invalidXmlAttributes);

            var content = TestModels.CreateContent();
            var service = new Mock<IPackagingService>();
            service.Setup(p => p.Export(content, false, false)).Returns(() =>
            {
                return xmlDocument;
            });

            var helper = new ParseHelper(service.Object);
            var xmlResult = helper.ToXml(content);

            Assert.AreEqual(10, xmlResult.Attributes().Count());
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Parses the path to split from each path and file name
        /// </summary>
        /// <param name="path">The path to parse</param>
        /// <param name="mode">
        /// DIRECTORY if it is only directory path
        /// FULL_PATH if it includes file name</param>
        /// <param name="name">Pass the variable to store the file name of given path</param>
        /// <returns>Path tokens in string array</returns>
        public static string[] ParsePathAndName(string path, ParseHelper.Mode mode, out string name)
        {
            List<string> list = new List<string>();
            path = ParseHelper.TrimSlash(path);

            while (path.Contains("/"))
            {
                list.Add(getToken(path, out path));
            }

            if (mode == Mode.DIRECTORY)
            {
                name = null;
                list.Add(path);
            }
            else
            {
                name = path;
            }
            return list.ToArray();
        }
Ejemplo n.º 8
0
        public MainPage()
        {
            this.InitializeComponent();
            parseHelper = ParseHelper.Instance;
            getDataCopyrightMessage();
                 
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;

            if(parseHelper.parseToilets.Count < 1)
            {
                //findNearbyToilets();
            } else
            {
                LoosNearbyList.ItemsSource = parseHelper.parseToilets;
            }

            CheckForGeolocation();

        }
Ejemplo n.º 9
0
        public override void CheckInput(FormM form, DFDictionary entity)
        {
            base.CheckInput(form, entity);
            //脱脂槽
            var TZCStandard = ParseHelper.ParseDecimal(entity["TZCStandard"]);

            if (!TZCStandard.HasValue)
            {
                throw new WFException("脱脂槽标准信息必须是数字");
            }
            var TZCMax = ParseHelper.ParseDecimal(entity["TZCMax"]);

            if (!TZCMax.HasValue)
            {
                throw new WFException("脱脂槽最大信息必须是数字");
            }
            var TZCMin = ParseHelper.ParseDecimal(entity["TZCMin"]);

            if (!TZCMin.HasValue)
            {
                throw new WFException("脱脂槽最小信息必须是数字");
            }

            //AQ
            var AQStandard = ParseHelper.ParseDecimal(entity["AQStandard"]);

            if (!AQStandard.HasValue)
            {
                throw new WFException("AQ标准信息必须是数字");
            }
            var AQMax = ParseHelper.ParseDecimal(entity["AQMax"]);

            if (!AQMax.HasValue)
            {
                throw new WFException("AQ最大信息必须是数字");
            }
            var AQMin = ParseHelper.ParseDecimal(entity["AQMin"]);

            if (!AQMin.HasValue)
            {
                throw new WFException("AQ最小信息必须是数字");
            }

            //碱洗
            var JXStandard = ParseHelper.ParseDecimal(entity["JXStandard"]);

            if (!JXStandard.HasValue)
            {
                throw new WFException("碱洗标准信息必须是数字");
            }
            var JXMax = ParseHelper.ParseDecimal(entity["JXMax"]);

            if (!JXMax.HasValue)
            {
                throw new WFException("碱洗最大信息必须是数字");
            }
            var JXMin = ParseHelper.ParseDecimal(entity["JXMin"]);

            if (!JXMin.HasValue)
            {
                throw new WFException("碱洗最小信息必须是数字");
            }
            //主酸洗
            var ZSXStandard = ParseHelper.ParseDecimal(entity["ZSXStandard"]);

            if (!ZSXStandard.HasValue)
            {
                throw new WFException("主酸洗标准信息必须是数字");
            }
            var ZSXMax = ParseHelper.ParseDecimal(entity["ZSXMax"]);

            if (!ZSXMax.HasValue)
            {
                throw new WFException("主酸洗最大信息必须是数字");
            }
            var ZSXMin = ParseHelper.ParseDecimal(entity["ZSXMin"]);

            if (!ZSXMin.HasValue)
            {
                throw new WFException("主酸洗最小信息必须是数字");
            }

            //焦铜
            var JTStandard = ParseHelper.ParseDecimal(entity["JTStandard"]);

            if (!JTStandard.HasValue)
            {
                throw new WFException("焦铜标准信息必须是数字");
            }
            var JTMax = ParseHelper.ParseDecimal(entity["JTMax"]);

            if (!JTMax.HasValue)
            {
                throw new WFException("焦铜最大信息必须是数字");
            }
            var JTMin = ParseHelper.ParseDecimal(entity["JTMin"]);

            if (!JTMin.HasValue)
            {
                throw new WFException("焦铜最小信息必须是数字");
            }

            //硫酸锌
            var LSXStandard = ParseHelper.ParseDecimal(entity["LSXStandard"]);

            if (!LSXStandard.HasValue)
            {
                throw new WFException("硫酸锌标准信息必须是数字");
            }
            var LSXMax = ParseHelper.ParseDecimal(entity["LSXMax"]);

            if (!LSXMax.HasValue)
            {
                throw new WFException("硫酸锌最大信息必须是数字");
            }
            var LSXMin = ParseHelper.ParseDecimal(entity["LSXMin"]);

            if (!LSXMin.HasValue)
            {
                throw new WFException("硫酸锌最小信息必须是数字");
            }

            //热水洗
            var RSXStandard = ParseHelper.ParseDecimal(entity["RSXStandard"]);

            if (!RSXStandard.HasValue)
            {
                throw new WFException("热水洗标准信息必须是数字");
            }
            var RSXMax = ParseHelper.ParseDecimal(entity["RSXMax"]);

            if (!RSXMax.HasValue)
            {
                throw new WFException("热水洗最大信息必须是数字");
            }
            var RSXMin = ParseHelper.ParseDecimal(entity["RSXMin"]);

            if (!RSXMin.HasValue)
            {
                throw new WFException("热水洗最小信息必须是数字");
            }

            //MF冷却水
            var MFLQSStandard = ParseHelper.ParseDecimal(entity["MFLQSStandard"]);

            if (!MFLQSStandard.HasValue)
            {
                throw new WFException("MF冷却水标准信息必须是数字");
            }
            var MFLQSMax = ParseHelper.ParseDecimal(entity["MFLQSMax"]);

            if (!MFLQSMax.HasValue)
            {
                throw new WFException("MF冷却水最大信息必须是数字");
            }
            var MFLQSMin = ParseHelper.ParseDecimal(entity["MFLQSMin"]);

            if (!MFLQSMin.HasValue)
            {
                throw new WFException("MF冷却水最小信息必须是数字");
            }

            //冷却槽
            var LQCStandard = ParseHelper.ParseDecimal(entity["LQCStandard"]);

            if (!LQCStandard.HasValue)
            {
                throw new WFException("冷却槽标准信息必须是数字");
            }
            var LQCMax = ParseHelper.ParseDecimal(entity["LQCMax"]);

            if (!LQCMax.HasValue)
            {
                throw new WFException("冷却槽最大信息必须是数字");
            }
            var LQCMin = ParseHelper.ParseDecimal(entity["LQCMin"]);

            if (!LQCMin.HasValue)
            {
                throw new WFException("冷却槽最小信息必须是数字");
            }


            //磷酸
            var LSStandard = ParseHelper.ParseDecimal(entity["LSStandard"]);

            if (!LSStandard.HasValue)
            {
                throw new WFException("磷酸标准信息必须是数字");
            }
            var LSMax = ParseHelper.ParseDecimal(entity["LSMax"]);

            if (!LSMax.HasValue)
            {
                throw new WFException("磷酸最大信息必须是数字");
            }
            var LSMin = ParseHelper.ParseDecimal(entity["LSMin"]);

            if (!LSMin.HasValue)
            {
                throw new WFException("磷酸最小信息必须是数字");
            }

            //皂浸
            var ZJStandard = ParseHelper.ParseDecimal(entity["ZJStandard"]);

            if (!ZJStandard.HasValue)
            {
                throw new WFException("皂浸标准信息必须是数字");
            }
            var ZJMax = ParseHelper.ParseDecimal(entity["ZJMax"]);

            if (!ZJMax.HasValue)
            {
                throw new WFException("皂浸最大信息必须是数字");
            }
            var ZJMin = ParseHelper.ParseDecimal(entity["ZJMin"]);

            if (!ZJMin.HasValue)
            {
                throw new WFException("皂浸最小信息必须是数字");
            }
        }
Ejemplo n.º 10
0
 public void LoadDataFromXmlCustom(XmlNode xmlRoot)
 {
     this.crownType = xmlRoot.Name;
     this.offset    = (Vector2)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(Vector2));
 }
Ejemplo n.º 11
0
        public static StatementSpecRaw CompilePattern(String expression, String expressionForErrorMessage, bool addPleaseCheck, EPServicesContext services, SelectClauseStreamSelectorEnum defaultStreamSelector)
        {
            // Parse
            ParseResult parseResult = ParseHelper.Parse(expression, expressionForErrorMessage, addPleaseCheck, PatternParseRule, true);
            var         ast         = parseResult.Tree;

            if (Log.IsDebugEnabled)
            {
                ASTUtil.DumpAST(ast);
            }

            // Walk
            EPLTreeWalkerListener walker = new EPLTreeWalkerListener(
                parseResult.TokenStream,
                services.EngineImportService,
                services.VariableService,
                services.SchedulingService,
                defaultStreamSelector,
                services.EngineURI,
                services.ConfigSnapshot,
                services.PatternNodeFactory,
                services.ContextManagementService,
                parseResult.Scripts,
                services.ExprDeclaredService,
                services.TableService);

            try
            {
                ParseHelper.Walk(ast, walker, expression, expressionForErrorMessage);
            }
            catch (ASTWalkException ex)
            {
                Log.Debug(".createPattern Error validating expression", ex);
                throw new EPStatementException(ex.Message, expression);
            }
            catch (EPStatementSyntaxException ex)
            {
                throw;
            }
            catch (Exception ex)
            {
                String message = "Error in expression";
                Log.Debug(message, ex);
                throw new EPStatementException(GetNullableErrortext(message, ex.Message), expression);
            }

            var walkerStatementSpec = walker.GetStatementSpec();

            if (walkerStatementSpec.StreamSpecs.Count > 1)
            {
                throw new IllegalStateException("Unexpected multiple stream specifications encountered");
            }

            // Get pattern specification
            var patternStreamSpec = (PatternStreamSpecRaw)walkerStatementSpec.StreamSpecs[0];

            // Create statement spec, set pattern stream, set wildcard select
            var statementSpec = new StatementSpecRaw(SelectClauseStreamSelectorEnum.ISTREAM_ONLY);

            statementSpec.StreamSpecs.Add(patternStreamSpec);
            statementSpec.SelectClauseSpec.SelectExprList.Clear();
            statementSpec.SelectClauseSpec.SelectExprList.Add(new SelectClauseElementWildcard());
            statementSpec.Annotations             = walkerStatementSpec.Annotations;
            statementSpec.ExpressionNoAnnotations = parseResult.ExpressionWithoutAnnotations;

            return(statementSpec);
        }
        /// <summary>
        /// </summary>
        /// <param name="line"> </param>
        public void SetHealingMitigated(Line line)
        {
            if (Name == Constants.CharacterName)
            {
                //LineHistory.Add(new LineHistory(line));
            }

            Last20HealingActions.Add(new LineHistory(line));
            if (Last20HealingActions.Count > 20)
            {
                Last20HealingActions.RemoveAt(0);
            }

            var currentHealing = line.Crit ? line.Amount > 0 ? ParseHelper.GetOriginalAmount(line.Amount, (decimal).5) : 0 : line.Amount;

            if (currentHealing > 0)
            {
                ParseHelper.LastAmountByAction.EnsurePlayerAction(line.Source, line.Action, currentHealing);
            }

            var       abilityGroup = GetGroup("HealingMitigatedByAction");
            StatGroup subAbilityGroup;

            if (!abilityGroup.TryGetGroup(line.Action, out subAbilityGroup))
            {
                subAbilityGroup = new StatGroup(line.Action);
                subAbilityGroup.Stats.AddStats(HealingMitigatedStatList(null));
                abilityGroup.AddGroup(subAbilityGroup);
            }
            var       playerGroup = GetGroup("HealingMitigatedToPlayers");
            StatGroup subPlayerGroup;

            if (!playerGroup.TryGetGroup(line.Target, out subPlayerGroup))
            {
                subPlayerGroup = new StatGroup(line.Target);
                subPlayerGroup.Stats.AddStats(HealingMitigatedStatList(null));
                playerGroup.AddGroup(subPlayerGroup);
            }
            var       abilities = subPlayerGroup.GetGroup("HealingMitigatedToPlayersByAction");
            StatGroup subPlayerAbilityGroup;

            if (!abilities.TryGetGroup(line.Action, out subPlayerAbilityGroup))
            {
                subPlayerAbilityGroup = new StatGroup(line.Action);
                subPlayerAbilityGroup.Stats.AddStats(HealingMitigatedStatList(subPlayerGroup, true));
                abilities.AddGroup(subPlayerAbilityGroup);
            }
            Stats.IncrementStat("TotalHealingMitigatedActionsUsed");
            subAbilityGroup.Stats.IncrementStat("TotalHealingMitigatedActionsUsed");
            subPlayerGroup.Stats.IncrementStat("TotalHealingMitigatedActionsUsed");
            subPlayerAbilityGroup.Stats.IncrementStat("TotalHealingMitigatedActionsUsed");
            Stats.IncrementStat("TotalOverallHealingMitigated", line.Amount);
            subAbilityGroup.Stats.IncrementStat("TotalOverallHealingMitigated", line.Amount);
            subPlayerGroup.Stats.IncrementStat("TotalOverallHealingMitigated", line.Amount);
            subPlayerAbilityGroup.Stats.IncrementStat("TotalOverallHealingMitigated", line.Amount);
            if (line.Crit)
            {
                Stats.IncrementStat("HealingMitigatedCritHit");
                Stats.IncrementStat("CriticalHealingMitigated", line.Amount);
                subAbilityGroup.Stats.IncrementStat("HealingMitigatedCritHit");
                subAbilityGroup.Stats.IncrementStat("CriticalHealingMitigated", line.Amount);
                subPlayerGroup.Stats.IncrementStat("HealingMitigatedCritHit");
                subPlayerGroup.Stats.IncrementStat("CriticalHealingMitigated", line.Amount);
                subPlayerAbilityGroup.Stats.IncrementStat("HealingMitigatedCritHit");
                subPlayerAbilityGroup.Stats.IncrementStat("CriticalHealingMitigated", line.Amount);
                if (line.Modifier != 0)
                {
                    var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                    var modStat = "HealingMitigatedCritMod";
                    Stats.IncrementStat(modStat, mod);
                    subAbilityGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerAbilityGroup.Stats.IncrementStat(modStat, mod);
                }
            }
            else
            {
                Stats.IncrementStat("HealingMitigatedRegHit");
                Stats.IncrementStat("RegularHealingMitigated", line.Amount);
                subAbilityGroup.Stats.IncrementStat("HealingMitigatedRegHit");
                subAbilityGroup.Stats.IncrementStat("RegularHealingMitigated", line.Amount);
                subPlayerGroup.Stats.IncrementStat("HealingMitigatedRegHit");
                subPlayerGroup.Stats.IncrementStat("RegularHealingMitigated", line.Amount);
                subPlayerAbilityGroup.Stats.IncrementStat("HealingMitigatedRegHit");
                subPlayerAbilityGroup.Stats.IncrementStat("RegularHealingMitigated", line.Amount);
                if (line.Modifier != 0)
                {
                    var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                    var modStat = "HealingMitigatedRegMod";
                    Stats.IncrementStat(modStat, mod);
                    subAbilityGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerAbilityGroup.Stats.IncrementStat(modStat, mod);
                }
            }
        }
Ejemplo n.º 13
0
 public void CreateCoupon(Coupon coupon) => RequestHelper.Post("/coupons", instance, ParseHelper.ParseRequest(coupon).Result);
Ejemplo n.º 14
0
 public Response <CouponRoot> GetCoupon(string uniqueId) => ParseHelper.ParseResponse <CouponRoot>(RequestHelper.Get(" /coupons/" + uniqueId, instance).Result).Result;
Ejemplo n.º 15
0
        /// <summary>
        /// Parses .osr file.
        /// </summary>
        /// <param name="stream">Stream containing replay data.</param>
        /// <returns>A usable <see cref="Replay"/>.</returns>
        public static Replay Decode(Stream stream)
        {
            Replay replay = new Replay();

            using (var r = new SerializationReader(stream))
            {
                replay.Ruleset        = (Ruleset)r.ReadByte();
                replay.OsuVersion     = r.ReadInt32();
                replay.BeatmapMD5Hash = r.ReadString();
                replay.PlayerName     = r.ReadString();
                replay.ReplayMD5Hash  = r.ReadString();
                replay.Count300       = r.ReadUInt16();
                replay.Count100       = r.ReadUInt16();
                replay.Count50        = r.ReadUInt16();
                replay.CountGeki      = r.ReadUInt16();
                replay.CountKatu      = r.ReadUInt16();
                replay.CountMiss      = r.ReadUInt16();
                replay.ReplayScore    = r.ReadInt32();
                replay.Combo          = r.ReadUInt16();
                replay.PerfectCombo   = r.ReadBoolean();
                replay.Mods           = (Mods)r.ReadInt32();

                string lifeData = r.ReadString();
                if (!string.IsNullOrEmpty(lifeData))
                {
                    foreach (string lifeBlock in lifeData.Split(','))
                    {
                        string[] split = lifeBlock.Split('|');
                        if (split.Length < 2)
                        {
                            continue;
                        }

                        replay.LifeFrames.Add(new LifeFrame()
                        {
                            Time       = Convert.ToInt32(split[0]),
                            Percentage = ParseHelper.ToFloat(split[1])
                        });
                    }
                }

                replay.ReplayTimestamp = r.ReadDateTime();
                replay.ReplayLength    = r.ReadInt32();

                if (replay.ReplayLength > 0)
                {
                    byte[] replayDataBytes    = r.ReadBytes(replay.ReplayLength);
                    byte[] decompressedBytes  = LZMAHelper.Decompress(replayDataBytes);
                    string decompressedString = Encoding.ASCII.GetString(decompressedBytes);
                    int    lastTime           = 0;

                    foreach (string frame in decompressedString.Split(','))
                    {
                        if (string.IsNullOrEmpty(frame))
                        {
                            continue;
                        }

                        string[] split = frame.Split('|');

                        if (split.Length < 4)
                        {
                            continue;
                        }

                        if (split[0] == "-12345")
                        {
                            replay.Seed = Convert.ToInt32(split[3]);
                            continue;
                        }

                        ReplayFrame replayFrame = new ReplayFrame();
                        replayFrame.TimeDiff = Convert.ToInt32(split[0]);
                        replayFrame.Time     = Convert.ToInt32(split[0]) + lastTime;
                        replayFrame.X        = ParseHelper.ToFloat(split[1]);
                        replayFrame.Y        = ParseHelper.ToFloat(split[2]);
                        switch (replay.Ruleset)
                        {
                        case Ruleset.Standard:
                            replayFrame.StandardKeys = (StandardKeys)Convert.ToInt32(split[3]);
                            break;

                        case Ruleset.Taiko:
                            replayFrame.TaikoKeys = (TaikoKeys)Convert.ToInt32(split[3]);
                            break;

                        case Ruleset.Fruits:
                            replayFrame.CatchKeys = (CatchKeys)Convert.ToInt32(split[3]);
                            break;

                        case Ruleset.Mania:
                            replayFrame.ManiaKeys = (ManiaKeys)replayFrame.X;
                            break;
                        }

                        replay.ReplayFrames.Add(replayFrame);

                        lastTime = replay.ReplayFrames.Last().Time;
                    }
                }

                if (r.BaseStream.Length - r.BaseStream.Position > 0)
                {
                    if (r.BaseStream.Length - r.BaseStream.Position == 4)
                    {
                        replay.OnlineId = r.ReadInt32();
                    }
                    else
                    {
                        replay.OnlineId = r.ReadInt64();
                    }
                }
            }

            return(replay);
        }
        IEduProgramProfile GetEduProgramProfile()
        {
            var eppId = ParseHelper.ParseToNullable <int> (Request.QueryString [Key]);

            return(eppId != null?GetItemWithDependencies(eppId.Value) : null);
        }
 public void LoadDataFromXmlCustom(XmlNode xmlRoot)
 {
     DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "animal", xmlRoot.Name);
     this.commonality = (float)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(float));
 }
Ejemplo n.º 18
0
 public override void Init()
 {
     Info     = ParseHelper.Parse <string>(Data[0]);
     PointIds = ParseHelper.ParseList <string>(Data[1]).Select(ParseHelper.ParseId).ToList();
 }
Ejemplo n.º 19
0
 public StrictResolveTagLibParser(TagLibForParsing lib, ExpressionLib expressionLib, ParseHelper helper, IResourceLocator locator, IResourceLocatorFactory factory, ITagValidator tagValidator)
     : base(lib, expressionLib, helper, locator, factory, tagValidator)
 {
 }
Ejemplo n.º 20
0
 public ParsedTemplate ParseNested(ParseHelper helper, IResourceLocator locator)
 {
     try
     {
         helper.PushNewTokenConfiguration(
             true,
             false,
             InternalFormatter.COMMENT,
             InternalFormatter.SEPERATORS,
             null,
             null, //InternalFormatter.LITERALS,
             ResetIndex.LookAhead);
         return new InternalFormatter(new TagLibParserFactoryAdapter(this), _expressionLib, helper, true, true, locator).ParseNested();
     }
     finally
     {
         helper.PopTokenConfiguration(ResetIndex.CurrentAndLookAhead);
     }
 }
Ejemplo n.º 21
0
 private static void ReadWhiteSpace(ParseHelper helper)
 {
     while (helper.Lookahead != null &&
            helper.Lookahead.Contents.Trim().Length == 0)
     {
         helper.Next();
     }
 }
Ejemplo n.º 22
0
 private static ParseResult Parse(string epl)
 {
     return(ParseHelper.Parse(epl, epl, true, EPL_PARSE_RULE, true));
 }
Ejemplo n.º 23
0
        private void ParseHitObjects(string line)
        {
            string[] tokens = line.Split(',');

            Point position = new Point(Convert.ToInt32(tokens[0]), Convert.ToInt32(tokens[1]));

            int startTime = Convert.ToInt32(tokens[2]);

            HitObjectType type = (HitObjectType)int.Parse(tokens[3]);

            int comboOffset = (int)(type & HitObjectType.ComboOffset) >> 4;

            type &= ~HitObjectType.ComboOffset;

            bool isNewCombo = type.HasFlag(HitObjectType.NewCombo);

            type &= ~HitObjectType.NewCombo;

            HitSoundType hitSound = (HitSoundType)Convert.ToInt32(tokens[4]);

            HitObject hitObject = null;

            string[] extrasSplit  = tokens.Last().Split(':');
            int      extrasOffset = type.HasFlag(HitObjectType.Hold) ? 1 : 0;
            Extras   extras       = tokens.Last().Contains(":") ? new Extras
            {
                SampleSet      = (SampleSet)Convert.ToInt32(extrasSplit[0 + extrasOffset]),
                AdditionSet    = (SampleSet)Convert.ToInt32(extrasSplit[1 + extrasOffset]),
                CustomIndex    = Convert.ToInt32(extrasSplit[2 + extrasOffset]),
                Volume         = Convert.ToInt32(extrasSplit[3 + extrasOffset]),
                SampleFileName = string.IsNullOrEmpty(extrasSplit[4 + extrasOffset]) ? null : extrasSplit[4 + extrasOffset]
            } : new Extras();

            switch (type)
            {
            case HitObjectType.Circle:
            {
                if (Beatmap.GeneralSection.Mode == Ruleset.Standard)
                {
                    hitObject = new Circle(position, startTime, startTime, hitSound, extras, isNewCombo, comboOffset);
                }
                else if (Beatmap.GeneralSection.Mode == Ruleset.Taiko)
                {
                    hitObject = new TaikoHit(position, startTime, startTime, hitSound, extras, isNewCombo, comboOffset);
                }
                else if (Beatmap.GeneralSection.Mode == Ruleset.Fruits)
                {
                    hitObject = new CatchFruit(position, startTime, startTime, hitSound, extras, isNewCombo, comboOffset);
                }
                else if (Beatmap.GeneralSection.Mode == Ruleset.Mania)
                {
                    hitObject = new ManiaHit(position, startTime, startTime, hitSound, extras, isNewCombo, comboOffset);
                }
            }
            break;

            case HitObjectType.Slider:
            {
                CurveType    curveType    = ParseHelper.GetCurveType(tokens[5].Split('|')[0][0]);
                List <Point> sliderPoints = ParseHelper.GetSliderPoints(tokens[5].Split('|'));

                int    repeats     = Convert.ToInt32(tokens[6]);
                double pixelLength = ParseHelper.ToDouble(tokens[7]);

                int endTime = CalculateEndTime(startTime, repeats, pixelLength);

                List <HitSoundType> edgeHitSounds = new List <HitSoundType>();
                if (tokens.Length > 8 && tokens[8].Length > 0)
                {
                    edgeHitSounds = new List <HitSoundType>();
                    edgeHitSounds = Array.ConvertAll(tokens[8].Split('|'), s => (HitSoundType)Convert.ToInt32(s)).ToList();
                }

                List <Tuple <SampleSet, SampleSet> > edgeAdditions = new List <Tuple <SampleSet, SampleSet> >();
                if (tokens.Length > 9 && tokens[9].Length > 0)
                {
                    edgeAdditions = new List <Tuple <SampleSet, SampleSet> >();
                    foreach (var s in tokens[9].Split('|'))
                    {
                        edgeAdditions.Add(new Tuple <SampleSet, SampleSet>((SampleSet)Convert.ToInt32(s.Split(':').First()), (SampleSet)Convert.ToInt32(s.Split(':').Last())));
                    }
                }

                if (Beatmap.GeneralSection.Mode == Ruleset.Standard)
                {
                    hitObject = new Slider(position, startTime, endTime, hitSound, curveType, sliderPoints, repeats,
                                           pixelLength, edgeHitSounds, edgeAdditions, extras, isNewCombo, comboOffset);
                }
                else if (Beatmap.GeneralSection.Mode == Ruleset.Taiko)
                {
                    hitObject = new TaikoDrumroll(position, startTime, endTime, hitSound, curveType, sliderPoints,
                                                  repeats, pixelLength, edgeHitSounds, edgeAdditions, extras, isNewCombo, comboOffset);
                }
                else if (Beatmap.GeneralSection.Mode == Ruleset.Fruits)
                {
                    hitObject = new CatchDroplets(position, startTime, endTime, hitSound, curveType, sliderPoints,
                                                  repeats, pixelLength, edgeHitSounds, edgeAdditions, extras, isNewCombo, comboOffset);
                }
            }
            break;

            case HitObjectType.Spinner:
            {
                int endTime = Convert.ToInt32(tokens[5].Trim());

                if (Beatmap.GeneralSection.Mode == Ruleset.Standard)
                {
                    hitObject = new Spinner(position, startTime, endTime, hitSound, extras, isNewCombo, comboOffset);
                }
                else if (Beatmap.GeneralSection.Mode == Ruleset.Taiko)
                {
                    hitObject = new TaikoSpinner(position, startTime, endTime, hitSound, extras, isNewCombo, comboOffset);
                }
                else if (Beatmap.GeneralSection.Mode == Ruleset.Fruits)
                {
                    hitObject = new CatchSpinner(position, startTime, endTime, hitSound, extras, isNewCombo, comboOffset);
                }
            }
            break;

            case HitObjectType.Hold:
            {
                string[] additions = tokens[5].Split(':');
                int      endTime   = Convert.ToInt32(additions[0].Trim());
                hitObject = new ManiaHold(position, startTime, endTime, hitSound, extras, isNewCombo, comboOffset);
            }
            break;
            }

            Beatmap.HitObjects.Add(hitObject);
        }
Ejemplo n.º 24
0
        void SetupDivisionSelector()
        {
            var divisionId = Request.QueryString ["division_id"];

            formEditPositions.SetDivision(ParseHelper.ParseToNullable <int> (divisionId));
        }
Ejemplo n.º 25
0
        private void ParseGeneral(string line)
        {
            int    index    = line.IndexOf(':');
            string variable = line.Remove(index).Trim();
            string value    = line.Remove(0, index + 1).Trim();

            switch (variable)
            {
            case "AudioFilename":
                Beatmap.GeneralSection.AudioFilename = value.Trim();
                break;

            case "AudioLeadIn":
                Beatmap.GeneralSection.AudioLeadIn = Convert.ToInt32(value.Trim());
                break;

            case "PreviewTime":
                Beatmap.GeneralSection.PreviewTime = Convert.ToInt32(value.Trim());
                break;

            case "Countdown":
                Beatmap.GeneralSection.Countdown = ParseHelper.ToBool(value.Trim());
                break;

            case "SampleSet":
                Beatmap.GeneralSection.SampleSet = (SampleSet)Enum.Parse(typeof(SampleSet), value.Trim());
                break;

            case "StackLeniency":
                Beatmap.GeneralSection.StackLeniency = ParseHelper.ToDouble(value.Trim());
                break;

            case "Mode":
                Beatmap.GeneralSection.Mode   = (Ruleset)Enum.Parse(typeof(Ruleset), value.Trim());
                Beatmap.GeneralSection.ModeId = Convert.ToInt32(value.Trim());
                break;

            case "LetterboxInBreaks":
                Beatmap.GeneralSection.LetterboxInBreaks = ParseHelper.ToBool(value.Trim());
                break;

            case "WidescreenStoryboard":
                Beatmap.GeneralSection.WidescreenStoryboard = ParseHelper.ToBool(value.Trim());
                break;

            case "StoryFireInFront":
                Beatmap.GeneralSection.StoryFireInFront = ParseHelper.ToBool(value.Trim());
                break;

            case "SpecialStyle":
                Beatmap.GeneralSection.SpecialStyle = ParseHelper.ToBool(value.Trim());
                break;

            case "EpilepsyWarning":
                Beatmap.GeneralSection.EpilepsyWarning = ParseHelper.ToBool(value.Trim());
                break;

            case "UseSkinSprites":
                Beatmap.GeneralSection.UseSkinSprites = ParseHelper.ToBool(value.Trim());
                break;
            }
        }
Ejemplo n.º 26
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="atomLine"></param>
 /// <returns></returns>
 private string GetInterfaceFileChain(string atomLine)
 {
     string[] fields = ParseHelper.ParsePdbAtomLine(atomLine);
     return(fields[4]);
 }
Ejemplo n.º 27
0
        /// <summary>
        /// 获取当前订单结算金额 add by caoheyang 20140402
        /// 胡灵波-20150504
        /// </summary>
        /// <param name="model">参数实体</param>
        /// <returns></returns>
        public decimal GetSettleMoney(OrderCommission model)
        {
            decimal sumsettleMoney = 0;

            decimal settleMoney = 0;

            if (model.CommissionType == 2)//固定金额
            {
                settleMoney    = Decimal.Round(ParseHelper.ToDecimal(model.CommissionFixValue) * ParseHelper.ToDecimal(model.OrderCount), 2);
                sumsettleMoney = Decimal.Round(ParseHelper.ToDecimal(model.DistribSubsidy)
                                               * ParseHelper.ToInt(model.OrderCount) + settleMoney, 2);
            }
            else
            {
                settleMoney = model.BusinessCommission == 0 ?
                              0 : Decimal.Round(ParseHelper.ToDecimal(model.BusinessCommission / 100m) * ParseHelper.ToDecimal(model.Amount), 2);
                sumsettleMoney = Decimal.Round(ParseHelper.ToDecimal(model.DistribSubsidy)
                                               * ParseHelper.ToInt(model.OrderCount) + settleMoney, 2);
            }

            return(sumsettleMoney);
        }
        public override void CheckInput(FormM form, DFDictionary entity)
        {
            base.CheckInput(form, entity);
            if (entity["Line"] == "L01")
            {
                if (string.IsNullOrWhiteSpace(entity["Z6Standard"]))
                {
                    throw new WFException("Z6炉气氛信息必须填写");
                }
            }


            //炉压设定检查
            var Z1Standard = ParseHelper.ParseDecimal(entity["Z1Standard"]);

            if (!Z1Standard.HasValue)
            {
                throw new WFException("Z1必须是数字");
            }
            var Z1Max = ParseHelper.ParseDecimal(entity["Z1Max"]);

            if (!Z1Max.HasValue)
            {
                throw new WFException("Z1最大值必须是数字");
            }
            var Z1Min = ParseHelper.ParseDecimal(entity["Z1Min"]);

            if (!Z1Min.HasValue)
            {
                throw new WFException("Z1最小值必须是数字");
            }
            var Z2Standard = ParseHelper.ParseDecimal(entity["Z2Standard"]);

            if (!Z2Standard.HasValue)
            {
                throw new WFException("Z2必须是数字");
            }
            var Z2Max = ParseHelper.ParseDecimal(entity["Z2Max"]);

            if (!Z2Max.HasValue)
            {
                throw new WFException("Z2最大值必须是数字");
            }
            var Z2Min = ParseHelper.ParseDecimal(entity["Z2Min"]);

            if (!Z2Min.HasValue)
            {
                throw new WFException("Z2最小值必须是数字");
            }
            var Z3Standard = ParseHelper.ParseDecimal(entity["Z3Standard"]);

            if (!Z3Standard.HasValue)
            {
                throw new WFException("Z3必须是数字");
            }
            var Z3Max = ParseHelper.ParseDecimal(entity["Z3Max"]);

            if (!Z3Max.HasValue)
            {
                throw new WFException("Z3最大值必须是数字");
            }
            var Z3Min = ParseHelper.ParseDecimal(entity["Z3Min"]);

            if (!Z3Min.HasValue)
            {
                throw new WFException("Z3最小值必须是数字");
            }
            var Z4Standard = ParseHelper.ParseDecimal(entity["Z4Standard"]);

            if (!Z4Standard.HasValue)
            {
                throw new WFException("Z4必须是数字");
            }
            var Z4Max = ParseHelper.ParseDecimal(entity["Z4Max"]);

            if (!Z4Max.HasValue)
            {
                throw new WFException("Z4最大值必须是数字");
            }
            var Z4Min = ParseHelper.ParseDecimal(entity["Z4Min"]);

            if (!Z4Min.HasValue)
            {
                throw new WFException("Z4最小值必须是数字");
            }
            var Z5Standard = ParseHelper.ParseDecimal(entity["Z5Standard"]);

            if (!Z5Standard.HasValue)
            {
                throw new WFException("Z5必须是数字");
            }
            var Z5Max = ParseHelper.ParseDecimal(entity["Z5Max"]);

            if (!Z5Max.HasValue)
            {
                throw new WFException("Z5最大值必须是数字");
            }
            var Z5Min = ParseHelper.ParseDecimal(entity["Z5Min"]);

            if (!Z5Min.HasValue)
            {
                throw new WFException("Z5最小值必须是数字");
            }
            var Z6Standard = ParseHelper.ParseDecimal(entity["Z6Standard"]);

            if (!Z6Standard.HasValue)
            {
                throw new WFException("Z6必须是数字");
            }

            var Z6Max = ParseHelper.ParseDecimal(entity["Z6Max"]);

            if (!Z6Max.HasValue)
            {
                throw new WFException("Z6最大值必须是数字");
            }
            var Z6Min = ParseHelper.ParseDecimal(entity["Z6Min"]);

            if (!Z6Min.HasValue)
            {
                throw new WFException("Z6最小值必须是数字");
            }
        }
Ejemplo n.º 29
0
        public void GetContentForBrackets_StringWithBrackets_ReturnValidContent(string inputString, string outputString)
        {
            var bracketsContent = ParseHelper.GetContentForBrackets(inputString);

            bracketsContent.ShouldBe(outputString);
        }
Ejemplo n.º 30
0
 public Response <CouponList> GetCoupons() => ParseHelper.ParseResponse <CouponList>(RequestHelper.Get("/coupons", instance).Result).Result;
Ejemplo n.º 31
0
        /// <summary>
        /// </summary>
        /// <param name="line"></param>
        public void SetDamageTaken(Line line)
        {
            if ((LimitBreaks.IsLimit(line.Action)) && Settings.Default.IgnoreLimitBreaks)
            {
                return;
            }

            Last20DamageTakenActions.Add(new LineHistory(line));
            if (Last20DamageTakenActions.Count > 20)
            {
                Last20DamageTakenActions.RemoveAt(0);
            }

            //LineHistory.Add(new LineHistory(line));

            var fields = line.GetType()
                         .GetProperties();

            var       abilityGroup = GetGroup("DamageTakenByAction");
            StatGroup subAbilityGroup;

            if (!abilityGroup.TryGetGroup(line.Action, out subAbilityGroup))
            {
                subAbilityGroup = new StatGroup(line.Action);
                subAbilityGroup.Stats.AddStats(DamageTakenStatList(null));
                abilityGroup.AddGroup(subAbilityGroup);
            }
            var       damageGroup = GetGroup("DamageTakenByPlayers");
            StatGroup subPlayerGroup;

            if (!damageGroup.TryGetGroup(line.Source, out subPlayerGroup))
            {
                subPlayerGroup = new StatGroup(line.Source);
                subPlayerGroup.Stats.AddStats(DamageTakenStatList(null));
                damageGroup.AddGroup(subPlayerGroup);
            }
            var       abilities = subPlayerGroup.GetGroup("DamageTakenByPlayersByAction");
            StatGroup subPlayerAbilityGroup;

            if (!abilities.TryGetGroup(line.Action, out subPlayerAbilityGroup))
            {
                subPlayerAbilityGroup = new StatGroup(line.Action);
                subPlayerAbilityGroup.Stats.AddStats(DamageTakenStatList(subPlayerGroup, true));
                abilities.AddGroup(subPlayerAbilityGroup);
            }
            Stats.IncrementStat("TotalDamageTakenActionsUsed");
            subAbilityGroup.Stats.IncrementStat("TotalDamageTakenActionsUsed");
            subPlayerGroup.Stats.IncrementStat("TotalDamageTakenActionsUsed");
            subPlayerAbilityGroup.Stats.IncrementStat("TotalDamageTakenActionsUsed");
            if (line.Hit)
            {
                Stats.IncrementStat("TotalOverallDamageTaken", line.Amount);
                subAbilityGroup.Stats.IncrementStat("TotalOverallDamageTaken", line.Amount);
                subPlayerGroup.Stats.IncrementStat("TotalOverallDamageTaken", line.Amount);
                subPlayerAbilityGroup.Stats.IncrementStat("TotalOverallDamageTaken", line.Amount);
                if (line.Crit)
                {
                    Stats.IncrementStat("DamageTakenCritHit");
                    subAbilityGroup.Stats.IncrementStat("DamageTakenCritHit");
                    subPlayerGroup.Stats.IncrementStat("DamageTakenCritHit");
                    subPlayerAbilityGroup.Stats.IncrementStat("DamageTakenCritHit");
                    Stats.IncrementStat("CriticalDamageTaken", line.Amount);
                    subAbilityGroup.Stats.IncrementStat("CriticalDamageTaken", line.Amount);
                    subPlayerGroup.Stats.IncrementStat("CriticalDamageTaken", line.Amount);
                    subPlayerAbilityGroup.Stats.IncrementStat("CriticalDamageTaken", line.Amount);
                    if (line.Modifier != 0)
                    {
                        var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                        var modStat = "DamageTakenCritMod";
                        Stats.IncrementStat(modStat, mod);
                        subAbilityGroup.Stats.IncrementStat(modStat, mod);
                        subPlayerGroup.Stats.IncrementStat(modStat, mod);
                        subPlayerAbilityGroup.Stats.IncrementStat(modStat, mod);
                    }
                }
                else
                {
                    Stats.IncrementStat("DamageTakenRegHit");
                    subAbilityGroup.Stats.IncrementStat("DamageTakenRegHit");
                    subPlayerGroup.Stats.IncrementStat("DamageTakenRegHit");
                    subPlayerAbilityGroup.Stats.IncrementStat("DamageTakenRegHit");
                    Stats.IncrementStat("RegularDamageTaken", line.Amount);
                    subAbilityGroup.Stats.IncrementStat("RegularDamageTaken", line.Amount);
                    subPlayerGroup.Stats.IncrementStat("RegularDamageTaken", line.Amount);
                    subPlayerAbilityGroup.Stats.IncrementStat("RegularDamageTaken", line.Amount);
                    if (line.Modifier != 0)
                    {
                        var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                        var modStat = "DamageTakenRegMod";
                        Stats.IncrementStat(modStat, mod);
                        subAbilityGroup.Stats.IncrementStat(modStat, mod);
                        subPlayerGroup.Stats.IncrementStat(modStat, mod);
                        subPlayerAbilityGroup.Stats.IncrementStat(modStat, mod);
                    }
                }
            }
            else
            {
                Stats.IncrementStat("DamageTakenRegMiss");
                subAbilityGroup.Stats.IncrementStat("DamageTakenRegMiss");
                subPlayerGroup.Stats.IncrementStat("DamageTakenRegMiss");
                subPlayerAbilityGroup.Stats.IncrementStat("DamageTakenRegMiss");
            }
            foreach (var stat in fields.Where(stat => LD.Contains(stat.Name))
                     .Where(stat => Equals(stat.GetValue(line), true)))
            {
                var regStat = String.Format("DamageTaken{0}", stat.Name);
                Stats.IncrementStat(regStat);
                subAbilityGroup.Stats.IncrementStat(regStat);
                subPlayerGroup.Stats.IncrementStat(regStat);
                subPlayerAbilityGroup.Stats.IncrementStat(regStat);
                if (line.Modifier == 0)
                {
                    continue;
                }
                var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                var modStat = String.Format("DamageTaken{0}Mod", stat.Name);
                Stats.IncrementStat(modStat, mod);
                subAbilityGroup.Stats.IncrementStat(modStat, mod);
                subPlayerGroup.Stats.IncrementStat(modStat, mod);
                subPlayerAbilityGroup.Stats.IncrementStat(modStat, mod);
            }
        }
Ejemplo n.º 32
0
 public void UpdateCoupon(Coupon coupon) => RequestHelper.Put("/coupons/", instance, ParseHelper.ParseRequest(coupon).Result);
Ejemplo n.º 33
0
        void ParseNews2(string html)
        {
            var doc = new HtmlDocument();

            doc.LoadHtml(html);

            var title = doc.DocumentNode.SelectSingleNode("//h2");

            if (title != null)
            {
                Model.Title = ParseHelper.Clean(title.InnerHtml);
            }

            var bodyChild = doc.DocumentNode.SelectSingleNode("//a[@name='content']");

            if (bodyChild != null)
            {
                var bodyPanel = bodyChild.ParentNode;
                if (bodyPanel != null)
                {
                    var image = bodyPanel.SelectSingleNode("descendant::img");
                    if (image != null)
                    {
                        var temp = image.Attributes["src"].Value;

                        if (!temp.Contains("http://"))
                        {
                            var index = Model.Id.LastIndexOf('/');
                            if (index != -1)
                            {
                                temp = Model.Id.Substring(0, index) + '/' + temp;
                            }
                        }

                        Model.Image = Model.LargeImage = temp;
                    }

                    Model.Content = ParseHelper.Clean(bodyPanel.InnerHtml);
                    if (Model.Content != null && Model.Content.Length > 200)
                    {
                        var index = Model.Content.IndexOf("\n", 20);
                        if (index != -1)
                        {
                            Model.Synopsis = Model.Content.Substring(0, index);
                        }
                        else
                        {
                            index = Model.Synopsis.IndexOf(" ", 200);
                            if (index != -1)
                            {
                                Model.Synopsis = Model.Content.Substring(0, index);
                            }
                            else
                            {
                                Model.Synopsis = Model.Synopsis.Substring(0, 200);
                            }
                        }
                    }
                }
            }

            if (LoadCompleted != null)
            {
                LoadCompleted(this, EventArgs.Empty);
            }
        }
Ejemplo n.º 34
0
        /// <summary>
        /// Compile the EPL.
        /// </summary>
        /// <param name="eplStatement">expression to compile</param>
        /// <param name="eplStatementForErrorMsg">use this text for the error message</param>
        /// <param name="addPleaseCheck">indicator to add a "please check" wording for stack paraphrases</param>
        /// <param name="statementName">is the name of the statement</param>
        /// <param name="defaultStreamSelector">the configuration for which insert or remove streams (or both) to produce</param>
        /// <param name="engineImportService">The engine import service.</param>
        /// <param name="variableService">The variable service.</param>
        /// <param name="schedulingService">The scheduling service.</param>
        /// <param name="engineURI">The engine URI.</param>
        /// <param name="configSnapshot">The config snapshot.</param>
        /// <param name="patternNodeFactory">The pattern node factory.</param>
        /// <param name="contextManagementService">The context management service.</param>
        /// <param name="exprDeclaredService">The expr declared service.</param>
        /// <param name="tableService">The table service.</param>
        /// <returns>
        /// statement specification
        /// </returns>
        /// <exception cref="EPStatementException">
        /// </exception>
        public static StatementSpecRaw CompileEPL(
            String eplStatement,
            String eplStatementForErrorMsg,
            bool addPleaseCheck,
            String statementName,
            SelectClauseStreamSelectorEnum defaultStreamSelector,
            EngineImportService engineImportService,
            VariableService variableService,
            SchedulingService schedulingService,
            String engineURI,
            ConfigurationInformation configSnapshot,
            PatternNodeFactory patternNodeFactory,
            ContextManagementService contextManagementService,
            ExprDeclaredService exprDeclaredService,
            TableService tableService)
        {
            if (Log.IsDebugEnabled)
            {
                Log.Debug(".createEPLStmt StatementName=" + statementName + " eplStatement=" + eplStatement);
            }

            var parseResult = ParseHelper.Parse(eplStatement, eplStatementForErrorMsg, addPleaseCheck, EPLParseRule, true);
            var ast         = parseResult.Tree;

            EPLTreeWalkerListener walker = new EPLTreeWalkerListener(
                parseResult.TokenStream,
                engineImportService,
                variableService,
                schedulingService,
                defaultStreamSelector,
                engineURI,
                configSnapshot,
                patternNodeFactory,
                contextManagementService,
                parseResult.Scripts,
                exprDeclaredService,
                tableService);

            try
            {
                ParseHelper.Walk(ast, walker, eplStatement, eplStatementForErrorMsg);
            }
            catch (ASTWalkException ex)
            {
                Log.Error(".createEPL Error validating expression", ex);
                throw new EPStatementException(ex.Message, eplStatementForErrorMsg, ex);
            }
            catch (EPStatementSyntaxException)
            {
                throw;
            }
            catch (Exception ex)
            {
                const string message = "Error in expression";
                Log.Debug(message, ex);
                throw new EPStatementException(GetNullableErrortext(message, ex.Message), eplStatementForErrorMsg, ex);
            }

            if (Log.IsDebugEnabled)
            {
                ASTUtil.DumpAST(ast);
            }

            StatementSpecRaw raw = walker.GetStatementSpec();

            raw.ExpressionNoAnnotations = parseResult.ExpressionWithoutAnnotations;
            return(raw);
        }
Ejemplo n.º 35
0
        void ParseNews(string html)
        {
            var doc = new HtmlDocument();

            doc.LoadHtml(html);

            var title = doc.DocumentNode.SelectSingleNode("//h1[@class='h1news']");

            if (title != null)
            {
                Model.Title = ParseHelper.Clean(title.InnerHtml);
            }

            var imageContainer = doc.DocumentNode.SelectSingleNode("//span[@class='lead_image']");

            if (imageContainer != null)
            {
                var image = imageContainer.SelectSingleNode("descendant::img");
                if (image != null)
                {
                    Model.Image = Model.LargeImage = image.Attributes["src"].Value;
                }
            }

            var bodyPanel = doc.DocumentNode.SelectSingleNode("//div[@id='contentbox_inner_main']");

            if (bodyPanel != null)
            {
                var date = bodyPanel.SelectSingleNode("descendant::p[@class='bold']");
                if (date != null)
                {
                    Model.Date = date.InnerText;
                }
                var paragraphs = bodyPanel.SelectNodes("descendant::p");
                if (paragraphs != null)
                {
                    var orderedParagraphs = paragraphs.OrderByDescending(p => p.InnerHtml.Length).ToArray();
                    Model.Content = ParseHelper.Clean(orderedParagraphs[0].InnerHtml);
                    if (Model.Content != null && Model.Content.Length > 200)
                    {
                        var index = Model.Content.IndexOf("\n", 20);
                        if (index != -1)
                        {
                            Model.Synopsis = Model.Content.Substring(0, index);
                        }
                        else
                        {
                            index = Model.Synopsis.IndexOf(" ", 200);
                            if (index != -1)
                            {
                                Model.Synopsis = Model.Content.Substring(0, index);
                            }
                            else
                            {
                                Model.Synopsis = Model.Synopsis.Substring(0, 200);
                            }
                        }
                    }
                }
            }

            if (LoadCompleted != null)
            {
                LoadCompleted(this, EventArgs.Empty);
            }
        }
Ejemplo n.º 36
0
 public void LoadDataFromXmlCustom(XmlNode xmlRoot)
 {
     DirectXmlCrossRefLoader.RegisterObjectWantsCrossRef(this, "bodyType", xmlRoot.Name);
     this.offset = (Vector2)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(Vector2));
 }
Ejemplo n.º 37
0
 public override void Init()
 {
     Info     = ParseHelper.ParseString(Data[0]);
     PointIds = Data.Skip(1).Select(ParseHelper.ParseId).ToArray();
 }
Ejemplo n.º 38
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <exception cref="ItemProcessingException"></exception>
        /// <exception cref="ConvoyItemProcessingException"></exception>
        public ConvoyData(JSONConfiguration config)
        {
            this.Currency     = config.System.Currency;
            this.ShowShopLink = (config.Shop != null);

            if (config.System.Tags != null)
            {
                this.Tags = Tag.BuildDictionary(config.System.Tags);
            }
            else
            {
                this.Tags = new Dictionary <string, Tag>();
            }

            this.Items = Item.BuildDictionary(config.System.Items, this.Tags);

            //Build the convoy item list
            this.ConvoyItems = new List <ConvoyItem>();
            foreach (IList <object> row in config.Convoy.Query.Data)
            {
                try
                {
                    IList <string> item = row.Select(r => r.ToString()).ToList();
                    string         name = ParseHelper.SafeStringParse(item, config.Convoy.Name, "Name", false);
                    if (string.IsNullOrEmpty(name))
                    {
                        continue;
                    }
                    this.ConvoyItems.Add(new ConvoyItem(config.Convoy, item, this.Items));
                }
                catch (Exception ex)
                {
                    throw new ConvoyItemProcessingException((row.ElementAtOrDefault(config.Convoy.Name) ?? string.Empty).ToString(), ex);
                }
            }

            //Build page parameters
            IList <ItemSort> sorts = new List <ItemSort>()
            {
                new ItemSort("Name", "name", false),
                new ItemSort("Owner", "owner", false),
                new ItemSort("Category", "category", true),
                new ItemSort("Uses", "maxUses", true)
            };

            if (config.System.WeaponRanks.Count > 0)
            {
                sorts.Add(new ItemSort("Weapon Rank", "weaponRank", true));
            }

            this.Parameters = new FilterParameters(sorts,
                                                   new List <string>()
            {
                "All"
            }.Union(this.ConvoyItems.Select(i => i.Owner).Where(o => !string.IsNullOrEmpty(o)).Distinct().OrderBy(o => o)).ToList(),
                                                   this.ConvoyItems.Select(i => i.Item.Category).Distinct().OrderBy(c => c).ToList(),
                                                   this.ConvoyItems.SelectMany(i => i.Item.UtilizedStats).Where(s => !string.IsNullOrEmpty(s)).Distinct().OrderBy(c => c).ToList(),
                                                   new Dictionary <string, bool>());

            //Always do this last
            RemoveUnusedObjects();
        }
Ejemplo n.º 39
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="pdbId"></param>
 /// <param name="crystInterface"></param>
 /// <param name="remark"></param>
 /// <param name="type"></param>
 public void GenerateInterfaceFile(string interfaceFile, InterfaceChains crystInterface, string remark, string type)
 {
     interfaceWriter.WriteInterfaceToFile(crystInterface.pdbId, crystInterface.interfaceId, interfaceFile, crystInterface.chain1, crystInterface.chain2, remark, type);
     ParseHelper.ZipPdbFile(interfaceFile);
 }
Ejemplo n.º 40
0
 public override void Init()
 {
     Info    = ParseHelper.ParseString(Data[0]);
     PointId = ParseHelper.ParseId(Data[1]);
     Length  = ParseHelper.Parse <double>(Data[2]);
 }
Ejemplo n.º 41
0
        /// <summary>
        /// Add the ligands with the same author name
        /// </summary>
        /// <param name="pdbId"></param>
        /// <param name="interfaceInfoList"></param>
        /// <param name="type"></param>
        /// <param name="needAsaUpdated"></param>
        /// <param name="needSameAuthorLigands"></param>
        /// <returns></returns>
        public ProtInterface[] GenerateInterfaceFilesInAuthNumbering(string pdbId, string coordXmlFile, ProtInterfaceInfo[] interfaceInfoList,
                                                                     string type, bool needSameAuthorLigands, string interfaceFileDir, DataTable asuTable, bool isAsuInterface)
        {
            string[] symOpStrings = GetSymOpStringsFromInterfaces(interfaceInfoList);

            // read data from crystal xml file
            EntryCrystal  thisEntryCrystal;
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(EntryCrystal));
            FileStream    xmlFileStream = new FileStream(coordXmlFile, FileMode.Open);

            thisEntryCrystal = (EntryCrystal)xmlSerializer.Deserialize(xmlFileStream);
            xmlFileStream.Close();

            Dictionary <string, AtomInfo[]> entryChainsHash = BuildCrystalWithAllChains(thisEntryCrystal, symOpStrings);

            UpdateResidueNumberingToAuthor(entryChainsHash);

            // protein asym id and its ligands with the same author name and the atoms for the ligands
            //    Hashtable asymIdLigandAtomInfoHash = GetEntryLigandAtomInfoHash(asuTable, thisEntryCrystal);
            Dictionary <string, string[]> asymLigandsHash = GetAsymChainLigandsHash(asuTable);

            int    i             = 0;
            string chain1        = "";
            string chain2        = "";
            string interfaceFile = "";

            ProtInterface[] interfaces      = new ProtInterface[interfaceInfoList.Length];
            string[]        symmetryStrings = new string[2];
            foreach (ProtInterfaceInfo interfaceInfo in interfaceInfoList)
            {
                chain1 = interfaceInfo.Chain1 + "_" + interfaceInfo.SymmetryString1;
                chain2 = interfaceInfo.Chain2 + "_" + interfaceInfo.SymmetryString2;
                if (!entryChainsHash.ContainsKey(chain1) || !entryChainsHash.ContainsKey(chain2))
                {
                    continue;
                }

                Dictionary <string, AtomInfo[]>[] ligandAtomInfoHashs = GetInterfaceLigandAtomInfoHashes(interfaceInfo, asymLigandsHash, entryChainsHash);

                interfaceInfo.Remark += FormatInterfaceAsa(interfaceInfo.ASA);
                symmetryStrings[0]    = interfaceInfo.SymmetryString1;
                symmetryStrings[1]    = interfaceInfo.SymmetryString2;
                interfaceInfo.Remark += FormatLigandsInfo(ligandAtomInfoHashs, symmetryStrings, asuTable);
                if (isAsuInterface)
                {
                    interfaceFile = Path.Combine(interfaceFileDir, pdbId + "_0" + interfaceInfo.InterfaceId.ToString() + ".cryst");
                }
                else
                {
                    interfaceFile = Path.Combine(interfaceFileDir, pdbId + "_" + interfaceInfo.InterfaceId.ToString() + ".cryst");
                }
                interfaceWriter.WriteInterfaceToFile(interfaceFile, entryChainsHash[chain1], entryChainsHash[chain2], interfaceInfo.Remark, type, ligandAtomInfoHashs);
                ParseHelper.ZipPdbFile(interfaceFile);

                interfaces[i] = new ProtInterface(interfaceInfo);
                interfaces[i].ResidueAtoms1 = GetSeqAtoms(entryChainsHash[chain1]);
                interfaces[i].ResidueAtoms2 = GetSeqAtoms(entryChainsHash[chain2]);
                i++;
            }
            return(interfaces);
        }