Ejemplo n.º 1
0
 public static bool Parse(string attrEx, out Dictionary <string, ItemAttributeElement> attributes)
 {
     string[] array = attrEx.Split(new char[]
     {
         ',',
         '[',
         ']'
     });
     if (array.Length == 0)
     {
         attributes = new Dictionary <string, ItemAttributeElement>();
         return(true);
     }
     attributes = new Dictionary <string, ItemAttributeElement>();
     foreach (string text in array)
     {
         if (!(text == ""))
         {
             ItemAttributeElement itemAttributeElement = ItemClassExBuilder.ParseSingleAttribute(text);
             if (itemAttributeElement != null)
             {
                 try
                 {
                     attributes.Add(itemAttributeElement.AttributeName, itemAttributeElement);
                 }
                 catch (Exception arg)
                 {
                     throw new Exception(string.Format("Item Parse Error [attrEx : {1}] [AttributeName : {2}]- {0}", arg, attrEx, itemAttributeElement.AttributeName));
                 }
             }
         }
     }
     return(true);
 }
Ejemplo n.º 2
0
        public static bool Parse(string itemClassEx, out string itemClass, out Dictionary <string, ItemAttributeElement> attributes)
        {
            string[] array = itemClassEx.Split(new char[]
            {
                ',',
                '[',
                ']'
            });
            if (array.Length == 0)
            {
                Log <ItemClassExBuilder> .Logger.WarnFormat("No Data [{0}]", itemClassEx);

                itemClass  = null;
                attributes = null;
                return(false);
            }
            itemClass  = array[0];
            attributes = new Dictionary <string, ItemAttributeElement>();
            foreach (string text in array.Skip(1))
            {
                if (!(text == ""))
                {
                    ItemAttributeElement itemAttributeElement = ItemClassExBuilder.ParseSingleAttribute(text);
                    if (itemAttributeElement != null)
                    {
                        try
                        {
                            attributes.Add(itemAttributeElement.AttributeName, itemAttributeElement);
                        }
                        catch (Exception arg)
                        {
                            throw new Exception(string.Format("Item Parse Error [ItemClass : {1}] [AttributeName : {2}]- {0}", arg, itemClassEx, itemAttributeElement.AttributeName));
                        }
                    }
                }
            }
            return(true);
        }