mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-27 22:00:23 -04:00
add OpenFolderDialog
This commit is contained in:
parent
96b8732d91
commit
2a7d40616d
237
Unity Studio/OpenFolderDialog.cs
Normal file
237
Unity Studio/OpenFolderDialog.cs
Normal file
@ -0,0 +1,237 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Unity_Studio
|
||||||
|
{
|
||||||
|
class OpenFolderDialog
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets/sets folder in which dialog will be open.
|
||||||
|
/// </summary>
|
||||||
|
public string InitialFolder { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets/sets directory in which dialog will be open if there is no recent directory available.
|
||||||
|
/// </summary>
|
||||||
|
public string DefaultFolder { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets selected folder.
|
||||||
|
/// </summary>
|
||||||
|
public string Folder { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
|
internal DialogResult ShowDialog(IWin32Window owner)
|
||||||
|
{
|
||||||
|
if (Environment.OSVersion.Version.Major >= 6)
|
||||||
|
{
|
||||||
|
return ShowVistaDialog(owner);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ShowLegacyDialog(owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private DialogResult ShowVistaDialog(IWin32Window owner)
|
||||||
|
{
|
||||||
|
var frm = (NativeMethods.IFileDialog)(new NativeMethods.FileOpenDialogRCW());
|
||||||
|
uint options;
|
||||||
|
frm.GetOptions(out options);
|
||||||
|
options |= NativeMethods.FOS_PICKFOLDERS | NativeMethods.FOS_FORCEFILESYSTEM | NativeMethods.FOS_NOVALIDATE | NativeMethods.FOS_NOTESTFILECREATE | NativeMethods.FOS_DONTADDTORECENT;
|
||||||
|
frm.SetOptions(options);
|
||||||
|
if (this.InitialFolder != null)
|
||||||
|
{
|
||||||
|
NativeMethods.IShellItem directoryShellItem;
|
||||||
|
var riid = new Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE"); //IShellItem
|
||||||
|
if (NativeMethods.SHCreateItemFromParsingName(this.InitialFolder, IntPtr.Zero, ref riid, out directoryShellItem) == NativeMethods.S_OK)
|
||||||
|
{
|
||||||
|
frm.SetFolder(directoryShellItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.DefaultFolder != null)
|
||||||
|
{
|
||||||
|
NativeMethods.IShellItem directoryShellItem;
|
||||||
|
var riid = new Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE"); //IShellItem
|
||||||
|
if (NativeMethods.SHCreateItemFromParsingName(this.DefaultFolder, IntPtr.Zero, ref riid, out directoryShellItem) == NativeMethods.S_OK)
|
||||||
|
{
|
||||||
|
frm.SetDefaultFolder(directoryShellItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (frm.Show(owner.Handle) == NativeMethods.S_OK)
|
||||||
|
{
|
||||||
|
NativeMethods.IShellItem shellItem;
|
||||||
|
if (frm.GetResult(out shellItem) == NativeMethods.S_OK)
|
||||||
|
{
|
||||||
|
IntPtr pszString;
|
||||||
|
if (shellItem.GetDisplayName(NativeMethods.SIGDN_FILESYSPATH, out pszString) == NativeMethods.S_OK)
|
||||||
|
{
|
||||||
|
if (pszString != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.Folder = Marshal.PtrToStringAuto(pszString);
|
||||||
|
return DialogResult.OK;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Marshal.FreeCoTaskMem(pszString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DialogResult.Cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DialogResult ShowLegacyDialog(IWin32Window owner)
|
||||||
|
{
|
||||||
|
using (var frm = new FolderBrowserDialog())
|
||||||
|
{
|
||||||
|
if (this.InitialFolder != null) { frm.SelectedPath = this.InitialFolder; }
|
||||||
|
if (frm.ShowDialog(owner) == DialogResult.OK)
|
||||||
|
{
|
||||||
|
this.Folder = Path.GetDirectoryName(frm.SelectedPath);
|
||||||
|
return DialogResult.OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return DialogResult.Cancel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static class NativeMethods
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Constants
|
||||||
|
|
||||||
|
public const uint FOS_PICKFOLDERS = 0x00000020;
|
||||||
|
public const uint FOS_FORCEFILESYSTEM = 0x00000040;
|
||||||
|
public const uint FOS_NOVALIDATE = 0x00000100;
|
||||||
|
public const uint FOS_NOTESTFILECREATE = 0x00010000;
|
||||||
|
public const uint FOS_DONTADDTORECENT = 0x02000000;
|
||||||
|
|
||||||
|
public const uint S_OK = 0x0000;
|
||||||
|
|
||||||
|
public const uint SIGDN_FILESYSPATH = 0x80058000;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region COM
|
||||||
|
|
||||||
|
[ComImport, ClassInterface(ClassInterfaceType.None), TypeLibType(TypeLibTypeFlags.FCanCreate), Guid("DC1C5A9C-E88A-4DDE-A5A1-60F82A20AEF7")]
|
||||||
|
internal class FileOpenDialogRCW { }
|
||||||
|
|
||||||
|
|
||||||
|
[ComImport(), Guid("42F85136-DB7E-439C-85F1-E4075D135FC8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||||
|
internal interface IFileDialog
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
[PreserveSig()]
|
||||||
|
uint Show([In, Optional] IntPtr hwndOwner); //IModalWindow
|
||||||
|
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetFileTypes([In] uint cFileTypes, [In, MarshalAs(UnmanagedType.LPArray)] IntPtr rgFilterSpec);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetFileTypeIndex([In] uint iFileType);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetFileTypeIndex(out uint piFileType);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint Advise([In, MarshalAs(UnmanagedType.Interface)] IntPtr pfde, out uint pdwCookie);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint Unadvise([In] uint dwCookie);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetOptions([In] uint fos);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetOptions(out uint fos);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
void SetDefaultFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetFolder([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetCurrentSelection([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetFileName([In, MarshalAs(UnmanagedType.LPWStr)] string pszName);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetFileName([MarshalAs(UnmanagedType.LPWStr)] out string pszName);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetOkButtonLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszText);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetFileNameLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetResult([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint AddPlace([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, uint fdap);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetDefaultExtension([In, MarshalAs(UnmanagedType.LPWStr)] string pszDefaultExtension);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint Close([MarshalAs(UnmanagedType.Error)] uint hr);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetClientGuid([In] ref Guid guid);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint ClearClientData();
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetFilter([MarshalAs(UnmanagedType.Interface)] IntPtr pFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[ComImport, Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||||
|
internal interface IShellItem
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint BindToHandler([In] IntPtr pbc, [In] ref Guid rbhid, [In] ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out IntPtr ppvOut);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetParent([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetDisplayName([In] uint sigdnName, out IntPtr ppszName);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetAttributes([In] uint sfgaoMask, out uint psfgaoAttribs);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint Compare([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, [In] uint hint, out int piOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
[DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||||
|
internal static extern int SHCreateItemFromParsingName([MarshalAs(UnmanagedType.LPWStr)] string pszPath, IntPtr pbc, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out IShellItem ppv);
|
||||||
|
}
|
||||||
|
}
|
@ -130,6 +130,7 @@
|
|||||||
<Compile Include="7zip\SevenZipHelper.cs">
|
<Compile Include="7zip\SevenZipHelper.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="OpenFolderDialog.cs" />
|
||||||
<Compile Include="Resource1.Designer.cs">
|
<Compile Include="Resource1.Designer.cs">
|
||||||
<DependentUpon>Resource1.resx</DependentUpon>
|
<DependentUpon>Resource1.resx</DependentUpon>
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
|
@ -130,6 +130,7 @@
|
|||||||
<Compile Include="7zip\SevenZipHelper.cs">
|
<Compile Include="7zip\SevenZipHelper.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="OpenFolderDialog.cs" />
|
||||||
<Compile Include="Resource1.Designer.cs">
|
<Compile Include="Resource1.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
|
23
Unity Studio/UnityStudioForm.Designer.cs
generated
23
Unity Studio/UnityStudioForm.Designer.cs
generated
@ -99,9 +99,7 @@
|
|||||||
this.timer = new System.Windows.Forms.Timer(this.components);
|
this.timer = new System.Windows.Forms.Timer(this.components);
|
||||||
this.timerOpenTK = new System.Windows.Forms.Timer(this.components);
|
this.timerOpenTK = new System.Windows.Forms.Timer(this.components);
|
||||||
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
||||||
this.openFolderDialog1 = new System.Windows.Forms.OpenFileDialog();
|
|
||||||
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
||||||
this.saveFolderDialog1 = new System.Windows.Forms.SaveFileDialog();
|
|
||||||
this.treeTip = new System.Windows.Forms.ToolTip(this.components);
|
this.treeTip = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
this.showOriginalFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.showOriginalFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
@ -818,28 +816,11 @@
|
|||||||
this.openFileDialog1.Multiselect = true;
|
this.openFileDialog1.Multiselect = true;
|
||||||
this.openFileDialog1.RestoreDirectory = true;
|
this.openFileDialog1.RestoreDirectory = true;
|
||||||
//
|
//
|
||||||
// openFolderDialog1
|
|
||||||
//
|
|
||||||
this.openFolderDialog1.AddExtension = false;
|
|
||||||
this.openFolderDialog1.CheckFileExists = false;
|
|
||||||
this.openFolderDialog1.FileName = "Select folder";
|
|
||||||
this.openFolderDialog1.Filter = "Folders|*.";
|
|
||||||
this.openFolderDialog1.RestoreDirectory = true;
|
|
||||||
this.openFolderDialog1.Title = "Browse for folder";
|
|
||||||
//
|
|
||||||
// saveFileDialog1
|
// saveFileDialog1
|
||||||
//
|
//
|
||||||
this.saveFileDialog1.Filter = "FBX file|*.fbx|Collada|*.dae";
|
this.saveFileDialog1.Filter = "FBX file|*.fbx";
|
||||||
this.saveFileDialog1.RestoreDirectory = true;
|
this.saveFileDialog1.RestoreDirectory = true;
|
||||||
//
|
//
|
||||||
// saveFolderDialog1
|
|
||||||
//
|
|
||||||
this.saveFolderDialog1.AddExtension = false;
|
|
||||||
this.saveFolderDialog1.FileName = "Select folder or write folder name to create";
|
|
||||||
this.saveFolderDialog1.Filter = "Folders|*.";
|
|
||||||
this.saveFolderDialog1.RestoreDirectory = true;
|
|
||||||
this.saveFolderDialog1.Title = "Browse for folder";
|
|
||||||
//
|
|
||||||
// contextMenuStrip1
|
// contextMenuStrip1
|
||||||
//
|
//
|
||||||
this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||||
@ -953,9 +934,7 @@
|
|||||||
private System.Windows.Forms.ToolStripMenuItem exportAll3DMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem exportAll3DMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem exportSelected3DMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem exportSelected3DMenuItem;
|
||||||
private System.Windows.Forms.OpenFileDialog openFileDialog1;
|
private System.Windows.Forms.OpenFileDialog openFileDialog1;
|
||||||
private System.Windows.Forms.OpenFileDialog openFolderDialog1;
|
|
||||||
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
|
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
|
||||||
private System.Windows.Forms.SaveFileDialog saveFolderDialog1;
|
|
||||||
private System.Windows.Forms.ToolStripComboBox assetGroupOptions;
|
private System.Windows.Forms.ToolStripComboBox assetGroupOptions;
|
||||||
private System.Windows.Forms.ToolStripMenuItem openAfterExport;
|
private System.Windows.Forms.ToolStripMenuItem openAfterExport;
|
||||||
private System.Windows.Forms.ToolStripMenuItem showExpOpt;
|
private System.Windows.Forms.ToolStripMenuItem showExpOpt;
|
||||||
|
@ -127,22 +127,10 @@ namespace Unity_Studio
|
|||||||
|
|
||||||
private void loadFolder_Click(object sender, EventArgs e)
|
private void loadFolder_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
/*FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
|
var openFolderDialog1 = new OpenFolderDialog();
|
||||||
|
if (openFolderDialog1.ShowDialog(this) == DialogResult.OK)
|
||||||
folderBrowserDialog1.Description = "Load all Unity assets from folder and subfolders";
|
|
||||||
folderBrowserDialog1.ShowNewFolderButton = false;
|
|
||||||
//folderBrowserDialog1.SelectedPath = "E:\\Assets\\Unity";
|
|
||||||
folderBrowserDialog1.SelectedPath = "E:\\Assets\\Unity\\WebPlayer\\Porsche\\92AAF1\\defaultGeometry";*/
|
|
||||||
|
|
||||||
if (openFolderDialog1.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
//mainPath = folderBrowserDialog1.SelectedPath;
|
|
||||||
mainPath = openFolderDialog1.FileName;
|
|
||||||
if (Path.GetFileName(mainPath) == "Select folder")
|
|
||||||
{ mainPath = Path.GetDirectoryName(mainPath); }
|
|
||||||
|
|
||||||
if (Directory.Exists(mainPath))
|
|
||||||
{
|
{
|
||||||
|
mainPath = openFolderDialog1.Folder;
|
||||||
resetForm();
|
resetForm();
|
||||||
|
|
||||||
//TODO find a way to read data directly instead of merging files
|
//TODO find a way to read data directly instead of merging files
|
||||||
@ -204,8 +192,6 @@ namespace Unity_Studio
|
|||||||
BuildAssetStrucutres();
|
BuildAssetStrucutres();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else { StatusStripUpdate("Selected path deos not exist."); }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void extractBundleToolStripMenuItem_Click(object sender, EventArgs e)
|
private void extractBundleToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
@ -238,16 +224,10 @@ namespace Unity_Studio
|
|||||||
int extractedCount = 0;
|
int extractedCount = 0;
|
||||||
List<string> bundleFiles = new List<string>();
|
List<string> bundleFiles = new List<string>();
|
||||||
|
|
||||||
/*FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
|
var openFolderDialog1 = new OpenFolderDialog();
|
||||||
folderBrowserDialog1.Description = "Extract all Unity bundles from folder and subfolders";
|
if (openFolderDialog1.ShowDialog(this) == DialogResult.OK)
|
||||||
folderBrowserDialog1.ShowNewFolderButton = false;*/
|
|
||||||
|
|
||||||
if (openFolderDialog1.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
{
|
||||||
string startPath = openFolderDialog1.FileName;
|
string startPath = openFolderDialog1.Folder;
|
||||||
if (Path.GetFileName(startPath) == "Select folder")
|
|
||||||
{ startPath = Path.GetDirectoryName(startPath); }
|
|
||||||
|
|
||||||
string[] fileTypes = new string[6] { "*.unity3d", "*.unity3d.lz4", "*.assetbundle", "*.assetbundle-*", "*.bundle", "*.bytes" };
|
string[] fileTypes = new string[6] { "*.unity3d", "*.unity3d.lz4", "*.assetbundle", "*.assetbundle-*", "*.bundle", "*.bytes" };
|
||||||
foreach (var fileType in fileTypes)
|
foreach (var fileType in fileTypes)
|
||||||
{
|
{
|
||||||
@ -317,7 +297,6 @@ namespace Unity_Studio
|
|||||||
}
|
}
|
||||||
StatusStripUpdate("Finished loading " + assetsfileList.Count + " files with " + (assetListView.Items.Count + sceneTreeView.Nodes.Count) + " exportable assets.");
|
StatusStripUpdate("Finished loading " + assetsfileList.Count + " files with " + (assetListView.Items.Count + sceneTreeView.Nodes.Count) + " exportable assets.");
|
||||||
treeSearch.Select();
|
treeSearch.Select();
|
||||||
saveFolderDialog1.InitialDirectory = mainPath;
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,15 +424,13 @@ namespace Unity_Studio
|
|||||||
{
|
{
|
||||||
if (AllClassStructures.Count > 0)
|
if (AllClassStructures.Count > 0)
|
||||||
{
|
{
|
||||||
if (saveFolderDialog1.ShowDialog() == DialogResult.OK)
|
var saveFolderDialog1 = new OpenFolderDialog();
|
||||||
|
if (saveFolderDialog1.ShowDialog(this) == DialogResult.OK)
|
||||||
{
|
{
|
||||||
progressBar1.Value = 0;
|
progressBar1.Value = 0;
|
||||||
progressBar1.Maximum = AllClassStructures.Count;
|
progressBar1.Maximum = AllClassStructures.Count;
|
||||||
|
|
||||||
var savePath = saveFolderDialog1.FileName;
|
var savePath = saveFolderDialog1.Folder;
|
||||||
if (Path.GetFileName(savePath) == "Select folder or write folder name to create")
|
|
||||||
{ savePath = Path.GetDirectoryName(saveFolderDialog1.FileName); }
|
|
||||||
|
|
||||||
foreach (var version in AllClassStructures)
|
foreach (var version in AllClassStructures)
|
||||||
{
|
{
|
||||||
if (version.Value.Count > 0)
|
if (version.Value.Count > 0)
|
||||||
@ -1444,11 +1421,10 @@ namespace Unity_Studio
|
|||||||
{
|
{
|
||||||
if (sceneTreeView.Nodes.Count > 0)
|
if (sceneTreeView.Nodes.Count > 0)
|
||||||
{
|
{
|
||||||
if (saveFolderDialog1.ShowDialog() == DialogResult.OK)
|
var saveFolderDialog1 = new OpenFolderDialog();
|
||||||
|
if (saveFolderDialog1.ShowDialog(this) == DialogResult.OK)
|
||||||
{
|
{
|
||||||
var savePath = saveFolderDialog1.FileName;
|
var savePath = saveFolderDialog1.Folder;
|
||||||
if (Path.GetFileName(savePath) == "Select folder or write folder name to create")
|
|
||||||
{ savePath = Path.GetDirectoryName(saveFolderDialog1.FileName); }
|
|
||||||
savePath = savePath + "\\";
|
savePath = savePath + "\\";
|
||||||
switch ((bool)Properties.Settings.Default["showExpOpt"])
|
switch ((bool)Properties.Settings.Default["showExpOpt"])
|
||||||
{
|
{
|
||||||
@ -1547,7 +1523,8 @@ namespace Unity_Studio
|
|||||||
|
|
||||||
private void ExportAssets_Click(object sender, EventArgs e)
|
private void ExportAssets_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (exportableAssets.Count > 0 && saveFolderDialog1.ShowDialog() == DialogResult.OK)
|
var saveFolderDialog1 = new OpenFolderDialog();
|
||||||
|
if (exportableAssets.Count > 0 && saveFolderDialog1.ShowDialog(this) == DialogResult.OK)
|
||||||
{
|
{
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
List<AssetPreloadData> toExportAssets = null;
|
List<AssetPreloadData> toExportAssets = null;
|
||||||
@ -1572,9 +1549,7 @@ namespace Unity_Studio
|
|||||||
ThreadPool.QueueUserWorkItem(delegate
|
ThreadPool.QueueUserWorkItem(delegate
|
||||||
{
|
{
|
||||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
|
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
|
||||||
var savePath = saveFolderDialog1.FileName;
|
var savePath = saveFolderDialog1.Folder;
|
||||||
if (Path.GetFileName(savePath) == "Select folder or write folder name to create")
|
|
||||||
{ savePath = Path.GetDirectoryName(saveFolderDialog1.FileName); }
|
|
||||||
|
|
||||||
int toExport = toExportAssets.Count;
|
int toExport = toExportAssets.Count;
|
||||||
int exportedCount = 0;
|
int exportedCount = 0;
|
||||||
|
@ -117,10 +117,9 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<data name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
<value>312, 17</value>
|
||||||
<value>325, 17</value>
|
</metadata>
|
||||||
</data>
|
|
||||||
<data name="fontPreviewBox.Text" xml:space="preserve">
|
<data name="fontPreviewBox.Text" xml:space="preserve">
|
||||||
<value>abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWYZ
|
<value>abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWYZ
|
||||||
1234567890.:,;'\"(!?)+-*/=
|
1234567890.:,;'\"(!?)+-*/=
|
||||||
@ -139,32 +138,31 @@ The quick brown fox jumps over the lazy dog. 1234567890
|
|||||||
|
|
||||||
The quick brown fox jumps over the lazy dog. 1234567890</value>
|
The quick brown fox jumps over the lazy dog. 1234567890</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>440, 17</value>
|
<value>432, 17</value>
|
||||||
</data>
|
</metadata>
|
||||||
<data name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
<metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>556, 17</value>
|
<value>553, 17</value>
|
||||||
</data>
|
</metadata>
|
||||||
<data name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
<metadata name="timerOpenTK.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>636, 17</value>
|
<value>636, 17</value>
|
||||||
</data>
|
</metadata>
|
||||||
<data name="openFileDialog1.Filter" xml:space="preserve">
|
<data name="openFileDialog1.Filter" xml:space="preserve">
|
||||||
<value>Unity asset files|*.*|Unity bundle files|*.*|Unity asset files|level*; globalgamemanagers; mainData; CustomAssetBundle-*; CAB-*; BuildPlayer-*; *.assets; *.sharedAssets|Unity bundle files|*.unity3d; *.unity3d.lz4; *.assetbundle; *.bundle; *.bytes</value>
|
<value>Unity asset files|*.*|Unity bundle files|*.*|Unity asset files|level*; globalgamemanagers; mainData; CustomAssetBundle-*; CAB-*; BuildPlayer-*; *.assets; *.sharedAssets|Unity bundle files|*.unity3d; *.unity3d.lz4; *.assetbundle; *.bundle; *.bytes</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="openFolderDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>169, 17</value>
|
<value>784, 17</value>
|
||||||
</data>
|
</metadata>
|
||||||
<data name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
<metadata name="treeTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>776, 17</value>
|
<value>928, 17</value>
|
||||||
</data>
|
</metadata>
|
||||||
<data name="saveFolderDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>147, 17</value>
|
||||||
</data>
|
</metadata>
|
||||||
<data name="treeTip.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>912, 17</value>
|
|
||||||
</data>
|
|
||||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="$this.TrayHeight" type="System.Int32, mscorlib">
|
|
||||||
<value>67</value>
|
<value>67</value>
|
||||||
</data>
|
</metadata>
|
||||||
</root>
|
</root>
|
Loading…
Reference in New Issue
Block a user