diff --git a/CatSystem2/CatSystem2Tools/AtxImage/AtxImage.csproj b/CatSystem2/CatSystem2Tools/AtxImage/AtxImage.csproj
index 543b04a..d01fd12 100644
--- a/CatSystem2/CatSystem2Tools/AtxImage/AtxImage.csproj
+++ b/CatSystem2/CatSystem2Tools/AtxImage/AtxImage.csproj
@@ -8,10 +8,12 @@
Exe
AtxImage
AtxImage
- v4.5
+ v4.8
512
true
+
+
AnyCPU
@@ -38,18 +40,28 @@
..\packages\ICSharpCode.SharpZipLib.dll.0.85.4.369\lib\net20\ICSharpCode.SharpZipLib.dll
-
- ..\packages\Nancy.1.4.1\lib\net40\Nancy.dll
+
+ ..\packages\Magick.NET-Q8-AnyCPU.13.10.0\lib\netstandard20\Magick.NET-Q8-AnyCPU.dll
+
+
+ ..\packages\Magick.NET.Core.13.10.0\lib\netstandard20\Magick.NET.Core.dll
+
+
+ ..\packages\Magick.NET.SystemDrawing.7.3.0\lib\net462\Magick.NET.SystemDrawing.dll
+
+
+ ..\packages\Nancy.1.4.4\lib\net40\Nancy.dll
..\packages\Nancy.Serialization.ProtoBuf.1.4.1\lib\net40\Nancy.Serialization.ProtoBuf.dll
-
- ..\packages\protobuf-net.2.0.0.614\lib\net40\protobuf-net.dll
+
+ ..\packages\protobuf-net.2.0.0.640\lib\net40\protobuf-net.dll
+
@@ -78,4 +90,11 @@
+
+
+
+ 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。
+
+
+
\ No newline at end of file
diff --git a/CatSystem2/CatSystem2Tools/AtxImage/AtxImage.csproj.user b/CatSystem2/CatSystem2Tools/AtxImage/AtxImage.csproj.user
new file mode 100644
index 0000000..29671f6
--- /dev/null
+++ b/CatSystem2/CatSystem2Tools/AtxImage/AtxImage.csproj.user
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CatSystem2/CatSystem2Tools/AtxImage/AtxImageBase.cs b/CatSystem2/CatSystem2Tools/AtxImage/AtxImageBase.cs
index 023d28c..1159518 100644
--- a/CatSystem2/CatSystem2Tools/AtxImage/AtxImageBase.cs
+++ b/CatSystem2/CatSystem2Tools/AtxImage/AtxImageBase.cs
@@ -6,195 +6,210 @@
using ProtoBuf;
using ICSharpCode.SharpZipLib.Zip;
using System.Drawing;
+using System.Drawing.Imaging;
+using ImageMagick;
namespace AtxImage
{
- public class AtxImageBase
- {
- public LayoutInfo layoutInfo { get; protected set; }
+ public class AtxImageBase
+ {
+ public LayoutInfo layoutInfo { get; protected set; }
- public int TextureCount { get; protected set; }
+ public int TextureCount { get; protected set; }
- public string FileName { get; private set; }
+ public string FileName { get; private set; }
- public List textures = new List();
+ public List textures = new List();
- ~AtxImageBase()
+ ~AtxImageBase()
{
- if(textures != null)
+ if (textures != null)
{
- for(int i=0; i();
- stream.Seek(0L, SeekOrigin.Begin);
- ZipFile zf = new ZipFile(stream);
- this.TextureCount = 0;
- int num = 0;
- byte[] array;
- for (; ; )
- {
- string text = string.Format("tex{0}.png", num);
- array = this.ReadBytes(zf, text);
- if (array == null || !this.AddImage(text, array))
- {
- break;
- }
- this.TextureCount += 1;
- num++;
- }
- array = this.ReadBytes(zf, ATLASPBNAME);
- if (array != null)
- {
- using (MemoryStream memoryStream = new MemoryStream(array))
- {
- this.layoutInfo = Serializer.Deserialize(memoryStream);
- this.layoutInfo.OnAfterDeserialize();
- }
- }
- else
- {
- array = this.ReadBytes(zf, ATLASNAME);
- using (FileMem fileMem = new FileMem(ATLASNAME, array))
- {
- string jsonString = fileMem.ReadString();
- this.layoutInfo = Json.Deserialize(jsonString);
-
- }
- }
- return this.layoutInfo != null;
- }
+ public bool Load(byte[] atx, string baseName = null)
+ {
+ this.FileName = baseName;
+ this.layoutInfo = null;
+ bool result;
+ using (MemoryStream memoryStream = new MemoryStream(atx))
+ {
+ result = this.Load(memoryStream, baseName);
+ }
+ return result;
+ }
+
+ public bool Load(Stream stream, string baseName = null)
+ {
+ this.FileName = baseName;
+ this.layoutInfo = null;
+ this.textures = new List();
+ stream.Seek(0L, SeekOrigin.Begin);
+ ZipFile zf = new ZipFile(stream);
+ this.TextureCount = 0;
+ int num = 0;
+ byte[] array;
+ for (; ; )
+ {
+ string text = string.Format("tex{0}.png", num);
+ array = this.ReadBytes(zf, text);
+ if (array == null || !this.AddImage(text, array))
+ {
+ text = string.Format("tex{0}.webp", num);
+ array = this.ReadBytes(zf, text);
+ if (array == null || !this.AddImage(text, array))
+ {
+ text = string.Format("tex{0}.jpg", num);
+ array = this.ReadBytes(zf, text);
+ if (array == null || !this.AddImage(text, array))
+ {
+ break;
+ }
+ }
+
+ }
+
+ this.TextureCount += 1;
+ num++;
+ }
+ array = this.ReadBytes(zf, ATLASPBNAME);
+ if (array != null)
+ {
+ using (MemoryStream memoryStream = new MemoryStream(array))
+ {
+ this.layoutInfo = Serializer.Deserialize(memoryStream);
+ this.layoutInfo.OnAfterDeserialize();
+ }
+ }
+ else
+ {
+ array = this.ReadBytes(zf, ATLASNAME);
+ using (FileMem fileMem = new FileMem(ATLASNAME, array))
+ {
+ string jsonString = fileMem.ReadString();
+ this.layoutInfo = Json.Deserialize(jsonString);
+
+ }
+ }
+ return this.layoutInfo != null;
+ }
protected bool AddImage(string textureName, byte[] data)
{
using (MemoryStream ms = new MemoryStream(data))
{
- Bitmap img = new Bitmap(ms);
- if(img != null)
+ MagickImage magickImage = new MagickImage(ms);
+ Bitmap bitmap = magickImage.ToBitmap();
+ if (bitmap != null)
{
- textures.Add(img);
- }
+ textures.Add(bitmap);
+ }
+ }
+ return true;
+ }
+
+ protected byte[] ReadBytes(ZipFile zf, string name)
+ {
+ ZipEntry entry = zf.GetEntry(name);
+ if (entry == null)
+ return null;
+ byte[] result = null;
+ int num = (int)entry.Size;
+ using (Stream inputStream = zf.GetInputStream(entry))
+ {
+ result = new byte[num];
+ inputStream.Read(result, 0, num);
+ }
+ return result;
+ }
+
+ public LayoutInfo.CanvasInfo GetCanvasInfo()
+ {
+ if (this.layoutInfo == null)
+ return null;
+
+ return this.layoutInfo.Canvas;
+ }
+
+ public LayoutInfo.BlockInfo GetBlockInfo(string name)
+ {
+ if (this.layoutInfo == null)
+ return null;
+ string key = name.ToLower();
+ if (this.layoutInfo.blockInfoMap.ContainsKey(key))
+ {
+ return this.layoutInfo.blockInfoMap[key];
}
- return true;
- }
-
- protected byte[] ReadBytes(ZipFile zf, string name)
- {
- ZipEntry entry = zf.GetEntry(name);
- if (entry == null)
- return null;
- byte[] result = null;
- int num = (int)entry.Size;
- using (Stream inputStream = zf.GetInputStream(entry))
- {
- result = new byte[num];
- inputStream.Read(result, 0, num);
- }
- return result;
- }
-
- public LayoutInfo.CanvasInfo GetCanvasInfo()
- {
- if (this.layoutInfo == null)
- return null;
-
- return this.layoutInfo.Canvas;
- }
-
- public LayoutInfo.BlockInfo GetBlockInfo(string name)
- {
- if (this.layoutInfo == null)
- return null;
- string key = name.ToLower();
- if(this.layoutInfo.blockInfoMap.ContainsKey(key))
+ return null;
+ }
+
+ public LayoutInfo.BlockInfo GetBlockInfo(string name, int id)
+ {
+ if (this.layoutInfo == null)
+ return null;
+ LayoutInfo.BlockInfo result = this.layoutInfo.SearchBlock(name, id);
+ return result;
+ }
+
+ public LayoutInfo.AttributeInfo GetAttributeInfo(int id)
+ {
+ foreach (LayoutInfo.BlockInfo blockInfo in this.layoutInfo.Block)
{
- return this.layoutInfo.blockInfoMap[key];
+ foreach (LayoutInfo.AttributeInfo attributeInfo in blockInfo.Attribute)
+ {
+ if (attributeInfo.id == id)
+ {
+ return attributeInfo;
+ }
+ }
}
- return null;
- }
-
- public LayoutInfo.BlockInfo GetBlockInfo(string name, int id)
- {
- if (this.layoutInfo == null)
- return null;
- LayoutInfo.BlockInfo result = this.layoutInfo.SearchBlock(name, id);
- return result;
- }
-
- public LayoutInfo.AttributeInfo GetAttributeInfo(int id)
- {
- foreach (LayoutInfo.BlockInfo blockInfo in this.layoutInfo.Block)
- {
- foreach (LayoutInfo.AttributeInfo attributeInfo in blockInfo.Attribute)
- {
- if (attributeInfo.id == id)
- {
- return attributeInfo;
- }
- }
- }
- return null;
- }
-
- //public List GetAttributeInfoList()
- //{
- // foreach (LayoutInfo.BlockInfo blockInfo in this.layoutInfo.Block)
- // {
- // bool flag = blockInfo.Attribute != null;
- // if (flag)
- // {
- // return blockInfo.Attribute;
- // }
- // }
- // return null;
- //}
-
- protected const string ATLASNAME = "atlas.json";
-
- protected const string ATLASPBNAME = "atlas.pb";
-
- public bool IsTextureReadable = false;
-
- }
+ return null;
+ }
+
+ //public List GetAttributeInfoList()
+ //{
+ // foreach (LayoutInfo.BlockInfo blockInfo in this.layoutInfo.Block)
+ // {
+ // bool flag = blockInfo.Attribute != null;
+ // if (flag)
+ // {
+ // return blockInfo.Attribute;
+ // }
+ // }
+ // return null;
+ //}
+
+ protected const string ATLASNAME = "atlas.json";
+
+ protected const string ATLASPBNAME = "atlas.pb";
+
+ public bool IsTextureReadable = false;
+
+ }
}
diff --git a/CatSystem2/CatSystem2Tools/AtxImage/app.config b/CatSystem2/CatSystem2Tools/AtxImage/app.config
index de2e5ae..449084e 100644
--- a/CatSystem2/CatSystem2Tools/AtxImage/app.config
+++ b/CatSystem2/CatSystem2Tools/AtxImage/app.config
@@ -6,6 +6,10 @@
+
+
+
+
-
+
diff --git a/CatSystem2/CatSystem2Tools/AtxImage/packages.config b/CatSystem2/CatSystem2Tools/AtxImage/packages.config
index 5169f9d..1faf07b 100644
--- a/CatSystem2/CatSystem2Tools/AtxImage/packages.config
+++ b/CatSystem2/CatSystem2Tools/AtxImage/packages.config
@@ -1,7 +1,10 @@
-
+
+
+
+
-
+
\ No newline at end of file
diff --git a/CatSystem2/CatSystem2Tools/CstxPack/CstxPack.csproj b/CatSystem2/CatSystem2Tools/CstxPack/CstxPack.csproj
index 07d140e..08b747f 100644
--- a/CatSystem2/CatSystem2Tools/CstxPack/CstxPack.csproj
+++ b/CatSystem2/CatSystem2Tools/CstxPack/CstxPack.csproj
@@ -8,9 +8,10 @@
Exe
CstxPack
CstxPack
- v4.0
+ v4.8
512
true
+
AnyCPU
@@ -23,6 +24,7 @@
4
true
Auto
+ false
AnyCPU
@@ -32,6 +34,7 @@
TRACE
prompt
4
+ false
@@ -51,5 +54,8 @@
+
+
+
\ No newline at end of file
diff --git a/CatSystem2/CatSystem2Tools/CstxPack/app.config b/CatSystem2/CatSystem2Tools/CstxPack/app.config
new file mode 100644
index 0000000..3e0e37c
--- /dev/null
+++ b/CatSystem2/CatSystem2Tools/CstxPack/app.config
@@ -0,0 +1,3 @@
+
+
+