protected override void FillObject(XmlDescriptor d, RuleElement element) { if (Enum.TryParse(d.Element.Name, true, out YmnosRuleKind kind)) { (element as YmnosRule).Kind = kind; } XmlAttribute attr = d.Element.Attributes[RuleConstants.YmnosRuleSourceAttrName]; if (Enum.TryParse(attr?.Value, true, out YmnosSource source)) { (element as YmnosRule).Source = source; } attr = d.Element.Attributes[RuleConstants.YmnosRulePlaceAttrName]; if (Enum.TryParse(attr?.Value, true, out PlaceYmnosSource place)) { (element as YmnosRule).Place = place; } attr = d.Element.Attributes[RuleConstants.YmnosRuleCountAttrName]; if (int.TryParse(attr?.Value, out int intValue)) { (element as YmnosRule).Count = intValue; } attr = d.Element.Attributes[RuleConstants.YmnosRuleStartFromAttrName]; if (int.TryParse(attr?.Value, out intValue)) { (element as YmnosRule).StartFrom = intValue; } }
protected override void FillObject(XmlDescriptor d, RuleElement element) { XmlAttribute attr = d.Element.Attributes[RuleConstants.DayOfWeekAttrName]; if (attr != null) { (element as GetClosestDay).DayOfWeek = new ItemDayOfWeek(attr.Value); } attr = d.Element.Attributes[RuleConstants.WeekCountAttrName]; if (int.TryParse(attr?.Value, out int count)) { (element as GetClosestDay).WeekCount = count; } if (d.Element.HasChildNodes) { (element as GetClosestDay).ChildDateExp = SerializerRoot.Container <DateExpression>() .Deserialize(new XmlDescriptor() { Element = d.Element.FirstChild }); } }
protected override void FillObject(XmlDescriptor d, RuleElement element) { XmlNode valuesNode = d.Element.SelectSingleNode(RuleConstants.ValuesNodeName); if (valuesNode?.HasChildNodes == true) { foreach (XmlNode valueNode in valuesNode.ChildNodes) { RuleExpression valueElement = SerializerRoot.Container <RuleExpression>() .Deserialize(new XmlDescriptor() { Element = valueNode }); (element as Case).ValuesElements.Add(valueElement); } } XmlNode actionNode = d.Element.SelectSingleNode(RuleConstants.ActionNodeName); if (actionNode != null) { (element as Case).ActionElement = SerializerRoot.Container <ExecContainer>() .Deserialize(new XmlDescriptor() { Element = actionNode }); } }
protected override void FillObject(XmlDescriptor d, RuleElement container) { base.FillObject(d, container); if (Enum.TryParse(d.GetElementName(), true, out WorshipSequenceKind kind)) { (container as WorshipSequence).Kind = kind; } }
protected override void FillObject(XmlDescriptor d, RuleElement element) { base.FillObject(d, element); XmlAttribute attr = d.Element.Attributes[RuleConstants.KindAttrName]; if (Enum.TryParse(attr?.Value, true, out KindOfReplacedDay value)) { (element as ModifyReplacedDay).Kind = value; } }
protected override void FillObject(XmlDescriptor d, RuleElement element) { base.FillObject(d, element); XmlAttribute attr = d.Element.Attributes[RuleConstants.KontakionShowIkosAttrName]; if (bool.TryParse(attr?.Value, out bool val)) { (element as KontakionRule).ShowIkos = val; } }
protected override void FillObject(XmlDescriptor d, RuleElement element) { base.FillObject(d, element); XmlAttribute attr = d.Element.Attributes[RuleConstants.KSedalenPlaceAttrName]; if (Enum.TryParse(attr?.Value, true, out KanonasPlaceKind place)) { (element as KSedalenRule).Place = place; } }
protected override void FillObject(XmlDescriptor d, RuleElement element) { base.FillObject(d, element); var attr = d.Element.Attributes[RuleConstants.KAfterOdiNumberAttrName]; if (int.TryParse(attr?.Value, out int intValue)) { (element as KAfterRule).OdiNumber = intValue; } }
protected override void FillObject(XmlDescriptor d, RuleElement element) { foreach (XmlNode childNode in d.Element.ChildNodes) { RuleElement child = SerializerRoot.Container <RuleElement>().Deserialize(new XmlDescriptor() { Element = childNode }); (element as ExecContainer).ChildElements.Add(child); } }
protected override void FillObject(XmlDescriptor d, RuleElement element) { if (d.Element.HasChildNodes) { (element as DateByDaysFromEaster).ChildExpression = SerializerRoot.Container <IntExpression>() .Deserialize(new XmlDescriptor() { Element = d.Element.FirstChild }); } }
protected override void FillObject(XmlDescriptor d, RuleElement element) { if (d.Element.HasChildNodes)// && node.FirstChild.Name == RuleConstants.YmnosRuleNode) { (element as IsExists).ChildElement = SerializerRoot.Container <RuleExecutable, ICalcStructureElement>() .Deserialize(new XmlDescriptor() { Element = d.Element.FirstChild }) as ICalcStructureElement; } }
protected override void FillObject(XmlDescriptor d, RuleElement container) { base.FillObject(d, container); XmlAttribute attr = d.Element.Attributes[RuleConstants.ShowPsalmAttribute]; if (bool.TryParse(attr?.Value, out bool showPsalm)) { (container as KekragariaRule).ShowPsalm = showPsalm; } }
protected override void FillObject(XmlDescriptor d, RuleElement element) { XmlAttribute attr = d.Element.Attributes[RuleConstants.ShortNameAttrName]; (element as ModifyDay).ShortName = attr?.Value; attr = d.Element.Attributes[RuleConstants.IsLastNameAttrName]; (element as ModifyDay).IsLastName = bool.TryParse(attr?.Value, out bool value) ? value : false; attr = d.Element.Attributes[RuleConstants.AsAdditionAttrName]; (element as ModifyDay).AsAddition = bool.TryParse(attr?.Value, out value) ? value : false; attr = d.Element.Attributes[RuleConstants.UseFullNameAttrName]; (element as ModifyDay).UseFullName = bool.TryParse(attr?.Value, out value) ? value : true; attr = d.Element.Attributes[RuleConstants.DayMoveAttrName]; if (int.TryParse(attr?.Value, out int intValue)) { (element as ModifyDay).DayMoveCount = intValue; } attr = d.Element.Attributes[RuleConstants.PriorityAttrName]; (element as ModifyDay).Priority = int.TryParse(attr?.Value, out intValue) ? intValue : 0; attr = d.Element.Attributes[RuleConstants.SignNumberAttrName]; if (int.TryParse(attr?.Value, out intValue)) { (element as ModifyDay).SignNumber = intValue; } //filter DeserializeFilter(d.Element, element as ModifyDay); foreach (XmlNode childNode in d.Element.ChildNodes) { if (childNode.Name == RuleConstants.ModifyReplacedDayNodeName) { (element as ModifyDay).ModifyReplacedDay = SerializerRoot.Container <ModifyReplacedDay>() .Deserialize(new XmlDescriptor() { Element = childNode }); } else { (element as ModifyDay).ChildDateExp = SerializerRoot.Container <DateExpression>() .Deserialize(new XmlDescriptor() { Element = childNode }); } } }
protected override void FillObject(XmlDescriptor d, RuleElement element) { foreach (XmlNode childNode in d.Element.ChildNodes) { var exp = SerializerRoot.Container <RuleExpression>() .Deserialize(new XmlDescriptor() { Element = childNode }); (element as LogicalExpression).ChildElements.Add(exp); } }
public static (Int32 animationType, AMAnimation[] animations, AMFrame[] frames) FromXml(Byte[] array) { using (MemoryStream ms = new MemoryStream(array)) { XmlSerializer serializer = new XmlSerializer(typeof(XmlDescriptor)); XmlDescriptor descriptor = (XmlDescriptor)serializer.Deserialize(ms); AMAnimation[] animations = descriptor.Animations.SelectArray(x => x.ToAMAnimation()); AMFrame[] frames = descriptor.Frames.SelectArray(x => x.ToAMFrame()); return(descriptor.AnimationType, animations, frames); } }
protected override void FillObject(XmlDescriptor d, RuleElement element) { base.FillObject(d, element); if (d.Element.SelectSingleNode(RuleConstants.YmnosRuleNode) is XmlNode ymnosNode) { (element as TheotokionRule).ReferenceYmnos = SerializerRoot.Container <YmnosRule>() .Deserialize(new XmlDescriptor() { Element = ymnosNode }); } }
//protected override RuleElement CreateObject(XmlDescriptor d) => new KontakionRule(d.GetElementName()); protected override void FillObject(XmlDescriptor d, RuleElement element) { XmlAttribute attr = d.Element.Attributes[RuleConstants.KKontakionSourceAttrName]; if (Enum.TryParse(attr?.Value, true, out KanonasSource source)) { (element as KanonasItemRuleBase).Source = source; } attr = d.Element.Attributes[RuleConstants.KKontakionKanonasAttrName]; if (Enum.TryParse(attr?.Value, true, out KanonasKind kanonas)) { (element as KanonasItemRuleBase).Kanonas = kanonas; } }
protected override void FillObject(XmlDescriptor d, RuleElement container) { base.FillObject(d, container); if (Enum.TryParse(d.GetElementName(), true, out YmnosStructureKind kind)) { (container as YmnosStructureRule).Kind = kind; } XmlAttribute attr = d.Element.Attributes[RuleConstants.TotalCountAttribute]; if (int.TryParse(attr?.Value, out int count)) { (container as YmnosStructureRule).TotalYmnosCount = count; } }
protected override void FillObject(XmlDescriptor d, RuleElement element) { base.FillObject(d, element); XmlAttribute attr = d.Element.Attributes[RuleConstants.KanonasCountAttrName]; if (int.TryParse(attr?.Value, out int intValue)) { (element as KKanonasItemRule).Count = intValue; } attr = d.Element.Attributes[RuleConstants.KanonasMartyrionAttrName]; (element as KKanonasItemRule).UseMartyrion = bool.TryParse(attr?.Value, out bool value) ? value : false; attr = d.Element.Attributes[RuleConstants.KanonasIrmosCountAttrName]; (element as KKanonasItemRule).IrmosCount = int.TryParse(attr?.Value, out int i) ? i : 0; }
protected override void FillObject(XmlDescriptor d, RuleElement element) { //ищем expression XmlNode expressionNode = d.Element.SelectSingleNode(RuleConstants.ExpressionNodeName); if (expressionNode?.HasChildNodes == true) { (element as Switch).Expression = SerializerRoot.Container <RuleExpression>() .Deserialize(new XmlDescriptor() { Element = expressionNode.FirstChild }); } //ищем элементы case XmlNodeList casesList = d.Element.SelectNodes(RuleConstants.CaseNodeName); if (casesList != null) { foreach (XmlNode caseNode in casesList) { Case caseElement = SerializerRoot.Container <Case>().Deserialize(new XmlDescriptor() { Element = caseNode }); (element as Switch).CaseElements.Add(caseElement); } } //ищем default XmlNode defaultNode = d.Element.SelectSingleNode(RuleConstants.DefaultNodeName); if (defaultNode != null) { (element as Switch).Default = SerializerRoot.Container <ExecContainer>() .Deserialize(new XmlDescriptor() { Element = defaultNode }); } }
protected override void FillObject(XmlDescriptor d, RuleElement element) { var psalmRule = element as PsalmRule; XmlAttribute attr = d.Element.Attributes[RuleConstants.PsalmRuleNumberAttr]; if (int.TryParse(attr?.Value, out int intValue)) { psalmRule.Number = intValue; } attr = d.Element.Attributes[RuleConstants.PsalmRuleStartAttr]; if (int.TryParse(attr?.Value, out intValue)) { psalmRule.StartStihos = intValue; } attr = d.Element.Attributes[RuleConstants.PsalmRuleEndAttr]; if (int.TryParse(attr?.Value, out intValue)) { psalmRule.EndStihos = intValue; } }
protected override void FillObject(XmlDescriptor d, RuleElement container) { base.FillObject(d, container); XmlAttribute attr = d.Element.Attributes[RuleConstants.ServiceIdAttrName]; (container as WorshipRule).Id = (attr != null) ? attr.Value : string.Empty; attr = d.Element.Attributes[RuleConstants.ServiceTimeAttrName]; (container as WorshipRule).Time = new ItemTime((attr != null) ? attr.Value : string.Empty); attr = d.Element.Attributes[RuleConstants.ServiceNameAttrName]; (container as WorshipRule).Name = (attr != null) ? attr.Value : string.Empty; attr = d.Element.Attributes[RuleConstants.ServiceIsDayBeforeAttrName]; if (bool.TryParse(attr?.Value, out bool showPsalm)) { (container as WorshipRule).IsDayBefore = showPsalm; } attr = d.Element.Attributes[RuleConstants.ServiceAdditionalNameAttrName]; (container as WorshipRule).AdditionalName = (attr != null) ? attr.Value : string.Empty; }
protected override void FillObject(XmlDescriptor d, RuleElement element) { //expression XmlNode elementNode = d.Element.SelectSingleNode(RuleConstants.ExpressionIfNodeName); if (elementNode?.HasChildNodes == true) { (element as If).Expression = SerializerRoot.Container <BooleanExpression>() .Deserialize(new XmlDescriptor() { Element = elementNode.FirstChild }); } //ищем then elementNode = d.Element.SelectSingleNode(RuleConstants.ThenNodeName); if (elementNode != null) { (element as If).ThenElement = SerializerRoot.Container <ExecContainer>() .Deserialize(new XmlDescriptor() { Element = elementNode }); } //ищем else elementNode = d.Element.SelectSingleNode(RuleConstants.ElseNodeName); if (elementNode != null) { (element as If).ElseElement = SerializerRoot.Container <ExecContainer>() .Deserialize(new XmlDescriptor() { Element = elementNode }); } }
protected override void FillObject(XmlDescriptor d, RuleElement element) { if (Enum.TryParse(d.Element.Name, true, out TextHolderKind kind)) { (element as TextHolder).Kind = kind; } XmlAttribute attr = d.Element.Attributes[RuleConstants.TextHolderMarkAttr]; if (Enum.TryParse(attr?.Value, true, out TextHolderMark mark)) { (element as TextHolder).Mark = mark; } foreach (XmlNode childNode in d.Element.ChildNodes) { if (childNode.Name == RuleConstants.TextHolderPapragraphNode) { ItemTextNoted item = new ItemTextNoted(childNode.OuterXml); (element as TextHolder).Paragraphs.Add(item); } } }
protected override RuleElement CreateObject(XmlDescriptor d) => new ModifyDay(d.GetElementName());
protected override RuleElement CreateObject(XmlDescriptor d) => new KontakionRule(d.GetElementName(), new KontakionRuleVMFactory(SerializerRoot));
protected override RuleElement CreateObject(XmlDescriptor d) { return(new MoreEquals(d.GetElementName())); }
protected override RuleElement CreateObject(XmlDescriptor d) { return(new DateByDaysFromEaster(d.GetElementName(), SerializerRoot.BookStorage.Easters)); }
protected override RuleElement CreateObject(XmlDescriptor d) => new KAfterRule(d.GetElementName());
protected override RuleElement CreateObject(XmlDescriptor d) { return(new AinoiRule(new AinoiRuleVMFactory(SerializerRoot), SerializerRoot, d.GetElementName())); }