Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightczx committed Dec 8, 2024
1 parent 7f10c81 commit ea14b5e
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ private static List<TEntity> AdjustIndex(List<TEntity> list)
Span<TEntity> span = CollectionsMarshal.AsSpan(list);
for (int i = 0; i < span.Length; i++)
{
ref readonly TEntity item = ref span[i];
item.Index = i;
span[i].Index = i;
}

return list;
Expand Down Expand Up @@ -89,8 +88,7 @@ private static List<TEntityAccess> AdjustIndex(List<TEntityAccess> list)
Span<TEntityAccess> span = CollectionsMarshal.AsSpan(list);
for (int i = 0; i < span.Length; i++)
{
ref readonly TEntityAccess item = ref span[i];
item.Entity.Index = i;
span[i].Entity.Index = i;
}

return list;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
namespace Snap.Hutao.Core.DependencyInjection.Abstraction;

[ConstructorGenerated]
internal abstract partial class OverseaSupportFactory<TClient, TClientCN, TClientOS> : IOverseaSupportFactory<TClient>
internal abstract partial class OverseaSupportFactory<TClient, TClientCn, TClientOs> : IOverseaSupportFactory<TClient>
where TClient : notnull
where TClientCN : TClient
where TClientOS : TClient
where TClientCn : TClient
where TClientOs : TClient
{
private readonly IServiceProvider serviceProvider;

public TClient Create(bool isOversea)
{
return isOversea
? serviceProvider.GetRequiredService<TClientOS>()
: serviceProvider.GetRequiredService<TClientCN>();
? serviceProvider.GetRequiredService<TClientOs>()
: serviceProvider.GetRequiredService<TClientCn>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,6 @@ public void Dispose()
(InnerProxy as IDisposable)?.Dispose();
}

public void OnSystemProxySettingsChanged()
{
UpdateInnerProxy();

Debug.Assert(XamlApplicationLifetime.IsDispatcherQueueInitialized, "DispatcherQueue not initialized");
// TaskContext can't be injected directly, we have to retrieve it from the service provider after
ITaskContext taskContext = serviceProvider.GetRequiredService<ITaskContext>();
taskContext.BeginInvokeOnMainThread(() => OnPropertyChanged(nameof(CurrentProxyUri)));
}

[Command("EnableLoopbackCommand")]
public void EnableLoopback()
{
loopbackSupport.EnableLoopback();
Expand All @@ -120,4 +109,15 @@ private void UpdateInnerProxy()

InnerProxy = proxy;
}

private void OnSystemProxySettingsChanged()
{
UpdateInnerProxy();

Debug.Assert(XamlApplicationLifetime.IsDispatcherQueueInitialized, "DispatcherQueue not initialized");

// TaskContext can't be injected directly, we have to retrieve it from the service provider after
ITaskContext taskContext = serviceProvider.GetRequiredService<ITaskContext>();
taskContext.BeginInvokeOnMainThread(() => OnPropertyChanged(nameof(CurrentProxyUri)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Snap.Hutao.Core.IO.Http.Sharding;

[Obsolete("Dangerous to use")]
[DebuggerTypeProxy(typeof(HttpShardsDebugView))]
internal sealed class AsyncHttpShards : IAsyncEnumerable<IHttpShard>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace Snap.Hutao.Core.IO.Http.Sharding;

[Obsolete("Dangerous to use")]
internal static class HttpShardCopyWorker
{
public static async ValueTask<IHttpShardCopyWorker<TStatus>> CreateAsync<TStatus>(HttpShardCopyWorkerOptions<TStatus> options)
Expand All @@ -18,6 +19,7 @@ public static async ValueTask<IHttpShardCopyWorker<TStatus>> CreateAsync<TStatus
}
}

[Obsolete("Dangerous to use")]
[SuppressMessage("", "SA1402")]
internal sealed partial class HttpShardCopyWorker<TStatus> : IHttpShardCopyWorker<TStatus>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Snap.Hutao.Core.IO.Http.Sharding;

[Obsolete("Dangerous to use")]
internal sealed class HttpShardCopyWorkerOptions<TStatus>
{
private readonly LazySlim<SafeFileHandle> lazyDestinationFileHandle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Snap.Hutao.Core.IO.Http.Sharding;

[Obsolete("Dangerous to use")]
internal interface IHttpShard
{
long Start { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Snap.Hutao.Core.IO.Http.Sharding;

[Obsolete("Dangerous to use")]
internal interface IHttpShardCopyWorker<out TStatus> : IDisposable
{
[SuppressMessage("", "SH003")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
MaxWidth="360"
Margin="0,16,0,0"
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource StringBoolConverter}, Mode=OneWay}"
Password="{x:Bind Password, Mode=TwoWay}"
Password="{x:Bind Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
PasswordChar="*"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportPasswordHint}"/>
<TextBlock
Expand Down
5 changes: 0 additions & 5 deletions src/Snap.Hutao/Snap.Hutao/UI/Xaml/View/Page/TestPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,6 @@
Header="Check path belongs to a SSD"
IsClickEnabled="True"/>

<cwc:SettingsCard
Command="{Binding TestHttpShardDownload}"
Header="Http Shard Test"
IsClickEnabled="True"/>

<cwc:SettingsCard
Command="{Binding RunCodeCommand}"
Header="Run Script Code"
Expand Down

0 comments on commit ea14b5e

Please sign in to comment.