Ejemplo n.º 1
0
 public SubLook(sbyte index, SubEntityBindingPointCategoryEnum category, Look look)
 {
     this.m_bindingIndex    = index;
     this.m_bindingCategory = category;
     this.m_look            = look;
 }
Ejemplo n.º 2
0
        public static Look Parse(string str)
        {
            if (string.IsNullOrEmpty(str) || str[0] != '{')
            {
                Console.WriteLine("Incorrect EntityLook format : {0}", str);
                return(new Look());
            }
            int i   = 1;
            int num = str.IndexOf('|');

            if (num == -1)
            {
                num = str.IndexOf("}");
                if (num == -1)
                {
                    throw new System.Exception("Incorrect EntityLook format : " + str);
                }
            }
            uint bones = uint.Parse(str.Substring(i, num - i));

            i = num + 1;
            uint[] skins = new uint[0];
            if ((num = str.IndexOf('|', i)) != -1 || (num = str.IndexOf('}', i)) != -1)
            {
                skins = Look.ParseCollection <uint>(str.Substring(i, num - i), new Func <string, uint>(uint.Parse));
                i     = num + 1;
            }
            Tuple <int, int>[] source = new Tuple <int, int> [0];
            if ((num = str.IndexOf('|', i)) != -1 || (num = str.IndexOf('}', i)) != -1)
            {
                source = Look.ParseCollection <Tuple <int, int> >(str.Substring(i, num - i), new Func <string, Tuple <int, int> >(Look.ParseIndexedColor));
                i      = num + 1;
            }
            int[] scales = new int[0];
            if ((num = str.IndexOf('|', i)) != -1 || (num = str.IndexOf('}', i)) != -1)
            {
                scales = Look.ParseCollection <int>(str.Substring(i, num - i), new Func <string, int>(int.Parse));
                i      = num + 1;
            }
            List <SubLook> list = new List <SubLook>();

            while (i < str.Length)
            {
                int  num2     = str.IndexOf('@', i, 3);
                int  num3     = str.IndexOf('=', num2 + 1, 3);
                byte category = byte.Parse(str.Substring(i, num2 - i));
                byte b        = byte.Parse(str.Substring(num2 + 1, num3 - (num2 + 1)));
                int  num4     = 0;
                int  num5     = num3 + 1;
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                do
                {
                    stringBuilder.Append(str[num5]);
                    if (str[num5] == '{')
                    {
                        num4++;
                    }
                    else
                    {
                        if (str[num5] == '}')
                        {
                            num4--;
                        }
                    }
                    num5++;
                }while (num4 > 0);
                list.Add(new SubLook((sbyte)b, (SubEntityBindingPointCategoryEnum)category, Look.Parse(stringBuilder.ToString())));
                i = num5 + 1;
            }
            return(new Look(bones, skins, source.ToDictionary((Tuple <int, int> x) => x.Item1, (Tuple <int, int> x) => x.Item2), scales, list.ToArray()));
        }