Skip to content

Commit

Permalink
v3.1.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Porog SSJ committed Oct 17, 2022
1 parent b918cde commit 4758f3f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
14 changes: 12 additions & 2 deletions PortableTerrariaCommon/PortableTerrariaCommon/SplitOutStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public override void Write(byte[] buffer, int offset, int count)
readonly InputStream inputStream;
readonly OutputStream outputStream;
readonly Action<Stream> writeDataToStream;
readonly Action<Exception> onError;
readonly int splitSize;
volatile byte[] buffer;
volatile int offset;
Expand All @@ -100,10 +101,12 @@ public override void Write(byte[] buffer, int offset, int count)

//constructor
public SplitOutStream(
Action<Stream> writeDataToStream, int splitSize)
Action<Stream> writeDataToStream, int splitSize,
Action<Exception> onError)
{
this.writeDataToStream = writeDataToStream;
this.splitSize = splitSize;
this.onError = onError;
inputStream = new InputStream(this);
outputStream = new OutputStream(this);
init();
Expand All @@ -120,7 +123,14 @@ void init()
Task.Run(() =>
{
//multithreaded write stream data
writeDataToStream(outputStream);
try
{
writeDataToStream(outputStream);
}
catch (Exception e)
{
onError(e);
}
ended = true;
lock (objLock)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ protected override void run()
void createPTL(Stream stream)
{
//edit exe embedded resources
Exception err = null;
using (var exe = GuiHelper.GetResourceStream(
"Sahlaysta.PortableTerrariaLauncher.exe"))
using (var ad = MonoCecilAssembly
Expand Down Expand Up @@ -160,7 +161,11 @@ void writeDataToStream(Stream s)
{
zipTerraria(s);
}
var sos = new SplitOutStream(writeDataToStream, splitSize);
void onError(Exception e)
{
err = e;
}
var sos = new SplitOutStream(writeDataToStream, splitSize, onError);
for (long i = 0; i < splitCount; i++)
{
string name = namep + "terraria.zip." + (i + 1).ToString(format);
Expand Down Expand Up @@ -194,6 +199,8 @@ void writeDataToStream(Stream s)
//write .exe
ad.Write(stream);
}
if (err != null)
throw err;
}
void zipTerraria(Stream stream)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.1.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]
[assembly: AssemblyVersion("3.1.1.0")]
[assembly: AssemblyFileVersion("3.1.1.0")]
[assembly: NeutralResourcesLanguage("")]
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.1.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]
[assembly: AssemblyVersion("3.1.1.0")]
[assembly: AssemblyFileVersion("3.1.1.0")]
Binary file not shown.

0 comments on commit 4758f3f

Please sign in to comment.