mirror of
https://github.com/proxysu/ProxySU.git
synced 2024-11-22 05:06:08 +03:00
hysterial model
This commit is contained in:
parent
ac003d476b
commit
5db61a02b5
23
ProxySuper.Core/Models/Projects/HysteriaSettings.cs
Normal file
23
ProxySuper.Core/Models/Projects/HysteriaSettings.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProxySuper.Core.Models.Projects
|
||||||
|
{
|
||||||
|
public class HysteriaSettings
|
||||||
|
{
|
||||||
|
public string Domain { get; set; } = "";
|
||||||
|
|
||||||
|
public string Obfs { get; set; } = "";
|
||||||
|
|
||||||
|
public string Email { get; set; } = "";
|
||||||
|
|
||||||
|
public int Port { get; set; } = 36712;
|
||||||
|
|
||||||
|
public int UpMbps { get; set; } = 300;
|
||||||
|
|
||||||
|
public int DownMbps { get; set; } = 300;
|
||||||
|
}
|
||||||
|
}
|
@ -8,5 +8,6 @@
|
|||||||
Brook = 3,
|
Brook = 3,
|
||||||
V2ray = 4,
|
V2ray = 4,
|
||||||
MTProtoGo = 5,
|
MTProtoGo = 5,
|
||||||
|
Hysteria = 6,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,9 @@ namespace ProxySuper.Core.Models
|
|||||||
[JsonProperty("mtProtoGoSettings")]
|
[JsonProperty("mtProtoGoSettings")]
|
||||||
public MTProtoGoSettings MTProtoGoSettings { get; set; }
|
public MTProtoGoSettings MTProtoGoSettings { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty]
|
||||||
|
public HysteriaSettings HysteriaSettings { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public ProjectType Type
|
public ProjectType Type
|
||||||
@ -67,6 +70,8 @@ namespace ProxySuper.Core.Models
|
|||||||
|
|
||||||
if (MTProtoGoSettings != null) return ProjectType.MTProtoGo;
|
if (MTProtoGoSettings != null) return ProjectType.MTProtoGo;
|
||||||
|
|
||||||
|
if (HysteriaSettings != null) return ProjectType.Hysteria;
|
||||||
|
|
||||||
return ProjectType.Brook;
|
return ProjectType.Brook;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,7 @@
|
|||||||
<Compile Include="Models\ProjectProgress.cs" />
|
<Compile Include="Models\ProjectProgress.cs" />
|
||||||
<Compile Include="Models\Projects\BrookSettings.cs" />
|
<Compile Include="Models\Projects\BrookSettings.cs" />
|
||||||
<Compile Include="Models\Projects\BrookType.cs" />
|
<Compile Include="Models\Projects\BrookType.cs" />
|
||||||
|
<Compile Include="Models\Projects\HysteriaSettings.cs" />
|
||||||
<Compile Include="Models\Projects\IProjectSettings.cs" />
|
<Compile Include="Models\Projects\IProjectSettings.cs" />
|
||||||
<Compile Include="Models\Hosts\LocalProxy.cs" />
|
<Compile Include="Models\Hosts\LocalProxy.cs" />
|
||||||
<Compile Include="Models\Projects\MTProtoGoSettings.cs" />
|
<Compile Include="Models\Projects\MTProtoGoSettings.cs" />
|
||||||
@ -122,6 +123,8 @@
|
|||||||
<Compile Include="ViewModels\BrookInstallViewModel.cs" />
|
<Compile Include="ViewModels\BrookInstallViewModel.cs" />
|
||||||
<Compile Include="ViewModels\EnableRootViewModel.cs" />
|
<Compile Include="ViewModels\EnableRootViewModel.cs" />
|
||||||
<Compile Include="ViewModels\HomeViewModel.cs" />
|
<Compile Include="ViewModels\HomeViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\HysteriaEditorViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\HysteriaInstallViewModel.cs" />
|
||||||
<Compile Include="ViewModels\MTProtoGoConfigViewModel.cs" />
|
<Compile Include="ViewModels\MTProtoGoConfigViewModel.cs" />
|
||||||
<Compile Include="ViewModels\MTProtoGoEditorViewModel.cs" />
|
<Compile Include="ViewModels\MTProtoGoEditorViewModel.cs" />
|
||||||
<Compile Include="ViewModels\MTProtoGoInstallViewModel.cs" />
|
<Compile Include="ViewModels\MTProtoGoInstallViewModel.cs" />
|
||||||
|
63
ProxySuper.Core/ViewModels/HysteriaEditorViewModel.cs
Normal file
63
ProxySuper.Core/ViewModels/HysteriaEditorViewModel.cs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
using MvvmCross.Navigation;
|
||||||
|
using MvvmCross.ViewModels;
|
||||||
|
using ProxySuper.Core.Models;
|
||||||
|
using ProxySuper.Core.Models.Hosts;
|
||||||
|
using ProxySuper.Core.Models.Projects;
|
||||||
|
using ProxySuper.Core.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
|
||||||
|
namespace ProxySuper.Core.ViewModels
|
||||||
|
{
|
||||||
|
public class HysteriaEditorViewModel : MvxViewModel<Record, Record>
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
public Host Host { get; set; }
|
||||||
|
|
||||||
|
public HysteriaSettings Settings { get; set; }
|
||||||
|
|
||||||
|
public IMvxNavigationService NavigationService { get; }
|
||||||
|
|
||||||
|
public HysteriaEditorViewModel(IMvxNavigationService mvxNavigationService)
|
||||||
|
{
|
||||||
|
NavigationService = mvxNavigationService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Prepare(Record parameter)
|
||||||
|
{
|
||||||
|
var record = Utils.DeepClone(parameter);
|
||||||
|
|
||||||
|
Id = record.Id;
|
||||||
|
Host = record.Host;
|
||||||
|
Settings = record.HysteriaSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
NavigationService.Close(this, new Record
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
Host = Host,
|
||||||
|
HysteriaSettings = Settings,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveAndInstall()
|
||||||
|
{
|
||||||
|
var record = new Record
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
Host = Host,
|
||||||
|
HysteriaSettings = Settings,
|
||||||
|
};
|
||||||
|
|
||||||
|
NavigationService.Close(this, record);
|
||||||
|
NavigationService.Navigate<HysteriaInstallViewModel, Record>(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
ProxySuper.Core/ViewModels/HysteriaInstallViewModel.cs
Normal file
25
ProxySuper.Core/ViewModels/HysteriaInstallViewModel.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using MvvmCross.ViewModels;
|
||||||
|
using ProxySuper.Core.Models;
|
||||||
|
using ProxySuper.Core.Models.Hosts;
|
||||||
|
using ProxySuper.Core.Models.Projects;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProxySuper.Core.ViewModels
|
||||||
|
{
|
||||||
|
public class HysteriaInstallViewModel : MvxViewModel<Record>
|
||||||
|
{
|
||||||
|
public Host Host { get; set; }
|
||||||
|
|
||||||
|
public HysteriaSettings Settings { get; set; }
|
||||||
|
|
||||||
|
public override void Prepare(Record parameter)
|
||||||
|
{
|
||||||
|
Host = parameter.Host;
|
||||||
|
Settings = parameter.HysteriaSettings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user