├── ErcTools
├── favicon.ico
├── App.xaml.cs
├── ViewModel
│ ├── MainViewModel.cs
│ └── ViewModelBase.cs
├── Command
│ ├── CloseWindowsCommand.cs
│ └── DelegateCommand.cs
├── ErcTools.csproj
├── App.xaml
├── MainWindow.xaml.cs
└── MainWindow.xaml
├── WPF_Best_Hosts
├── favicon.ico
├── App.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Domain
│ ├── DocumentationLinkType.cs
│ ├── DocumentationLinks.xaml.cs
│ ├── NotifyPropertyChangedExtension.cs
│ ├── MainWindowViewModel.cs
│ ├── AnotherCommandImplementation.cs
│ ├── DemoItem.cs
│ ├── DocumentationLink.cs
│ └── DocumentationLinks.xaml
├── Behaviour
│ ├── WebSpeedComparer.cs
│ ├── ResponseComparer.cs
│ └── DataGridSortBehavior.cs
├── App.xaml.cs
├── Model
│ ├── UpdateDataParams.cs
│ ├── HtmlSearch.cs
│ ├── HostsData.cs
│ └── PingData.cs
├── View
│ ├── Home.xaml
│ ├── Home.xaml.cs
│ ├── HostsManage.xaml
│ ├── HostsManage.xaml.cs
│ ├── IPTest.xaml
│ └── IPTest.xaml.cs
├── Converter
│ └── InverseBoolConvert.cs
├── XamlDisplayEx.cs
├── packages.config
├── Lib
│ ├── Utils.cs
│ ├── HttpHelper.cs
│ └── Hosts.cs
├── MainWindow.xaml.cs
├── MainWindow.xaml
├── App.xaml
└── WPF_Best_Hosts.csproj
├── README.assets
├── 1561103527447.png
├── 1561103547373.png
└── 1561103555928.png
├── Wpf_github_hosts
├── app.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── app.manifest
│ └── Resources.resx
├── App.xaml.cs
├── LogHelper.cs
├── packages.config
├── HtmlSearch.cs
├── HttpHelper.cs
├── ProgressBarHelper.cs
├── App.xaml
├── Model.cs
├── Hosts.cs
├── MainWindow.xaml
├── Wpf_github_hosts.csproj
└── MainWindow.xaml.cs
├── Wpf_github_hosts.sln.DotSettings
├── README.md
├── Wpf_github_hosts.sln
└── .gitignore
/ErcTools/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ercJuL/Wpf_github_hosts/HEAD/ErcTools/favicon.ico
--------------------------------------------------------------------------------
/WPF_Best_Hosts/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ercJuL/Wpf_github_hosts/HEAD/WPF_Best_Hosts/favicon.ico
--------------------------------------------------------------------------------
/README.assets/1561103527447.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ercJuL/Wpf_github_hosts/HEAD/README.assets/1561103527447.png
--------------------------------------------------------------------------------
/README.assets/1561103547373.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ercJuL/Wpf_github_hosts/HEAD/README.assets/1561103547373.png
--------------------------------------------------------------------------------
/README.assets/1561103555928.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ercJuL/Wpf_github_hosts/HEAD/README.assets/1561103555928.png
--------------------------------------------------------------------------------
/Wpf_github_hosts/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/WPF_Best_Hosts/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/WPF_Best_Hosts/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Wpf_github_hosts/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/WPF_Best_Hosts/Domain/DocumentationLinkType.cs:
--------------------------------------------------------------------------------
1 | namespace WPF_Best_Hosts.Domain
2 | {
3 | public enum DocumentationLinkType
4 | {
5 | Wiki,
6 | DemoPageSource,
7 | ControlSource,
8 | StyleSource,
9 | Video
10 | }
11 | }
--------------------------------------------------------------------------------
/Wpf_github_hosts/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace Wpf_github_hosts
9 | {
10 | ///
11 | /// App.xaml 的交互逻辑
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ErcTools/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace ErcTools
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/WPF_Best_Hosts/Domain/DocumentationLinks.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace WPF_Best_Hosts.Domain
4 | {
5 | ///
6 | /// Interaction logic for DocumentationLinks.xaml
7 | ///
8 | public partial class DocumentationLinks : UserControl
9 | {
10 | public DocumentationLinks()
11 | {
12 | InitializeComponent();
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Wpf_github_hosts.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
--------------------------------------------------------------------------------
/ErcTools/ViewModel/MainViewModel.cs:
--------------------------------------------------------------------------------
1 | using ErcTools.Command;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Input;
7 |
8 | namespace ErcTools.ViewModel
9 | {
10 | public class MainViewModel: ViewModelBase
11 | {
12 | public ICommand CloseWindowsCommand { get; }
13 | public MainViewModel()
14 | {
15 | CloseWindowsCommand = new CloseWindowsCommand();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/WPF_Best_Hosts/Behaviour/WebSpeedComparer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using WPF_Best_Hosts.Lib;
4 |
5 | namespace WPF_Best_Hosts.Behaviour
6 | {
7 | public class WebSpeedComparer : IComparer
8 | {
9 | public int Compare(object x, object y)
10 | {
11 | var xNum = Utils.InverseHumanReadableByteCount((string) x);
12 | var yNum = Utils.InverseHumanReadableByteCount((string) y);
13 |
14 | var result = xNum - yNum;
15 | return result == 0 ? 0 : (int) (Math.Abs(result) / result);
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/WPF_Best_Hosts/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using ShowMeTheXAML;
9 |
10 | namespace WPF_Best_Hosts
11 | {
12 | ///
13 | /// App.xaml 的交互逻辑
14 | ///
15 | public partial class App : Application
16 | {
17 | protected override void OnStartup(StartupEventArgs e)
18 | {
19 | XamlDisplay.Init();
20 | base.OnStartup(e);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Wpf_github_hosts/LogHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.CompilerServices;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Controls;
8 |
9 | namespace Wpf_github_hosts
10 | {
11 | public static class LogHelper
12 | {
13 | public static TextBlock LableComponent { get; set; }
14 |
15 | public static void UpdateLog(string message)
16 | {
17 | if (LableComponent != null)
18 | {
19 | LableComponent.Text = message;
20 | }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/WPF_Best_Hosts/Model/UpdateDataParams.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace WPF_Best_Hosts.Model
8 | {
9 | public class UpdateDataParams
10 | {
11 | public UpdateDataParams(string guidLocalKey, string domain, string encode)
12 | {
13 | GuidLocalKey = guidLocalKey;
14 | Domain = domain;
15 | Encode = encode;
16 | }
17 | public string GuidLocalKey { get; set; }
18 | public string Domain { get; set; }
19 | public string Encode { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/WPF_Best_Hosts/View/Home.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/WPF_Best_Hosts/View/Home.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | namespace WPF_Best_Hosts.View
16 | {
17 | ///
18 | /// Home.xaml 的交互逻辑
19 | ///
20 | public partial class Home : UserControl
21 | {
22 | public Home()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/WPF_Best_Hosts/Behaviour/ResponseComparer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Text.RegularExpressions;
7 | using System.Threading.Tasks;
8 | using WPF_Best_Hosts.Lib;
9 |
10 | namespace WPF_Best_Hosts.Behaviour
11 | {
12 | public class ResponseComparer: IComparer
13 | {
14 | public int Compare(object x, object y)
15 | {
16 | var xNum = Utils.StringToNum(x);
17 | var yNum = Utils.StringToNum(y);
18 |
19 | var result = xNum - yNum;
20 | return result == 0 ? 0 : (int) (Math.Abs(result) / result);
21 | }
22 |
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/WPF_Best_Hosts/Converter/InverseBoolConvert.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Data;
8 |
9 | namespace WPF_Best_Hosts.Converter
10 | {
11 | public class InverseBoolConvert: IValueConverter
12 | {
13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
14 | {
15 | return !(bool) value;
16 | }
17 |
18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
19 | {
20 | throw new NotImplementedException();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/WPF_Best_Hosts/XamlDisplayEx.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 |
4 | namespace WPF_Best_Hosts
5 | {
6 | public static class XamlDisplayEx
7 | {
8 | public static readonly DependencyProperty ButtonDockProperty = DependencyProperty.RegisterAttached(
9 | "ButtonDock", typeof(Dock), typeof(XamlDisplayEx), new PropertyMetadata(default(Dock)));
10 |
11 | public static void SetButtonDock(DependencyObject element, Dock value)
12 | {
13 | element.SetValue(ButtonDockProperty, value);
14 | }
15 |
16 | public static Dock GetButtonDock(DependencyObject element)
17 | {
18 | return (Dock) element.GetValue(ButtonDockProperty);
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/WPF_Best_Hosts/Domain/NotifyPropertyChangedExtension.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Runtime.CompilerServices;
5 |
6 | namespace WPF_Best_Hosts.Domain
7 | {
8 | public static class NotifyPropertyChangedExtension
9 | {
10 | public static void MutateVerbose(this INotifyPropertyChanged instance, ref TField field, TField newValue, Action raise, [CallerMemberName] string propertyName = null)
11 | {
12 | if (EqualityComparer.Default.Equals(field, newValue)) return;
13 | field = newValue;
14 | raise?.Invoke(new PropertyChangedEventArgs(propertyName));
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ErcTools/Command/CloseWindowsCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Windows.Input;
5 | using static System.Net.Mime.MediaTypeNames;
6 | using System;
7 |
8 | namespace ErcTools.Command
9 | {
10 | public class CloseWindowsCommand: ICommand
11 | {
12 | public event EventHandler CanExecuteChanged;
13 |
14 | public bool CanExecute(object parameter)
15 | {
16 | return true;
17 | }
18 |
19 | public void Execute(object parameter)
20 | {
21 | System.Windows.Application.Current.Shutdown();
22 | }
23 |
24 | public void InvokeCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/ErcTools/ErcTools.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | netcoreapp3.0
6 | true
7 | favicon.ico
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | PreserveNewest
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/ErcTools/ViewModel/ViewModelBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Runtime.CompilerServices;
5 | using System.Text;
6 |
7 | namespace ErcTools.ViewModel
8 | {
9 | public abstract class ViewModelBase : INotifyPropertyChanged
10 | {
11 | public event PropertyChangedEventHandler PropertyChanged;
12 |
13 | protected bool SetProperty(ref T field, T newValue, [CallerMemberName]string propertyName = null)
14 | {
15 | if (!EqualityComparer.Default.Equals(field, newValue))
16 | {
17 | field = newValue;
18 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
19 | return true;
20 | }
21 | return false;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/WPF_Best_Hosts/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/WPF_Best_Hosts/Domain/MainWindowViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Configuration;
3 | using System.Windows.Controls;
4 | using System.Windows.Documents;
5 | using MaterialDesignThemes.Wpf;
6 | using MaterialDesignThemes.Wpf.Transitions;
7 | using WPF_Best_Hosts.View;
8 |
9 | namespace WPF_Best_Hosts.Domain
10 | {
11 | public class MainWindowViewModel
12 | {
13 | public MainWindowViewModel(ISnackbarMessageQueue snackbarMessageQueue)
14 | {
15 | if (snackbarMessageQueue == null) throw new ArgumentNullException(nameof(snackbarMessageQueue));
16 |
17 | DemoItems = new []
18 | {
19 | new DemoItem("Home", new Home()),
20 | new DemoItem("IPTest", new IPTest()),
21 | new DemoItem("HostsManage", new HostsManage()),
22 | };
23 | }
24 |
25 | public DemoItem[] DemoItems { get; }
26 | }
27 | }
--------------------------------------------------------------------------------
/Wpf_github_hosts/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ErcTools/Command/DelegateCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Windows.Input;
5 |
6 | namespace ErcTools.Command
7 | {
8 | class DelegateCommand: ICommand
9 | {
10 | private readonly Action