diff --git a/TexturePackerToEtcJson/App.config b/TexturePackerToEtcJson/App.config
new file mode 100644
index 0000000..7d84477
--- /dev/null
+++ b/TexturePackerToEtcJson/App.config
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TexturePackerToEtcJson/Program.cs b/TexturePackerToEtcJson/Program.cs
new file mode 100644
index 0000000..8629e97
--- /dev/null
+++ b/TexturePackerToEtcJson/Program.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace TexturePackerToEtcJson
+{
+ internal static class Program
+ {
+ ///
+ /// アプリケーションのメイン エントリ ポイントです。
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new frmMain());
+ }
+ }
+}
diff --git a/TexturePackerToEtcJson/Properties/AssemblyInfo.cs b/TexturePackerToEtcJson/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..7f55cf1
--- /dev/null
+++ b/TexturePackerToEtcJson/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// アセンブリに関する一般的な情報は、次の方法で制御されます
+// 制御されます。アセンブリに関連付けられている情報を変更するには、
+// これらの属性値を変更します。
+[assembly: AssemblyTitle("TexturePackerToEtcJson")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("TexturePackerToEtcJson")]
+[assembly: AssemblyCopyright("Copyright © 2023")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから
+// 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、
+// その型の ComVisible 属性を true に設定してください。
+[assembly: ComVisible(false)]
+
+// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
+[assembly: Guid("73774f74-739d-47cb-9b19-68b1b1d7a97e")]
+
+// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
+//
+// メジャー バージョン
+// マイナー バージョン
+// ビルド番号
+// リビジョン
+//
+// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
+// 既定値にすることができます:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/TexturePackerToEtcJson/Properties/Resources.Designer.cs b/TexturePackerToEtcJson/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..20d98d4
--- /dev/null
+++ b/TexturePackerToEtcJson/Properties/Resources.Designer.cs
@@ -0,0 +1,73 @@
+//------------------------------------------------------------------------------
+//
+// このコードはツールによって生成されました。
+// ランタイム バージョン:4.0.30319.42000
+//
+// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
+// コードが再生成されるときに損失したりします。
+//
+//------------------------------------------------------------------------------
+
+namespace TexturePackerToEtcJson.Properties {
+ using System;
+
+
+ ///
+ /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
+ ///
+ // このクラスは StronglyTypedResourceBuilder クラスが ResGen
+ // または Visual Studio のようなツールを使用して自動生成されました。
+ // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
+ // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TexturePackerToEtcJson.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします
+ /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// 型 System.Drawing.Bitmap のローカライズされたリソースを検索します。
+ ///
+ internal static System.Drawing.Bitmap folderIcon {
+ get {
+ object obj = ResourceManager.GetObject("folderIcon", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/TexturePackerToEtcJson/Properties/Resources.resx b/TexturePackerToEtcJson/Properties/Resources.resx
new file mode 100644
index 0000000..2e4be2b
--- /dev/null
+++ b/TexturePackerToEtcJson/Properties/Resources.resx
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ ..\folderIcon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file
diff --git a/TexturePackerToEtcJson/Properties/Settings.Designer.cs b/TexturePackerToEtcJson/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..3ffa2a3
--- /dev/null
+++ b/TexturePackerToEtcJson/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace TexturePackerToEtcJson.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/TexturePackerToEtcJson/Properties/Settings.settings b/TexturePackerToEtcJson/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/TexturePackerToEtcJson/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/TexturePackerToEtcJson/TexturePackerToEtcJson.csproj b/TexturePackerToEtcJson/TexturePackerToEtcJson.csproj
new file mode 100644
index 0000000..f6f3c3f
--- /dev/null
+++ b/TexturePackerToEtcJson/TexturePackerToEtcJson.csproj
@@ -0,0 +1,116 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {73774F74-739D-47CB-9B19-68B1B1D7A97E}
+ WinExe
+ TexturePackerToEtcJson
+ TexturePackerToEtcJson
+ v4.7.2
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll
+
+
+
+ packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll
+
+
+
+ packages\System.Memory.4.5.5\lib\net461\System.Memory.dll
+
+
+
+ packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
+
+ packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
+
+
+ packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll
+
+
+ packages\System.Text.Json.7.0.3\lib\net462\System.Text.Json.dll
+
+
+ packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll
+
+
+ packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ frmMain.cs
+
+
+
+
+ frmMain.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+ True
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TexturePackerToEtcJson/TexturePackerToEtcJson.sln b/TexturePackerToEtcJson/TexturePackerToEtcJson.sln
new file mode 100644
index 0000000..f504462
--- /dev/null
+++ b/TexturePackerToEtcJson/TexturePackerToEtcJson.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.5.33424.131
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TexturePackerToEtcJson", "TexturePackerToEtcJson.csproj", "{73774F74-739D-47CB-9B19-68B1B1D7A97E}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {73774F74-739D-47CB-9B19-68B1B1D7A97E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {73774F74-739D-47CB-9B19-68B1B1D7A97E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {73774F74-739D-47CB-9B19-68B1B1D7A97E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {73774F74-739D-47CB-9B19-68B1B1D7A97E}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A8EC2C5C-DC5A-47F0-9CEF-D8EF3797866C}
+ EndGlobalSection
+EndGlobal
diff --git a/TexturePackerToEtcJson/folderIcon.png b/TexturePackerToEtcJson/folderIcon.png
new file mode 100644
index 0000000..4efea4d
Binary files /dev/null and b/TexturePackerToEtcJson/folderIcon.png differ
diff --git a/TexturePackerToEtcJson/frmMain.Designer.cs b/TexturePackerToEtcJson/frmMain.Designer.cs
new file mode 100644
index 0000000..0b7a6c6
--- /dev/null
+++ b/TexturePackerToEtcJson/frmMain.Designer.cs
@@ -0,0 +1,230 @@
+namespace TexturePackerToEtcJson
+{
+ partial class frmMain
+ {
+ ///
+ /// 必要なデザイナー変数です。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 使用中のリソースをすべてクリーンアップします。
+ ///
+ /// マネージド リソースを破棄する場合は true を指定し、その他の場合は false を指定します。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows フォーム デザイナーで生成されたコード
+
+ ///
+ /// デザイナー サポートに必要なメソッドです。このメソッドの内容を
+ /// コード エディターで変更しないでください。
+ ///
+ private void InitializeComponent()
+ {
+ this.btnOpenOriginalJSON = new System.Windows.Forms.Button();
+ this.btnOpenTexturePackerJSON = new System.Windows.Forms.Button();
+ this.dlgOpenJSON = new System.Windows.Forms.OpenFileDialog();
+ this.btnConvert = new System.Windows.Forms.Button();
+ this.dlgSave = new System.Windows.Forms.SaveFileDialog();
+ this.txtPrePath = new System.Windows.Forms.TextBox();
+ this.lblPrePath = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtPackedImageDir = new System.Windows.Forms.TextBox();
+ this.btnPackedImageFolder = new System.Windows.Forms.Button();
+ this.dlgPackedImgFolder = new System.Windows.Forms.OpenFileDialog();
+ this.txtBasePath = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.btnBasePath = new System.Windows.Forms.Button();
+ this.label3 = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // btnOpenOriginalJSON
+ //
+ this.btnOpenOriginalJSON.Font = new System.Drawing.Font("MS UI Gothic", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+ this.btnOpenOriginalJSON.Location = new System.Drawing.Point(104, 304);
+ this.btnOpenOriginalJSON.Name = "btnOpenOriginalJSON";
+ this.btnOpenOriginalJSON.Size = new System.Drawing.Size(123, 54);
+ this.btnOpenOriginalJSON.TabIndex = 0;
+ this.btnOpenOriginalJSON.Text = "元のJSONを開く";
+ this.btnOpenOriginalJSON.UseVisualStyleBackColor = true;
+ this.btnOpenOriginalJSON.Click += new System.EventHandler(this.btnOpenOriginalJSON_Click);
+ //
+ // btnOpenTexturePackerJSON
+ //
+ this.btnOpenTexturePackerJSON.Font = new System.Drawing.Font("MS UI Gothic", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+ this.btnOpenTexturePackerJSON.Location = new System.Drawing.Point(328, 304);
+ this.btnOpenTexturePackerJSON.Name = "btnOpenTexturePackerJSON";
+ this.btnOpenTexturePackerJSON.Size = new System.Drawing.Size(123, 54);
+ this.btnOpenTexturePackerJSON.TabIndex = 1;
+ this.btnOpenTexturePackerJSON.Text = "TexturePackerのJSONを開く";
+ this.btnOpenTexturePackerJSON.UseVisualStyleBackColor = true;
+ this.btnOpenTexturePackerJSON.Click += new System.EventHandler(this.btnOpenTexturePackerJSON_Click);
+ //
+ // dlgOpenJSON
+ //
+ this.dlgOpenJSON.FileName = "openFileDialog1";
+ //
+ // btnConvert
+ //
+ this.btnConvert.Font = new System.Drawing.Font("MS UI Gothic", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+ this.btnConvert.Location = new System.Drawing.Point(550, 304);
+ this.btnConvert.Name = "btnConvert";
+ this.btnConvert.Size = new System.Drawing.Size(123, 54);
+ this.btnConvert.TabIndex = 2;
+ this.btnConvert.Text = "コンバート";
+ this.btnConvert.UseVisualStyleBackColor = true;
+ this.btnConvert.Click += new System.EventHandler(this.btnConvert_Click);
+ //
+ // dlgSave
+ //
+ this.dlgSave.FileName = "_packed.json";
+ this.dlgSave.Filter = "JSONファイル|*.json";
+ //
+ // txtPrePath
+ //
+ this.txtPrePath.Font = new System.Drawing.Font("メイリオ", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+ this.txtPrePath.Location = new System.Drawing.Point(173, 185);
+ this.txtPrePath.Name = "txtPrePath";
+ this.txtPrePath.Size = new System.Drawing.Size(141, 30);
+ this.txtPrePath.TabIndex = 3;
+ this.txtPrePath.Text = "gui2023";
+ this.txtPrePath.TextChanged += new System.EventHandler(this.txtPrePath_TextChanged);
+ //
+ // lblPrePath
+ //
+ this.lblPrePath.AutoSize = true;
+ this.lblPrePath.Font = new System.Drawing.Font("メイリオ", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+ this.lblPrePath.ForeColor = System.Drawing.Color.White;
+ this.lblPrePath.Location = new System.Drawing.Point(67, 188);
+ this.lblPrePath.Name = "lblPrePath";
+ this.lblPrePath.Size = new System.Drawing.Size(100, 23);
+ this.lblPrePath.TabIndex = 4;
+ this.lblPrePath.Text = "付加プリパス";
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Font = new System.Drawing.Font("メイリオ", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+ this.label1.ForeColor = System.Drawing.Color.White;
+ this.label1.Location = new System.Drawing.Point(375, 188);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(145, 23);
+ this.label1.TabIndex = 6;
+ this.label1.Text = "パック画像フォルダ";
+ //
+ // txtPackedImageDir
+ //
+ this.txtPackedImageDir.Font = new System.Drawing.Font("メイリオ", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+ this.txtPackedImageDir.Location = new System.Drawing.Point(526, 185);
+ this.txtPackedImageDir.Name = "txtPackedImageDir";
+ this.txtPackedImageDir.Size = new System.Drawing.Size(141, 30);
+ this.txtPackedImageDir.TabIndex = 5;
+ //
+ // btnPackedImageFolder
+ //
+ this.btnPackedImageFolder.Image = global::TexturePackerToEtcJson.Properties.Resources.folderIcon;
+ this.btnPackedImageFolder.Location = new System.Drawing.Point(673, 178);
+ this.btnPackedImageFolder.Name = "btnPackedImageFolder";
+ this.btnPackedImageFolder.Size = new System.Drawing.Size(55, 44);
+ this.btnPackedImageFolder.TabIndex = 7;
+ this.btnPackedImageFolder.UseVisualStyleBackColor = true;
+ this.btnPackedImageFolder.Click += new System.EventHandler(this.btnPackedImageFolder_Click);
+ //
+ // dlgPackedImgFolder
+ //
+ this.dlgPackedImgFolder.CheckFileExists = false;
+ this.dlgPackedImgFolder.FileName = "FileName";
+ this.dlgPackedImgFolder.Filter = "Folder|.";
+ //
+ // txtBasePath
+ //
+ this.txtBasePath.Font = new System.Drawing.Font("メイリオ", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+ this.txtBasePath.Location = new System.Drawing.Point(173, 95);
+ this.txtBasePath.Name = "txtBasePath";
+ this.txtBasePath.Size = new System.Drawing.Size(141, 30);
+ this.txtBasePath.TabIndex = 8;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Font = new System.Drawing.Font("メイリオ", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+ this.label2.ForeColor = System.Drawing.Color.White;
+ this.label2.Location = new System.Drawing.Point(67, 98);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(85, 23);
+ this.label2.TabIndex = 9;
+ this.label2.Text = "ベースパス";
+ //
+ // btnBasePath
+ //
+ this.btnBasePath.Image = global::TexturePackerToEtcJson.Properties.Resources.folderIcon;
+ this.btnBasePath.Location = new System.Drawing.Point(328, 88);
+ this.btnBasePath.Name = "btnBasePath";
+ this.btnBasePath.Size = new System.Drawing.Size(55, 44);
+ this.btnBasePath.TabIndex = 10;
+ this.btnBasePath.UseVisualStyleBackColor = true;
+ this.btnBasePath.Click += new System.EventHandler(this.btnBasePath_Click);
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Font = new System.Drawing.Font("メイリオ", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
+ this.label3.ForeColor = System.Drawing.Color.White;
+ this.label3.Location = new System.Drawing.Point(389, 102);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(298, 23);
+ this.label3.TabIndex = 11;
+ this.label3.Text = "dataフォルダをベースパスにしてください";
+ //
+ // frmMain
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.btnBasePath);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.txtBasePath);
+ this.Controls.Add(this.btnPackedImageFolder);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.txtPackedImageDir);
+ this.Controls.Add(this.lblPrePath);
+ this.Controls.Add(this.txtPrePath);
+ this.Controls.Add(this.btnConvert);
+ this.Controls.Add(this.btnOpenTexturePackerJSON);
+ this.Controls.Add(this.btnOpenOriginalJSON);
+ this.Name = "frmMain";
+ this.Text = "Form1";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button btnOpenOriginalJSON;
+ private System.Windows.Forms.Button btnOpenTexturePackerJSON;
+ private System.Windows.Forms.OpenFileDialog dlgOpenJSON;
+ private System.Windows.Forms.Button btnConvert;
+ private System.Windows.Forms.SaveFileDialog dlgSave;
+ private System.Windows.Forms.TextBox txtPrePath;
+ private System.Windows.Forms.Label lblPrePath;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox txtPackedImageDir;
+ private System.Windows.Forms.Button btnPackedImageFolder;
+ private System.Windows.Forms.OpenFileDialog dlgPackedImgFolder;
+ private System.Windows.Forms.TextBox txtBasePath;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Button btnBasePath;
+ private System.Windows.Forms.Label label3;
+ }
+}
+
diff --git a/TexturePackerToEtcJson/frmMain.cs b/TexturePackerToEtcJson/frmMain.cs
new file mode 100644
index 0000000..90284c7
--- /dev/null
+++ b/TexturePackerToEtcJson/frmMain.cs
@@ -0,0 +1,386 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Text.Json;
+using System.Diagnostics;
+using System.Text.Json.Nodes;
+using System.Runtime.InteropServices.WindowsRuntime;
+using System.Security.Policy;
+using System.IO;
+using System.Text.Encodings.Web;
+using System.Text.Unicode;
+
+namespace TexturePackerToEtcJson
+{
+ public partial class frmMain : Form
+ {
+ public frmMain()
+ {
+ InitializeComponent();
+ }
+ System.IO.Stream originalJSONStream_ = null;
+ System.IO.Stream texturePackerJSONStream_ = null;
+ string strPackedImagePath_ = "";
+ struct Rect{
+ public int x;
+ public int y;
+ public int w;
+ public int h;
+ public override string ToString()
+ {
+ string ret="rect:x=";
+ ret += x.ToString();
+ ret += ",y="+y.ToString();
+ ret += ",w="+w.ToString();
+ ret += ",h="+h.ToString();
+ return ret;
+ }
+ }
+ Dictionary rectTable_ = new Dictionary();
+
+ private void btnOpenOriginalJSON_Click(object sender, EventArgs e)
+ {
+ if(dlgOpenJSON.ShowDialog()!= DialogResult.OK )
+ {
+ return;
+ }
+ originalJSONStream_ = null;
+ originalJSONStream_ = dlgOpenJSON.OpenFile();
+
+ }
+
+ private void btnOpenTexturePackerJSON_Click(object sender, EventArgs e)
+ {
+ if (dlgOpenJSON.ShowDialog() != DialogResult.OK)
+ {
+ return;
+ }
+ texturePackerJSONStream_ = null;
+ texturePackerJSONStream_ = dlgOpenJSON.OpenFile();
+
+ }
+
+ private void Convert(JsonDocument originalJSON , JsonDocument texJSON) {
+ var root = originalJSON.RootElement;
+
+ }
+ private void ParseFrameForArray(JsonElement frameElement)
+ {
+ foreach (var obj in frameElement.EnumerateObject())
+ {
+ if (obj.Name == "filename")
+ {
+ Debug.Print(obj.Value.ToString());
+ }
+ }
+ }
+
+ private void ParseFrameForHash(JsonProperty prop)
+ {
+ //Debug.Print(prop.Name);
+ Rect rc;
+ rc.x = 0;
+ rc.y = 0;
+ rc.w = 0;
+ rc.h = 0;
+ foreach (var obj in prop.Value.EnumerateObject())
+ {
+ if (obj.Name == "frame")
+ {
+ foreach (var rectJson in obj.Value.EnumerateObject())
+ {
+ if (rectJson.Name == "x")
+ {
+ rc.x = rectJson.Value.GetInt32();
+ }
+ else if (rectJson.Name == "y")
+ {
+ rc.y = rectJson.Value.GetInt32();
+ }
+ else if (rectJson.Name == "w")
+ {
+ rc.w = rectJson.Value.GetInt32();
+ }
+ else if (rectJson.Name == "h")
+ {
+ rc.h = rectJson.Value.GetInt32();
+ }
+ }
+ break;
+ }
+ }
+ string name = prop.Name;
+ if(txtPrePath.Text.Length > 0)
+ {
+ name = txtPrePath.Text + "/" + name;
+ }
+ rectTable_.Add(name, rc);
+ }
+
+ private void ParseFrames(JsonElement framesElement)
+ {
+ //TexturePackerの出力設定がArrayの時は
+ //"filename"="ファイル名"になっている
+ if (framesElement.ValueKind == JsonValueKind.Array)
+ {
+ foreach (var elem in framesElement.EnumerateArray())
+ {
+ ParseFrameForArray(elem);
+ }
+ }
+ //TexturePackerの出力設定がハッシュの時はファイル名=オブジェクト名
+ else if (framesElement.ValueKind == JsonValueKind.Object)
+ {
+ foreach (var obj in framesElement.EnumerateObject())
+ {
+ ParseFrameForHash(obj);
+ }
+ }
+
+ }
+
+ private List GetLayoutsFromOriginalJson(JsonDocument doc)
+ {
+ List < JsonElement > layouts = new List< JsonElement >();
+ foreach (var obj in doc.RootElement.EnumerateObject())
+ {
+ if (obj.Name == "Layout")
+ {
+ if(obj.Value.ValueKind == JsonValueKind.Array)
+ {
+ var len = obj.Value.GetArrayLength();
+ for(int i = 0; i < len; i++)
+ {
+ layouts.Add(obj.Value[i]);
+ }
+ }
+ }
+ }
+ return layouts;
+ }
+ private List GetLayoutsFromOriginalJson(JsonNode doc)
+ {
+ List layouts = new List();
+ var layout = doc.Root["Layout"];
+ var layoutNodes = layout.AsArray();
+ foreach (var layoutNode in layoutNodes)
+ {
+ layouts.Add((JsonNode)layoutNode);
+ }
+ return layouts;
+ }
+ private Nullable< JsonElement > FindObjectFromJsonElement(JsonElement elem,string name)
+ {
+ Nullable retElem = null;
+ foreach (var obj in elem.EnumerateObject())
+ {
+ if(obj.Name== name)
+ {
+ retElem= obj.Value;
+ }
+ }
+ return retElem;
+ }
+ private List GetImageGUIsFromOriginalJsonLayout(JsonNode layout)
+ {
+ List guis = new List();
+ var guiNodeArray=layout["Gui"].AsArray();
+ foreach (JsonNode guiNode in guiNodeArray)
+ {
+ var value = guiNode["Type"].AsValue();
+ if(value != null)
+ {
+ if(value.ToString() == "image")
+ {
+ guis.Add((JsonNode)guiNode);
+ }else if(value.ToString() == "button")
+ {
+ var paramButton = guiNode["ParamButton"];
+ if(paramButton != null)
+ {
+ var fileName = paramButton["FileName"];
+ if (fileName != null)
+ {
+ guis.Add((JsonNode)guiNode);
+ }
+ }
+ }
+ }
+ }
+ return guis;
+ }
+
+ private void btnConvert_Click(object sender, EventArgs e)
+ {
+ if (texturePackerJSONStream_ == null)
+ {
+ return;
+ }
+
+ //ストリームの最後に来てたら巻き戻す
+ if (texturePackerJSONStream_.Length <= texturePackerJSONStream_.Position)
+ {
+ texturePackerJSONStream_.Seek(0, System.IO.SeekOrigin.Begin);
+ }
+ var texPackDoc = JsonDocument.Parse(texturePackerJSONStream_);
+ var texPackRoot = texPackDoc.RootElement;
+ rectTable_.Clear();
+ if (texPackRoot.ValueKind == JsonValueKind.Object)
+ {
+ foreach (var obj in texPackRoot.EnumerateObject())
+ {
+ if (obj.Name == "frames")
+ {
+ ParseFrames(obj.Value);
+ }
+ else if(obj.Name =="meta")
+ {
+ foreach(var metaobj in obj.Value.EnumerateObject())
+ {
+ if(metaobj.Name == "image")
+ {
+ strPackedImagePath_= metaobj.Value.ToString();
+ if(txtPackedImageDir.Text.Length> 0)
+ {
+ var imageDir = new Uri(txtPackedImageDir.Text);
+ var baseDir = new Uri(txtBasePath.Text+"/");
+ var strRelativeImageDir = baseDir.MakeRelativeUri(imageDir).ToString();
+ strPackedImagePath_ = strRelativeImageDir + "/"+strPackedImagePath_;
+ }
+ }
+ }
+ }
+ }
+ }
+ else if (texPackRoot.ValueKind == JsonValueKind.Array)
+ {
+ //Debug.Print(texPackRoot.ToString());
+ }
+ //ここまででTexturePackerJSONの解析が終了
+ //パス→RectのDictionaryになっている。
+ //では次はオリジナルJSONの解析
+ //ストリームの最後に来てたら巻き戻す
+ if (originalJSONStream_.Length <= originalJSONStream_.Position)
+ {
+ originalJSONStream_.Seek(0, System.IO.SeekOrigin.Begin);
+ }
+
+ JsonNode orgDoc = JsonNode.Parse(originalJSONStream_);
+ var layoutsJson=GetLayoutsFromOriginalJson(orgDoc);
+ List imgElements = new List();
+ foreach (var layout in layoutsJson)
+ {
+ var elems= GetImageGUIsFromOriginalJsonLayout(layout);
+ if (elems != null)
+ {
+ foreach (var elem in elems)
+ {
+ imgElements.Add(elem);
+ }
+ }
+ }
+ //一つ一つ置換していきます。
+ foreach(var node in imgElements)
+ {
+ if (node["Type"].ToString() == "image")
+ {
+ var paramImage = node["ParamImage"];
+ if (paramImage != null)
+ {
+ var uri = paramImage["Uri"];
+ if(uri != null)
+ {
+ Debug.Print($"{uri.ToString()}");
+ if (rectTable_.ContainsKey(uri.ToString())){
+ var rc = rectTable_[uri.ToString()];
+ Debug.Print(rc.ToString());
+
+ JsonArray jsonArray = new JsonArray();
+ jsonArray.Add(rc.x);
+ jsonArray.Add(rc.y);
+ jsonArray.Add(rc.w);
+ jsonArray.Add(rc.h);
+ paramImage["UVArea"] = jsonArray;
+ uri = strPackedImagePath_;
+ paramImage["Uri"] = uri;
+ }
+ }
+ }
+ }else if (node["Type"].ToString() == "button")
+ {
+ var paramButton = node["ParamButton"];
+ if (paramButton != null)
+ {
+ var fileName = paramButton["FileName"];
+ if (fileName != null)
+ {
+ Debug.Print($"{fileName.ToString()}");
+ if (rectTable_.ContainsKey(fileName.ToString()))
+ {
+ var rc = rectTable_[fileName.ToString()];
+
+ Debug.Print(rc.ToString());
+
+ JsonArray jsonArray = new JsonArray();
+ jsonArray.Add(rc.x);
+ jsonArray.Add(rc.y);
+ jsonArray.Add(rc.w);
+ jsonArray.Add(rc.h);
+ paramButton["UVArea"] = jsonArray;
+ fileName = strPackedImagePath_;
+ paramButton["FileName"] = fileName;
+ }
+
+ }
+ }
+ }
+ }
+ if(dlgSave.ShowDialog()==DialogResult.OK)
+ {
+ var strSaveFolderPath = dlgSave.FileName;
+ var stream = File.OpenWrite(strSaveFolderPath);
+ JsonWriterOptions options = new JsonWriterOptions();
+ options.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All);
+ options.Indented = true;
+ options.MaxDepth = 0;
+
+ Utf8JsonWriter jsonWriter = new Utf8JsonWriter(stream,options);
+ orgDoc.WriteTo(jsonWriter);
+ jsonWriter.Flush();
+ jsonWriter.Dispose();
+ stream.Close();//書き込み先をクローズ
+ originalJSONStream_.Close();//
+ texturePackerJSONStream_.Close();
+ MessageBox.Show("パック画像キャンバスJSONを出力しました。");
+ }
+ }
+
+ private void txtPrePath_TextChanged(object sender, EventArgs e)
+ {
+
+ }
+
+ private void btnPackedImageFolder_Click(object sender, EventArgs e)
+ {
+ if(dlgPackedImgFolder.ShowDialog()==DialogResult.OK) {
+ string strPath = Path.GetDirectoryName(dlgPackedImgFolder.FileName);
+ txtPackedImageDir.Text = strPath;
+ }
+ }
+
+ private void btnBasePath_Click(object sender, EventArgs e)
+ {
+ if (dlgPackedImgFolder.ShowDialog() == DialogResult.OK)
+ {
+ string strPath = Path.GetDirectoryName(dlgPackedImgFolder.FileName);
+ txtBasePath.Text = strPath;
+ }
+ }
+ }
+}
diff --git a/TexturePackerToEtcJson/frmMain.resx b/TexturePackerToEtcJson/frmMain.resx
new file mode 100644
index 0000000..c5ff4db
--- /dev/null
+++ b/TexturePackerToEtcJson/frmMain.resx
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+ 146, 17
+
+
+ 240, 17
+
+
\ No newline at end of file
diff --git a/TexturePackerToEtcJson/packages.config b/TexturePackerToEtcJson/packages.config
new file mode 100644
index 0000000..7859666
--- /dev/null
+++ b/TexturePackerToEtcJson/packages.config
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file