public static void InitSettings() { try { // User Defined Globals: if (Properties.Settings.Default.logDir != "") { Globals.logDir = Properties.Settings.Default.logDir; } else { Properties.Settings.Default.logDir = Directory.GetCurrentDirectory().ToString(); Globals.logDir = Properties.Settings.Default.logDir; } Globals.blackList = Properties.Settings.Default.blackList; Globals.stealthMode = Properties.Settings.Default.stealthMode; if (Properties.Settings.Default.autoKill.ToString() != "") { Globals.autoKill = Properties.Settings.Default.autoKill; } // SQL Server Location: if (Properties.Settings.Default.databaseSvr != null) { Globals.databaseSvr = Properties.Settings.Default.databaseSvr; } if (Properties.Settings.Default.database != null) { Globals.database = Properties.Settings.Default.database; } if (Properties.Settings.Default.databaseTbl != null) { Globals.databaseTbl = Properties.Settings.Default.databaseTbl; } // SQL Server Authentication: if (Properties.Settings.Default.authMethod.ToString() != "") { Globals.authMethod = Properties.Settings.Default.authMethod; } Globals.sqlUser = Properties.Settings.Default.sqlUser; Globals.sqlPass = Properties.Settings.Default.sqlPass; Globals.connectionStringWinAuth = @"Data Source=" + Globals.databaseSvr + ";Initial Catalog=" + Globals.database + ";Integrated Security=True;"; Globals.connectionStringSQLAuth = @"Data Source=" + Globals.databaseSvr + ";Initial Catalog=" + Globals.database + ";User ID=(" + Globals.sqlUser + ");Password=(" + Globals.sqlPass + ");"; } catch (Exception ex) { SimpleLog.Log(ex); // Write any exception to Log file. } }
private void OnFrameworkUpdate(Framework framework) { try { foreach (var w in windowsWithCommunityFinder) { UpdateCommunityFinderButton(Service.Framework, w); } } catch (Exception ex) { SimpleLog.Error(ex); } }
public PipelineInput(int batchSize) { SimpleLog.ToLog(this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, SimpleLogEventType.Trace); if (batchSize < 1) { throw new ArgumentOutOfRangeException("batchSize", "must be positive"); } _batchSizeRows = batchSize; }
// ############################################################################### // ### M E T H O D S // ############################################################################### #region Methods /// <summary>Add an item to the end of the list.</summary> /// <param name="item">The style to add to the list.<see cref="ITextStyle"/></param> /// <remarks>The list is limited to a maximum of 32 styles.</remarks> public void Add(ITextStyle item) { if (_styles.Count >= 32) { SimpleLog.LogLine(TraceEventType.Error, CLASS_NAME + "::Add () Can't handle more than 32 styles!"); } else { _styles.Add(item); } }
public void AddConversionItem(string segmentNumber, string before, string after, string searchText, string replaceText = "") { SimpleLog.Info(string.Join(Environment.NewLine, $"{ Environment.NewLine }\tCHANGED TEXT", $"\tId: { segmentNumber }", $"\tBefore: { before }", $"\tAfter: { after }", $"\tSearched Text: { searchText }", $"\tReplaced Text: { replaceText + Environment.NewLine }")); conversionCount++; }
public override void Disable() { if (!Enabled) { return; } if (!SafeMemory.WriteBytes(changeAddress, originalBytes)) { SimpleLog.Error("Failed to write original instruction"); } base.Disable(); }
public PipelineOutput(IPipelineIn inputModule) { SimpleLog.ToLog(this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, SimpleLogEventType.Trace); if (inputModule == null) { throw new System.ArgumentNullException("inputModule"); } _inputModule = inputModule; }
private void SyncCalendar(int InstructorID) { InstructorBusiness InsBO = new InstructorBusiness(); Instructor Ins = InsBO.GetInstructorByID(InstructorID); //Neu chua co teken thi ko lam gi het if (Ins.ApiToken == null) { return; } SimpleLog.Info("Begin Sync Calendar for Instructor " + Ins.Fullname + "."); try { String RefreshToken = Ins.ApiToken; var WrapperAPI = new GoogleCalendarAPIWrapper(RefreshToken); //Tim toan bo lich cua instructor var Calendars = WrapperAPI.GetCalendarList(); //Tim xem da co teaching calendar chua, chua co thi insert GoogleCalendar TeachingCalendar = Calendars.Items.SingleOrDefault(ca => ca.Summary.Equals("Teaching Calendar")); if (TeachingCalendar == null) { TeachingCalendar = WrapperAPI.InsertCalendar("Teaching Calendar"); } else { //Clear nhung ngay trong tuong lai WrapperAPI.ClearFutureDateCalendar(TeachingCalendar.ID); } //Bat dau lay event, ghi vao calendar. StudySessionBusiness StuSesBO = new StudySessionBusiness(); //Chi lay nhung event trong tuong lai, tiet kiem dung luong List <Event> Events = StuSesBO.GetCalendarEvent(InstructorID). Where(e => e.StartDate >= DateTime.Now).ToList(); foreach (var Event in Events) { WrapperAPI.InsertEvent(TeachingCalendar.ID, Event.title, Event.StartDate, Event.EndDate); } String Message = String.Format("Succesfull sync {0} events, from {1:dd-MM-yyyy} to {2:dd-MM-yyyy}", Events.Count, Events.First().StartDate, Events.Last().StartDate); SimpleLog.Info(Message); } catch (Exception e) { SimpleLog.Error("Error while trying to sync."); SimpleLog.Error(e.Message); } }
public LoginForm() { InitializeComponent(); SimpleLog.SetLogFile(".\\Log", "MyLog_"); //Form this.Text = string.Empty; this.ControlBox = false; this.DoubleBuffered = true; this.MaximizedBounds = Screen.FromHandle(this.Handle).WorkingArea; }
protected void LoadXml(string xml) { LoadSchema(); XDocument = XDocument.Parse(xml); XDocument.Validate(_schema, (o, e) => { Debug.WriteLine($"{e.Message}"); Exception ex = new Exception(e.Message); SimpleLog.AddException(ex, nameof(XmlBasic)); throw ex; }); }
// Start is called before the first frame update void Start() { _mgr = new QuitManager(WaitTime); _mgr.onBeginQuit += Task0; _mgr.onBeginQuit += Task1; _mgr.onWillFinallyQuit += OnQuit; _mgr.SetQuitFunc(QuitFunc); _log = new SimpleLog(".", "log"); _log.logEnabled = true; _log.StampType = StampType; _log.StackDepth = 5; }
public ActionResult <IEnumerable <Product> > GetAllProducts() { try { var products = _iProductApplication.GetAllProducts(); return(Ok(products)); } catch (Exception ex) { SimpleLog.Error($"Error message: {ex.Message}. Inner exception: {ex.InnerException}!"); return(BadRequest(ex.Message)); } }
void IWMSToMFCS.DestinationEmptied(string place) { try { Model.Singleton().ReleaseRamp(place); } catch (Exception ex) { SimpleLog.AddException(ex, nameof(WMSToMFCS)); Debug.WriteLine(ex.Message); throw new FaultException(ex.Message); } }
void IWMSToMFCS.PlaceChanged(string placeID, int TU_ID, int dim, string changeType) { try { Model.Singleton().UpdatePlace(placeID, TU_ID, dim, changeType); } catch (Exception ex) { SimpleLog.AddException(ex, nameof(WMSToMFCS)); Debug.WriteLine(ex.Message); throw new FaultException(ex.Message); } }
bool IWMSToMFCS.OrderForRampActive(string ramp) { try { return(Model.Singleton().OrderForRampActive(ramp)); } catch (Exception ex) { SimpleLog.AddException(ex, nameof(WMSToMFCS)); Debug.WriteLine(ex.Message); throw new FaultException(ex.Message); } }
public override void Enable() { eventHook ??= Common.Hook <EventHandle>("48 89 5C 24 ?? 57 48 83 EC 20 48 8B D9 4D 8B D1", EventDetour); eventHook.Enable(); setupHook ??= Common.Hook <SetupHandle>("48 8B C4 48 89 58 10 48 89 70 18 48 89 78 20 55 41 54 41 55 41 56 41 57 48 8D 68 A1 48 81 EC ?? ?? ?? ?? 0F 29 70 C8 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 45 17 F3 0F 10 35 ?? ?? ?? ?? 45 33 C9 45 33 C0 F3 0F 11 74 24 ?? 0F 57 C9 48 8B F9", SetupDetour); setupHook.Enable(); try { SetupCharacterClass(Common.GetUnitBase("CharacterClass")); } catch (Exception ex) { SimpleLog.Error(ex); } base.Enable(); }
public override void Setup() { if (Ready) { return; } try { processChatInputAddress = PluginInterface.TargetModuleScanner.ScanText("E8 ?? ?? ?? ?? FE 86 ?? ?? ?? ?? C7 86 ?? ?? ?? ?? ?? ?? ?? ??"); Ready = true; } catch { SimpleLog.Log("Failed to find address for ProcessChatInput"); } }
override public void Dispose() { SimpleLog.ToLog(this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, SimpleLogEventType.Trace); base.Dispose(); if (_connection == null) { return; } _connection.Close(); _connection.Dispose(); }
public override void Setup() { if (Ready) { return; } try { processChatInputAddress = Service.SigScanner.ScanText("E8 ?? ?? ?? ?? FE 86 ?? ?? ?? ?? C7 86 ?? ?? ?? ?? ?? ?? ?? ??"); Ready = true; } catch { SimpleLog.Log("Failed to find address for ProcessChatInput"); } }
public override unsafe void Enable() { if (setTextAddress == IntPtr.Zero) { setTextAddress = PluginInterface.TargetModuleScanner.ScanText("E8 ?? ?? ?? ?? 49 8B FC") + 9; SimpleLog.Verbose($"SetTextAddress: {setTextAddress.ToInt64():X}"); } setTextHook ??= new Hook <SetText>(setTextAddress, new SetText(SetTextDetour)); setTextHook?.Enable(); PluginInterface.Framework.OnUpdateEvent += OnFrameworkUpdate; base.Enable(); }
public override void Disable() { if (!Enabled) { return; } SaveConfig(LoadedConfig); PluginConfig.UiAdjustments.ShiftTargetCastBarText = null; Service.Framework.Update -= OnFrameworkUpdate; SimpleLog.Debug($"[{GetType().Name}] Reset"); HandleBars(true); Enabled = false; }
public virtual void Close() { _outputStream.Close(); if (File.Exists(_fqTargetFile)) { SimpleLog.ToLog("Deleting pre-existing target file " + _fqTargetFile, SimpleLogEventType.Information); File.Delete(_fqTargetFile); } System.IO.File.Move(_fqTempFile, _fqTargetFile); this.Dispose(); }
public void FillPlaceIDAndParams() { try { Task.WaitAll(FillPlaceIDs(), FillParameters()); } catch (Exception ex) { SimpleLog.AddException(ex, nameof(ModelInitialization)); Debug.WriteLine(ex.Message); throw; } }
public void UpdateRackFrequencyClass(double[] abcPortions) { try { Task.WaitAll(UpdateRackFrequencyClassAsync(abcPortions)); } catch (Exception ex) { SimpleLog.AddException(ex, nameof(ModelInitialization)); Debug.WriteLine(ex.Message); throw; } }
private List <AddonResult> GetAtkUnitBaseAtPosition(Vector2 position) { SimpleLog.Log($">> GetAtkUnitBaseAtPosition"); var list = new List <AddonResult>(); var stage = AtkStage.GetSingleton(); var unitManagers = &stage->RaptureAtkUnitManager->AtkUnitManager.DepthLayerOneList; for (var i = 0; i < UnitListCount; i++) { var unitManager = &unitManagers[i]; var unitBaseArray = &(unitManager->AtkUnitEntries); for (var j = 0; j < unitManager->Count; j++) { var unitBase = unitBaseArray[j]; if (unitBase->RootNode == null) { continue; } if (!(unitBase->IsVisible && unitBase->RootNode->IsVisible)) { continue; } var addonResult = new AddonResult() { UnitBase = unitBase }; if (list.Contains(addonResult)) { continue; } if (unitBase->X > position.X || unitBase->Y > position.Y) { continue; } if (unitBase->X + unitBase->RootNode->Width < position.X) { continue; } if (unitBase->Y + unitBase->RootNode->Height < position.Y) { continue; } addonResult.Nodes = GetAtkResNodeAtPosition(unitBase->UldManager, position); list.Add(addonResult); } } SimpleLog.Log($"<< GetAtkUnitBaseAtPosition"); return(list); }
private void btnClear_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("Are you sure you would like to Clear the Database?", "Clear Database", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.Yes) { if (Program.Globals.authMethod == 1) { try { string query = "TRUNCATE TABLE " + Program.Globals.databaseTbl; using (SqlConnection connection = new SqlConnection(Program.Globals.connectionStringWinAuth)) { SqlCommand command = new SqlCommand(query, connection); command.Connection.Open(); command.ExecuteNonQuery(); command.Connection.Close(); } SimpleLog.Info("Cleared Database."); } catch (Exception ex) { SimpleLog.Log(ex); } } else { try { string query = "TRUNCATE TABLE " + Program.Globals.databaseTbl; // Defines the SQL query inline. // Defines the connection with the Windows Authentication connection string. using (SqlConnection connection = new SqlConnection(Program.Globals.connectionStringWinAuth)) { SqlCommand command = new SqlCommand(query, connection); command.Connection.Open(); // Opens the connection to the SQL Server command.ExecuteNonQuery(); // Executes the inline SQL query against the specified database. command.Connection.Close(); // Closes the the connection. } SimpleLog.Info("Cleared Database."); } catch (Exception ex) { SimpleLog.Log(ex); } } } }
public ActionResult <double> Get() { try { var result = _juros.RetornarTaxaDeJuros(); return(Ok(result)); } catch (Exception e) { SimpleLog.Error("Message: " + e.Message + "; InnerException: " + e.InnerException); throw e; } }
public override unsafe void Enable() { TweakConfig = LoadConfig <Config>() ?? PluginConfig.UiAdjustments.CustomTimeFormats ?? new Config(); if (setTextAddress == IntPtr.Zero) { setTextAddress = Service.SigScanner.ScanText("E8 ?? ?? ?? ?? 49 8B FC") + 9; SimpleLog.Verbose($"SetTextAddress: {setTextAddress.ToInt64():X}"); } setTextHook ??= new Hook <SetText>(setTextAddress, new SetText(SetTextDetour)); setTextHook?.Enable(); Service.Framework.Update += OnFrameworkUpdate; base.Enable(); }
private async Task UpdateRackFrequencyClassAsync(double[] abc) { try { using (var dc = new WMSContext()) { var query = dc.PlaceIds.Where(p => p.PositionTravel > 0 && p.PositionHoist > 0).OrderBy(pp => pp.PositionHoist * pp.PositionHoist + pp.PositionTravel * pp.PositionTravel); int m = query.Count(); int count = 0; int idx = 0; int idxmax = 0; double range = 0; if (abc == null || abc.Length == 0) { idxmax = 0; range = 1.0; } else { idxmax = abc.Length; range = abc[0]; } foreach (var slot in query) { count++; if (count / (double)m > range) { idx++; if (idx < idxmax) { range += abc[idx]; } else { range = 1.0; } } slot.FrequencyClass = idx + 1; } await dc.SaveChangesAsync(); } } catch (Exception ex) { SimpleLog.AddException(ex, nameof(ModelInitialization)); Debug.WriteLine(ex.Message); throw; } }
public static void cerrar() { try { if (connection != null) { connection.Close(); } } catch (Exception ex) { SimpleLog.Log(ex); } try { if (connection != null) { connection.Dispose(); } } catch (Exception ex) { SimpleLog.Log(ex); } try { if (reader != null) { reader.Dispose(); } } catch (Exception ex) { SimpleLog.Log(ex); } try { if (command != null) { command.Dispose(); } } catch (Exception ex) { SimpleLog.Log(ex); } }