Пример #1
0
        /// <summary>
        /// Exports the mipmaps in the image.
        /// </summary>
        public void RunExport()
        {
            this.ItemExportListStore.Foreach(delegate(ITreeModel model, TreePath path, TreeIter iter)
            {
                bool bShouldExport = (bool)this.ItemExportListStore.GetValue(iter, 0);

                if (bShouldExport)
                {
                    FileReference referenceToExport = this.ReferenceMapping[(string)this.ItemExportListStore.GetValue(iter, 1)];

                    string exportPath = "";
                    if (this.Config.GetShouldKeepFileDirectoryStructure())
                    {
                        string parentDirectoryOfFile = this.ExportTarget.FilePath.ConvertPathSeparatorsToCurrentNativeSeparator();

                        exportPath =
                            $"{this.ExportDirectoryFileChooserButton.Filename}{System.IO.Path.DirectorySeparatorChar}{parentDirectoryOfFile}{System.IO.Path.DirectorySeparatorChar}{referenceToExport.GetReferencedItemName()}";
                    }
                    else
                    {
                        exportPath = $"{this.ExportDirectoryFileChooserButton.Filename}{System.IO.Path.DirectorySeparatorChar}{referenceToExport.GetReferencedItemName()}";
                    }

                    Directory.CreateDirectory(Directory.GetParent(exportPath).FullName);

                    byte[] fileData = referenceToExport.Extract();
                    if (fileData != null)
                    {
                        File.WriteAllBytes(exportPath, fileData);
                    }
                }

                return(false);
            });
        }