private void exportDirXmlInternal(WzDirectory dir, string path)
        {
            if (!Directory.Exists(path))
            {
                createDirSafe(ref path);
            }

            if (path.Substring(path.Length - 1) != @"\")
            {
                path += @"\";
            }

            foreach (WzDirectory subdir in dir.WzDirectories)
            {
                exportDirXmlInternal(subdir, path + ProgressingWzSerializer.EscapeInvalidFilePathNames(subdir.name) + @"\");
            }
            foreach (WzImage subimg in dir.WzImages)
            {
                exportXmlInternal(subimg, path + ProgressingWzSerializer.EscapeInvalidFilePathNames(subimg.Name) + ".xml");
            }
        }
        private void ExportRecursion(WzObject currObj, string outPath)
        {
            if (currObj is WzFile)
            {
                ExportRecursion(((WzFile)currObj).WzDirectory, outPath);
            }
            else if (currObj is WzDirectory)
            {
                outPath += ProgressingWzSerializer.EscapeInvalidFilePathNames(currObj.Name) + @"\";
                if (!Directory.Exists(outPath))
                {
                    Directory.CreateDirectory(outPath);
                }
                foreach (WzDirectory subdir in ((WzDirectory)currObj).WzDirectories)
                {
                    ExportRecursion(subdir, outPath + subdir.Name + @"\");
                }
                foreach (WzImage subimg in ((WzDirectory)currObj).WzImages)
                {
                    ExportRecursion(subimg, outPath + subimg.Name + @"\");
                }
            }
            else if (currObj is WzCanvasProperty)
            {
                Bitmap bmp = ((WzCanvasProperty)currObj).PngProperty.GetPNG(false);

                string path = outPath + ProgressingWzSerializer.EscapeInvalidFilePathNames(currObj.Name) + ".png";

                bmp.Save(path, ImageFormat.Png);
                //curr++;
            }
            else if (currObj is WzBinaryProperty)
            {
                string path = outPath + ProgressingWzSerializer.EscapeInvalidFilePathNames(currObj.Name) + ".mp3";
                ((WzBinaryProperty)currObj).SaveToFile(path);
            }
            else if (currObj is WzImage)
            {
                WzImage wzImage = ((WzImage)currObj);

                outPath += ProgressingWzSerializer.EscapeInvalidFilePathNames(currObj.Name) + @"\";
                if (!Directory.Exists(outPath))
                {
                    Directory.CreateDirectory(outPath);
                }

                bool parse = wzImage.Parsed || wzImage.Changed;
                if (!parse)
                {
                    wzImage.ParseImage();
                }
                foreach (WzImageProperty subprop in wzImage.WzProperties)
                {
                    ExportRecursion(subprop, outPath);
                }
                if (!parse)
                {
                    wzImage.UnparseImage();
                }
                curr++;
            }
            else if (currObj is IPropertyContainer)
            {
                outPath += ProgressingWzSerializer.EscapeInvalidFilePathNames(currObj.Name) + ".";
                foreach (WzImageProperty subprop in ((IPropertyContainer)currObj).WzProperties)
                {
                    ExportRecursion(subprop, outPath);
                }
            }
            else if (currObj is WzUOLProperty)
            {
                ExportRecursion(((WzUOLProperty)currObj).LinkValue, outPath);
            }
        }