fix bug
This commit is contained in:
parent
7c2e717eda
commit
31655bf890
@ -2,6 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<Version>2.0.5</Version>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
|
||||
<IsWebConfigTransformDisabled>true</IsWebConfigTransformDisabled>
|
||||
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
|
||||
<Description>github加速神器</Description>
|
||||
|
||||
@ -30,6 +30,17 @@ namespace FastGithub.FlowAnalyze
|
||||
}
|
||||
|
||||
private static void Add(ConcurrentQueue<QueueItem> quques, int length)
|
||||
{
|
||||
var ticks = Flush(quques);
|
||||
quques.Enqueue(new QueueItem(ticks, length));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新队列
|
||||
/// </summary>
|
||||
/// <param name="quques"></param>
|
||||
/// <returns></returns>
|
||||
private static long Flush(ConcurrentQueue<QueueItem> quques)
|
||||
{
|
||||
var ticks = Environment.TickCount64;
|
||||
while (quques.TryPeek(out var item))
|
||||
@ -43,17 +54,23 @@ namespace FastGithub.FlowAnalyze
|
||||
quques.TryDequeue(out _);
|
||||
}
|
||||
}
|
||||
quques.Enqueue(new QueueItem(ticks, length));
|
||||
return ticks;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取速率
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public FlowRate GetFlowRate()
|
||||
{
|
||||
Flush(this.readQueue);
|
||||
var readRate = (double)this.readQueue.Sum(item => item.Length) / INTERVAL_SECONDS;
|
||||
|
||||
Flush(this.writeQueue);
|
||||
var writeRate = (double)this.writeQueue.Sum(item => item.Length) / INTERVAL_SECONDS;
|
||||
|
||||
return new FlowRate { ReadRate = readRate, WriteRate = writeRate };
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,8 +92,11 @@ namespace FastGithub
|
||||
|
||||
var httpsPort = ReverseProxyPort.Https;
|
||||
kestrel.Listen(IPAddress.Loopback, httpsPort, listen =>
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
listen.UseFlowAnalyze();
|
||||
}
|
||||
listen.UseHttps(https =>
|
||||
{
|
||||
https.ServerCertificateSelector = (ctx, domain) => certService.GetOrCreateServerCert(domain);
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
using System.Windows;
|
||||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
|
||||
namespace FastGithub.UI
|
||||
{
|
||||
@ -7,5 +9,12 @@ namespace FastGithub.UI
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
var emulation = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", true);
|
||||
var key = $"{Process.GetCurrentProcess().ProcessName}.exe";
|
||||
emulation.SetValue(key, 9000, RegistryValueKind.DWord);
|
||||
base.OnStartup(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,12 +8,13 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>FastGithub.UI</RootNamespace>
|
||||
<AssemblyName>FastGithub.UI</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:FastGithub.UI"
|
||||
mc:Ignorable="d"
|
||||
Title="FastGithub" Height="640" Width="960" WindowStartupLocation="CenterScreen">
|
||||
Title="FastGithub" Height="480" Width="640" WindowStartupLocation="CenterScreen">
|
||||
|
||||
<Window.Resources>
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
@ -93,6 +93,7 @@
|
||||
<Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Top"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="Foreground" TargetName="txt" Value="#37aefe"/>
|
||||
</MultiDataTrigger>
|
||||
<MultiDataTrigger>
|
||||
@ -129,6 +130,7 @@
|
||||
<Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="true"/>
|
||||
<Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Top"/>
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="Panel.ZIndex" Value="1"/>
|
||||
<Setter Property="Foreground" TargetName="txt" Value="#37aefe"/>
|
||||
<Setter Property="BorderThickness" TargetName="_underline" Value="0 0 0 2"/>
|
||||
|
||||
40
FastGithub.UI/Properties/Resources.Designer.cs
generated
40
FastGithub.UI/Properties/Resources.Designer.cs
generated
@ -3,47 +3,42 @@
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FastGithub.UI.Properties
|
||||
{
|
||||
namespace FastGithub.UI.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 强类型资源类,用于查找本地化字符串等。
|
||||
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存 ResourceManager 实例。
|
||||
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FastGithub.UI.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
@ -56,14 +51,11 @@ namespace FastGithub.UI.Properties
|
||||
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
22
FastGithub.UI/Properties/Settings.Designer.cs
generated
22
FastGithub.UI/Properties/Settings.Designer.cs
generated
@ -1,28 +1,24 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FastGithub.UI.Properties
|
||||
{
|
||||
namespace FastGithub.UI.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,10 +45,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="wwwroot\flow.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="wwwroot\cert.html">
|
||||
<Content Update="wwwroot\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user