예제 #1
0
        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.
            }
        }
예제 #2
0
 private void OnFrameworkUpdate(Framework framework)
 {
     try {
         foreach (var w in windowsWithCommunityFinder)
         {
             UpdateCommunityFinderButton(Service.Framework, w);
         }
     } catch (Exception ex) {
         SimpleLog.Error(ex);
     }
 }
예제 #3
0
        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;
        }
예제 #4
0
        // ###############################################################################
        // ### 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);
            }
        }
예제 #5
0
        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++;
        }
예제 #6
0
 public override void Disable()
 {
     if (!Enabled)
     {
         return;
     }
     if (!SafeMemory.WriteBytes(changeAddress, originalBytes))
     {
         SimpleLog.Error("Failed to write original instruction");
     }
     base.Disable();
 }
예제 #7
0
        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);
            }
        }
예제 #9
0
파일: LoginForm.cs 프로젝트: Kyouru/SICA
        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;
        }
예제 #10
0
 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;
     });
 }
예제 #11
0
    // 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;
    }
예제 #12
0
 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));
     }
 }
예제 #13
0
 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);
     }
 }
예제 #14
0
 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);
     }
 }
예제 #15
0
 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);
     }
 }
예제 #16
0
 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();
 }
예제 #17
0
 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");
     }
 }
예제 #18
0
        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");
     }
 }
예제 #20
0
        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();
        }
예제 #21
0
 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;
 }
예제 #22
0
        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();
        }
예제 #23
0
 public void FillPlaceIDAndParams()
 {
     try
     {
         Task.WaitAll(FillPlaceIDs(), FillParameters());
     }
     catch (Exception ex)
     {
         SimpleLog.AddException(ex, nameof(ModelInitialization));
         Debug.WriteLine(ex.Message);
         throw;
     }
 }
예제 #24
0
 public void UpdateRackFrequencyClass(double[] abcPortions)
 {
     try
     {
         Task.WaitAll(UpdateRackFrequencyClassAsync(abcPortions));
     }
     catch (Exception ex)
     {
         SimpleLog.AddException(ex, nameof(ModelInitialization));
         Debug.WriteLine(ex.Message);
         throw;
     }
 }
예제 #25
0
        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);
        }
예제 #26
0
        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;
            }
        }
예제 #28
0
        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();
        }
예제 #29
0
        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;
            }
        }
예제 #30
0
파일: Conexion.cs 프로젝트: Kyouru/SICA
        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);
            }
        }