Auto formatting

This commit is contained in:
2022-05-02 02:04:40 -04:00
parent f103dc7bed
commit b2516fc80a
64 changed files with 683 additions and 548 deletions
-1
View File
@@ -29,7 +29,6 @@ public interface IToastService
public interface IDataCollectionService
{
public void SendEvent<T>(string eventName, T eventData);
}
public interface IStorageService
+4 -13
View File
@@ -343,16 +343,10 @@ public class BuildOrderService : IBuildOrderService
var checkedInterval = _lastInterval;
if (supply == null || production == null || supply.Takes.Equals(0))
{
return 1;
}
if (supply == null || production == null || supply.Takes.Equals(0)) return 1;
var producedBy = production.ProducedBy;
if (producedBy == null)
{
return 1;
}
if (producedBy == null) return 1;
var uniqueCompleted = _buildOrder.UniqueCompleted[producedBy];
@@ -372,7 +366,7 @@ public class BuildOrderService : IBuildOrderService
usedSlots += used.UsedSlots;
var duration = used.StopUsageTime - used.StartingUsageTime;
if (duration < shortestIncrement) shortestIncrement = duration;
}
}
if (usedSlots + supply.Takes <= trainingSlots)
{
@@ -389,10 +383,7 @@ public class BuildOrderService : IBuildOrderService
checkedInterval += shortestIncrement;
didDelay = true;
if (shortestIncrement == int.MaxValue)
{
return null;
}
if (shortestIncrement == int.MaxValue) return null;
}
}
+3 -2
View File
@@ -1,5 +1,4 @@
using Model.Entity.Data;
using Model.Types;
using static Services.IEntityFilterService;
namespace Services.Immortal;
@@ -16,7 +15,9 @@ public class EntityFilterService : IEntityFilterService
{
private readonly List<string> _entityChoices = new();
private readonly List<string> _factionChoices = new() { DataType.Any, DataType.FACTION_QRath, DataType.FACTION_Aru };
private readonly List<string> _factionChoices = new()
{ DataType.Any, DataType.FACTION_QRath, DataType.FACTION_Aru };
private readonly List<string> _immortalChoices = new();
private string _entityType = EntityType.Army;
private string _searchText = "";
@@ -5,15 +5,14 @@ namespace Services.Immortal;
public class ImmortalSelectionService : IImmortalSelectionService, IDisposable
{
private readonly IStorageService _storageService;
private string _selectedFaction = DataType.FACTION_QRath;
private string _selectedImmortal = DataType.IMMORTAL_Orzum;
private readonly IStorageService _storageService;
public ImmortalSelectionService(IStorageService storageService)
{
_storageService = storageService;
_storageService.Subscribe(RefreshDefaults);
RefreshDefaults();
@@ -73,7 +72,7 @@ public class ImmortalSelectionService : IImmortalSelectionService, IDisposable
if (foundFaction != null) _selectedFaction = foundFaction;
if (foundImmortal != null) _selectedImmortal = foundImmortal;
NotifyDataChanged();
}
+6 -6
View File
@@ -15,15 +15,15 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Blazor-Analytics" Version="3.11.0" />
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0-preview.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.ProtectedBrowserStorage" Version="5.0.0-rc.1.20451.17" />
<PackageReference Include="Microsoft.JSInterop" Version="7.0.0-preview.2.22153.2" />
<PackageReference Include="YamlDotNet" Version="11.2.1" />
<PackageReference Include="Blazor-Analytics" Version="3.11.0"/>
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0-preview.1"/>
<PackageReference Include="Microsoft.AspNetCore.Components.ProtectedBrowserStorage" Version="5.0.0-rc.1.20451.17"/>
<PackageReference Include="Microsoft.JSInterop" Version="7.0.0-preview.2.22153.2"/>
<PackageReference Include="YamlDotNet" Version="11.2.1"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\Model\Model.csproj"/>
</ItemGroup>
</Project>
+10 -15
View File
@@ -1,6 +1,4 @@
using Blazor.Analytics;
using Blazored.LocalStorage;
using Model.Feedback;
namespace Services.Website;
@@ -14,37 +12,34 @@ public class DataCollectionKeys
public class DataCollectionService : IDataCollectionService, IDisposable
{
private readonly IAnalytics _globalTracking;
private readonly IStorageService _storageService;
private bool _isEnabled = false;
private readonly IAnalytics _globalTracking;
private bool _isEnabled;
public DataCollectionService(IAnalytics globalTracking,
IStorageService storageService)
{
_globalTracking = globalTracking;
_storageService = storageService;
_storageService.Subscribe(Refresh);
Refresh();
}
public void SendEvent<T>(string eventName, T eventData)
{
if (_isEnabled) _globalTracking.TrackEvent(eventName, eventData);
}
void IDisposable.Dispose()
{
_storageService.Unsubscribe(Refresh);
}
private void Refresh()
{
_isEnabled = _storageService.GetValue<bool>(StorageKeys.EnabledDataCollection);
}
public void SendEvent<T>(string eventName, T eventData)
{
if (_isEnabled)
{
_globalTracking.TrackEvent(eventName, eventData);
}
}
}
+2 -9
View File
@@ -1,7 +1,4 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Model.Entity.Data;
using Model.Website;
namespace Services.Website;
@@ -18,11 +15,7 @@ public class DialogService : IDialogService
{
private DialogContents _dialogContents;
public DialogService()
{
}
public bool IsVisible { get; set; }
public bool IsVisible { get; set; }
public void Subscribe(Action action)
{
@@ -38,7 +31,7 @@ public class DialogService : IDialogService
{
_dialogContents = dialogContents;
IsVisible = true;
NotifyDataChanged();
}
+2 -2
View File
@@ -4,8 +4,8 @@ namespace Services.Website;
public class PermissionService : IPermissionService, IDisposable
{
private IJSRuntime _jsRuntime;
private readonly IStorageService _storageService;
private IJSRuntime _jsRuntime;
private IToastService _toastService;
private bool isLoaded;
private bool isStorageEnabled = false;
@@ -15,7 +15,7 @@ public class PermissionService : IPermissionService, IDisposable
_jsRuntime = jsRuntime;
_toastService = toastService;
_storageService = storageService;
_storageService.Subscribe(NotifyDataChanged);
}
+4 -4
View File
@@ -61,7 +61,7 @@ public class SearchService : ISearchService
{
Title = webPage.Name,
PointType = "WebPage",
Summary = $"{webPage.Description}",
Summary = $"{webPage.Description}",
Href = webPage.Href
});
@@ -73,7 +73,7 @@ public class SearchService : ISearchService
SearchPoints.Add(new SearchPointModel
{
Title = note.Name,
PointType = "Note",
PointType = "Note",
Href = note.GetNoteLink(),
Summary = note.Description
});
@@ -84,13 +84,13 @@ public class SearchService : ISearchService
foreach (var entity in DATA.Get().Values)
{
var summary =
var summary =
entity.Info().Description.Length > 35
? entity.Info().Description.Substring(0, 30).Trim() + "..."
: entity.Info().Description.Length > 0
? entity.Info().Description
: "";
SearchPoints.Add(new SearchPointModel
{
Title = entity.Info().Name,
+1
View File
@@ -93,6 +93,7 @@ public class StorageService : IStorageService
}
private event Action OnChange = null!;
private void NotifyDataChanged()
{
OnChange();