Beispiel #1
0
        private void LoadOperationInfoFromXml(SecurityElement element, Operation operation)
        {
            OperationInfo item = new OperationInfo {
                OperationSubIndex = StrParser.ParseDecInt(element.Attribute("OperationSubIndex"), 0),
                OperationName     = element.Attribute("OperationName")
            };

            operation.OperationIcon = StrParser.ParseHexInt(element.Attribute("OperationIcon"), 0);
            item.OperationDesc      = element.Attribute("OperationDesc");
            operation.Priority      = StrParser.ParseDecInt(element.Attribute("Priority"), 0);
            operation.OperationType = TypeNameContainer <_OperationType> .GetTypeByName(element.Attribute("OperationType"));

            item.AbsolutePurchaseStartTime   = element.Attribute("AbsolutePurchaseStartTime");
            item.AbsolutePurchaseCloseTime   = element.Attribute("AbsolutePurchaseCloseTime");
            item.RelativePurchaseStartTime   = element.Attribute("RelativePurchaseStartTime");
            item.RelativePurchaseCloseTime   = element.Attribute("RelativePurchaseCloseTime");
            item.AbsolutePickRewardStartTime = element.Attribute("AbsolutePickRewardStartTime");
            item.AbsolutePickRewardCloseTime = element.Attribute("AbsolutePickRewardCloseTime");
            item.RelativePickRewardStartTime = element.Attribute("RelativePickRewardStartTime");
            item.RelativePickRewardCloseTime = element.Attribute("RelativePickRewardCloseTime");
            item.RefreshCycle = StrParser.ParseDecInt(element.Attribute("RefreshCycle"), 0);
            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    string str;
                    if (((str = element2.Tag) != null) && (str == "OperationItem"))
                    {
                        item.OperationItems.Add(this.LoadOperationItemFromXml(element2));
                    }
                }
            }
            operation.OperationInfos.Add(item);
        }
Beispiel #2
0
        private OperationItem LoadOperationItemFromXml(SecurityElement element)
        {
            OperationItem item = new OperationItem {
                ItemId        = StrParser.ParseHexInt(element.Attribute("ItemId"), 0),
                ItemName      = element.Attribute("ItemName"),
                ItemIcon      = StrParser.ParseHexInt(element.Attribute("ItemIcon"), 0),
                ItemDesc      = element.Attribute("ItemDesc"),
                CompareType   = TypeNameContainer <_ConditionValueCompareType> .GetTypeByName(element.Attribute("CompareType")),
                CompareValue  = StrParser.ParseDecInt(element.Attribute("CompareValue"), 0),
                CycleMaxCount = StrParser.ParseDecInt(element.Attribute("CycleMaxCount"), 0)
            };

            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    string str;
                    if (((str = element2.Tag) != null) && (str == "Reward"))
                    {
                        item.Rewards.Add(LoadRewardFromXml(element2));
                    }
                }
            }
            return(item);
        }
 public static int Parse(string typeName, int defValue)
 {
     if ((typeName == null) || (typeName == ""))
     {
         return(defValue);
     }
     if (!TypeNameContainer <Type> .IsValidType(typeName))
     {
         Logger.Error(string.Format("Invalid Type {0} in {1}", typeName, typeof(Type)), new object[0]);
         return(defValue);
     }
     return(TypeNameContainer <Type> .GetTypeByName(typeName));
 }