101 lines
2.6 KiB
C#
101 lines
2.6 KiB
C#
|
using Api.Framework;
|
|||
|
using Api.Framework.SDK;
|
|||
|
using Api.Framework.Tools;
|
|||
|
using NewFans.Entitys;
|
|||
|
using NewFans.Properties;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace NewFans
|
|||
|
{
|
|||
|
public class Class1 : Plugin
|
|||
|
{
|
|||
|
public Class1()
|
|||
|
{
|
|||
|
this.Name = "新粉助手";
|
|||
|
this.Note = "新粉助手";
|
|||
|
this.Logo = Resources._222;
|
|||
|
}
|
|||
|
|
|||
|
#region 自定义变量
|
|||
|
//public static Config Config;
|
|||
|
private MainForm mainForm = null;
|
|||
|
// public static VariateReplace variateReplace = null;
|
|||
|
#endregion
|
|||
|
|
|||
|
public static Config Config = null;
|
|||
|
TaskJob taskJob = null;
|
|||
|
|
|||
|
public override void Start()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
#region 判断表是否存在,不存在创建表
|
|||
|
if (!session.TableExist<fl_newfans_hist_>())
|
|||
|
{
|
|||
|
session.CreateTable<fl_newfans_hist_>();
|
|||
|
session.AddUnique<fl_newfans_hist_>("uid");
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
//创建配置文件
|
|||
|
Config = this.ReadConfig<Config>();
|
|||
|
|
|||
|
Config.hour3 = 20;//三个小时的改成20分钟了
|
|||
|
Config.hour24 = 24 * 60;
|
|||
|
Config.hour48 = 48 * 60;
|
|||
|
Config.hour72 = 72 * 60;
|
|||
|
|
|||
|
Util.Save(Config);
|
|||
|
|
|||
|
taskJob = new TaskJob();
|
|||
|
taskJob.Run();
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
this.OnLog(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
public override void ShowForm()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (mainForm == null || mainForm.IsDisposed)
|
|||
|
{
|
|||
|
mainForm = new MainForm();
|
|||
|
mainForm.Show();
|
|||
|
}
|
|||
|
mainForm.TopMost = true;
|
|||
|
mainForm.TopMost = false;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
this.OnLog(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
public override void Stop()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
//SessionExt.Clear();
|
|||
|
if (mainForm != null)
|
|||
|
{
|
|||
|
mainForm.CloseForm();
|
|||
|
mainForm = null;
|
|||
|
}
|
|||
|
taskJob.Abort();
|
|||
|
taskJob = null;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
this.OnLog(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|