initial commit
This commit is contained in:
commit
1b60743303
274 changed files with 25866 additions and 0 deletions
40
Explorer/DiscView/ContextMenuManager.cs
Normal file
40
Explorer/DiscView/ContextMenuManager.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: GDRomExplorer.DiscView.ContextMenuManager
|
||||
// Assembly: GD-ROM Explorer, Version=1.6.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
|
||||
// MVID: B7A7D10A-9A63-4E9E-9840-D297E5FC2219
|
||||
// Assembly location: GD-ROM Explorer.exe
|
||||
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GDRomExplorer.DiscView
|
||||
{
|
||||
public class ContextMenuManager
|
||||
{
|
||||
private MenuItemFactory Context;
|
||||
private ContextMenuStrip LastDisplayedContextMenu;
|
||||
|
||||
public ContextMenuManager(MenuItemFactory Context) => this.Context = Context;
|
||||
|
||||
public ContextMenuStrip CreateContextMenu(ToolStripItem[] MenuItems)
|
||||
{
|
||||
ContextMenuStrip contextMenuStrip = new ContextMenuStrip();
|
||||
contextMenuStrip.Items.AddRange(MenuItems);
|
||||
return contextMenuStrip;
|
||||
}
|
||||
|
||||
public ContextMenuStrip CreateAndShowContextMenu(ToolStripItem[] MenuItems)
|
||||
{
|
||||
this.CloseContextMenuIfAny();
|
||||
this.LastDisplayedContextMenu = this.CreateContextMenu(MenuItems);
|
||||
this.LastDisplayedContextMenu.Show(Cursor.Position);
|
||||
return this.LastDisplayedContextMenu;
|
||||
}
|
||||
|
||||
public void CloseContextMenuIfAny()
|
||||
{
|
||||
if (this.LastDisplayedContextMenu == null)
|
||||
return;
|
||||
this.LastDisplayedContextMenu.Close();
|
||||
}
|
||||
}
|
||||
}
|
29
Explorer/DiscView/DiscListViewSelectionHandlerFactory.cs
Normal file
29
Explorer/DiscView/DiscListViewSelectionHandlerFactory.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: GDRomExplorer.DiscView.DiscListViewSelectionHandlerFactory
|
||||
// Assembly: GD-ROM Explorer, Version=1.6.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
|
||||
// MVID: B7A7D10A-9A63-4E9E-9840-D297E5FC2219
|
||||
// Assembly location: GD-ROM Explorer.exe
|
||||
|
||||
using GDRomExplorer.UserControls;
|
||||
using ImageReader.ISO9660.DirectoryRecords;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GDRomExplorer.DiscView
|
||||
{
|
||||
public class DiscListViewSelectionHandlerFactory : DiscSelectionHandlerFactory<ListView>
|
||||
{
|
||||
public DiscListViewSelectionHandlerFactory(DiscViewExplorer Context, ListView Control)
|
||||
: base(Context, Control)
|
||||
{
|
||||
}
|
||||
|
||||
private DiscViewSelection<IList<DirectoryRecord>> newSelectionHandlers(
|
||||
IList<DirectoryRecord> DirectoryRecords)
|
||||
{
|
||||
return DiscViewSelection<IList<DirectoryRecord>>.NewHandlersForListView(new DiscViewSelection<IList<DirectoryRecord>>.SelectionHandler<IList<DirectoryRecord>>(this.Context.DirectoryRecords_MouseRightClickHandler), new DiscViewSelection<IList<DirectoryRecord>>.SelectionHandler<IList<DirectoryRecord>>(this.Context.DirectoryRecords_MouseLeftClickHandler), new DiscViewSelection<IList<DirectoryRecord>>.SelectionHandler<IList<DirectoryRecord>>(this.Context.DirectoryRecords_MouseDoubleLeftClicksHandler), DirectoryRecords);
|
||||
}
|
||||
|
||||
public override IDiscViewSelection newSelectionHandlers(object Handle) => Handle is IList<DirectoryRecord> ? (IDiscViewSelection) this.newSelectionHandlers(Handle as IList<DirectoryRecord>) : (IDiscViewSelection) null;
|
||||
}
|
||||
}
|
13
Explorer/DiscView/DiscSelectionHandlerFactory.cs
Normal file
13
Explorer/DiscView/DiscSelectionHandlerFactory.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: GDRomExplorer.DiscView.DiscSelectionHandlerFactory
|
||||
// Assembly: GD-ROM Explorer, Version=1.6.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
|
||||
// MVID: B7A7D10A-9A63-4E9E-9840-D297E5FC2219
|
||||
// Assembly location: GD-ROM Explorer.exe
|
||||
|
||||
namespace GDRomExplorer.DiscView
|
||||
{
|
||||
public interface DiscSelectionHandlerFactory
|
||||
{
|
||||
IDiscViewSelection newSelectionHandlers(object Handle);
|
||||
}
|
||||
}
|
24
Explorer/DiscView/DiscSelectionHandlerFactory`1.cs
Normal file
24
Explorer/DiscView/DiscSelectionHandlerFactory`1.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: GDRomExplorer.DiscView.DiscSelectionHandlerFactory`1
|
||||
// Assembly: GD-ROM Explorer, Version=1.6.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
|
||||
// MVID: B7A7D10A-9A63-4E9E-9840-D297E5FC2219
|
||||
// Assembly location: GD-ROM Explorer.exe
|
||||
|
||||
using GDRomExplorer.UserControls;
|
||||
|
||||
namespace GDRomExplorer.DiscView
|
||||
{
|
||||
public abstract class DiscSelectionHandlerFactory<T> : DiscSelectionHandlerFactory
|
||||
{
|
||||
protected DiscViewExplorer Context;
|
||||
private T Control;
|
||||
|
||||
public DiscSelectionHandlerFactory(DiscViewExplorer Context, T Control)
|
||||
{
|
||||
this.Context = Context;
|
||||
this.Control = Control;
|
||||
}
|
||||
|
||||
public abstract IDiscViewSelection newSelectionHandlers(object Handle);
|
||||
}
|
||||
}
|
71
Explorer/DiscView/DiscTreeViewSelectionHandlerFactory.cs
Normal file
71
Explorer/DiscView/DiscTreeViewSelectionHandlerFactory.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: GDRomExplorer.DiscView.DiscTreeViewSelectionHandlerFactory
|
||||
// Assembly: GD-ROM Explorer, Version=1.6.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
|
||||
// MVID: B7A7D10A-9A63-4E9E-9840-D297E5FC2219
|
||||
// Assembly location: GD-ROM Explorer.exe
|
||||
|
||||
using GDRomExplorer.UserControls;
|
||||
using ImageReader.ISO9660.DirectoryRecords;
|
||||
using SEGATools.DiscFileSystem;
|
||||
using SEGATools.Security;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GDRomExplorer.DiscView
|
||||
{
|
||||
public class DiscTreeViewSelectionHandlerFactory : DiscSelectionHandlerFactory<TreeView>
|
||||
{
|
||||
public DiscTreeViewSelectionHandlerFactory(DiscViewExplorer Context, TreeView Control)
|
||||
: base(Context, Control)
|
||||
{
|
||||
}
|
||||
|
||||
private DiscViewSelection<IDiscFileSystem> newSelectionHandlers(
|
||||
IDiscFileSystem discFileSystem)
|
||||
{
|
||||
return DiscViewSelection<IDiscFileSystem>.NewHandlersForTreeView(new DiscViewSelection<IDiscFileSystem>.SelectionHandler<IDiscFileSystem>(this.Context.Disc_AfterSelectHandler), new DiscViewSelection<IDiscFileSystem>.SelectionHandler<IDiscFileSystem>(this.Context.Disc_MouseRightClickHandler), (DiscViewSelection<IDiscFileSystem>.SelectionHandler<IDiscFileSystem>) null, discFileSystem);
|
||||
}
|
||||
|
||||
private DiscViewSelection<DirectoryRecord> newSelectionHandlers(
|
||||
DirectoryRecord DirectoryRecord)
|
||||
{
|
||||
return DiscViewSelection<DirectoryRecord>.NewHandlersForTreeView(new DiscViewSelection<DirectoryRecord>.SelectionHandler<DirectoryRecord>(this.Context.DirectoryRecord_AfterSelectClickHandler), new DiscViewSelection<DirectoryRecord>.SelectionHandler<DirectoryRecord>(this.Context.DirectoryRecord_MouseRightClickHandler), (DiscViewSelection<DirectoryRecord>.SelectionHandler<DirectoryRecord>) null, DirectoryRecord);
|
||||
}
|
||||
|
||||
private DiscViewSelection<InitialProgramExtended> newSelectionHandlers(
|
||||
InitialProgramExtended InitialProgram)
|
||||
{
|
||||
return DiscViewSelection<InitialProgramExtended>.NewHandlersForTreeView(new DiscViewSelection<InitialProgramExtended>.SelectionHandler<InitialProgramExtended>(this.Context.InitialProgram_AfterSelectHandler), new DiscViewSelection<InitialProgramExtended>.SelectionHandler<InitialProgramExtended>(this.Context.InitialProgram_MouseRightClickHandler), new DiscViewSelection<InitialProgramExtended>.SelectionHandler<InitialProgramExtended>(this.Context.InitialProgram_MouseDoubleLeftClicksHandler), InitialProgram);
|
||||
}
|
||||
|
||||
private DiscViewSelection<IDiscSession> newSelectionHandlers(
|
||||
IDiscSession DiscSession)
|
||||
{
|
||||
return DiscViewSelection<IDiscSession>.NewHandlersForTreeView(new DiscViewSelection<IDiscSession>.SelectionHandler<IDiscSession>(this.Context.DiscSession_AfterSelectHandler), new DiscViewSelection<IDiscSession>.SelectionHandler<IDiscSession>(this.Context.DiscSession_MouseRightClickHandler), (DiscViewSelection<IDiscSession>.SelectionHandler<IDiscSession>) null, DiscSession);
|
||||
}
|
||||
|
||||
private DiscViewSelection<IDiscTrack> newSelectionHandlers(
|
||||
IDiscTrack DiscTrack)
|
||||
{
|
||||
return DiscViewSelection<IDiscTrack>.NewHandlersForTreeView(new DiscViewSelection<IDiscTrack>.SelectionHandler<IDiscTrack>(this.Context.DiscTrack_AfterSelectHandler), new DiscViewSelection<IDiscTrack>.SelectionHandler<IDiscTrack>(this.Context.DiscTrack_MouseRightClickHandler), (DiscViewSelection<IDiscTrack>.SelectionHandler<IDiscTrack>) null, DiscTrack);
|
||||
}
|
||||
|
||||
public override IDiscViewSelection newSelectionHandlers(object Handle)
|
||||
{
|
||||
switch (Handle)
|
||||
{
|
||||
case IDiscFileSystem _:
|
||||
return (IDiscViewSelection) this.newSelectionHandlers(Handle as IDiscFileSystem);
|
||||
case IDiscSession _:
|
||||
return (IDiscViewSelection) this.newSelectionHandlers(Handle as IDiscSession);
|
||||
case IDiscTrack _:
|
||||
return (IDiscViewSelection) this.newSelectionHandlers(Handle as IDiscTrack);
|
||||
case InitialProgramExtended _:
|
||||
return (IDiscViewSelection) this.newSelectionHandlers(Handle as InitialProgramExtended);
|
||||
case DirectoryRecord _:
|
||||
return (IDiscViewSelection) this.newSelectionHandlers(Handle as DirectoryRecord);
|
||||
default:
|
||||
return (IDiscViewSelection) null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
107
Explorer/DiscView/DiscViewSelection`1.cs
Normal file
107
Explorer/DiscView/DiscViewSelection`1.cs
Normal file
|
@ -0,0 +1,107 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: GDRomExplorer.DiscView.DiscViewSelection`1
|
||||
// Assembly: GD-ROM Explorer, Version=1.6.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
|
||||
// MVID: B7A7D10A-9A63-4E9E-9840-D297E5FC2219
|
||||
// Assembly location: GD-ROM Explorer.exe
|
||||
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GDRomExplorer.DiscView
|
||||
{
|
||||
public class DiscViewSelection<Selection> : IDiscViewSelection
|
||||
{
|
||||
private static readonly Logger.ILog logger = Logger.CreateLog();
|
||||
private DiscViewSelection<Selection>.SelectionHandler<Selection> AfterSelectHandler;
|
||||
private DiscViewSelection<Selection>.SelectionHandler<Selection> RightClickHandler;
|
||||
private DiscViewSelection<Selection>.SelectionHandler<Selection> LeftClickHandler;
|
||||
private DiscViewSelection<Selection>.SelectionHandler<Selection> DoubleLeftClickHandler;
|
||||
private Selection Handle;
|
||||
|
||||
private DiscViewSelection(
|
||||
DiscViewSelection<Selection>.SelectionHandler<Selection> AfterSelectHandler,
|
||||
DiscViewSelection<Selection>.SelectionHandler<Selection> RightClickHandler,
|
||||
DiscViewSelection<Selection>.SelectionHandler<Selection> LeftClickHandler,
|
||||
DiscViewSelection<Selection>.SelectionHandler<Selection> DoubleLeftClickHandler,
|
||||
Selection Handle)
|
||||
{
|
||||
this.AfterSelectHandler = AfterSelectHandler;
|
||||
this.RightClickHandler = RightClickHandler;
|
||||
this.LeftClickHandler = LeftClickHandler;
|
||||
this.DoubleLeftClickHandler = DoubleLeftClickHandler;
|
||||
this.Handle = Handle;
|
||||
}
|
||||
|
||||
public static DiscViewSelection<Selection> NoHandler(Selection Handle) => new DiscViewSelection<Selection>((DiscViewSelection<Selection>.SelectionHandler<Selection>) null, (DiscViewSelection<Selection>.SelectionHandler<Selection>) null, (DiscViewSelection<Selection>.SelectionHandler<Selection>) null, (DiscViewSelection<Selection>.SelectionHandler<Selection>) null, Handle);
|
||||
|
||||
public static DiscViewSelection<Selection> NewHandlersForTreeView(
|
||||
DiscViewSelection<Selection>.SelectionHandler<Selection> AfterSelectHandler,
|
||||
DiscViewSelection<Selection>.SelectionHandler<Selection> RightClickHandler,
|
||||
DiscViewSelection<Selection>.SelectionHandler<Selection> DoubleLeftClickHandler,
|
||||
Selection Handle)
|
||||
{
|
||||
return new DiscViewSelection<Selection>(AfterSelectHandler, RightClickHandler, (DiscViewSelection<Selection>.SelectionHandler<Selection>) null, DoubleLeftClickHandler, Handle);
|
||||
}
|
||||
|
||||
public static DiscViewSelection<Selection> NewHandlersForListView(
|
||||
DiscViewSelection<Selection>.SelectionHandler<Selection> RightClickHandler,
|
||||
DiscViewSelection<Selection>.SelectionHandler<Selection> LeftClickHandler,
|
||||
DiscViewSelection<Selection>.SelectionHandler<Selection> DoubleLeftClickHandler,
|
||||
Selection Handle)
|
||||
{
|
||||
return new DiscViewSelection<Selection>((DiscViewSelection<Selection>.SelectionHandler<Selection>) null, RightClickHandler, LeftClickHandler, DoubleLeftClickHandler, Handle);
|
||||
}
|
||||
|
||||
public void HandleAfterSelect()
|
||||
{
|
||||
if (this.AfterSelectHandler == null)
|
||||
return;
|
||||
this.AfterSelectHandler(this.Handle);
|
||||
}
|
||||
|
||||
public void HandleLeftClick()
|
||||
{
|
||||
if (this.LeftClickHandler == null)
|
||||
return;
|
||||
this.LeftClickHandler(this.Handle);
|
||||
}
|
||||
|
||||
public void HandleDoubleLeftClicks()
|
||||
{
|
||||
if (this.DoubleLeftClickHandler == null)
|
||||
return;
|
||||
this.DoubleLeftClickHandler(this.Handle);
|
||||
}
|
||||
|
||||
public void HandleRightClick()
|
||||
{
|
||||
if (this.RightClickHandler == null)
|
||||
return;
|
||||
this.RightClickHandler(this.Handle);
|
||||
}
|
||||
|
||||
public void HandleMouseEvent(MouseEventArgs MouseEvent)
|
||||
{
|
||||
switch (MouseEvent.Button)
|
||||
{
|
||||
case MouseButtons.Left:
|
||||
if (MouseEvent.Clicks == 1)
|
||||
{
|
||||
this.HandleLeftClick();
|
||||
return;
|
||||
}
|
||||
if (MouseEvent.Clicks == 2)
|
||||
{
|
||||
this.HandleDoubleLeftClicks();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case MouseButtons.Right:
|
||||
this.HandleRightClick();
|
||||
return;
|
||||
}
|
||||
DiscViewSelection<Selection>.logger.DebugFormat("No handler for {0} with {1} click(s) mouse button(s) {2}", (object) this.Handle, (object) MouseEvent.Clicks, (object) MouseEvent.Button);
|
||||
}
|
||||
|
||||
public delegate void SelectionHandler<HandleType>(HandleType handle);
|
||||
}
|
||||
}
|
54
Explorer/DiscView/ExplorerListItemFactory.cs
Normal file
54
Explorer/DiscView/ExplorerListItemFactory.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: GDRomExplorer.DiscView.ExplorerListItemFactory
|
||||
// Assembly: GD-ROM Explorer, Version=1.6.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
|
||||
// MVID: B7A7D10A-9A63-4E9E-9840-D297E5FC2219
|
||||
// Assembly location: GD-ROM Explorer.exe
|
||||
|
||||
using GDRomExplorer.Resources;
|
||||
using ImageReader.ISO9660.DirectoryRecords;
|
||||
using SEGATools.DiscFileSystem;
|
||||
using SEGATools.Formater;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GDRomExplorer.DiscView
|
||||
{
|
||||
public class ExplorerListItemFactory
|
||||
{
|
||||
public static ListViewItem CreateItem(
|
||||
DirectoryRecord DirectoryRecord,
|
||||
IDiscFileSystem Disc)
|
||||
{
|
||||
ListViewItem listViewItem = new ListViewItem(DirectoryRecord.Name, DirectoryRecord.IsDirectory ? 1 : 0);
|
||||
listViewItem.Name = DirectoryRecord.Name;
|
||||
listViewItem.Tag = (object) DirectoryRecord;
|
||||
listViewItem.UseItemStyleForSubItems = true;
|
||||
listViewItem.ToolTipText = ExplorerToolTipFactory.CreateToolTipText(DirectoryRecord);
|
||||
listViewItem.SubItems.Add(SizeFormater.ToHumanReadableSize((long) DirectoryRecord.ExtentSize));
|
||||
listViewItem.SubItems.Add(DirectoryRecord.ExtentSize.ToString());
|
||||
listViewItem.SubItems.Add(DirectoryRecord.Extent.ToString());
|
||||
if (DirectoryRecord.RecordingDateTime.HasValue)
|
||||
listViewItem.SubItems.Add(string.Format("{0:G}", (object) DirectoryRecord.RecordingDateTime));
|
||||
else
|
||||
listViewItem.SubItems.Add(Strings.InvalidDateTimeText);
|
||||
if (!DirectoryRecord.HasValidFileIdentifier)
|
||||
{
|
||||
listViewItem.BackColor = Color.OrangeRed;
|
||||
listViewItem.ForeColor = Color.White;
|
||||
listViewItem.ToolTipText = Strings.ToolTipInvalidFileIdentifier;
|
||||
}
|
||||
else if (Disc.MainBinary != null && Disc.MainBinary.FullPath.Equals(DirectoryRecord.FullPath))
|
||||
{
|
||||
listViewItem.Font = new Font(listViewItem.Font, FontStyle.Bold);
|
||||
listViewItem.ToolTipText = string.Format(Strings.ToolTipMainBinaryWithFormat, (object) DirectoryRecord.Name);
|
||||
}
|
||||
return listViewItem;
|
||||
}
|
||||
|
||||
public static ListViewItem CreateParentDirectoryItem(DirectoryRecord DirectoryRecord) => new ListViewItem(DirectoryRecord.PARENT_DIRECTORY_NAME, 2)
|
||||
{
|
||||
Name = DirectoryRecord.PARENT_DIRECTORY_NAME,
|
||||
Tag = (object) DirectoryRecord
|
||||
};
|
||||
}
|
||||
}
|
29
Explorer/DiscView/ExplorerToolTipFactory.cs
Normal file
29
Explorer/DiscView/ExplorerToolTipFactory.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: GDRomExplorer.DiscView.ExplorerToolTipFactory
|
||||
// Assembly: GD-ROM Explorer, Version=1.6.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
|
||||
// MVID: B7A7D10A-9A63-4E9E-9840-D297E5FC2219
|
||||
// Assembly location: GD-ROM Explorer.exe
|
||||
|
||||
using GDRomExplorer.Resources;
|
||||
using ImageReader.ISO9660.DirectoryRecords;
|
||||
using SEGATools.Formater;
|
||||
using System.Text;
|
||||
|
||||
namespace GDRomExplorer.DiscView
|
||||
{
|
||||
public class ExplorerToolTipFactory
|
||||
{
|
||||
public static string CreateToolTipText(DirectoryRecord directoryRecord)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (directoryRecord.IsDirectory)
|
||||
{
|
||||
stringBuilder.AppendLine(string.Format(Strings.ToolTipFileSizeWithFormat, (object) SizeFormater.ToHumanReadableSize((long) directoryRecord.UsedSpace)));
|
||||
int count1 = directoryRecord.GetAllSubFiles().Count;
|
||||
int count2 = directoryRecord.GetAllSubFolder().Count;
|
||||
stringBuilder.AppendLine(string.Format(Strings.ToolTipDirectoryContentWithFormat, (object) count1, count1 > 1 ? (object) Strings.ToolTipFiles : (object) Strings.ToolTipFile, (object) count2, count2 > 1 ? (object) Strings.ToolTipDirectories : (object) Strings.ToolTipDirectory));
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
}
|
135
Explorer/DiscView/ExplorerTreeNodeFactory.cs
Normal file
135
Explorer/DiscView/ExplorerTreeNodeFactory.cs
Normal file
|
@ -0,0 +1,135 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: GDRomExplorer.DiscView.ExplorerTreeNodeFactory
|
||||
// Assembly: GD-ROM Explorer, Version=1.6.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
|
||||
// MVID: B7A7D10A-9A63-4E9E-9840-D297E5FC2219
|
||||
// Assembly location: GD-ROM Explorer.exe
|
||||
|
||||
using ImageReader.ISO9660.DirectoryRecords;
|
||||
using SEGATools.Binary;
|
||||
using SEGATools.DiscFileSystem;
|
||||
using SEGATools.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GDRomExplorer.DiscView
|
||||
{
|
||||
public class ExplorerTreeNodeFactory
|
||||
{
|
||||
public static TreeNode CreateTree(IDiscFileSystem Disc)
|
||||
{
|
||||
TreeNode treeNode1 = ExplorerTreeNodeFactory.CreateTreeNode(Disc);
|
||||
foreach (IDiscSession session in Disc.Sessions)
|
||||
{
|
||||
TreeNode treeNode2 = ExplorerTreeNodeFactory.CreateTreeNode(session);
|
||||
treeNode1.Nodes.Add(treeNode2);
|
||||
foreach (IDiscTrack track in session.Tracks)
|
||||
{
|
||||
TreeNode treeNode3 = ExplorerTreeNodeFactory.CreateTreeNode(track);
|
||||
treeNode2.Nodes.Add(treeNode3);
|
||||
if (track == session.FirstDataTrack)
|
||||
{
|
||||
if (session.BootStrap != null)
|
||||
{
|
||||
TreeNode treeNode4 = ExplorerTreeNodeFactory.CreateTreeNode(session.BootStrap, Disc);
|
||||
treeNode3.Nodes.Add(treeNode4);
|
||||
}
|
||||
if (session.RootDirectoryRecord != null)
|
||||
{
|
||||
string identifier = session.PrimaryVolumeDescriptor.Identifier;
|
||||
TreeNode discFileSystemTree = ExplorerTreeNodeFactory.CreateDiscFileSystemTree(session.RootDirectoryRecord, identifier);
|
||||
treeNode3.Nodes.Add(discFileSystemTree);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return treeNode1;
|
||||
}
|
||||
|
||||
private static TreeNode CreateDiscFileSystemTree(
|
||||
DirectoryRecord RootDirectoryRecord,
|
||||
string RootDirectoryName)
|
||||
{
|
||||
TreeNode treeNode = ExplorerTreeNodeFactory.CreateTreeNode(RootDirectoryRecord, RootDirectoryName, 5, 5);
|
||||
ExplorerTreeNodeFactory.CreateDiscFileSystemTreeRec(treeNode);
|
||||
return treeNode;
|
||||
}
|
||||
|
||||
private static void CreateDiscFileSystemTreeRec(TreeNode ParentNode)
|
||||
{
|
||||
foreach (DirectoryRecord DirectoryRecord in (IEnumerable<DirectoryRecord>) (ParentNode.Tag as DirectoryRecord).SubDirectories.FindAll((Predicate<DirectoryRecord>) (directoryRecord => directoryRecord.IsDirectory)))
|
||||
{
|
||||
TreeNode treeNode = ExplorerTreeNodeFactory.CreateTreeNode(DirectoryRecord, 6, 7);
|
||||
ParentNode.Nodes.Add(treeNode);
|
||||
ExplorerTreeNodeFactory.CreateDiscFileSystemTreeRec(treeNode);
|
||||
}
|
||||
}
|
||||
|
||||
private static TreeNode CreateTreeNode(
|
||||
DirectoryRecord DirectoryRecord,
|
||||
int ImageIndex,
|
||||
int SelectedImageIndex)
|
||||
{
|
||||
return ExplorerTreeNodeFactory.CreateTreeNode(DirectoryRecord, DirectoryRecord.Name, ImageIndex, SelectedImageIndex);
|
||||
}
|
||||
|
||||
private static TreeNode CreateTreeNode(
|
||||
DirectoryRecord DirectoryRecord,
|
||||
string Name,
|
||||
int ImageIndex,
|
||||
int SelectedImageIndex)
|
||||
{
|
||||
return new TreeNode(Name, ImageIndex, SelectedImageIndex)
|
||||
{
|
||||
Name = Name,
|
||||
Tag = (object) DirectoryRecord,
|
||||
ToolTipText = ExplorerToolTipFactory.CreateToolTipText(DirectoryRecord)
|
||||
};
|
||||
}
|
||||
|
||||
private static TreeNode CreateTreeNode(
|
||||
InitialProgram InitialProgram,
|
||||
IDiscFileSystem Disc)
|
||||
{
|
||||
List<SEGALibrary> segaLibraries = Disc.GetSEGALibraries((object) InitialProgram);
|
||||
InitialProgramExtended initialProgramExtended = InitialProgramExtended.create(InitialProgram, segaLibraries);
|
||||
return new TreeNode(initialProgramExtended.FileName, 4, 4)
|
||||
{
|
||||
Name = initialProgramExtended.FileName,
|
||||
Tag = (object) initialProgramExtended
|
||||
};
|
||||
}
|
||||
|
||||
private static TreeNode CreateTreeNode(IDiscTrack DiscTrack)
|
||||
{
|
||||
TreeNode treeNode = new TreeNode(DiscTrack.ToString());
|
||||
switch (DiscTrack.TrackData)
|
||||
{
|
||||
case TrackModeType.Audio:
|
||||
treeNode.ImageIndex = 3;
|
||||
treeNode.ToolTipText = string.Format("CD-DA ({0})", (object) DiscTrack.Name);
|
||||
break;
|
||||
case TrackModeType.Data:
|
||||
treeNode.ImageIndex = 2;
|
||||
treeNode.ToolTipText = string.Format("Data ({0})", (object) DiscTrack.Name);
|
||||
break;
|
||||
}
|
||||
treeNode.Name = DiscTrack.Name;
|
||||
treeNode.Tag = (object) DiscTrack;
|
||||
treeNode.SelectedImageIndex = treeNode.ImageIndex;
|
||||
return treeNode;
|
||||
}
|
||||
|
||||
private static TreeNode CreateTreeNode(IDiscSession DiscSession) => new TreeNode(DiscSession.Name, 1, 1)
|
||||
{
|
||||
Name = DiscSession.Name,
|
||||
Tag = (object) DiscSession
|
||||
};
|
||||
|
||||
private static TreeNode CreateTreeNode(IDiscFileSystem Disc) => new TreeNode(Disc.DiscName, 0, 0)
|
||||
{
|
||||
Name = Disc.DiscName,
|
||||
Tag = (object) Disc
|
||||
};
|
||||
}
|
||||
}
|
23
Explorer/DiscView/IDiscViewSelection.cs
Normal file
23
Explorer/DiscView/IDiscViewSelection.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: GDRomExplorer.DiscView.IDiscViewSelection
|
||||
// Assembly: GD-ROM Explorer, Version=1.6.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
|
||||
// MVID: B7A7D10A-9A63-4E9E-9840-D297E5FC2219
|
||||
// Assembly location: GD-ROM Explorer.exe
|
||||
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GDRomExplorer.DiscView
|
||||
{
|
||||
public interface IDiscViewSelection
|
||||
{
|
||||
void HandleAfterSelect();
|
||||
|
||||
void HandleDoubleLeftClicks();
|
||||
|
||||
void HandleLeftClick();
|
||||
|
||||
void HandleRightClick();
|
||||
|
||||
void HandleMouseEvent(MouseEventArgs MouseEvent);
|
||||
}
|
||||
}
|
228
Explorer/DiscView/MenuItemFactory.cs
Normal file
228
Explorer/DiscView/MenuItemFactory.cs
Normal file
|
@ -0,0 +1,228 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: GDRomExplorer.DiscView.MenuItemFactory
|
||||
// Assembly: GD-ROM Explorer, Version=1.6.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
|
||||
// MVID: B7A7D10A-9A63-4E9E-9840-D297E5FC2219
|
||||
// Assembly location: GD-ROM Explorer.exe
|
||||
|
||||
using ImageReader.ISO9660.DirectoryRecords;
|
||||
using SEGATools.DiscFileSystem;
|
||||
using SEGATools.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GDRomExplorer.DiscView
|
||||
{
|
||||
public class MenuItemFactory
|
||||
{
|
||||
private UserActions Context;
|
||||
private ImageList ContextMenuImageList;
|
||||
|
||||
public MenuItemFactory(UserActions Context, ImageList ImageList)
|
||||
{
|
||||
this.Context = Context;
|
||||
this.ContextMenuImageList = ImageList;
|
||||
}
|
||||
|
||||
private ToolStripItem CreateMenuItem(
|
||||
string Text,
|
||||
int ImageIndex,
|
||||
EventHandler Handler)
|
||||
{
|
||||
return (ToolStripItem) new ToolStripMenuItem(Text, this.ContextMenuImageList.Images[ImageIndex], Handler);
|
||||
}
|
||||
|
||||
public ToolStripItem[] CreateDiscMenuItems(IDiscFileSystem Disc)
|
||||
{
|
||||
ToolStripItem menuItem = this.CreateMenuItem(GDRomExplorer.Resources.Strings.ContextMenuItemExportForGDEmu, 0, this.Context.GetHandler(UserActions.Action.ExportForGDEmu));
|
||||
menuItem.Enabled = Disc.CanBeExportedToGdi;
|
||||
menuItem.Tag = (object) Disc;
|
||||
return new ToolStripItem[1]{ menuItem };
|
||||
}
|
||||
|
||||
public ToolStripItem[] CreateDiscSessionMenuItems(IDiscSession Session)
|
||||
{
|
||||
ToolStripItem[] toolStripItemArray = new ToolStripItem[2]
|
||||
{
|
||||
this.CreateMenuItem(GDRomExplorer.Resources.Strings.ContextMenuItemCreateCUE, 0, this.Context.GetHandler(UserActions.Action.CreateCueSheet)),
|
||||
null
|
||||
};
|
||||
toolStripItemArray[0].Enabled = Session.Disc.CanBeExportedToCueSheet && Session.Tracks.Count > 0;
|
||||
toolStripItemArray[0].Tag = (object) Session;
|
||||
toolStripItemArray[1] = this.CreateMenuItem(GDRomExplorer.Resources.Strings.ContextMenuItemConvertGDDA, 0, this.Context.GetHandler(UserActions.Action.ShowGDDAConversion));
|
||||
toolStripItemArray[1].Enabled = Session.Disc.CanExtractData && Session.AudioTracks.Count > 0;
|
||||
toolStripItemArray[1].Tag = (object) Session;
|
||||
return toolStripItemArray;
|
||||
}
|
||||
|
||||
public ToolStripItem[] CreateDiscTrackMenuItems(IDiscTrack Track)
|
||||
{
|
||||
IList<ToolStripItem> source = (IList<ToolStripItem>) new List<ToolStripItem>();
|
||||
string fileName = Path.GetFileName(Track.Name);
|
||||
DirectoryRecord rootDirectoryRecord = Track.Session.RootDirectoryRecord;
|
||||
ToolStripItem menuItem1 = this.CreateMenuItem(string.Format(GDRomExplorer.Resources.Strings.ContextMenuItemExtract, (object) fileName), 0, this.Context.GetHandler(UserActions.Action.ExtractItem));
|
||||
menuItem1.Enabled = Track.Session.Disc.CanExtractData;
|
||||
menuItem1.Tag = (object) Track;
|
||||
source.Add(menuItem1);
|
||||
if (Track.TrackData == TrackModeType.Data && Track == Track.Session.FirstDataTrack)
|
||||
{
|
||||
ToolStripItem menuItem2 = this.CreateMenuItem(GDRomExplorer.Resources.Strings.ContextMenuItemGenerateSortFile, 1, this.Context.GetHandler(UserActions.Action.CreateSortFile));
|
||||
menuItem2.Tag = (object) Track.Session;
|
||||
source.Add(menuItem2);
|
||||
ToolStripItem menuItem3 = this.CreateMenuItem(GDRomExplorer.Resources.Strings.ContextMenuItemViewPvd, 3, this.Context.GetHandler(UserActions.Action.ShowPrimaryVolumeDescriptor));
|
||||
menuItem3.Tag = (object) Track;
|
||||
source.Add(menuItem3);
|
||||
}
|
||||
else if (Track.TrackData == TrackModeType.Audio)
|
||||
{
|
||||
ToolStripItem menuItem2 = this.CreateMenuItem(string.Format(GDRomExplorer.Resources.Strings.ContextMenuItemConvertAudio, (object) fileName), 0, this.Context.GetHandler(UserActions.Action.ConvertGDDA));
|
||||
menuItem2.Enabled = Track.Session.Disc.CanExtractData;
|
||||
menuItem2.Tag = (object) Track;
|
||||
source.Add(menuItem2);
|
||||
}
|
||||
return source.ToArray<ToolStripItem>();
|
||||
}
|
||||
|
||||
public ToolStripItem[] CreateInitialProgramMenuItems(
|
||||
InitialProgramExtended InitialProgramFile)
|
||||
{
|
||||
List<ToolStripItem> toolStripItemList = new List<ToolStripItem>();
|
||||
ToolStripItem menuItem1 = this.CreateMenuItem(GDRomExplorer.Resources.Strings.ContextMenuItemViewIP, 2, this.Context.GetHandler(UserActions.Action.ShowBootSector));
|
||||
menuItem1.Tag = (object) InitialProgramFile;
|
||||
toolStripItemList.Add(menuItem1);
|
||||
ToolStripItem menuItem2 = this.CreateMenuItem(string.Format(GDRomExplorer.Resources.Strings.ContextMenuItemExtractIP, (object) InitialProgramFile.FileName), 0, this.Context.GetHandler(UserActions.Action.ExtractBootSector));
|
||||
menuItem2.Tag = (object) InitialProgramFile;
|
||||
toolStripItemList.Add(menuItem2);
|
||||
return toolStripItemList.ToArray();
|
||||
}
|
||||
|
||||
public ToolStripItem[] CreateFileExtractMenuItems(
|
||||
string ItemLabel,
|
||||
object Tag,
|
||||
bool SupportDecryption)
|
||||
{
|
||||
string.Format(GDRomExplorer.Resources.Strings.ContextMenuItemExtract, (object) ItemLabel);
|
||||
string.Format(GDRomExplorer.Resources.Strings.ContextMenuItemDecryptAndExtract, (object) ItemLabel);
|
||||
return this.CreateFileMenuItems(string.Format(GDRomExplorer.Resources.Strings.ContextMenuItemExtract, (object) ItemLabel), string.Format(GDRomExplorer.Resources.Strings.ContextMenuItemDecryptAndExtract, (object) ItemLabel), Tag, SupportDecryption);
|
||||
}
|
||||
|
||||
public ToolStripItem[] CreateFileExtractContentMenuItems(
|
||||
string ItemLabel,
|
||||
object Tag)
|
||||
{
|
||||
return this.CreateFileMenuItems(string.Format(GDRomExplorer.Resources.Strings.ContextMenuItemExtractContent, (object) ItemLabel), string.Format(GDRomExplorer.Resources.Strings.ContextMenuItemDecryptAndExtract, (object) ItemLabel), Tag, false);
|
||||
}
|
||||
|
||||
private ToolStripItem[] CreateFileMenuItems(
|
||||
string ExtractText,
|
||||
string DecryptExtractText,
|
||||
object Tag,
|
||||
bool SupportDecryption)
|
||||
{
|
||||
List<ToolStripItem> toolStripItemList = new List<ToolStripItem>();
|
||||
if (SupportDecryption)
|
||||
{
|
||||
ToolStripItem menuItem = this.CreateMenuItem(DecryptExtractText, 0, this.Context.GetHandler(UserActions.Action.DecryptNaomiBinary));
|
||||
menuItem.Tag = Tag;
|
||||
toolStripItemList.Add(menuItem);
|
||||
}
|
||||
ToolStripItem menuItem1 = this.CreateMenuItem(ExtractText, 0, this.Context.GetHandler(UserActions.Action.ExtractItem));
|
||||
menuItem1.Tag = Tag;
|
||||
toolStripItemList.Add(menuItem1);
|
||||
return toolStripItemList.ToArray();
|
||||
}
|
||||
|
||||
public ToolStripItem[] CreateDiscWithSessionTopMenuItem(IDiscFileSystem Disc)
|
||||
{
|
||||
List<ToolStripItem> toolStripItemList = new List<ToolStripItem>();
|
||||
toolStripItemList.AddRange((IEnumerable<ToolStripItem>) this.CreateDiscMenuItems(Disc));
|
||||
toolStripItemList.Add((ToolStripItem) new ToolStripSeparator());
|
||||
foreach (IDiscSession session in Disc.Sessions)
|
||||
{
|
||||
ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem(session.Name);
|
||||
toolStripMenuItem.DropDownItems.AddRange(this.CreateDiscSessionMenuItems(session));
|
||||
toolStripItemList.Add((ToolStripItem) toolStripMenuItem);
|
||||
}
|
||||
return toolStripItemList.ToArray();
|
||||
}
|
||||
|
||||
public ToolStripMenuItem CreateSelectionTopMenuItemForListView(
|
||||
ToolStripItem[] MenuItems)
|
||||
{
|
||||
ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem(GDRomExplorer.Resources.Strings.EditSelectionMenuItemName);
|
||||
toolStripMenuItem.DropDownItems.AddRange(MenuItems);
|
||||
toolStripMenuItem.Enabled = toolStripMenuItem.DropDownItems.Count > 0;
|
||||
return toolStripMenuItem;
|
||||
}
|
||||
|
||||
public ToolStripItem[] CreateSelectionMenuItemsForListView(
|
||||
object NewSelection,
|
||||
IDiscFileSystem Disc)
|
||||
{
|
||||
ToolStripItem[] toolStripItemArray = new ToolStripItem[0];
|
||||
List<DirectoryRecord> directoryRecordList = NewSelection is List<DirectoryRecord> ? NewSelection as List<DirectoryRecord> : throw new NotSupportedException();
|
||||
if (directoryRecordList.Count != 1)
|
||||
return this.CreateFileExtractMenuItems(GDRomExplorer.Resources.Strings.MsgBoxToolStripMenuSelectedFiles, NewSelection, false);
|
||||
DirectoryRecord directoryRecord = directoryRecordList[0];
|
||||
string ItemLabel = directoryRecord == Disc.MainBinary ? string.Format(GDRomExplorer.Resources.Strings.ToolTipMainBinaryWithFormat, (object) directoryRecord.Name) : directoryRecord.Name;
|
||||
bool SupportDecryption = Disc.DiscType == DiscImageType.Naomi && directoryRecord == Disc.MainBinary;
|
||||
return this.CreateFileExtractMenuItems(ItemLabel, NewSelection, SupportDecryption);
|
||||
}
|
||||
|
||||
public ToolStripItem[] CreateSelectionDisabledTopMenuItem() => new ToolStripItem[0];
|
||||
|
||||
public static ToolStripMenuItem CreateEditSelectionTopMenuItem(
|
||||
ToolStripItem[] MenuItems)
|
||||
{
|
||||
ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem(GDRomExplorer.Resources.Strings.EditSelectionMenuItemName);
|
||||
if (MenuItems != null && MenuItems.Length > 0)
|
||||
toolStripMenuItem.DropDownItems.AddRange(MenuItems);
|
||||
toolStripMenuItem.Enabled = MenuItems != null && MenuItems.Length > 0;
|
||||
return toolStripMenuItem;
|
||||
}
|
||||
|
||||
public static ToolStripMenuItem CreateEditDiscTopMenuItem(
|
||||
ToolStripItem[] MenuItems)
|
||||
{
|
||||
ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem(GDRomExplorer.Resources.Strings.EditDiscMenuItemName);
|
||||
toolStripMenuItem.DropDownItems.AddRange(MenuItems);
|
||||
toolStripMenuItem.Enabled = MenuItems != null && MenuItems.Length > 0;
|
||||
return toolStripMenuItem;
|
||||
}
|
||||
|
||||
public static ToolStripItem[] CreateEditMenuItems(
|
||||
ToolStripItem[] DiscMenuItems,
|
||||
ToolStripItem[] SelectionMenuItems)
|
||||
{
|
||||
return new ToolStripItem[3]
|
||||
{
|
||||
(ToolStripItem) MenuItemFactory.CreateEditSelectionTopMenuItem(SelectionMenuItems),
|
||||
(ToolStripItem) new ToolStripSeparator(),
|
||||
(ToolStripItem) MenuItemFactory.CreateEditDiscTopMenuItem(DiscMenuItems)
|
||||
};
|
||||
}
|
||||
|
||||
public ToolStripItem[] CreateSelectionMenuItemsForTreeView(object NewSelection)
|
||||
{
|
||||
ToolStripItem[] toolStripItemArray = new ToolStripItem[0];
|
||||
switch (NewSelection)
|
||||
{
|
||||
case IDiscFileSystem _:
|
||||
return this.CreateDiscMenuItems(NewSelection as IDiscFileSystem);
|
||||
case IDiscSession _:
|
||||
return this.CreateDiscSessionMenuItems(NewSelection as IDiscSession);
|
||||
case IDiscTrack _:
|
||||
return this.CreateDiscTrackMenuItems(NewSelection as IDiscTrack);
|
||||
case InitialProgramExtended _:
|
||||
return this.CreateInitialProgramMenuItems(NewSelection as InitialProgramExtended);
|
||||
case DirectoryRecord _:
|
||||
DirectoryRecord directoryRecord = NewSelection as DirectoryRecord;
|
||||
return this.CreateFileExtractContentMenuItems(directoryRecord.Name, (object) directoryRecord.SubDirectories);
|
||||
default:
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
34
Explorer/DiscView/UserActions.cs
Normal file
34
Explorer/DiscView/UserActions.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Decompiled with JetBrains decompiler
|
||||
// Type: GDRomExplorer.DiscView.UserActions
|
||||
// Assembly: GD-ROM Explorer, Version=1.6.3.0, Culture=neutral, PublicKeyToken=611be24fdeb07e08
|
||||
// MVID: B7A7D10A-9A63-4E9E-9840-D297E5FC2219
|
||||
// Assembly location: GD-ROM Explorer.exe
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GDRomExplorer.DiscView
|
||||
{
|
||||
public class UserActions
|
||||
{
|
||||
private Dictionary<UserActions.Action, EventHandler> EventHandlers = new Dictionary<UserActions.Action, EventHandler>();
|
||||
|
||||
public void SetHandler(UserActions.Action Action, EventHandler Handler) => this.EventHandlers.Add(Action, Handler);
|
||||
|
||||
public EventHandler GetHandler(UserActions.Action Action) => this.EventHandlers.ContainsKey(Action) ? this.EventHandlers[Action] : throw new NotSupportedException("Action not supported");
|
||||
|
||||
public enum Action
|
||||
{
|
||||
ExportForGDEmu,
|
||||
CreateCueSheet,
|
||||
ShowGDDAConversion,
|
||||
ShowBootSector,
|
||||
ExtractBootSector,
|
||||
ExtractItem,
|
||||
CreateSortFile,
|
||||
ShowPrimaryVolumeDescriptor,
|
||||
ConvertGDDA,
|
||||
DecryptNaomiBinary,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue