예제 #1
0
        // Constructor
        public MainViewModel()
        {
            // Filler for Line graph
            this.Title = "Line Graph";

            var trap1 = new Trap()
            {
                TrapNumber           = 1,
                Geo1                 = "7.080744",
                Geo2                 = "125.506953",
                NoOfCaughtMosquitoes = 0
            };

            var trap2 = new Trap()
            {
                TrapNumber           = 2,
                Geo1                 = "7.081007",
                Geo2                 = "125.507435",
                NoOfCaughtMosquitoes = 0
            };

            var trap3 = new Trap()
            {
                TrapNumber           = 3,
                Geo1                 = "7.080533",
                Geo2                 = "125.507446",
                NoOfCaughtMosquitoes = 0
            };

            TrapList.Add(trap1);
            TrapList.Add(trap2);
            TrapList.Add(trap3);
        }
예제 #2
0
        void update_list()
        {
            List <Trap> traps = Session.Traps;

            TrapList.BeginUpdate();
            TrapList.Items.Clear();
            foreach (Trap trap in traps)
            {
                // Check level
                if ((trap.Level < LevelRangePanel.MinimumLevel) || (trap.Level > LevelRangePanel.MaximumLevel))
                {
                    continue;
                }

                if (!match(trap, LevelRangePanel.NameQuery))
                {
                    continue;
                }

                ListViewItem lvi = TrapList.Items.Add(trap.Name);
                lvi.SubItems.Add(trap.Info);
                lvi.Group = TrapList.Groups[trap.Type == TrapType.Trap ? 0 : 1];
                lvi.Tag   = trap;
            }
            TrapList.EndUpdate();
        }
예제 #3
0
        public static int CheckSession(string sessionId, int teamid, int userid)
        {
            int      iRes       = 2;
            string   senderName = "DBActions.CheckSession";
            string   procName   = "SPCHAT_SIGNALR_SESSION_CHK_V1";
            string   ConnDB     = "DSN_CHAT";
            DateTime sTime      = Tools.GetTimeZoneDateTime();
            DateTime eTime      = sTime;

            try
            {
                using (DBFactory objDB = new DBFactory(ConnDB))
                {
                    objDB.AddInParam("sessionid", SqlType.VarChar, sessionId);
                    objDB.AddInParam("userid", SqlType.Int, userid);
                    objDB.AddInParam("teamid", SqlType.Int, teamid);
                    objDB.AddInParam("reqtime", SqlType.DateTime, Tools.GetTimeZoneDateTime());
                    objDB.AddOutParam("retval", SqlType.Int, 10);
                    objDB.RunProc(procName);
                    iRes = objDB.GetOutValue("retval").ToString().IsNumeric() ? Convert.ToInt32(objDB.GetOutValue("retval").ToString()) : -1;
                }
                eTime = Tools.GetTimeZoneDateTime();

                // Send Connectivity Success Trap
                SNMPMonitor.Send(SNMPCodes.DB_EXCEPTION, eTrapLevel.Clear, eSingalrTrap.DB_Connectivity.GetHashCode(), "SUCCESS");

                // Send execution Success Trap
                SNMPMonitor.Send(SNMPCodes.DB_EXCEPTION, eTrapLevel.Clear, eSingalrTrap.CheckSession.GetHashCode(),
                                 TrapList.GetMessageDB(senderName, procName, "SUCCESS"));
            }
            catch (Exception ex)
            {
                if (ex.Message.ToUpper().IndexOf("DB_CONNECTIVITY_FAILURE") > -1)
                {
                    // Connectivity Issue, Send failure Trap
                    SNMPMonitor.Send(SNMPCodes.DB_EXCEPTION, eTrapLevel.Critical, eSingalrTrap.DB_Connectivity.GetHashCode(), "Failed to Connect Database " + ConnDB);
                }
                else
                {
                    // send Procedure execution failure Trap
                    SNMPMonitor.Send(SNMPCodes.DB_EXCEPTION, eTrapLevel.Critical, eSingalrTrap.CheckSession.GetHashCode(),
                                     TrapList.GetMessageDB(senderName, procName, "Exception::" + ex.Message));
                }
                TextLog.DBError("", "Database", senderName + "|" + procName + "|Exception>>" + ex.ToString());
            }
            finally
            {
                #region finally
                // write log with time taking
                DBTimeTaking(string.Format("{0}|{1}|{2}|{3}|{4}",
                                           sTime.ToString("yyyy-MM-dd HH:mm:ss.fff"),
                                           sessionId,
                                           Math.Round(eTime.Subtract(sTime).TotalMilliseconds).ToString(),
                                           senderName,
                                           procName));
                #endregion
            }
            return(iRes);
        }
예제 #4
0
        private void TrapList_ColumnClick(object sender, ColumnClickEventArgs e)
        {
            TrapSorter sorter = TrapList.ListViewItemSorter as TrapSorter;

            sorter.Set(e.Column);

            TrapList.Sort();
        }
예제 #5
0
        private void SetupDetour()
        {
            //if we are not on the lobby & we have already reloaded detour for this floor return
            if (_floorId == DeepDungeonManager.Level)
            {
                return;
            }

            //Logger.Debug("Traps Last Floor: Floor = {0} RawZoneId = {1}   Total Traps: {2}   Distinct: {3}", _floorId, WorldManager.RawZoneId, Traps.Count, Traps.Distinct().Count());
            // AvoidanceManager.RemoveAllAvoids( r => r.Collection.Any());
            // AvoidanceManager.Avoids.Clear();

            //foreach (var i in DeepTracker.Traps.Where(r => r.Y != 0.0f))

            TrapList.CheckForTrapList(WorldManager.RawZoneId);
            foreach (var i in TrapList.TrapLocations[WorldManager.RawZoneId].trapList)
            {
                //Logger.Verbose($"##TRAPLIST## {i.X} , {i.Y} , {i.Z}");
                if (!trapList.Contains(new BoundingCircle {
                    Center = i.ToVector2().ToVector3(), Radius = TrapSize
                }))
                {
                    trapList.Add(new BoundingCircle {
                        Center = i.ToVector2().ToVector3(), Radius = TrapSize
                    });
                }
            }
            //AvoidanceManager.AddAvoidLocation(() => true, 2f, () => i, true);

            _floorId = DeepDungeonManager.Level;

            var map = Constants.Maps[WorldManager.RawZoneId];

            Logger.Debug("Floor = {0} Map = {1} RawZoneId = {2}", _floorId, map, WorldManager.RawZoneId);
            if (_detourLevel != map)
            {
                _detourLevel = map;
                _walls       = LoadWalls(map);
            }

            //load the map
            Walls  = new Dictionary <uint, bool>();
            _traps = new List <uint>();
            Traps  = new List <Vector3>();
            _map   = new List <Vector3>();

            Logger.Verbose("Updating navigation {0}", map);
            wallList.Clear();
            //trapList.Clear();
            activeWalls = FindWalls();

            WallCheck();

            startingLoc = Core.Me.Location;
            //Logger.Debug("Game objects: unit \t NpcID \t ObjID");
            //var units = GameObjectManager.GameObjects.Where(r => r.Name  == "Trap" );
        }
예제 #6
0
    // Use this for initialization
    void Start()
    {
        trapList = Resources.Load("TrapList/Trap") as TrapList;

        if (trapId == null)
        {
            trapId = "";
        }

        trapId.ObserveEveryValueChanged(_ => trapId)
        .Subscribe(_ => {
            SetTrapInfo();
        })
        .AddTo(this);
    }
예제 #7
0
        private static void SetupSettings()
        {
            Logger.Info("UpdateTrapSettings");

            TrapList.Initialize();

            Logger.Info($"Loaded {TrapList.TrapLocations.Count} trap files:");

            foreach (var file in TrapList.TrapLocations)
            {
                Logger.Info($"Loaded {file.Value.trapList.Count} traps for map {file.Key}");
            }

            //mimic stuff
            if (Settings.Instance.OpenMimics)
            {
                //if we have mimics remove them from our ignore list
                if (Constants.IgnoreEntity.Contains(EntityNames.MimicCoffer[0]))
                {
                    Constants.IgnoreEntity = Constants.IgnoreEntity.Except(EntityNames.MimicCoffer).ToArray();
                }
            }
            else
            {
                //if we don't have mimics add them to our ignore list
                if (!Constants.IgnoreEntity.Contains(EntityNames.MimicCoffer[0]))
                {
                    Constants.IgnoreEntity = Constants.IgnoreEntity.Concat(EntityNames.MimicCoffer).ToArray();
                }
            }

            //Exploding Coffers
            if (Settings.Instance.OpenTraps)
            {
                //if we have traps remove them
                if (Constants.IgnoreEntity.Contains(EntityNames.TrapCoffer))
                {
                    Constants.IgnoreEntity = Constants.IgnoreEntity.Except(new[] { EntityNames.TrapCoffer }).ToArray();
                }
            }
            else
            {
                if (!Constants.IgnoreEntity.Contains(EntityNames.TrapCoffer))
                {
                    Constants.IgnoreEntity = Constants.IgnoreEntity.Concat(new[] { EntityNames.TrapCoffer }).ToArray();
                }
            }

            if (Settings.Instance.OpenSilver)
            {
                //if we have traps remove them
                if (Constants.IgnoreEntity.Contains(EntityNames.SilverCoffer))
                {
                    Constants.IgnoreEntity = Constants.IgnoreEntity.Except(new[] { EntityNames.SilverCoffer }).ToArray();
                }
            }
            else
            {
                if (!Constants.IgnoreEntity.Contains(EntityNames.SilverCoffer))
                {
                    Constants.IgnoreEntity = Constants.IgnoreEntity.Concat(new[] { EntityNames.SilverCoffer }).ToArray();
                }

                /*              if (!Constants.IgnoreEntity.Contains(EntityNames.GoldCoffer))
                 *                  Constants.IgnoreEntity = Constants.IgnoreEntity.Concat(new[] { EntityNames.GoldCoffer }).ToArray();	 */
                //if (!Constants.IgnoreEntity.Contains(EntityNames.GoldChest))
                //     Constants.IgnoreEntity = Constants.IgnoreEntity.Concat(new[] { EntityNames.GoldChest }).ToArray();
            }

            Settings.Instance.Dump();
        }