Skip to content

Commit ebf32a2

Browse files
committed
增加默认参数,文件可以用AssetStudio打开
1 parent b025077 commit ebf32a2

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

AssetStudioGUI/AssetStudioGUIForm.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ partial class AssetStudioGUIForm : Form
8383
[DllImport("gdi32.dll")]
8484
private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [In] ref uint pcFonts);
8585

86-
public AssetStudioGUIForm()
86+
public AssetStudioGUIForm(string[] args)
8787
{
8888
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
8989
InitializeComponent();
@@ -98,6 +98,11 @@ public AssetStudioGUIForm()
9898
Logger.Default = new GUILogger(StatusStripUpdate);
9999
Progress.Default = new GUIProgress(SetProgressBarValue);
100100
Studio.StatusStripUpdate = StatusStripUpdate;
101+
102+
if (args != null && args.Length > 0)
103+
{
104+
LoadFile(args[0]);
105+
}
101106
}
102107

103108
private async void loadFile_Click(object sender, EventArgs e)
@@ -121,6 +126,15 @@ private async void loadFolder_Click(object sender, EventArgs e)
121126
}
122127
}
123128

129+
private async void LoadFile(string filepath)
130+
{
131+
if (!File.Exists(filepath))
132+
return;
133+
ResetForm();
134+
await Task.Run(() => assetsManager.LoadFiles(filepath));
135+
BuildAssetStructures();
136+
}
137+
124138
private void extractFileToolStripMenuItem_Click(object sender, EventArgs e)
125139
{
126140
if (openFileDialog1.ShowDialog() == DialogResult.OK)

AssetStudioGUI/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
@@ -12,11 +12,11 @@ static class Program
1212
/// 应用程序的主入口点。
1313
/// </summary>
1414
[STAThread]
15-
static void Main()
15+
static void Main(string[] args)
1616
{
1717
Application.EnableVisualStyles();
1818
Application.SetCompatibleTextRenderingDefault(false);
19-
Application.Run(new AssetStudioGUIForm());
19+
Application.Run(new AssetStudioGUIForm(args));
2020
}
2121
}
2222
}

0 commit comments

Comments
 (0)