/// <summary> /// アンロード処理 /// </summary> private void unload() { //設定保存 saveSettings(); logger.Output(LogLevelKind.DEBUG, "設定保存終了"); //メインスレッド停止 if (thFishing != null && thFishing.IsAlive) thFishing.Abort(); thFishing = null; logger.Output(LogLevelKind.DEBUG, "メインスレッド停止"); //DB更新スレッド停止 if (thUpdateDB != null && thUpdateDB.IsAlive) thUpdateDB.Abort(); //監視スレッド停止 if (thMonitor != null && thMonitor.IsAlive) thMonitor.Abort(); thMonitor = null; logger.Output(LogLevelKind.DEBUG, "監視スレッド停止"); //FFACEControl停止 control = null; //HarakiriTool停止 if (harakiri != null) harakiri.SystemAbort(); harakiri = null; logger.Output(LogLevelKind.DEBUG, "HarakiriTool停止"); //FishingTool停止 if (fishing != null) fishing.SystemAbort(); fishing = null; logger.Output(LogLevelKind.DEBUG, "FishingTool停止"); //ChatTool停止 if (chat != null) chat.SystemAbort(); chat = null; logger.Output(LogLevelKind.DEBUG, "ChatTool停止"); logger.Output(string.Format("===== {0} {1} 終了=====", MiscTool.GetAppAssemblyName(), MiscTool.GetAppVersion())); }
/// <summary> /// ステータスバー情報更新 /// </summary> /// <param name="iFishing">FishingTool</param> private void updateStatusBar(FishingTool iFishing) { if (InvokeRequired) { Invoke(new UpdateStatusBarDelegate(updateStatusBar), iFishing); } else { FFACE.TimerTools.VanaTime vt = fface.Timer.GetVanaTime(); //月齢 lblMoonPhase.ToolTipText = string.Format("{0}({1}%)", dicMoonPhaseName[iFishing.MoonPhase], fishing.MoonPercent); lblMoonPhase.Image = dicMoonPhaseImage[iFishing.MoonPhase]; if (iFishing.MoonPhase == MoonPhase.New || iFishing.MoonPhase == MoonPhase.Full) { lblMoonPhase.ToolTipText += "\r\n釣果が向上"; } else if (iFishing.MoonPhase == MoonPhase.FirstQuarter || iFishing.MoonPhase == MoonPhase.LastQuarter) { lblMoonPhase.ToolTipText += "\r\n釣果が低下"; } //ヴァナ時間 lblVanaTime.Text = string.Format("{0:00}:{1:00}", iFishing.VanaDateTime.Hour, iFishing.VanaDateTime.Minute); lblVanaTime.ToolTipText = "ヴァナ時間 " + iFishing.VanaDateTimeYmdhms; //地球時間 lblEarthTime.Text = iFishing.EarthDateTime.ToString("HH:mm"); lblEarthTime.ToolTipText = "地球時間 " + iFishing.EarthDateTime.ToString("yyyy/MM/dd HH:mm"); //曜日 lblDayType.ToolTipText = dicWeekDayName[iFishing.DayType]; lblDayType.Image = dicWeekDayImage[iFishing.DayType]; //Loginステータス lblLoginStatus.Text = iFishing.LoginStatus.ToString(); //Playerステータス lblPlayerStatus.Text = iFishing.PlayerStatus.ToString(); //HP lblHP.Text = string.Format("{0}%",iFishing.HpPercent); barHP.Value = iFishing.HpPercent; //残り時間 lblRemainTime.Text = string.Format("{0}s", iFishing.RemainTimeCurrent); barRemainTime.Value = iFishing.RemainTimePercent; } }
/// <summary> /// FishingTool Fishedイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FishingTool_Fished(object sender, FishingTool.FishedEventArgs e) { //魚リストの更新 updateFishList(); //釣り情報の更新 updateFishingInfo(gridFishingInfo, DateTime.Now, FishResultStatusKind.Unknown, string.Empty); }
/// <summary> /// FishingTool ChangeStatusイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FishingTool_ChangeStatus(object sender, FishingTool.ChangeStatusEventArgs e) { //logger.Output(string.Format("{0} {1}", e.RunningStatus, e.FishingStatus)); if (InvokeRequired) { Invoke(new FishingTool_ChangeStatusDelegate(FishingTool_ChangeStatus), sender, e); } else { //ステータスバーの背景色を設定 switch (e.FishingStatus) { case FishingTool.FishingStatusKind.Normal: if (e.RunningStatus == FishingTool.RunningStatusKind.Running) { statusStrip.BackColor = Color.FromArgb(0x80, 0xFF, 0xFF); } else { statusStrip.BackColor = SystemColors.Control; } break; case FishingTool.FishingStatusKind.Wait: statusStrip.BackColor = Color.FromArgb(0xFF, 0xFF, 0x80); flashWindow();//画面フラッシュ break; case FishingTool.FishingStatusKind.Error: statusStrip.BackColor = Color.FromArgb(0xFF, 0x80, 0x80); flashWindow();//画面フラッシュ break; default: statusStrip.BackColor = SystemColors.Control; break; } switch (e.RunningStatus) { case FishingTool.RunningStatusKind.UnderStop: this.Cursor = Cursors.WaitCursor; break; case FishingTool.RunningStatusKind.Stop: this.Cursor = Cursors.Default; flashWindow();//画面フラッシュ break; } } }
/// <summary> /// FishingTool ChangeMessageイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FishingTool_ChangeMessage(object sender, FishingTool.ChangeMessageEventArgs e) { if (InvokeRequired) { Invoke(new FishingTool_ChangeMessageDelegate(FishingTool_ChangeMessage), sender, e); } else { //メッセージの更新 setMessage(e.Message); } }
/// <summary> /// FishingTool CaughtFishesUpdateイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FishingTool_CaughtFishesUpdate(object sender, FishingTool.CaughtFishesUpdateEventArgs e) { //logger.Output(string.Format("{0} {1}", e.RunningStatus, e.FishingStatus)); if (InvokeRequired) { Invoke(new FishingTool_CaughtFishesUpdateDelegate(FishingTool_CaughtFishesUpdate), sender, e); } else { updateCaughtFishes(); saveSettings(); } }
/// <summary> /// コンストラクタ処理部 /// </summary> /// <param name="iPol"></param> private void constructor(PolTool iPol) { //PolTool初期設定 pol = iPol; pol.ChangeStatus += new PolTool.ChangeStatusEventHandler(this.PolTool_ChangeStatus); //FFACE初期設定 fface = iPol.FFACE; //LoggerTool初期設定 logger = new LoggerTool(MiscTool.GetAppAssemblyName(), pol.FFACE.Player.Name); logger.Enable = args.LoggerEnable; logger.OutputLogLevel = args.LoggerLogLevel; logger.EnableVarDump = args.LoggerVarDumpEnable; logger.Output(LogLevelKind.INFO, string.Format("===== {0} {1} =====", MiscTool.GetAppAssemblyName(), MiscTool.GetAppVersion())); logger.Output(LogLevelKind.INFO, string.Format("デバッグログ:{0} ログレベル:{1} 変数出力:{2}", args.LoggerEnable, args.LoggerLogLevel, args.LoggerVarDumpEnable)); logger.Output(LogLevelKind.INFO, string.Format("プロセス({0})にアタッチしました", pol.ProcessID)); //Settings初期設定 settings = new Settings(iPol.FFACE.Player.Name); //ChatTool初期設定 chat = new ChatTool(iPol.FFACE); chat.ReceivedCommand += new ChatTool.ReceivedCommandEventHandler(this.ChatTool_ReceivedCommand); logger.Output(LogLevelKind.DEBUG, "ChatTool起動"); //FishingTool初期設定 fishing = new FishingTool(iPol, chat, settings, logger); fishing.Fished += new FishingTool.FishedEventHandler(this.FishingTool_Fished); fishing.ChangeMessage += new FishingTool.ChangeMessageEventHandler(this.FishingTool_ChangeMessage); fishing.ChangeStatus += new FishingTool.ChangeStatusEventHandler(this.FishingTool_ChangeStatus); fishing.CaughtFishesUpdate += new FishingTool.CaughtFishesUpdateEventHandler(this.FishingTool_CaughtFishesUpdate); logger.Output(LogLevelKind.DEBUG, "FishingTool起動"); //HarakiriTool初期設定 harakiri = new HarakiriTool(iPol, chat, settings, logger); harakiri.HarakiriOnce += new HarakiriTool.HarakiriOnceEventHandler(this.HarakiriTool_HarakiriOnce); harakiri.ChangeMessage += new HarakiriTool.ChangeMessageEventHandler(this.HarakiriTool_ChangeMessage); harakiri.ChangeStatus += new HarakiriTool.ChangeStatusEventHandler(this.HarakiriTool_ChangeStatus); logger.Output(LogLevelKind.DEBUG, "HarakiriTool起動"); //FFACEControl初期設定 control = new FFACEControl(pol, chat, logger); control.MaxLoopCount = Constants.MAX_LOOP_COUNT; control.UseEnternity = settings.UseEnternity; control.BaseWait = settings.Global.WaitBase; control.ChatWait = settings.Global.WaitChat; logger.Output(LogLevelKind.DEBUG, "FFACEControl起動"); //監視スレッド起動 thMonitor = new Thread(threadMonitor); thMonitor.Start(); logger.Output(LogLevelKind.DEBUG, "監視スレッド起動"); //DB fishDB = new FishDB(logger); fishHistoryDB = new FishHistoryDB(fishing.PlayerName, fishing.EarthDateTime, logger); harakiriDB = new HarakiriDB(logger); //古いデータをコンバート converter(); //DB更新 updatedb = new UpdateDBTool(settings, logger); updatedb.ReceiveMessage += new UpdateDBTool.ReceiveMessageEventHandler(this.UpdateDBTool_ReceiveMessage); updatedb.NewerVersion += new UpdateDBTool.NewerVersionEventHandler(this.UpdateDBTool_NewerVersion); }