Skip to content

Commit

Permalink
fix: Fix FileUtil.GetFileDataStream to return a
Browse files Browse the repository at this point in the history
  • Loading branch information
SenexCrenshaw committed Feb 8, 2024
1 parent fa67e13 commit 7eace41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions StreamMaster.Application/Hub/StreamMasterHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class SignalRMessage

public partial class StreamMasterHub(ISender mediator, ISettingsService settingsService, IBackgroundTaskQueue taskQueue) : Hub<IStreamMasterHub>, ISharedHub
{
private static readonly ConcurrentHashSet<string> _connections = new();
private static readonly ConcurrentHashSet<string> _connections = [];

public static bool IsConnected
{
Expand All @@ -49,7 +49,7 @@ public override async Task OnDisconnectedAsync(Exception exception)



public Task<bool> GetIsSystemReady()
public Task<bool> GetIsSystemReady(object waste)
{
return mediator.Send(new GetIsSystemReadyRequest());
}
Expand Down
13 changes: 5 additions & 8 deletions StreamMaster.Domain/Common/FileUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static string CleanUpFileName(string fullName)
{

XmlSerializer serializer = new(typeof(XMLTV));
using StreamReader reader = GetFileDataStream(filepath);
using Stream reader = GetFileDataStream(filepath);
object? result = serializer.Deserialize(reader);
return (XMLTV?)result;
}
Expand Down Expand Up @@ -229,18 +229,15 @@ public static async Task<string> GetContentType(string Url)



public static StreamReader GetFileDataStream(string source)
public static Stream GetFileDataStream(string source)
{

if (!IsFileGzipped(source))
{
using StreamReader readerf = new(source, Encoding.Default);
return readerf;
return File.OpenRead(source);
}
using FileStream fs = File.OpenRead(source);
using GZipStream gzStream = new(fs, CompressionMode.Decompress);
using StreamReader reader = new(gzStream, Encoding.Default);
return reader;
FileStream fs = File.OpenRead(source);
return new GZipStream(fs, CompressionMode.Decompress);
}

public static async Task<string> GetFileData(string source)
Expand Down

0 comments on commit 7eace41

Please sign in to comment.