Skip to content
This repository has been archived by the owner on Jan 21, 2023. It is now read-only.

fix a bug and add multiple language for some menu #921

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions AssetStudioGUI/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="language" value="en-US"/>
</appSettings>
</configuration>
10 changes: 10 additions & 0 deletions AssetStudioGUI/AssetStudioGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.Configuration" />
</ItemGroup>

<ItemGroup>
<None Update="App.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<Target Name="CopyExtraFiles" AfterTargets="AfterBuild">
<Copy SourceFiles="$(SolutionDir)AssetStudioFBXNative\bin\Win32\$(Configuration)\AssetStudioFBXNative.dll" DestinationFolder="$(TargetDir)x86" ContinueOnError="true" />
<Copy SourceFiles="$(SolutionDir)AssetStudioFBXNative\bin\x64\$(Configuration)\AssetStudioFBXNative.dll" DestinationFolder="$(TargetDir)x64" ContinueOnError="true" />
Expand Down
1,306 changes: 567 additions & 739 deletions AssetStudioGUI/AssetStudioGUIForm.Designer.cs

Large diffs are not rendered by default.

41 changes: 40 additions & 1 deletion AssetStudioGUI/AssetStudioGUIForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Drawing;
using System.Drawing.Text;
using System.Globalization;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -42,6 +43,7 @@ partial class AssetStudioGUIForm : Form
private FMOD.MODE loopMode = FMOD.MODE.LOOP_OFF;
private uint FMODlenms;
private float FMODVolume = 0.8f;


#region TexControl
private static char[] textureChannelNames = new[] { 'B', 'G', 'R', 'A' };
Expand Down Expand Up @@ -90,12 +92,16 @@ partial class AssetStudioGUIForm : Form

private GUILogger logger;

private System.Configuration.Configuration cfg=ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

[DllImport("gdi32.dll")]
private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [In] ref uint pcFonts);

public AssetStudioGUIForm()
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
string language = cfg.AppSettings.Settings["language"].Value;
Thread.CurrentThread.CurrentCulture = new CultureInfo(language);
Thread.CurrentThread.CurrentUICulture= new CultureInfo(language);
InitializeComponent();
Text = $"AssetStudioGUI v{Application.ProductVersion}";
delayTimer = new System.Timers.Timer(800);
Expand Down Expand Up @@ -1384,6 +1390,11 @@ private void ExportMergeObjects(bool animation)
{
var gameObjects = new List<GameObject>();
GetSelectedParentNode(sceneTreeView.Nodes, gameObjects);
if (gameObjects.Count <= 0)
{
StatusStripUpdate("No Object can be exported");
return;
}
var saveFileDialog = new SaveFileDialog();
saveFileDialog.FileName = gameObjects[0].m_Name + " (merge).fbx";
saveFileDialog.AddExtension = false;
Expand Down Expand Up @@ -2046,6 +2057,34 @@ private void toolStripMenuItem15_Click(object sender, EventArgs e)
logger.ShowErrorMessage = toolStripMenuItem15.Checked;
}

private void englieshToolStripMenuItem_Click(object sender, EventArgs e)
{
ChangeLanguage(LanguageType.English);
}

private void chineseToolStripMenuItem_Click(object sender, EventArgs e)
{
ChangeLanguage(LanguageType.Chinese);
}

private void ChangeLanguage(LanguageType lang)
{
switch (lang)
{
case LanguageType.Chinese:
cfg.AppSettings.Settings["language"].Value = "zh-Hans";
cfg.Save();
break;
default:
cfg.AppSettings.Settings["language"].Value = "";
cfg.Save();
break;
}
MessageBox.Show("Please restart the software to set the application language");
}



private void glControl1_MouseWheel(object sender, MouseEventArgs e)
{
if (glControl1.Visible)
Expand Down