public void FillData(DataTable table) { OpenConnection(); SqlDataAdapter sda = new SqlDataAdapter(CMD); try { sda.Fill(table);//Fill table with data CloseConnection(); } catch (Exception ex)//Catch if unable to get data { string message = ex.Message; CMD.Dispose(); CloseConnection(); } }
public bool ExecuteCMD()//Execute particular action { try { OpenConnection(); CMD.ExecuteNonQuery(); CloseConnection(); return(true); } catch (Exception ex) { string message = ex.Message; CMD.Dispose(); CloseConnection(); } return(false); }
protected override void Shutdown() { try { lib.gameStatus = 0; if (lib.status == 0) { Utility.WindowText("Asheron's Call"); } else if (lib.Autorelog == false) { Utility.AddWindowText(lib.MyServer + " : " + lib.MyName + " logged off by " + lib.reason + " at " + DateTime.Now.ToString("h:mm:ss tt")); if (lib.UseMacroLogic == true && lib.reason != "user") { Utility.ActivateWindow(); } } else if (lib.Autorelog == true && lib.longcycle == false) { Utility.AddWindowText(lib.MyServer + " : " + lib.MyName + " logged off by " + lib.reason + " at " + DateTime.Now.ToString("h:mm:ss tt") + ". Relogger is set to " + lib.Timer + " seconds. Counter: " + lib.relogcounter); if (lib.UseMacroLogic == true) { Utility.ActivateWindow(); } } else if (lib.Autorelog == true && lib.longcycle == true) { Utility.AddWindowText(lib.MyServer + " : " + lib.MyName + " logged off by " + lib.reason + " at " + DateTime.Now.ToString("h:mm:ss tt") + ". Relogger is on Long Cycle (10 minutes)."); lib.longcycle = false; if (lib.UseMacroLogic == true) { Utility.ActivateWindow(); } } lib.MyCore.CharacterFilter.Login -= Core_Login_Init; if (lib.AuthInstance > 0) { ATH.Dispose(); } if (lib.CommandsInstance > 0) { CMD.Dispose(); } if (lib.LoggingInstance > 0) { LGM.Dispose(); } if (lib.ViewControlInstance > 0) { VCT.Dispose(); } if (lib.ScannerInstance > 0) { SCN.Dispose(); } if (lib.DeathParseInstance > 0) { DTH.Dispose(); } if (lib.SoundInstance > 0) { SND.Dispose(); } if (lib.MacroInstance > 0) { MCL.Dispose(); } if (lib.VersInstance > 0) { VSC.Dispose(); } if (lib.HUDInstance > 0) { HUD.Dispose(); } if (lib.ReportInstance > 0) { REP.Dispose(); } if (SCN != null) { SCN = null; } if (SND != null) { SND = null; } if (ATH != null) { ATH = null; } if (VCT != null) { VCT = null; } if (DTH != null) { DTH = null; } if (CMD != null) { CMD = null; } if (VSC != null) { VSC = null; } if (LGM != null) { LGM = null; } if (MCL != null) { MCL = null; } if (HUD != null) { HUD = null; } if (REP != null) { REP = null; } if (ShrtTmr.Enabled == true) { ShrtTmr.Stop(); ShrtTmr.Dispose(); } if (LngTmr.Enabled == true) { LngTmr.Stop(); LngTmr.Dispose(); } if (LogTmr.Enabled == true) { LogTmr.Stop(); LogTmr.Dispose(); } PGCore = null; lib.PluginInstance--; lib.Dispose(); } catch (Exception ex) { Repo.RecordException(ex); } }
public void Core_Login_Retry() { try { if (lib.PluginInstance == 1) { if (lib.DFTEXT != null) { lib.DFTEXT.Dispose(); lib.DFTEXT = null; } if (lib.DF2TEXT != null) { lib.DF2TEXT.Dispose(); lib.DF2TEXT = null; } if (lib.AuthInstance > 0) { ATH.Dispose(); } if (lib.CommandsInstance > 0) { CMD.Dispose(); } if (lib.LoggingInstance > 0) { LGM.Dispose(); } if (lib.ViewControlInstance > 0) { VCT.Dispose(); } if (lib.ScannerInstance > 0) { SCN.Dispose(); } if (lib.DeathParseInstance > 0) { DTH.Dispose(); } if (lib.SoundInstance > 0) { SND.Dispose(); } if (lib.MacroInstance > 0) { MCL.Dispose(); } if (lib.VersInstance > 0) { VSC.Dispose(); } if (lib.HUDInstance > 0) { HUD.Dispose(); } if (lib.ReportInstance > 0) { REP.Dispose(); } if (SCN != null) { SCN = null; } if (SND != null) { SND = null; } if (ATH != null) { ATH = null; } if (VCT != null) { VCT = null; } if (DTH != null) { DTH = null; } if (CMD != null) { CMD = null; } if (VSC != null) { VSC = null; } if (LGM != null) { LGM = null; } if (MCL != null) { MCL = null; } if (HUD != null) { HUD = null; } if (REP != null) { REP = null; } CMD = new Commands(); CMD.InitCommands(PGCore); Core_Login_Check(); } } catch (Exception ex) { Repo.RecordException(ex); } }