Example #1
0
        private void RestoreDefaultClothes()
        {
            String sampleBodyPath = Path.GetDirectoryName(lastBasePath) + @"\sample_body.xx.$org$";
            if (File.Exists(sampleBodyPath))
            {
                ppParser basePP = (ppParser)Plugins.OpenPP(lastBasePath);
                ppEditor baseEditor = new ppEditor(basePP);
                baseEditor.RemoveSubfile("sample_body.xx");
                baseEditor.AddSubfile(sampleBodyPath);
                baseEditor.RenameSubfile(Path.GetFileName(sampleBodyPath), "sample_body.xx");
                baseEditor.SavePP(false, (string)Gui.Config["BackupExtensionPP"], false);

                File.Delete(sampleBodyPath);
            }
        }
Example #2
0
        private void Preview(String parserVar, ListViewItem item)
        {
            ppParser parser = (ppParser)Gui.Scripting.Variables[parserVar];
            IWriteFile subfile = (IWriteFile)item.Tag;
            String clothPreviewPath = Path.GetDirectoryName(parser.FilePath) + @"\" + subfile.Name + ".preview";
            Plugins.ExportSubfile(parser, subfile.Name, clothPreviewPath);
            lastBasePath = Path.GetDirectoryName(parser.FilePath) + @"\base.pp";
            ppParser basePP = (ppParser)Plugins.OpenPP(lastBasePath);
            ppEditor baseEditor = new ppEditor(basePP);
            String sampleBodyPath = Path.GetDirectoryName(parser.FilePath) + @"\sample_body.xx.$org$";
            if (!File.Exists(sampleBodyPath))
            {
                Plugins.ExportSubfile(basePP, "sample_body.xx", sampleBodyPath);
            }
            baseEditor.RemoveSubfile("sample_body.xx");
            baseEditor.AddSubfile(clothPreviewPath);
            baseEditor.RenameSubfile(Path.GetFileName(clothPreviewPath), "sample_body.xx");
            baseEditor.SavePP(false, (string)Gui.Config["BackupExtensionPP"], false);
            File.Delete(clothPreviewPath);
            lastPreviewed = item;

            buttonPrepare.Text = "Prepare " + item.Text;
            buttonRestoreDefault.Enabled = true;
        }