Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SenexCrenshaw committed Jul 13, 2023
1 parent 7316a83 commit 67333e1
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions StreamMasterApplication/Settings/Commands/UpdateSettingRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,38 @@ namespace StreamMasterApplication.Settings.Commands;

public class UpdateSettingRequest : IRequest<UpdateSettingResponse>
{
public AuthenticationType? AuthenticationMethod { get; set; }
public string? AdminPassword { get; set; }
public string? AdminUserName { get; set; }
public string? ApiKey { get; set; }
public bool? EnableSSL { get; set; }
public AuthenticationType? AuthenticationMethod { get; set; }
public bool? CacheIcons { get; set; }
public bool? CleanURLs { get; set; }

public bool? UseDummyEPGForBlanks { get; set; }
public bool? M3UFieldCUID { get; set; }
public string? ClientUserAgent { get; set; }
public string? DeviceID { get; set; }
public bool? EnableSSL { get; set; }
public string? FFMPegExecutable { get; set; }
public long? FirstFreeNumber { get; set; }
public bool? M3UFieldChannelId { get; set; }
public bool? M3UFieldChannelNumber { get; set; }
public bool? M3UFieldTvgName { get; set; }
public bool? M3UFieldCUID { get; set; }
public bool? M3UFieldGroupTitle { get; set; }
public bool? M3UFieldTvgChno { get; set; }
public bool? M3UFieldTvgId { get; set; }
public bool? M3UFieldTvgLogo { get; set; }
public bool? M3UFieldGroupTitle { get; set; }

public string? StreamingClientUserAgent { get; set; }
public string? ClientUserAgent { get; set; }
public string? DeviceID { get; set; }
public string? FFMPegExecutable { get; set; }
public string? SSLCertPath { get; set; }
public string? SSLCertPassword { get; set; }
public long? FirstFreeNumber { get; set; }
public bool? M3UFieldTvgName { get; set; }
public int? MaxConnectRetry { get; set; }
public int? MaxConnectRetryTimeMS { get; set; }
public bool? OverWriteM3UChannels { get; set; }
public int? PreloadPercentage { get; set; }
public int? RingBufferSizeMB { get; set; }
public string? SDPassword { get; set; }
public string? SDUserName { get; set; }
public int? SourceBufferPreBufferPercentage { get; set; }
public string? SSLCertPassword { get; set; }
public string? SSLCertPath { get; set; }
public string? StreamingClientUserAgent { get; set; }
public StreamingProxyTypes? StreamingProxyType { get; set; }
public bool? UseDummyEPGForBlanks { get; set; }
}

public class UpdateSettingValidator : AbstractValidator<UpdateSettingRequest>
Expand All @@ -69,12 +68,6 @@ public UpdateSettingHandler(ILogger<UpdateSettingRequest> logger, IMapper mapper
_hubContext = hubContext;
}

public class UpdateSettingResponse
{
public SettingDto Settings { get; set; }
public bool NeedsLogOut { get; set; }
}

public async Task<UpdateSettingResponse> Handle(UpdateSettingRequest request, CancellationToken cancellationToken)
{
Setting currentSetting = FileUtil.GetSetting();
Expand Down Expand Up @@ -225,6 +218,11 @@ private static bool UpdateSetting(Setting currentSetting, UpdateSettingRequest r
currentSetting.MaxConnectRetryTimeMS = (int)request.MaxConnectRetryTimeMS;
}

if (request.PreloadPercentage != null && request.PreloadPercentage >= 0 && request.PreloadPercentage <= 100 && request.PreloadPercentage != currentSetting.PreloadPercentage)
{
currentSetting.PreloadPercentage = (int)request.PreloadPercentage;
}

if (request.RingBufferSizeMB != null && request.RingBufferSizeMB >= 0 && request.RingBufferSizeMB != currentSetting.RingBufferSizeMB)
{
currentSetting.RingBufferSizeMB = (int)request.RingBufferSizeMB;
Expand Down Expand Up @@ -253,4 +251,10 @@ private static bool UpdateSetting(Setting currentSetting, UpdateSettingRequest r

return needsLogOut;
}
}

public class UpdateSettingResponse
{
public bool NeedsLogOut { get; set; }
public SettingDto Settings { get; set; }
}
}

0 comments on commit 67333e1

Please sign in to comment.