Beispiel #1
0
        public bool uncompress()
        {
            bool result;

            try
            {
                InflaterInputStream inflaterInputStream = new InflaterInputStream(new MemoryStream(this.m_data));
                DynamicArray <byte> dynamicArray        = new DynamicArray <byte>();
                byte[] array = new byte[2048];
                while (true)
                {
                    int  num  = inflaterInputStream.Read(array, 0, array.Length);
                    bool flag = num > 0;
                    if (!flag)
                    {
                        break;
                    }
                    dynamicArray.pushBack(array, num);
                }
                inflaterInputStream.Close();
                base.clear();
                this.m_data    = dynamicArray.data;
                this.m_size    = dynamicArray.length;
                this.m_capcity = dynamicArray.capcity;
            }
            catch (Exception)
            {
                DebugTrace.print("Failed to uncompress ByteArray");
                result = false;
                return(result);
            }
            result = true;
            return(result);
        }
Beispiel #2
0
 protected void _formatLangPackConf(Variant conf)
 {
     foreach (Variant current in conf["group"]._arr)
     {
         bool flag = !current.ContainsKey("id");
         if (flag)
         {
             DebugTrace.print("ss");
         }
         bool        flag2 = this.m_lPakMap.ContainsKey(current["id"]._str);
         StringTable stringTable;
         if (flag2)
         {
             stringTable = this.m_lPakMap[current["id"]._str];
         }
         else
         {
             stringTable = null;
         }
         bool flag3 = stringTable == null;
         if (flag3)
         {
             stringTable = new StringTable();
             this.m_lPakMap[current["id"]._str] = stringTable;
         }
         bool flag4 = current.ContainsKey("p");
         if (flag4)
         {
             stringTable.loadStrings(current["p"]._arr);
         }
     }
 }
Beispiel #3
0
        private static void _trace(string msg)
        {
            bool flag = DebugTrace.print != null;

            if (flag)
            {
                DebugTrace.print(msg);
            }
        }
Beispiel #4
0
        public static void dumpObj(object obj)
        {
            bool flag = obj is Variant;

            if (flag)
            {
                DebugTrace.print((obj as Variant).dump());
            }
            else
            {
                bool flag2 = obj is ByteArray;
                if (flag2)
                {
                    DebugTrace.print((obj as ByteArray).dump());
                }
            }
        }
        public override void loadImpl(bool bSync)
        {
            base.loadImpl(bSync);
            bool flag = this.m_path == null || this.m_path == "";

            if (!flag)
            {
                bool flag2 = this.m_ready || this.m_loaded;
                if (!flag2)
                {
                    FileStream   input        = new FileStream(base.path, FileMode.Open, FileAccess.Read);
                    BinaryReader binaryReader = new BinaryReader(input);
                    try
                    {
                        char c   = binaryReader.ReadChar();
                        char c2  = binaryReader.ReadChar();
                        char c3  = binaryReader.ReadChar();
                        char c4  = binaryReader.ReadChar();
                        int  num = (int)binaryReader.ReadInt16();
                        this.m_pixelWidth  = (int)binaryReader.ReadInt16();
                        this.m_pixelHeight = (int)binaryReader.ReadInt16();
                        this.m_proportion  = binaryReader.ReadSingle();
                        this.m_heightMin   = binaryReader.ReadSingle();
                        this.m_heightMax   = binaryReader.ReadSingle();
                        this.m_produc      = this.m_pixelWidth * this.m_pixelHeight;
                        this.m_byt         = new byte[this.m_produc];
                        binaryReader.Read(this.byt, 0, this.m_produc);
                    }
                    catch (EndOfStreamException ex)
                    {
                        DebugTrace.print(ex.Message);
                    }
                    bool flag3 = string.Concat(this.m_pixelWidth) != null && string.Concat(this.m_pixelHeight) != null && string.Concat(this.m_heightMin) != null && string.Concat(this.m_heightMax) != null && string.Concat(this.m_proportion) != null && this.m_byt != null;
                    if (flag3)
                    {
                        this.m_ready = true;
                        (os.asset as AssetManagerImpl).readyAsset(this);
                    }
                    this.m_loaded = true;
                }
            }
        }