Exemple #1
0
    // Request a minimap image from the parser //
    private static void RequestBlock(MinimapRequest minimapRequest)
    {
        string mapName  = minimapRequest.mapName;
        int    x        = (int)minimapRequest.coords.x;
        int    y        = (int)minimapRequest.coords.y;
        string fileName = mapName + "." + x.ToString("X").ToLower() + y.ToString("X").ToLower() + ".tex";
        string path     = @"AIDX\Map\" + mapName + @"\" + fileName;

        if (DataManager.fileList.ContainsKey(path))
        {
            TexFile          texFile   = new TexFile();
            byte[]           data      = texFile.Read(path);
            MinimapBlockData blockData = new MinimapBlockData();
            blockData.mapName         = mapName;
            blockData.coords          = minimapRequest.coords;
            blockData.textureInfo     = texFile.header2;
            blockData.minimapByteData = data;
            MinimapDataQueue.Enqueue(blockData);
        }
    }
Exemple #2
0
    private void Update()
    {
        if (interacted)
        {
            interacted = false;
            // clicked folder //
            if (currentPath != previousPath)
            {
                previousPath = currentPath;
                BreadCrumb.GetComponent <UnityEngine.UI.Text>().text = currentPath;
                OpenFolder();
            }
            // clicked file //
            if (currentSelected != previousSelected)
            {
                previousSelected = currentSelected;
                if (previousSelectedFileIcon != null)
                {
                    previousSelectedFileIcon.GetComponent <UnityEngine.UI.Image>().color = Color.white;
                }
                currentSelectedFileIcon.GetComponent <UnityEngine.UI.Image>().color = new Color(0, 0, 1, .2f);
                string infoText = "";
                infoText += currentPath + "\\" + currentSelected + "\n";
                //infoText += "Name Offset: " + fileList[currentSelected].nameOffset + "\n";
                string compression = "Uncompressed";
                if (fileList[currentSelected].flags == 3)
                {
                    compression = "ZLib";
                }
                else if (fileList[currentSelected].flags == 5)
                {
                    compression = "LZMA";
                }
                infoText += "Compression: " + fileList[currentSelected].flags + " " + compression + "\n";
                DateTime date = new DateTime((long)fileList[currentSelected].writeTime);
                infoText += "Write Time: " + date.Hour + ":" + date.Minute + " - " + date.Day + "\\" + date.Month + "\\" + date.Year + "\n";
                infoText += "Uncompressed Size: " + fileList[currentSelected].uncompressedSize + "\n";
                infoText += "Compressed Size: " + fileList[currentSelected].compressedSize + "\n";
                infoText += "Hash: " + DataManager.ToHex(fileList[currentSelected].hash, false) + "\n";
                infoText += "Unknown: " + fileList[currentSelected].unk2 + "\n";
                fileProperties.GetComponent <UnityEngine.UI.Text>().text = infoText;

                DataManager.ExtractFile(currentPath + "\\" + currentSelected);
                //DataManager.GetFileBytes(currentPath + "\\" + currentSelected);

                // Texture File //
                if (Path.GetExtension(currentSelected).ToLower() == ".tex")
                {
                    TexFile texFile = new TexFile();

                    texFile.Read(currentPath + @"\" + currentSelected);
                    Texture2D tex = texFile.ReadToTexture2D(currentPath + @"\" + currentSelected);
                    texturePreview.GetComponent <UnityEngine.UI.RawImage>().texture = tex;

                    string texPropertiesString = "";
                    texPropertiesString += "Type: " + texFile.header2.version + "\n";
                    texPropertiesString += "Dimensions: " + texFile.header2.width + "x" + +texFile.header2.height + "\n";
                    texPropertiesString += "Depth: " + texFile.header2.depth + "\n";
                    texPropertiesString += "Sides: " + texFile.header2.faces + "\n";
                    texPropertiesString += "MipmapCount: " + texFile.header2.mipCount + "\n";
                    string format = texFile.header2.format.ToString();

                    /*
                     * if (texFile.header2.format == 13)
                     *  format = "DXT1";
                     * else if (texFile.header2.format == 14)
                     *  format = "DXT3";
                     * else if (texFile.header2.format == 15)
                     *  format = "DXT5";
                     */
                    texPropertiesString += "Format: " + format + "\n";
                    texPropertiesString += "Sizes: " + texFile.header2.sizes[0] + " " + texFile.header2.sizes[1] + " " + texFile.header2.sizes[2] + " " + texFile.header2.sizes[3] + " " + texFile.header2.sizes[4] + " " + texFile.header2.sizes[5] + " " +
                                           texFile.header2.sizes[6] + " " + texFile.header2.sizes[7] + " " + texFile.header2.sizes[8] + " " + texFile.header2.sizes[9] + " " + texFile.header2.sizes[10] + " " + texFile.header2.sizes[11] + " " + texFile.header2.sizes[12] + " " +
                                           texFile.header2.sizes[13] + " " + "\n";
                    texPropertiesString += "unk1: " + texFile.header2.unk1 + "\n";
                    texPropertiesString += "unk2: " + texFile.header2.unk2[0] + " " + texFile.header2.unk2[1] + " " + texFile.header2.unk2[2] + " " + "\n";
                    texPropertiesString += "unk3: " + texFile.header2.unk3 + "\n";
                    specificProperties.GetComponent <UnityEngine.UI.Text>().text = texPropertiesString;
                }
            }
        }
    }