Example #1
0
 private static double ReadPathDouble(BamlTranslator.BamlBinaryReader reader, bool isInt)
 {
     if (isInt)
     {
         return (reader.ReadInt32() * 1E-06);
     }
     return reader.ReadCompressedDouble();
 }
Example #2
0
            internal static object ParseStreamGeometry(BamlTranslator.BamlBinaryReader reader)
            {
                byte num;
                StringBuilder sb = new StringBuilder();
                bool flag = false;
                char lastCommandChar = '\0';
                Label_000A:
                num = reader.ReadByte();
                bool flag2 = (num & 0x10) == 0x10;
                bool flag3 = (num & 0x20) == 0x20;
                bool flag4 = (num & 0x40) == 0x40;
                bool flag5 = (num & 0x80) == 0x80;
                switch ((num & 15))
                {
                    case 0:
                        flag = flag3;
                        AddPathCommand('M', ref lastCommandChar, sb);
                        AddPathPoint(reader, sb, flag4, flag5);
                        goto Label_000A;

                    case 1:
                        AddPathCommand('L', ref lastCommandChar, sb);
                        AddPathPoint(reader, sb, flag4, flag5);
                        goto Label_000A;

                    case 2:
                        AddPathCommand('Q', ref lastCommandChar, sb);
                        AddPathPoint(reader, sb, flag4, flag5);
                        AddPathPoint(reader, sb);
                        goto Label_000A;

                    case 3:
                        AddPathCommand('C', ref lastCommandChar, sb);
                        AddPathPoint(reader, sb, flag4, flag5);
                        AddPathPoint(reader, sb);
                        AddPathPoint(reader, sb);
                        goto Label_000A;

                    case 4:
                        {
                            AddPathCommand('L', ref lastCommandChar, sb);
                            int num2 = reader.ReadInt32();
                            for (int i = 0; i < num2; i++)
                            {
                                AddPathPoint(reader, sb);
                            }
                            goto Label_000A;
                        }
                    case 5:
                        {
                            AddPathCommand('Q', ref lastCommandChar, sb);
                            int num4 = reader.ReadInt32();
                            for (int j = 0; j < num4; j++)
                            {
                                AddPathPoint(reader, sb);
                            }
                            goto Label_000A;
                        }
                    case 6:
                        {
                            AddPathCommand('C', ref lastCommandChar, sb);
                            int num6 = reader.ReadInt32();
                            for (int k = 0; k < num6; k++)
                            {
                                AddPathPoint(reader, sb);
                            }
                            goto Label_000A;
                        }
                    case 7:
                        {
                            double num8 = ReadPathDouble(reader, flag4);
                            double num9 = ReadPathDouble(reader, flag5);
                            byte num10 = reader.ReadByte();
                            bool flag6 = (num10 & 15) != 0;
                            bool flag7 = (num10 & 240) != 0;
                            double num11 = reader.ReadCompressedDouble();
                            double num12 = reader.ReadCompressedDouble();
                            double num13 = reader.ReadCompressedDouble();
                            sb.AppendFormat("A {0},{1} {2} {3} {4} {5},{6} ", new object[] { num11, num12, num13, flag6 ? 1 : 0, flag7 ? 1 : 0, num8, num9 });
                            lastCommandChar = 'A';
                            goto Label_000A;
                        }
                    case 8:
                        if (!flag)
                        {
                            if (sb.Length > 0)
                            {
                                sb.Remove(sb.Length - 1, 0);
                            }
                            break;
                        }
                        sb.Append("Z");
                        break;

                    case 9:
                        sb.Insert(0, flag2 ? "F1 " : "F0 ");
                        lastCommandChar = 'F';
                        goto Label_000A;

                    default:
                        throw new InvalidOperationException();
                }
                return sb.ToString();
            }