Skip to content

Commit

Permalink
SLManager-1.3.4
Browse files Browse the repository at this point in the history
- 修改存档的备份,防止备份了其他的文件或文件夹
  • Loading branch information
sth4nothing committed Dec 18, 2018
1 parent d8271ce commit 65bf60f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions SLManager/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@

## 1.3.3
- 修复备份存档的压缩包的文件名错误

## 1.3.4
- 修改存档的备份,防止备份了其他的文件或文件夹
2 changes: 1 addition & 1 deletion SLManager/Info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Id": "SLManager",
"DisplayName": "Save / Load",
"Author": "Sth4nothing",
"Version": "1.3.3",
"Version": "1.3.4",
"AssemblyName": "SLManager.dll",
"EntryMethod": "Sth4nothing.SLManager.Main.Load",
"HomePage": "https://bbs.nga.cn/read.php?tid=15734945"
Expand Down
18 changes: 17 additions & 1 deletion SLManager/Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,27 @@ internal static void BackupFolderToFile(string pathToBackup, string targetFile)
{
using (var zip = new ZipFile())
{
zip.AddDirectory(pathToBackup);
zip.AddFiles(GetFilesToBackup(pathToBackup));
zip.Save(targetFile);
}
}

/// <summary>
/// 获取备份文件列表
/// </summary>
/// <param name="pathToBackup"></param>
/// <returns></returns>
internal static List<string> GetFilesToBackup(string pathToBackup)
{
var files = new List<string>();
if (File.Exists(Path.Combine(pathToBackup, "date.json")))
{
files.Add(Path.Combine(pathToBackup, "date.json"));
}
files.AddRange(Directory.GetFiles(pathToBackup, "TW_Save_Date_?.tw*"));
return files;
}

/// <summary>
/// 返回存档备份存储路径
/// </summary>
Expand Down

0 comments on commit 65bf60f

Please sign in to comment.