Skip to content

Commit bf8ede6

Browse files
authored
Merge pull request #87 from yangxuilyx/master
following issues are fixed
2 parents a1b8451 + 937e215 commit bf8ede6

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/c#/GeneralUpdate.ClientCore/GeneralClientBootstrap.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ private async Task ExecuteWorkflowAsync()
170170
BlackListManager.Instance?.AddBlackFiles(_configInfo.BlackFiles);
171171
BlackListManager.Instance?.AddBlackFileFormats(_configInfo.BlackFormats);
172172
BlackListManager.Instance?.AddSkipDirectorys(_configInfo.SkipDirectorys);
173-
173+
174174
_configInfo.Encoding = GetOption(UpdateOption.Encoding) ?? Encoding.Default;
175175
_configInfo.Format = GetOption(UpdateOption.Format) ?? Format.ZIP;
176176
_configInfo.DownloadTimeOut = GetOption(UpdateOption.DownloadTimeOut) == 0
@@ -184,7 +184,7 @@ private async Task ExecuteWorkflowAsync()
184184
if (_configInfo.IsMainUpdate)
185185
{
186186
_configInfo.UpdateVersions = upgradeResp.Body.OrderBy(x => x.ReleaseDate).ToList();
187-
_configInfo.LastVersion = _configInfo.UpdateVersions.Last().Version;
187+
_configInfo.LastVersion = mainResp.Body.OrderBy(x => x.ReleaseDate).Last().Version;
188188

189189
var failed = CheckFail(_configInfo.LastVersion);
190190
if (failed) return;

src/c#/GeneralUpdate.Common/Compress/ZipCompressionStrategy.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void Compress(string sourceDirectoryName
4444
foreach (var toZipFileKey in toZipFileDictionaryList.Keys)
4545
{
4646
if (toZipFileKey == destinationArchiveFileName) continue;
47-
47+
4848
var toZipedFileName = Path.GetFileName(toZipFileKey);
4949
var toDelArchives = new List<ZipArchiveEntry>();
5050
foreach (var zipArchiveEntry in archive.Entries)
@@ -84,8 +84,8 @@ public void Compress(string sourceDirectoryName
8484
var toDelArchives = new List<ZipArchiveEntry>();
8585
foreach (var zipArchiveEntry in archive.Entries)
8686
{
87-
if (toZipedFileName != null
88-
&& (zipArchiveEntry.FullName.StartsWith(toZipedFileName)|| toZipedFileName.StartsWith(zipArchiveEntry.FullName)))
87+
if (toZipedFileName != null
88+
&& (zipArchiveEntry.FullName.StartsWith(toZipedFileName) || toZipedFileName.StartsWith(zipArchiveEntry.FullName)))
8989
{
9090
toDelArchives.Add(zipArchiveEntry);
9191
}
@@ -101,13 +101,13 @@ public void Compress(string sourceDirectoryName
101101
}
102102
}
103103
}
104-
catch(Exception exception)
104+
catch (Exception exception)
105105
{
106106
Debug.WriteLine(exception);
107107
throw new Exception($"Failed to compress archive: {exception.Message}");
108108
}
109109
}
110-
110+
111111
/// <summary>
112112
/// Unzip the Zip file and save it to the specified target path folder .
113113
/// </summary>
@@ -120,7 +120,7 @@ public void Decompress(string zipFilePath, string unZipDir, Encoding encoding)
120120
{
121121
var dirSeparatorChar = Path.DirectorySeparatorChar.ToString();
122122
unZipDir = unZipDir.EndsWith(dirSeparatorChar) ? unZipDir : unZipDir + dirSeparatorChar;
123-
123+
124124
var directoryInfo = new DirectoryInfo(unZipDir);
125125
if (!directoryInfo.Exists)
126126
{
@@ -138,14 +138,14 @@ public void Decompress(string zipFilePath, string unZipDir, Encoding encoding)
138138
for (int i = 0; i < archive.Entries.Count; i++)
139139
{
140140
var entries = archive.Entries[i];
141-
if (entries.FullName.EndsWith(dirSeparatorChar))
141+
var pattern = $"^{dirSeparatorChar}*";
142+
var entryFilePath = Regex.Replace(entries.FullName.Replace("/", dirSeparatorChar), pattern,
143+
"");
144+
if (entryFilePath.EndsWith(dirSeparatorChar))
142145
{
143146
continue;
144147
}
145148

146-
var pattern = $"^{dirSeparatorChar}*";
147-
var entryFilePath = Regex.Replace(entries.FullName.Replace("/", dirSeparatorChar), pattern,
148-
"");
149149
var filePath = directoryInfo + entryFilePath;
150150
var greatFolder = Directory.GetParent(filePath);
151151
if (greatFolder is not null && !greatFolder.Exists)

0 commit comments

Comments
 (0)