Skip to content

Commit a3699c7

Browse files
author
kritsu
committed
1.7.0.2 update
1 parent 94b5ce3 commit a3699c7

File tree

12 files changed

+64
-42
lines changed

12 files changed

+64
-42
lines changed

ExtractorSharp.Core/Handle/FourthHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public FourthHandler(Album Album) : base(Album) {}
1515
public override Bitmap ConvertToBitmap(Sprite entity) {
1616
var data = entity.Data;
1717
var size = entity.Width * entity.Height;
18-
if (entity.Compress == Compress.ZLIB) {
18+
if (entity.Type==ColorBits.ARGB_1555&&entity.Compress == Compress.ZLIB) {
1919
data = Zlib.Decompress(data, size);
2020
var table = Album.CurrentTable;
2121
if (table.Count > 0) {
@@ -28,7 +28,7 @@ public override Bitmap ConvertToBitmap(Sprite entity) {
2828
}
2929
}
3030
}
31-
return Bitmaps.FromArray(data, entity.Size);
31+
return base.ConvertToBitmap(entity);
3232
}
3333

3434
public override byte[] ConvertToByte(Sprite entity) {

ExtractorSharp.Core/Handle/Handler.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ public void Adjust() {
5858
var ms = new MemoryStream();
5959
var data = AdjustData();
6060
if (Album.Version > Img_Version.Other) {
61-
var flag = Album.Version == Img_Version.Ver1 ? Npks.IMAGE_FLAG : Npks.IMG_FLAG;
62-
ms.WriteString(flag);
63-
ms.WriteLong(Album.Info_Length);
61+
if (Album.Version == Img_Version.Ver1) {
62+
ms.WriteString(Npks.IMAGE_FLAG);
63+
ms.WriteInt((int)Album.Info_Length);
64+
ms.WriteShort(0);
65+
} else {
66+
ms.WriteString(Npks.IMG_FLAG);
67+
ms.WriteLong(Album.Info_Length);
68+
}
6469
ms.WriteInt((int)Album.Version);
6570
ms.WriteInt(Album.Count);
6671
}

ExtractorSharp.Core/Handle/SixthHandler.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ public SixthHandler(Album Album) : base(Album) { }
1212
public override Bitmap ConvertToBitmap(Sprite entity) {
1313
var data = entity.Data;
1414
var size = entity.Width * entity.Height;
15-
if (entity.Compress != Compress.ZLIB || entity.Type > ColorBits.ARGB_1555) {
16-
return base.ConvertToBitmap(entity);
17-
}
18-
data = Zlib.Decompress(data, size);
19-
var table = Album.CurrentTable;
20-
if (table.Count > 0) {
21-
using (var os = new MemoryStream()) {
22-
foreach (var i in data) {
23-
Colors.WriteColor(os, table[i % table.Count], ColorBits.ARGB_8888);
15+
if (entity.Type == ColorBits.ARGB_1555 && entity.Compress == Compress.ZLIB) {
16+
data = Zlib.Decompress(data, size);
17+
var table = Album.CurrentTable;
18+
if (table.Count > 0) {
19+
using (var os = new MemoryStream()) {
20+
foreach (var i in data) {
21+
Colors.WriteColor(os, table[i % table.Count], ColorBits.ARGB_8888);
22+
}
23+
data = os.ToArray();
2424
}
25-
data = os.ToArray();
2625
}
26+
return Bitmaps.FromArray(data, entity.Size);
2727
}
28-
return Bitmaps.FromArray(data, entity.Size);
28+
return base.ConvertToBitmap(entity);
2929
}
3030

3131

ExtractorSharp.Core/Lib/Bitmaps.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static Bitmap LinearDodge(this Bitmap bmp) {
6969
bmp = FromArray(data, bmp.Size);
7070
return bmp;
7171
}
72-
72+
7373
/// <summary>
7474
/// 线性减淡
7575
/// </summary>
@@ -185,7 +185,7 @@ public static Bitmap FromArray(byte[] data, Size size, ColorBits bits) {
185185
}
186186

187187
public static Bitmap[] ReadGif(string path) {
188-
using (var fs = File.Open(path, FileMode.Open)) {
188+
using (var fs = File.OpenRead(path)) {
189189
return ReadGif(fs);
190190
}
191191
}

ExtractorSharp.Core/Lib/Reader/Npks.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ public static List<Album> ReadNPK(this Stream stream, string file) {
162162
album.Count = stream.ReadInt();
163163
album.InitHandle(stream);
164164
} else if (album_flag == IMAGE_FLAG) {
165-
stream.Seek(10);
166-
album.Version = Img_Version.Ver1;
165+
album.Info_Length = stream.ReadInt();
166+
stream.Seek(2);
167+
album.Version = (Img_Version)stream.ReadInt();
167168
album.Count = stream.ReadInt();
168169
album.InitHandle(stream);
169170
} else {
@@ -227,7 +228,7 @@ public static List<Album> Load(bool onlyPath, string file) {
227228
if (!File.Exists(file)) {
228229
return List;
229230
}
230-
using (var stream = File.Open(file, FileMode.Open)) {
231+
using (var stream = File.OpenRead(file)) {
231232
if (onlyPath) {
232233
return ReadInfo(stream);
233234
}
@@ -260,7 +261,7 @@ public static Album LoadWithName(string file, string name) {
260261
}
261262

262263
public static void Save(string file, List<Album> list) {
263-
using (var fs = new FileStream(file, FileMode.Create)) {
264+
using (var fs = File.OpenWrite(file)) {
264265
WriteNpk(fs, list);
265266
}
266267
}

ExtractorSharp.Core/Model/Album.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public void Save(Stream stream) {
209209
}
210210

211211
public void Save(string file) {
212-
using(var fs=new FileStream(file, FileMode.Create)) {
212+
using(var fs=File.OpenWrite(file)) {
213213
Save(fs);
214214
}
215215
}

ExtractorSharp/Command/PaletteCommand/ChangeColor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ public void Do(params object[] args) {
2828
Indexes = args[2] as int[];
2929
NewColor = (Color)args[3];
3030
OldColor = new Color[Indexes.Length];
31+
var table = Album.Tables[TableIndex];
3132
for (var i =0;i<Indexes.Length;i++) {
3233
var index = Indexes[i];
33-
var table = Album.Tables[TableIndex];
3434
OldColor[i] = table[index];
35-
table[i] = NewColor;
35+
table[index] = NewColor;
3636
}
3737
Album.Refresh();
3838
}

ExtractorSharp/Core/Drawer.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ class Drawer {
2727

2828
public IPaint CurrentLayer {
2929
set {
30-
var lastPoint = LayerList[0].Location;
3130
var lastVisible = LayerList[0].Visible;
3231
var curPoint = LayerList[1].Location;
3332
var curVisible = LayerList[1].Visible;
3433
LayerList[0] = LayerList[1];//图层更新
35-
LayerList[0].Location = lastPoint;
34+
LayerList[0].Location = curPoint;
3635
LayerList[0].Name = "LastLayer";
3736
LayerList[0].Visible = lastVisible;
3837
LayerList[1] = value;

ExtractorSharp/MainForm.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,7 @@ private void RenameLayer(object sender,EventArgs e) {
383383
}
384384

385385
private void BeforeDraw(object sender, LayerEventArgs e) {
386-
Border.Tag = Drawer.CurrentLayer.Rectangle;
387386

388-
var ruler = Ruler as Ruler;
389-
ruler.DrawSpan = Config["RulerSpan"].Boolean;
390-
ruler.DrawCrosshair = Config["RulerCrosshair"].Boolean;
391-
ruler.Tag = Drawer.CurrentLayer.Location.Minus(Ruler.Location);
392-
ruler.Size = box.Size;
393387

394388
Grid.Tag = Config["GridGap"].Integer;
395389
Grid.Size = box.Size;
@@ -411,6 +405,13 @@ private void BeforeDraw(object sender, LayerEventArgs e) {
411405
Drawer.CurrentLayer.Size = size;
412406
Drawer.CurrentLayer.Image = pictrue;//校正贴图
413407
}
408+
Border.Tag = Drawer.CurrentLayer.Rectangle;
409+
var ruler = Ruler as Ruler;
410+
ruler.DrawSpan = Config["RulerSpan"].Boolean;
411+
ruler.DrawCrosshair = Config["RulerCrosshair"].Boolean;
412+
ruler.Tag = Drawer.CurrentLayer.Location.Minus(Ruler.Location);
413+
ruler.Size = box.Size;
414+
414415
}
415416

416417
private void RecentChanged(object sender, EventArgs e) {
@@ -529,10 +530,9 @@ private void ScaleChange(object sender, EventArgs e) {
529530

530531
private void RealPosition(object sender, EventArgs e) {
531532
var currentTag = Drawer.CurrentLayer.Tag as Sprite;
532-
if (currentTag != null) {
533-
var lastTag = Drawer.LastLayer.Tag as Sprite;
534-
var isRelative = realPositionBox.Checked;
535-
Drawer.CurrentLayer.Location = isRelative ? currentTag.Location : Point.Empty;
533+
var lastTag = Drawer.LastLayer.Tag as Sprite;
534+
if (currentTag != null&&!currentTag.Equals(lastTag)) {
535+
Drawer.CurrentLayer.Location = realPositionBox.Checked ? currentTag.Location : Point.Empty;
536536
}
537537
Flush(sender, e);
538538
}

ExtractorSharp/Program.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,7 @@ private static void ShowDebug(object sender, ThreadExceptionEventArgs e) {
159159
Directory.CreateDirectory(dir);
160160
}
161161
var current = $"{dir}/{DateTime.Now.ToString("yyyyMMddHHmmss")}.log";
162-
using (var fs = new FileStream(current, FileMode.Create)) {
163-
fs.Write(data);
164-
}
162+
File.WriteAllBytes(current, data);
165163
if ((e.Exception is ProgramException && Connector != null)) {
166164
Connector.SendError(e.Exception.Message);
167165
} else if (Config["Profile"].Value.Equals("release")) {

ExtractorSharp/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
3434
// 方法是按如下所示使用“*”: :
3535
// [assembly: AssemblyVersion("1.0.*")]
36-
[assembly: AssemblyVersion("1.7.0.0")]
37-
[assembly: AssemblyFileVersion("1.7.0.0")]
36+
[assembly: AssemblyVersion("1.7.0.1")]
37+
[assembly: AssemblyFileVersion("1.7.0.1")]
3838
[assembly: NeutralResourcesLanguage("zh-CN")]
3939

ExtractorSharp/Resources/version.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,5 +977,24 @@
977977
"新增贴图效果处理",
978978
"新增拼合-预览,自动排序"
979979
]
980+
},
981+
{
982+
"Version": "1.7.0.1",
983+
"Info": [
984+
"修复试衣间载入点击无效的bug",
985+
"修复试衣间载入时选中项不一致的bug",
986+
"修复缩放无法使用的bug",
987+
"修复隐藏贴图遗留色表的bug"
988+
]
989+
},
990+
{
991+
"Version": "1.7.0.2",
992+
"Info": [
993+
"修复Ver1输出文件格式错误的bug",
994+
"修复Ver4读取部分文件不正常的bug",
995+
"修复可能存在的文件占用bug",
996+
"修复颜色更改时不正常的bug",
997+
"修复上一图层坐标不对的bug"
998+
]
980999
}
9811000
]

0 commit comments

Comments
 (0)