Skip to content

Commit

Permalink
Minor Fixes
Browse files Browse the repository at this point in the history
- Fix HTTP download when the server don't provide the content length
- Fix Self Update bug
  • Loading branch information
marcussacana committed Jul 1, 2022
1 parent 22390b1 commit bef0ec9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 2 additions & 4 deletions Build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,10 @@ OSXPublish (){

AndroidPublish (){
if ! [ -d "${AndroidSdkDirectory}build-tools" ]; then
printf "\x1b[31mINVALID ANDROID SDK PATH\x1b[0m\n";
return;
echo "POSSIBLE INVALID ANDROID SDK PATH";
fi
if ! [ -f "${AndroidNdkDirectory}ndk-build" ]; then
printf "\x1b[31mINVALID ANDROID NDK PATH\x1b[0m\n";
return;
echo "POSSIBLE INVALID ANDROID NDK PATH";
fi

dotnet workload restore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public PartialHttpStream(string url, int cacheLen = CacheLen)

public override bool CanRead => true;
public override bool CanWrite => false;
public override bool CanSeek => true;
public override bool CanSeek => Length > 0;

public override long Position { get; set; }

Expand Down Expand Up @@ -238,7 +238,7 @@ private int HttpRead(byte[] buffer, ref int offset, ref int count, int Tries = 0
foreach (var Header in Headers)
req.Headers[Header.Key] = Header.Value;

if (length != null || Position > 0)
if (length > 0 || Position > 0)
req.AddRange(Position, Length - 1);

resp = req.GetResponse();
Expand Down Expand Up @@ -274,6 +274,9 @@ private int HttpRead(byte[] buffer, ref int offset, ref int count, int Tries = 0
nread += Readed;
} while (Readed > 0 && count > 0);

if (Readed == 0 && length is null or -1)
length = nread;

offset += nread;
count -= nread;

Expand Down
7 changes: 5 additions & 2 deletions DirectPackageInstaller/DirectPackageInstaller/SelfUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static string? MainExecutable

const string UpdateList = "Update.ini";

public static Version CurrentVersion = new Version("6.1.8");
public static Version CurrentVersion = new Version("6.1.9");

public static Version? LastVersion = null;

Expand Down Expand Up @@ -156,14 +156,17 @@ public async Task DownloadUpdate()

public bool FinishUpdatePending()
{
if (!App.IsAndroid)
if (App.IsAndroid)
{
try
{
if (Directory.Exists(TempUpdateDir))
{
Directory.Delete(TempUpdateDir, true);
}
}
catch { }

return false;
}

Expand Down

0 comments on commit bef0ec9

Please sign in to comment.