Ejemplo n.º 1
0
        public void Extract(SerializeObject obj, string outputPath)
        {
            Unity.Texture2D tex = new Unity.Texture2D();
            tex.Deserialize(obj.RootProperty);
            //string m_Name = obj.FindProperty("m_Name").Value as string;
            //int m_Width = (int)obj.FindProperty("m_Width").Value;
            //int m_Height = (int)obj.FindProperty("m_Height").Value;
            //int m_CompleteImageSize = (int)obj.FindProperty("m_CompleteImageSize").Value;
            //int m_TextureFormat = (int)obj.FindProperty("m_TextureFormat").Value;
            //byte[] data = (byte[])obj.FindProperty("image data").Value;
            //Bitmap bmp = new Bitmap(m_Width, m_Height, PixelFormat.Format32bppArgb);
            //var bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
            //int bytes = Math.Abs(bmpData.Stride) * bmp.Height;
            //IntPtr ptr = bmpData.Scan0;
            //System.Runtime.InteropServices.Marshal.Copy(data, 0, ptr, bytes);
            Image iamg;

            //bmp.UnlockBits(bmpData);
            outputPath = outputPath + "/" + tex.name + "." + tex.m_TextureFormat;
            outputPath = AssetToolUtility.FixOuputPath(outputPath);
            if (!Directory.Exists(Path.GetDirectoryName(outputPath)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
            }
            File.WriteAllBytes(outputPath, tex.image_data);
            //bmp.Save(outputPath);
        }
Ejemplo n.º 2
0
        public void Extract(SerializeObject obj, string outputPath)
        {
            Font font = new Font();

            font.Deserialize(obj.RootProperty);
            string name = font.name;

            outputPath = outputPath + "/" + name + ".ttf";
            outputPath = AssetToolUtility.FixOuputPath(outputPath);
            if (!Directory.Exists(Path.GetDirectoryName(outputPath)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
            }
            File.WriteAllBytes(outputPath, font.FontData);
        }
Ejemplo n.º 3
0
        public void Extract(SerializeObject obj, string outputPath)
        {
            TextAsset textAsset = new TextAsset();

            textAsset.Deserialize(obj.RootProperty);
            string name   = textAsset.name;
            string script = "";

            outputPath = outputPath + "/" + name + ".txt";
            outputPath = AssetToolUtility.FixOuputPath(outputPath);
            if (!Directory.Exists(Path.GetDirectoryName(outputPath)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
            }
            var bytes = System.Text.Encoding.Unicode.GetBytes(script);
            var fs    = new FileStream(outputPath, FileMode.OpenOrCreate, FileAccess.Write);

            fs.Write(bytes, 0, bytes.Length);
            fs.Flush();
            fs.Dispose();
        }