コード例 #1
0
        public void Extract(BundleFileExtractArgs e)
        {
            var fullpath = e.FileName;
            var isPng    = Path.GetExtension(fullpath) == ".png";

            fullpath = Path.ChangeExtension(fullpath, "dds");

            Directory.CreateDirectory(Path.GetDirectoryName(fullpath) ?? "");
            if (File.Exists(fullpath))
            {
                File.Delete(fullpath);
            }

            using (var output = new FileStream(fullpath, FileMode.CreateNew, FileAccess.Write))
            {
                Extract(output);
            }

            // convert all dds files to the extension specified in the settings
            // also convert "pngs" to pngs lol
            if (e.Extension != EUncookExtension.dds || isPng)
            {
                //convert
                var fi = new FileInfo(fullpath);
                if (fi.Exists)
                {
                    // convert to png if file is a png, else convert to custom extension
                    Texconv.Convert(Path.GetDirectoryName(fullpath), fullpath, isPng ? EUncookExtension.png : e.Extension);
                }

                // delete old DDS
                fi.Delete();
            }
        }
コード例 #2
0
        public void Extract(BundleFileExtractArgs e)
        {
            var fullpath = e.FileName;

            fullpath = Path.ChangeExtension(fullpath, "dds");

            Directory.CreateDirectory(Path.GetDirectoryName(fullpath) ?? "");
            if (File.Exists(fullpath))
            {
                File.Delete(fullpath);
            }

            using (var output = new FileStream(fullpath, FileMode.CreateNew, FileAccess.Write))
            {
                Extract(output);
            }

            if (e.Extension != EUncookExtension.dds)
            {
                //convert
                var fi = new FileInfo(fullpath);
                if (fi.Exists)
                {
                    Texconv.Convert(Path.GetDirectoryName(fullpath), fullpath, e.Extension);
                }

                // delete old DDS
                fi.Delete();
            }
        }