Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Feb 15, 2023
1 parent 9ef371e commit 01423c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 7 additions & 3 deletions clashN/clashN/Handler/ConfigHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,10 @@ public static int AddProfileCommon(ref Config config, ProfileItem profileItem)
{
profileItem.indexId = Utils.GetGUID(false);
}
if (profileItem.coreType is null)
{
profileItem.coreType = ECoreType.clash_meta;
}
if (!config.profileItems.Exists(it => it.indexId == profileItem.indexId))
{
var maxSort = config.profileItems.Any() ? config.profileItems.Max(t => t.sort) : 0;
Expand Down Expand Up @@ -564,7 +568,7 @@ public static int AddBatchProfiles(ref Config config, string clipboardData, stri
{
groupId = groupId,
url = clipboardData,
coreType = ECoreType.clash,
coreType = ECoreType.clash_meta,
address = string.Empty,
enabled = true,
remarks = "clash_subscription"
Expand All @@ -586,7 +590,7 @@ public static int AddBatchProfiles(ref Config config, string clipboardData, stri
{
groupId = groupId,
url = query["url"],
coreType = ECoreType.clash,
coreType = ECoreType.clash_meta,
address = string.Empty,
enabled = true,
remarks = "clash_subscription"
Expand All @@ -604,7 +608,7 @@ public static int AddBatchProfiles(ref Config config, string clipboardData, stri
{
groupId = groupId,
url = "",
coreType = ECoreType.clash,
coreType = ECoreType.clash_meta,
address = string.Empty,
enabled = false,
remarks = "clash_local_file"
Expand Down
4 changes: 4 additions & 0 deletions clashN/clashN/Tool/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,10 @@ public static void AutoStart(string taskName, string fileName, string descriptio
var task = taskService.NewTask();
task.RegistrationInfo.Description = taskDescription;
task.Settings.DisallowStartIfOnBatteries = false;
task.Settings.StopIfGoingOnBatteries = false;
task.Settings.RunOnlyIfIdle = false;
task.Settings.IdleSettings.StopOnIdleEnd = false;
task.Settings.ExecutionTimeLimit = TimeSpan.Zero;
task.Triggers.Add(new LogonTrigger { UserId = logonUser, Delay = TimeSpan.FromMinutes(1) });
task.Principal.RunLevel = TaskRunLevel.Highest;
task.Actions.Add(new ExecAction(deamonFileName));
Expand Down

0 comments on commit 01423c9

Please sign in to comment.