Skip to content

Commit

Permalink
Initial ppx rewriting implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
bbepis committed Nov 15, 2017
1 parent d626ea2 commit f2b2239
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 103 deletions.
41 changes: 12 additions & 29 deletions Plugins/SB3UtilityPPx/FormPPx.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 27 additions & 34 deletions Plugins/SB3UtilityPPx/FormPPx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -778,21 +778,23 @@ private void soundSubfilesList_KeyUp(object sender, KeyEventArgs e)
removeToolStripMenuItem_Click(sender, e);
}

private void saveppToolStripMenuItem_Click(object sender, EventArgs e)
void ClearChanges()
{
InitSubfileLists(false);
Changed = false;
}

private void saveppToolStripMenuItem_Click(object sender, EventArgs e)
{
throw new NotImplementedException();
/*
try
{
BackgroundWorker worker = (BackgroundWorker)Gui.Scripting.RunScript(EditorVar + ".SavePP(keepBackup=" + keepBackupToolStripMenuItem.Checked + ", backupExtension=\"" + (string)Gui.Config["BackupExtensionPP"] + "\", background=True)");
ShowBlockingDialog(Editor.Parser.FilePath, worker);
ClearChanges();
Gui.Scripting.RunScript(EditorVar + ".SavePPx()");
ClearChanges();
}
catch (Exception ex)
{
Utility.ReportException(ex);
}
*/
}

private void saveppAsToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -863,8 +865,6 @@ private void newSourceFormatToolStripMenuItem_Click(object sender, EventArgs e)

private void addFilesToolStripMenuItem_Click(object sender, EventArgs e)
{
throw new NotImplementedException();
/*
try
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
Expand All @@ -888,7 +888,7 @@ private void addFilesToolStripMenuItem_Click(object sender, EventArgs e)
}
foreach (string path in openFileDialog1.FileNames)
{
Gui.Scripting.RunScript(EditorVar + ".AddSubfile(path=\"" + path + "\", replace=True)");
Gui.Scripting.RunScript(EditorVar + ".AddSubfile(arcname=\"" + comboBoxArchives.Text + "\", path=\"" + path + "\", replace=True)");
Changed = Changed;
}

Expand All @@ -899,7 +899,6 @@ private void addFilesToolStripMenuItem_Click(object sender, EventArgs e)
{
Utility.ReportException(ex);
}
*/
}

bool CloseEditors(string title, List<string> editors)
Expand Down Expand Up @@ -927,8 +926,6 @@ bool CloseEditors(string title, List<string> editors)

private void removeToolStripMenuItem_Click(object sender, EventArgs e)
{
throw new NotImplementedException();
/*
try
{
bool removed = false;
Expand All @@ -941,7 +938,7 @@ private void removeToolStripMenuItem_Click(object sender, EventArgs e)
}
foreach (ListViewItem item in xxSubfilesList.SelectedItems)
{
IWriteFile writeFile = (IWriteFile)item.Tag;
ISubfile writeFile = (ISubfile)item.Tag;

if (ChildParserVars.ContainsKey(writeFile.Name))
{
Expand All @@ -953,7 +950,7 @@ private void removeToolStripMenuItem_Click(object sender, EventArgs e)
ChildForms[writeFile.Name].Close();
}

Gui.Scripting.RunScript(EditorVar + ".RemoveSubfile(name=\"" + writeFile.Name + "\")");
Gui.Scripting.RunScript(EditorVar + ".RemoveSubfile(arcname=\"" + writeFile.ArchiveName + "\", name=\"" + writeFile.Name + "\")");
removed = true;
}
}
Expand All @@ -965,7 +962,7 @@ private void removeToolStripMenuItem_Click(object sender, EventArgs e)
}
foreach (ListViewItem item in xaSubfilesList.SelectedItems)
{
IWriteFile writeFile = (IWriteFile)item.Tag;
ISubfile writeFile = (ISubfile)item.Tag;

if (ChildParserVars.ContainsKey(writeFile.Name))
{
Expand All @@ -977,27 +974,27 @@ private void removeToolStripMenuItem_Click(object sender, EventArgs e)
ChildForms[writeFile.Name].Close();
}

Gui.Scripting.RunScript(EditorVar + ".RemoveSubfile(name=\"" + writeFile.Name + "\")");
removed = true;
Gui.Scripting.RunScript(EditorVar + ".RemoveSubfile(arcname=\"" + writeFile.ArchiveName + "\", name=\"" + writeFile.Name + "\")");
removed = true;
}
}
else if (tabControlSubfiles.SelectedTab == tabPageImageSubfiles)
{
foreach (ListViewItem item in imageSubfilesList.SelectedItems)
{
IWriteFile writeFile = (IWriteFile)item.Tag;
Gui.Scripting.RunScript(EditorVar + ".RemoveSubfile(name=\"" + writeFile.Name + "\")");
removed = true;
ISubfile writeFile = (ISubfile)item.Tag;
Gui.Scripting.RunScript(EditorVar + ".RemoveSubfile(arcname=\"" + writeFile.ArchiveName + "\", name=\"" + writeFile.Name + "\")");
removed = true;
}
}
else if (tabControlSubfiles.SelectedTab == tabPageSoundSubfiles)
{
foreach (ListViewItem item in soundSubfilesList.SelectedItems)
{
item.Selected = false;
IWriteFile writeFile = (IWriteFile)item.Tag;
Gui.Scripting.RunScript(EditorVar + ".RemoveSubfile(name=\"" + writeFile.Name + "\")");
removed = true;
ISubfile writeFile = (ISubfile)item.Tag;
Gui.Scripting.RunScript(EditorVar + ".RemoveSubfile(arcname=\"" + writeFile.ArchiveName + "\", name=\"" + writeFile.Name + "\")");
removed = true;
}
}
else if (tabControlSubfiles.SelectedTab == tabPageOtherSubfiles)
Expand All @@ -1008,9 +1005,9 @@ private void removeToolStripMenuItem_Click(object sender, EventArgs e)
}
foreach (ListViewItem item in otherSubfilesList.SelectedItems)
{
IWriteFile writeFile = (IWriteFile)item.Tag;
Gui.Scripting.RunScript(EditorVar + ".RemoveSubfile(name=\"" + writeFile.Name + "\")");
removed = true;
ISubfile writeFile = (ISubfile)item.Tag;
Gui.Scripting.RunScript(EditorVar + ".RemoveSubfile(arcname=\"" + writeFile.ArchiveName + "\", name=\"" + writeFile.Name + "\")");
removed = true;
}
}

Expand All @@ -1024,7 +1021,6 @@ private void removeToolStripMenuItem_Click(object sender, EventArgs e)
{
Utility.ReportException(ex);
}
*/
}

private bool FindAndCloseEditorsForRemoval(ListView listView)
Expand Down Expand Up @@ -1216,23 +1212,20 @@ private void multiRenameItem(FormPPMultiRename renameForm, ListViewItem item, bo

private void exportPPToolStripMenuItem_Click(object sender, EventArgs e)
{
throw new NotImplementedException();
/*
try
{
folderBrowserDialog1.SelectedPath = Path.GetDirectoryName(this.Editor.Parser.FilePath);
folderBrowserDialog1.SelectedPath = Path.GetDirectoryName(this.Editor.Archive.Filename);
folderBrowserDialog1.RootFolder = Environment.SpecialFolder.MyComputer;
folderBrowserDialog1.Description = "Attention! " + Editor.Parser.Subfiles.Count + " subfiles to be exported.";
folderBrowserDialog1.Description = "Attention! " + Editor.Archive.Files.Count + " subfiles to be exported.";
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
Gui.Scripting.RunScript("ExportPP(parser=" + ParserVar + ", path=\"" + folderBrowserDialog1.SelectedPath + "\")");
Gui.Scripting.RunScript(EditorVar + ".ExportPPx(\"" + folderBrowserDialog1.SelectedPath + "\")");
}
}
catch (Exception ex)
{
Utility.ReportException(ex);
}
*/
}

private void exportSubfilesToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down
Loading

0 comments on commit f2b2239

Please sign in to comment.