Пример #1
0
        public Server(String URL, Logging.Log Log)
        {
            // Initialise Caches
            this.ControlTypeCache     = new Dictionary <String, ControlType>();
            this.PluginTypeCache      = new Dictionary <String, ControlTypes.PluginType>();
            this.ApplicationTypeCache = new Dictionary <String, ControlTypes.ApplicationType>();

            // Initialiase RSA Encyption
            this.RSA = new RSACryptoServiceProvider();

            // Store Log
            this.Log = Log;

            // Create Model Server
            this.Model = new Model.Server(URL);

            // Set Default Session Expire
            this.ExpireSession = DefaultExpireSession;

            // Initialiase Session Cache
            this.SessionCache = new Dictionary <String, Dictionary <String, Session> >();

            // Set Default Assembly Directory
            this.AssemblyDirectory = new DirectoryInfo(Environment.CurrentDirectory);
        }
Пример #2
0
        ListViewItem ItemFromLog(Logging.Log log)
        {
            var item = new ListViewItem(new string[] { log.timestamp, log.text });

            switch (log.level)
            {
            case Logging.Level.None:
            case Logging.Level.Debug:
                item.BackColor = Color.FromArgb(unchecked ((int)0xffdddddd));
                break;

            case Logging.Level.Info:
                //item.BackColor = Color.FromArgb(unchecked((int)0xffaaffaa));
                break;

            case Logging.Level.Warning:
                item.BackColor = Color.FromArgb(unchecked ((int)0xffffffaa));
                break;

            case Logging.Level.Error:
                item.BackColor = Color.FromArgb(unchecked ((int)0xffffaaaa));
                break;

            default:
                break;
            }
            return(item);
        }
Пример #3
0
 private void Logging_Logged(Logging.Log log)
 {
     try {
         if (!posting)
         {
             posting = true;
             recycler.PostDelayed(() => {
                 posting = false;
                 if (!this.IsAdded)
                 {
                     return;
                 }
                 UpdateDatasetRange(out var removed, out var appended);
                 if (removed > 0)
                 {
                     dataset.NotifyItemRangeRemoved(0, removed);
                 }
                 if (appended > 0)
                 {
                     dataset.NotifyItemRangeInserted(dataset.Count - appended, appended);
                     if (autoScroll)
                     {
                         AutoScroll();
                     }
                 }
             }, 50);
         }
     } catch (Exception e) {
         Unregister();
         Logging.exception(e, Logging.Level.Error, "Logging_Logged exception");
     }
 }
Пример #4
0
        public TmsManager(StructuralReasonerOptions structuralReasonerOptions, Log log)
        {
            this.structuralReasonerOptions = structuralReasonerOptions;
            this.log = log;

            cdaStarTms = new Workspace();

            CreateDomains();
            CreateConstraintTypes();
        }
Пример #5
0
        /// <summary>
        /// Add log message
        /// </summary>
        /// <param name="labelId">Label id</param>
        /// <param name="label">Label text</param>
        /// <param name="labelFileName">Label file name</param>
        private void log(string labelId, string label, string labelFileName)
        {
            Logging.Log singleLog = new Logging.Log();

            singleLog.labelId   = labelId;
            singleLog.label     = label;
            singleLog.labelFile = labelFileName;

            this.logging.add(singleLog);
        }
Пример #6
0
        private void FillServerDetails(Logging.Log log)
        {
            log.ServerMachineName = TakeMax(System.Environment.MachineName, 40);

            try
            {
                var process = System.Diagnostics.Process.GetCurrentProcess();
                log.ServerProcessName = TakeMax(process.ProcessName, 30);
                log.ServerProcessId   = process.Id;
            }
            catch
            {
            }
        }
Пример #7
0
            public void Render(Logging.Log log, Logging.Log?prevLog)
            {
                string timestamp = "[" + log.time.ToString("HH:mm:ss.fff") + " " + log.levelStr + "]";

                Color color  = getColorFromLevel(log.level) ?? Color.LightGray;
                var   color2 = color;

                color2.A = (byte)(color2.A / 2);
                color2   = AlphaComposite(Color.White, color2);
                var color1 = AlphaComposite(color2, color);


                ssb.Append(timestamp, new BackgroundColorSpan(color1), SpanTypes.ExclusiveExclusive);
                ssb.Append(log.text);
                textView.SetBackgroundColor(color2);
                textView.SetText(ssb, TextView.BufferType.Spannable);
                ssb.Clear();
                int topMargin;

                if (MyData.DynamicMargin == false || prevLog == null)
                {
                    topMargin = 0;
                }
                else
                {
                    var delta = log.runningTime - prevLog.Value.runningTime;
                    if (delta < 10)
                    {
                        topMargin = 0;
                    }
                    else
                    {
                        topMargin = (int)(Math.Log(delta / 10, 1.5) * 1.5 * dip);
                    }
                }
                textView.LayoutParameters = new LinearLayout.LayoutParams(-1, -2)
                {
                    TopMargin = topMargin
                };
            }
Пример #8
0
        public Session(Uri URL, String Username, String Password, DirectoryInfo LocalCache, Int32 SyncDelay, Logging.Log Log)
        {
            this.Reading       = false;
            this.ReadingNumber = 0;
            this.ReadingTotal  = 0;
            this.Writing       = false;
            this.WritingNumber = 0;
            this.WritingTotal  = 0;
            this.Initialised   = false;

            this.ItemTypeCache = new Dictionary <string, Model.ItemType>();
            this.ItemCache     = new Dictionary <Model.ItemType, Dictionary <Guid, Item> >();
            this.Loaded        = new List <Int64>();
            this.UploadQueue   = new ConcurrentQueue <Int64>();
            this.Downloaded    = new List <Int64>();

            this.URL      = URL;
            this.Username = Username;

            // Store Secure Password
            this.Password = new System.Security.SecureString();

            foreach (char c in Password.ToCharArray())
            {
                this.Password.AppendChar(c);
            }

            this.LocalCache = LocalCache;
            this.SyncDelay  = SyncDelay;
            this.Log        = Log;

            this.Log.Add(plmOS.Logging.Log.Levels.DEB, "Opening SharePoint Database: " + this.URL);

            // Start Download
            this.DownloadThread = new Thread(this.Download);
            this.DownloadThread.IsBackground = true;
            this.DownloadThread.Start();
        }
Пример #9
0
        private void MainPanelTimer_Tick(object sender, EventArgs e)
        {
            try
            {
                if (_playerName != ObjectManager.Me.Name && !string.IsNullOrEmpty(ObjectManager.Me.Name) &&
                    ObjectManager.Me.IsValid)
                {
                    Thread.Sleep(1000);
                    if (_playerName != ObjectManager.Me.Name && !string.IsNullOrEmpty(ObjectManager.Me.Name) &&
                        ObjectManager.Me.IsValid)
                    {
                        Logging.WriteError(nManager.Translate.Get(nManager.Translate.Id.PlayerNameChanged));
                        Pulsator.Dispose(true);
                    }
                }

                if (ObjectManager.Me.IsValid)
                {
                    if (Health.Value < ObjectManager.Me.HealthPercent || Health.Value > ObjectManager.Me.HealthPercent)
                    {
                        Health.Value = (int)ObjectManager.Me.HealthPercent;
                    }
                    toolTip.SetToolTip(Health, ObjectManager.Me.Health + "/" + ObjectManager.Me.MaxHealth);
                }
                else
                {
                    Health.Value = 0;
                    toolTip.SetToolTip(Health, "0/" + ObjectManager.Me.MaxHealth);
                }
                if (Products.IsStarted && ObjectManager.Me.IsValid)
                {
                    XPPerHour.Text                = Statistics.ExperienceByHr().ToString();
                    HonorPerHour.Text             = Statistics.HonorByHr().ToString();
                    LootsCount.Text               = Statistics.Loots + " (" + Statistics.LootsByHr() + "/" + nManager.Translate.Get(nManager.Translate.Id.hr) + ")";
                    UnitKillsCount.Text           = Statistics.Kills + " (" + Statistics.KillsByHr() + "/" + nManager.Translate.Get(nManager.Translate.Id.hr) + ")";
                    DeathsCount.Text              = Statistics.Deaths + " (" + Statistics.DeathsByHr() + "/" + nManager.Translate.Get(nManager.Translate.Id.hr) + ")";
                    FarmsCount.Text               = Statistics.Farms + " (" + Statistics.FarmsByHr() + "/" + nManager.Translate.Get(nManager.Translate.Id.hr) + ")";
                    ProductStartedSinceLabel.Text = "Product started since : " + Others.SecToHour((Statistics.RunningTimeInSec()));
                }
                else if (!Products.IsStarted && ObjectManager.Me.IsValid)
                {
                    ProductStartedSinceLabel.Text = "";
                }
                if (ObjectManager.Target.IsValid)
                {
                    TargetName.Text = ObjectManager.Target.Name;
                    if (TargetHealth.Value < ObjectManager.Target.HealthPercent || TargetHealth.Value > ObjectManager.Target.HealthPercent)
                    {
                        TargetHealth.Value = (int)ObjectManager.Target.HealthPercent;
                    }
                    toolTip.SetToolTip(TargetHealth, ObjectManager.Target.Health + "/" + ObjectManager.Target.MaxHealth);
                    TargetLevel.Text = ObjectManager.Target.Level.ToString();
                }
                else
                {
                    TargetName.Text    = @"-";
                    TargetHealth.Value = 0;
                    toolTip.SetToolTip(TargetHealth, "0/1");
                    TargetLevel.Text = @"-";
                }
                Logging.Log log = Logging.ReadLast(Logging.LogType.S);
                LatestLog.Text            = log.ToString();
                LatestLog.ForeColor       = log.Color;
                BotStartedSinceLabel.Text = nManager.Translate.Get(nManager.Translate.Id.tnb_started_since) + @" : " + Others.SecToHour((Others.Times - LoginServer.StartTime) / 1000);
            }
            catch (Exception ex)
            {
                Logging.WriteError("Main > gameInformationTimer_Tick(object sender, EventArgs e): " + ex);
            }

            if (Display.WindowInTaskBarre(Memory.WowProcess.MainWindowHandle) &&
                Products.IsStarted)
            {
                if (!_wowInTaskBarre)
                {
                    _wowInTaskBarre = true;
                    Display.ShowWindow(Memory.WowProcess.MainWindowHandle);
                }
            }
            else
            {
                _wowInTaskBarre = false;
            }
        }
Пример #10
0
 private void Logging_Logged(Logging.Log log)
 {
     PendingUpdate();
 }