Ejemplo n.º 1
0
        public void ExtractRawText(SerializeObject obj, string outputPath)
        {
            if (Path.GetFileName(outputPath) == "")
            {
                var    nameProperty = obj.FindProperty("m_Name");
                string name         = "";
                if (nameProperty != null)
                {
                    name = nameProperty.Value as string;
                }
                if (string.IsNullOrEmpty(name))
                {
                    name = (gID++).ToString();
                }
                outputPath += "/" + name;
            }
            if (Path.GetExtension(outputPath) == "")
            {
                outputPath += ".txt";
            }
            outputPath = AssetToolUtility.FixOuputPath(outputPath);
            string content = obj.ToString();

            if (!Directory.Exists(Path.GetDirectoryName(outputPath)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
            }
            var bytes = System.Text.Encoding.Unicode.GetBytes(content);
            var fs    = new FileStream(outputPath, FileMode.OpenOrCreate, FileAccess.Write);

            fs.Write(bytes, 0, bytes.Length);
            fs.Flush();
            fs.Dispose();
        }
Ejemplo n.º 2
0
        private void ExtractRawBits(Asset.AssetObjectInfo obj, string outputPath)
        {
            if (Path.GetFileName(outputPath) == "")
            {
                string name = (gID++) + "_" + obj.PathID.ToString();
                outputPath = outputPath + "/" + name;
            }
            if (Path.GetExtension(outputPath) == "")
            {
                outputPath += ".raw";
            }



            outputPath = AssetToolUtility.FixOuputPath(outputPath);
            if (!Directory.Exists(Path.GetDirectoryName(outputPath)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
            }
            var bytes = obj.data;
            var fs    = new FileStream(outputPath, FileMode.OpenOrCreate, FileAccess.Write);

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