add 'CRI Extensions for FileSystemEditor' to plugins
This commit is contained in:
parent
05493e3f0b
commit
8ea1713f19
@ -0,0 +1,191 @@
|
||||
//
|
||||
// MyClass.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2019 Mike Becker
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
using MBS.Framework.UserInterface;
|
||||
using UniversalEditor.Plugins.CRI.DataFormats.FileSystem.CPK;
|
||||
using UniversalEditor.UserInterface;
|
||||
|
||||
namespace UniversalEditor.Plugins.CRI.UserInterface
|
||||
{
|
||||
public class FileSystemEditorExtensions : EditorPlugin
|
||||
{
|
||||
public FileSystemEditorExtensions()
|
||||
{
|
||||
SupportedEditors.Add(typeof(Editors.FileSystem.FileSystemEditor));
|
||||
}
|
||||
|
||||
protected override void InitializeInternal()
|
||||
{
|
||||
Context = new Context(new Guid("{7A5A7675-529E-46B1-A4FF-0786956DAE47}"), "CRI Extensions for FileSystemEditor");
|
||||
}
|
||||
|
||||
private bool _initOnce = false;
|
||||
protected override void OnEditorCreated(EventArgs e)
|
||||
{
|
||||
base.OnEditorCreated(e);
|
||||
|
||||
if (_initOnce)
|
||||
return;
|
||||
|
||||
EditorReference er = Editor.MakeReference();
|
||||
|
||||
if (Document == null)
|
||||
return;
|
||||
if (!(Document.DataFormat is CPKDataFormat))
|
||||
return;
|
||||
|
||||
Application.Commands.Add(new Command("CRI_FileSystem_Extensions", "CRI Tools", new CommandItem[]
|
||||
{
|
||||
new CommandReferenceCommandItem("CRI_FileSystem_Extensions_Export_Header"),
|
||||
new CommandReferenceCommandItem("CRI_FileSystem_Extensions_Export_TOC"),
|
||||
new CommandReferenceCommandItem("CRI_FileSystem_Extensions_Export_ITOC"),
|
||||
new CommandReferenceCommandItem("CRI_FileSystem_Extensions_Export_GTOC"),
|
||||
new CommandReferenceCommandItem("CRI_FileSystem_Extensions_Export_ETOC")
|
||||
}));
|
||||
Application.Commands.Add(new Command("CRI_FileSystem_Extensions_Export_Header", "Export Header UTF"));
|
||||
Application.Commands.Add(new Command("CRI_FileSystem_Extensions_Export_TOC", "Export TOC UTF"));
|
||||
Application.Commands.Add(new Command("CRI_FileSystem_Extensions_Export_ITOC", "Export ITOC UTF"));
|
||||
Application.Commands.Add(new Command("CRI_FileSystem_Extensions_Export_GTOC", "Export GTOC UTF"));
|
||||
Application.Commands.Add(new Command("CRI_FileSystem_Extensions_Export_ETOC", "Export ETOC UTF"));
|
||||
|
||||
er.Commands["FileSystemContextMenu_Unselected"].Items.Add(new SeparatorCommandItem());
|
||||
er.Commands["FileSystemContextMenu_Unselected"].Items.Add(new CommandReferenceCommandItem("CRI_FileSystem_Extensions"));
|
||||
|
||||
Context.AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_Header", CRI_FileSystem_Extensions_Export_Header_Click);
|
||||
Context.AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_TOC", CRI_FileSystem_Extensions_Export_TOC_Click);
|
||||
Context.AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_ITOC", CRI_FileSystem_Extensions_Export_ITOC_Click);
|
||||
Context.AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_GTOC", CRI_FileSystem_Extensions_Export_GTOC_Click);
|
||||
Context.AttachCommandEventHandler("CRI_FileSystem_Extensions_Export_ETOC", CRI_FileSystem_Extensions_Export_ETOC_Click);
|
||||
|
||||
_initOnce = true;
|
||||
}
|
||||
|
||||
private void CRI_FileSystem_Extensions_Export_Header_Click(object sender, EventArgs e)
|
||||
{
|
||||
CPKDataFormat cpk = (Document.DataFormat as CPKDataFormat);
|
||||
if (cpk == null)
|
||||
return;
|
||||
|
||||
if (cpk.HeaderData == null)
|
||||
{
|
||||
MBS.Framework.UserInterface.Dialogs.MessageDialog.ShowDialog("This archive does not contain a header (CPK ) table.", "Error", MBS.Framework.UserInterface.Dialogs.MessageDialogButtons.OK, MBS.Framework.UserInterface.Dialogs.MessageDialogIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
MBS.Framework.UserInterface.Dialogs.FileDialog dlg = new MBS.Framework.UserInterface.Dialogs.FileDialog();
|
||||
dlg.Text = "Export header UTF";
|
||||
dlg.SelectedFileNames.Add("CpkHeader.utf");
|
||||
dlg.Mode = MBS.Framework.UserInterface.Dialogs.FileDialogMode.Save;
|
||||
dlg.FileNameFilters.Add("CRI Middleware UTF table", "*.utf");
|
||||
if (dlg.ShowDialog() == MBS.Framework.UserInterface.DialogResult.OK)
|
||||
{
|
||||
System.IO.File.WriteAllBytes(dlg.SelectedFileNames[dlg.SelectedFileNames.Count - 1], cpk.HeaderData);
|
||||
}
|
||||
}
|
||||
private void CRI_FileSystem_Extensions_Export_TOC_Click(object sender, EventArgs e)
|
||||
{
|
||||
CPKDataFormat cpk = (Document.DataFormat as CPKDataFormat);
|
||||
if (cpk == null)
|
||||
return;
|
||||
|
||||
if (cpk.TocData == null)
|
||||
{
|
||||
MBS.Framework.UserInterface.Dialogs.MessageDialog.ShowDialog("This archive does not contain a file list TOC (TOC ) table.", "Error", MBS.Framework.UserInterface.Dialogs.MessageDialogButtons.OK, MBS.Framework.UserInterface.Dialogs.MessageDialogIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
MBS.Framework.UserInterface.Dialogs.FileDialog dlg = new MBS.Framework.UserInterface.Dialogs.FileDialog();
|
||||
dlg.Text = "Export file list (TOC) UTF";
|
||||
dlg.SelectedFileNames.Add("CpkTocInfo.utf");
|
||||
dlg.Mode = MBS.Framework.UserInterface.Dialogs.FileDialogMode.Save;
|
||||
dlg.FileNameFilters.Add("CRI Middleware UTF table", "*.utf");
|
||||
if (dlg.ShowDialog() == MBS.Framework.UserInterface.DialogResult.OK)
|
||||
{
|
||||
System.IO.File.WriteAllBytes(dlg.SelectedFileNames[dlg.SelectedFileNames.Count - 1], cpk.TocData);
|
||||
}
|
||||
}
|
||||
private void CRI_FileSystem_Extensions_Export_ITOC_Click(object sender, EventArgs e)
|
||||
{
|
||||
CPKDataFormat cpk = (Document.DataFormat as CPKDataFormat);
|
||||
if (cpk == null)
|
||||
return;
|
||||
|
||||
if (cpk.ITocData == null)
|
||||
{
|
||||
MBS.Framework.UserInterface.Dialogs.MessageDialog.ShowDialog("This archive does not contain an indexes TOC (ITOC) table.", "Error", MBS.Framework.UserInterface.Dialogs.MessageDialogButtons.OK, MBS.Framework.UserInterface.Dialogs.MessageDialogIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
MBS.Framework.UserInterface.Dialogs.FileDialog dlg = new MBS.Framework.UserInterface.Dialogs.FileDialog();
|
||||
dlg.Text = "Export indexes (ITOC) UTF";
|
||||
dlg.SelectedFileNames.Add("CpkExtendId.utf");
|
||||
dlg.Mode = MBS.Framework.UserInterface.Dialogs.FileDialogMode.Save;
|
||||
dlg.FileNameFilters.Add("CRI Middleware UTF table", "*.utf");
|
||||
if (dlg.ShowDialog() == MBS.Framework.UserInterface.DialogResult.OK)
|
||||
{
|
||||
System.IO.File.WriteAllBytes(dlg.SelectedFileNames[dlg.SelectedFileNames.Count - 1], cpk.ITocData);
|
||||
}
|
||||
}
|
||||
private void CRI_FileSystem_Extensions_Export_GTOC_Click(object sender, EventArgs e)
|
||||
{
|
||||
CPKDataFormat cpk = (Document.DataFormat as CPKDataFormat);
|
||||
if (cpk == null)
|
||||
return;
|
||||
|
||||
if (cpk.GTocData == null)
|
||||
{
|
||||
MBS.Framework.UserInterface.Dialogs.MessageDialog.ShowDialog("This archive does not contain a groups TOC (GTOC) table.", "Error", MBS.Framework.UserInterface.Dialogs.MessageDialogButtons.OK, MBS.Framework.UserInterface.Dialogs.MessageDialogIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
MBS.Framework.UserInterface.Dialogs.FileDialog dlg = new MBS.Framework.UserInterface.Dialogs.FileDialog();
|
||||
dlg.Text = "Export groups (GTOC) UTF";
|
||||
dlg.Mode = MBS.Framework.UserInterface.Dialogs.FileDialogMode.Save;
|
||||
dlg.FileNameFilters.Add("CRI Middleware UTF table", "*.utf");
|
||||
if (dlg.ShowDialog() == MBS.Framework.UserInterface.DialogResult.OK)
|
||||
{
|
||||
System.IO.File.WriteAllBytes(dlg.SelectedFileNames[dlg.SelectedFileNames.Count - 1], cpk.GTocData);
|
||||
}
|
||||
}
|
||||
private void CRI_FileSystem_Extensions_Export_ETOC_Click(object sender, EventArgs e)
|
||||
{
|
||||
CPKDataFormat cpk = (Document.DataFormat as CPKDataFormat);
|
||||
if (cpk == null)
|
||||
return;
|
||||
|
||||
if (cpk.ETocData == null)
|
||||
{
|
||||
MBS.Framework.UserInterface.Dialogs.MessageDialog.ShowDialog("This archive does not contain an end-of-file TOC (ETOC) table.", "Error", MBS.Framework.UserInterface.Dialogs.MessageDialogButtons.OK, MBS.Framework.UserInterface.Dialogs.MessageDialogIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
MBS.Framework.UserInterface.Dialogs.FileDialog dlg = new MBS.Framework.UserInterface.Dialogs.FileDialog();
|
||||
dlg.Text = "Export end-of-file (ETOC) UTF";
|
||||
dlg.SelectedFileNames.Add("CpkEtocInfo.utf");
|
||||
dlg.Mode = MBS.Framework.UserInterface.Dialogs.FileDialogMode.Save;
|
||||
dlg.FileNameFilters.Add("CRI Middleware UTF table", "*.utf");
|
||||
if (dlg.ShowDialog() == MBS.Framework.UserInterface.DialogResult.OK)
|
||||
{
|
||||
System.IO.File.WriteAllBytes(dlg.SelectedFileNames[dlg.SelectedFileNames.Count - 1], cpk.ETocData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
//
|
||||
// AssemblyInfo.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2019 Mike Becker
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("UniversalEditor.Plugins.CRI.UserInterface")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("Mike Becker")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{83709A63-8C43-4C67-80F6-00022986A086}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>UniversalEditor.Plugins.CRI.UserInterface</RootNamespace>
|
||||
<AssemblyName>UniversalEditor.Plugins.CRI.UserInterface</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Output\Debug\Plugins</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Output\Release\Plugins</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FileSystemEditorExtensions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\MBS.Framework\MBS.Framework\MBS.Framework.csproj">
|
||||
<Project>{00266B21-35C9-4A7F-A6BA-D54D7FDCC25C}</Project>
|
||||
<Name>MBS.Framework</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\MBS.Framework.UserInterface\Libraries\MBS.Framework.UserInterface\MBS.Framework.UserInterface.csproj">
|
||||
<Project>{29E1C1BB-3EA5-4062-B62F-85EEC703FE07}</Project>
|
||||
<Name>MBS.Framework.UserInterface</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
|
||||
<Project>{2D4737E6-6D95-408A-90DB-8DFF38147E85}</Project>
|
||||
<Name>UniversalEditor.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Essential\UniversalEditor.Essential.csproj">
|
||||
<Project>{30467E5C-05BC-4856-AADC-13906EF4CADD}</Project>
|
||||
<Name>UniversalEditor.Essential</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.UserInterface\UniversalEditor.UserInterface.csproj">
|
||||
<Project>{8622EBC4-8E20-476E-B284-33D472081F5C}</Project>
|
||||
<Name>UniversalEditor.UserInterface</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Plugins\UniversalEditor.Plugins.CRI\UniversalEditor.Plugins.CRI.csproj">
|
||||
<Project>{DBA93D1B-01BC-4218-8309-85FA0D5402FC}</Project>
|
||||
<Name>UniversalEditor.Plugins.CRI</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@ -147,6 +147,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Syn
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.CRI", "Plugins\UniversalEditor.Plugins.CRI\UniversalEditor.Plugins.CRI.csproj", "{DBA93D1B-01BC-4218-8309-85FA0D5402FC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.CRI.UserInterface", "Plugins.UserInterface\UniversalEditor.Plugins.CRI.UserInterface\UniversalEditor.Plugins.CRI.UserInterface.csproj", "{83709A63-8C43-4C67-80F6-00022986A086}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -423,6 +425,10 @@ Global
|
||||
{DBA93D1B-01BC-4218-8309-85FA0D5402FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DBA93D1B-01BC-4218-8309-85FA0D5402FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DBA93D1B-01BC-4218-8309-85FA0D5402FC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{83709A63-8C43-4C67-80F6-00022986A086}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{83709A63-8C43-4C67-80F6-00022986A086}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{83709A63-8C43-4C67-80F6-00022986A086}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{83709A63-8C43-4C67-80F6-00022986A086}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{6F0AB1AF-E1A1-4D19-B19C-05BBB15C94B2} = {05D15661-E684-4EC9-8FBD-C014BA433CC5}
|
||||
@ -491,6 +497,7 @@ Global
|
||||
{00266B21-35C9-4A7F-A6BA-D54D7FDCC25C} = {20F315E0-52AE-479F-AF43-3402482C1FC8}
|
||||
{0EEC3646-9749-48AF-848E-0F699247E76F} = {2ED32D16-6C06-4450-909A-40D32DA67FB4}
|
||||
{DBA93D1B-01BC-4218-8309-85FA0D5402FC} = {2ED32D16-6C06-4450-909A-40D32DA67FB4}
|
||||
{83709A63-8C43-4C67-80F6-00022986A086} = {7B535D74-5496-4802-B809-89ED88274A91}
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
Policies = $0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user