mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-03 03:52:07 +03:00
@@ -25,6 +25,21 @@ public partial class RoutingRuleDetailsViewModel : MyReactiveObject, ICloseable
|
||||
[Reactive]
|
||||
public partial bool AutoSort { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public partial string OutboundTag { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public partial string Remarks { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public partial string Port { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public partial string Network { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public partial bool Enabled { get; set; }
|
||||
|
||||
public ReactiveCommand<RxVoid, RxVoid> SelectProfileCmd { get; }
|
||||
public ReactiveCommand<RxVoid, RxVoid> SaveCmd { get; }
|
||||
|
||||
@@ -57,6 +72,11 @@ public partial class RoutingRuleDetailsViewModel : MyReactiveObject, ICloseable
|
||||
IP = Utils.List2String(SelectedSource.Ip, true);
|
||||
Process = Utils.List2String(SelectedSource.Process, true);
|
||||
RuleType = SelectedSource.RuleType?.ToString();
|
||||
OutboundTag = SelectedSource.OutboundTag;
|
||||
Remarks = SelectedSource.Remarks;
|
||||
Port = SelectedSource.Port;
|
||||
Network = SelectedSource.Network;
|
||||
Enabled = SelectedSource.Enabled;
|
||||
}
|
||||
|
||||
private async Task SaveRulesAsync()
|
||||
@@ -80,6 +100,11 @@ public partial class RoutingRuleDetailsViewModel : MyReactiveObject, ICloseable
|
||||
SelectedSource.Protocol = ProtocolItems?.ToList();
|
||||
SelectedSource.InboundTag = InboundTagItems?.ToList();
|
||||
SelectedSource.RuleType = RuleType.IsNullOrEmpty() ? null : Enum.Parse<ERuleType>(RuleType);
|
||||
SelectedSource.OutboundTag = OutboundTag;
|
||||
SelectedSource.Remarks = Remarks;
|
||||
SelectedSource.Port = Port;
|
||||
SelectedSource.Network = Network;
|
||||
SelectedSource.Enabled = Enabled;
|
||||
|
||||
var hasRule = SelectedSource.Domain?.Count > 0
|
||||
|| SelectedSource.Ip?.Count > 0
|
||||
@@ -110,8 +135,7 @@ public partial class RoutingRuleDetailsViewModel : MyReactiveObject, ICloseable
|
||||
var profileItem = await profileSelectViewModel.GetProfileItem();
|
||||
if (profileItem != null)
|
||||
{
|
||||
SelectedSource.OutboundTag = profileItem.Remarks;
|
||||
SelectedSource = JsonUtils.DeepCopy(SelectedSource);
|
||||
OutboundTag = profileItem.Remarks;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,11 @@ public partial class SubEditViewModel : MyReactiveObject, ICloseable
|
||||
|
||||
[Reactive]
|
||||
public partial string CustomCoreType { get; set; }
|
||||
[Reactive]
|
||||
public partial string PrevProfile { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public partial string NextProfile { get; set; }
|
||||
|
||||
public ReactiveCommand<RxVoid, RxVoid> SelectPrevProfileCmd { get; }
|
||||
public ReactiveCommand<RxVoid, RxVoid> SelectNextProfileCmd { get; }
|
||||
@@ -23,8 +28,7 @@ public partial class SubEditViewModel : MyReactiveObject, ICloseable
|
||||
var profileItem = await SelectProfileAsync();
|
||||
if (profileItem != null)
|
||||
{
|
||||
SelectedSource?.PrevProfile = profileItem.Remarks;
|
||||
SelectedSource = JsonUtils.DeepCopy(SelectedSource);
|
||||
PrevProfile = profileItem.Remarks;
|
||||
}
|
||||
});
|
||||
SelectNextProfileCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
@@ -32,8 +36,7 @@ public partial class SubEditViewModel : MyReactiveObject, ICloseable
|
||||
var profileItem = await SelectProfileAsync();
|
||||
if (profileItem != null)
|
||||
{
|
||||
SelectedSource?.NextProfile = profileItem.Remarks;
|
||||
SelectedSource = JsonUtils.DeepCopy(SelectedSource);
|
||||
NextProfile = profileItem.Remarks;
|
||||
}
|
||||
});
|
||||
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
@@ -43,6 +46,8 @@ public partial class SubEditViewModel : MyReactiveObject, ICloseable
|
||||
|
||||
SelectedSource = subItem.Id.IsNullOrEmpty() ? subItem : JsonUtils.DeepCopy(subItem);
|
||||
CustomCoreType = SelectedSource.CustomCoreType?.ToString() ?? string.Empty;
|
||||
PrevProfile = SelectedSource.PrevProfile;
|
||||
NextProfile = SelectedSource.NextProfile;
|
||||
}
|
||||
|
||||
private async Task SaveSubAsync()
|
||||
@@ -72,6 +77,8 @@ public partial class SubEditViewModel : MyReactiveObject, ICloseable
|
||||
}
|
||||
|
||||
SelectedSource.CustomCoreType = Enum.TryParse<ECoreType>(CustomCoreType, out var coreType) ? coreType : null;
|
||||
SelectedSource.PrevProfile = PrevProfile;
|
||||
SelectedSource.NextProfile = NextProfile;
|
||||
|
||||
if (await ConfigHandler.AddSubItem(_config, SelectedSource) == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user