Skip to content

Commit

Permalink
Fixed file write
Browse files Browse the repository at this point in the history
Better LauncherEx gzipping
  • Loading branch information
Aragas committed Apr 9, 2024
1 parent 88603db commit 2903577
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<!--Development Variables-->
<PropertyGroup>
<Version>1.4.13</Version>
<Version>1.5.0</Version>
<HarmonyVersion>2.2.2</HarmonyVersion>
<BUTRSharedVersion>3.0.0.138</BUTRSharedVersion>
<BUTRModuleManagerVersion>5.0.221</BUTRModuleManagerVersion>
Expand Down
2 changes: 1 addition & 1 deletion build/common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if (Files.Length > 0)
Log.LogMessage(MessageImportance.Normal, $"EmbeddedResource Src: {sourceItemSpec}");
using (var sourceStream = File.OpenRead(sourcePath))
using (var destinationStream = File.OpenWrite(destinationPath))
using (var destinationStream = new FileStream(destinationPath, FileMode.Truncate, FileAccess.Write))
using (var destinationGZip = new GZipStream(destinationStream, CompressionLevel.Optimal))
{
sourceStream.CopyTo(destinationGZip);
Expand Down
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 1.5.0
Game Versions: v1.0.0,v1.0.1,v1.0.2,v1.0.3,v1.1.0,v1.1.1,v1.1.2,v1.1.3,v1.1.4,v1.1.5,v1.1.6,v1.2.x
* BETA Release!
* Switched to new launcher manager backend
---------------------------------------------------------------------------------------------------
Version: 1.4.12
Game Versions: v1.0.0,v1.0.1,v1.0.2,v1.0.3,v1.1.0,v1.1.1,v1.1.2,v1.1.3,v1.1.4,v1.1.5,v1.1.6,v1.2.9
* Adapted to v1.2.9. Thanks to jzebedee!
Expand Down
6 changes: 4 additions & 2 deletions src/Bannerlord.BLSE.Shared/Bannerlord.BLSE.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@
<LauncherExProject>$(MSBuildThisFileDirectory)..\Bannerlord.LauncherEx\Bannerlord.LauncherEx.csproj</LauncherExProject>
<LauncherExProjectFull>"$([System.IO.Path]::GetFullPath('$(LauncherExProject)'))"</LauncherExProjectFull>
</PropertyGroup>
<Message Text="dotnet build $(LauncherExProjectFull) --target:BuildExtended -p:GameVersion=%(GameAPIVersion.GameVersion) -p:Configuration=$(Configuration)_%(GameAPIVersion.Flat) -p:ILRepackBuildEnable=true" Importance="High" />
<Exec Command="dotnet build $(LauncherExProjectFull) --target:BuildExtended -p:GameVersion=%(GameAPIVersion.GameVersion) -p:Configuration=$(Configuration)_%(GameAPIVersion.Flat) -p:ILRepackBuildEnable=true" />
<Message Text="dotnet clean $(LauncherExProjectFull) -p:Configuration=$(Configuration)_%(GameAPIVersion.Flat)" Importance="High" />
<Exec Command="dotnet clean $(LauncherExProjectFull) -p:Configuration=$(Configuration)_%(GameAPIVersion.Flat)" />
<Message Text="dotnet build $(LauncherExProjectFull) --force -p:GameVersion=%(GameAPIVersion.GameVersion) -p:Configuration=$(Configuration)_%(GameAPIVersion.Flat)" Importance="High" />
<Exec Command="dotnet build $(LauncherExProjectFull) --force -p:GameVersion=%(GameAPIVersion.GameVersion) -p:Configuration=$(Configuration)_%(GameAPIVersion.Flat)" />
</Target>
<Target Condition="$(Configuration) == 'Release'" Name="BeforeBuildCompress" AfterTargets="BeforeBuildLauncherEx">
<GZip Files="@(EmbeddedResource)">
Expand Down
4 changes: 2 additions & 2 deletions src/Bannerlord.LauncherEx/Adapters/DialogProviderImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void SendDialog(DialogType type, string title, string message, IReadOnlyL
}
case DialogType.FileOpen:
{
var filter = string.Join("|", filters.Select(x => $"{x.Name} ({string.Join((string) ", ", (IEnumerable<string>) x.Extensions)}|{string.Join((string) ", ", (IEnumerable<string>) x.Extensions)}"));
var filter = string.Join("|", filters.Select(x => $"{x.Name} {string.Join((string) ", ", x.Extensions)}|{string.Join((string) ", ", x.Extensions)}"));
var dialog = new OpenFileDialog
{
Title = title,
Expand All @@ -51,7 +51,7 @@ public void SendDialog(DialogType type, string title, string message, IReadOnlyL
case DialogType.FileSave:
{
var fileName = message;
var filter = string.Join("|", filters.Select(x => $"{x.Name} ({string.Join(", ", x.Extensions)}|{string.Join(", ", x.Extensions)}"));
var filter = string.Join("|", filters.Select(x => $"{x.Name} {string.Join(", ", x.Extensions)}|{string.Join(", ", x.Extensions)}"));
var dialog = new SaveFileDialog
{
Title = title,
Expand Down
4 changes: 1 addition & 3 deletions src/Bannerlord.LauncherEx/Adapters/FileSystemProviderImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal sealed class FileSystemProviderImpl : IFileSystemProvider
using var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
var data = new byte[length];
fs.Seek(offset, SeekOrigin.Begin);
fs.Read(data, 0, length);
_ = fs.Read(data, 0, length);
return data;
}
else
Expand All @@ -41,8 +41,6 @@ internal sealed class FileSystemProviderImpl : IFileSystemProvider

public void WriteFileContent(string filePath, byte[]? data)
{
if (!File.Exists(filePath)) return;

try
{
if (data is null)
Expand Down
21 changes: 8 additions & 13 deletions src/Bannerlord.LauncherEx/Bannerlord.LauncherEx.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<PlatformTarget>x64</PlatformTarget>
<DebugType>full</DebugType>
<DebugType>portable</DebugType>
<Version>1.25.0</Version>
<PolySharpExcludeGeneratedTypes>System.Diagnostics.CodeAnalysis.UnscopedRefAttribute</PolySharpExcludeGeneratedTypes>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
Expand All @@ -18,16 +18,15 @@
<ILRepackMergeDebugSymbols>true</ILRepackMergeDebugSymbols>
<ILRepackPerformInternalize>true</ILRepackPerformInternalize>
<ILRepackCopyAttributes>false</ILRepackCopyAttributes>
<ILRepackBuildToolingPath Condition="$(Configuration) != 'Debug'">$(PkgBUTR_ILRepack)\tools\net461\ILRepack.exe</ILRepackBuildToolingPath>
<!--
<GameVersion>1.1.0</GameVersion>
</PropertyGroup>

<PropertyGroup Condition="$(Configuration) == 'Debug'">
<GameVersion>1.2.0</GameVersion>
<GameVersionFlat>$([System.String]::Copy('$(GameVersion)').Replace('.',''))</GameVersionFlat>
<GameVersionConstant>v$(GameVersionFlat)</GameVersionConstant>
-->

<DefineConstants>$(DefineConstants);$(GameVersionConstant)</DefineConstants>
</PropertyGroup>

<PropertyGroup>
<PackageId>Bannerlord.LauncherEx</PackageId>
<Title>Bannerlord.LauncherEx</Title>
Expand Down Expand Up @@ -78,12 +77,8 @@
</AssemblyAttribute>
</ItemGroup>
</Target>

<Target Name="BuildExtended">
<CallTarget Targets="Build" />
</Target>

<Target Name="ExcludeAssembliesFromILRepack" BeforeTargets="ILRepackPrepare">

<Target Name="ExcludeAssembliesFromILRepack" BeforeTargets="ILRepackPrepareBuild">
<PropertyGroup>
<ILRepackExcludeAssemblies>$(ILRepackExcludeAssemblies);$(ProjectDir)$(OutputPath)System.Drawing.dll;</ILRepackExcludeAssemblies>
<ILRepackExcludeAssemblies>$(ILRepackExcludeAssemblies);$(ProjectDir)$(OutputPath)System.Drawing.Common.dll;</ILRepackExcludeAssemblies>
Expand Down

0 comments on commit 2903577

Please sign in to comment.