Example #1
0
        public static bool ParseModFile(string modFileData)
        {
            if (SystemsContainer.Get <ModSystem>().ModControl == ModControlMode.Disabled)
            {
                return(true);
            }

            SystemsContainer.Get <ModSystem>().LastModFileData = modFileData; //Save mod file so we can recheck it.

            StringBuilder = new StringBuilder();
            ParseRequired.Clear();
            ParseOptional.Clear();
            WhiteList.Clear();
            BlackList.Clear();
            PartsList.Clear();

            SaveCurrentModConfigurationFile();

            ReadModConfigurationFile(modFileData);

            CheckFiles();

            if (!ModCheckOk)
            {
                SystemsContainer.Get <ModSystem>().FailText = StringBuilder.ToString();
                WindowsContainer.Get <ModWindow>().Display  = true;
                return(false);
            }

            SystemsContainer.Get <ModSystem>().AllowedParts = PartsList;
            LunaLog.Log("[LMP]: Mod check passed!");
            return(true);
        }
Example #2
0
        public override bool Do()
        {
            if (BlackList.IsBlacklisted(this.unit))
            {
                return(true);
            }

            if (this.unit.Reaction.Equals(Enums.UnitReaction.Friendly) || this.unit.Health <= 0)
            {
                BlackList.Blacklist(this.unit);
                return(true);
            }

            if (CustomClasses.Instance == null || CustomClasses.Instance.Current == null)
            {
                return(true);
            }

            Logger.Log("We are doing combat!");


            if (ObjectManager.Instance.Player.TargetGuid.Equals(this.unit.Guid) == false &&
                ObjectManager.Instance.Player.IsInCombat.Equals(false))
            {
                ObjectManager.Instance.Player.Face(this.unit);
                ObjectManager.Instance.Player.SetTarget(this.unit);
                CustomClasses.Instance.Current.OnPull();
            }
            else
            {
                CustomClasses.Instance.Current.OnFight();
            }

            return(this.unit.Health <= 0);
        }
        /// <summary>
        /// Return if the player is blacklisted.
        /// </summary>
        /// <param name="Player">Player to check.</param>
        public static bool IsBlackListed(this Player Player)
        {
            if (Core.Setting.BlackList)
            {
                BlackList BlackList = GetBlackList(Player);

                if (BlackList != null)
                {
                    if (BlackList.Duration == -1 || DateTime.Now < BlackList.StartTime.AddSeconds(BlackList.Duration))
                    {
                        return(true);
                    }
                    else
                    {
                        Core.Setting.BlackListData.Remove(BlackList);
                        Core.Setting.Save();
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Example #4
0
        public async Task <IActionResult> PutBlackList(int id, BlackList blackList)
        {
            if (id != blackList.Id)
            {
                return(BadRequest());
            }

            _context.Entry(blackList).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BlackListExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #5
0
        public JsonResult List(BlackList filter, PageInfo pageInfo)
        {
            if (!string.IsNullOrEmpty(filter.BankName))
            {
                var inforSearchObj = new InforSearchOperate()
                {
                    CreateOn   = DateTime.Now,
                    OperaterId = Operator.UserId,
                    OperateMsg = "搜索    近似银行搜索词:" + filter.BankName
                };
                InforSearchOperateService.CreateModel(inforSearchObj);
            }
            var result = blackListService.GetListByFilter(filter, pageInfo);
            //Type t = result.GetType();
            //PropertyInfo p = t.GetProperty("count");
            //object v = p.GetValue(result, null);
            object v = result?.GetType().GetProperty("count")?.GetValue(result, null);

            if (v != null)
            {
                if ((long)v == 0)
                {
                    var inforSearchObj = new InforSearchOperate()
                    {
                        CreateOn   = DateTime.Now,
                        OperaterId = Operator.UserId,
                        OperateMsg = $"搜索    近似银行搜索词:{filter.BankName} 无搜索结果,已提示您搜索的承兑行 {filter.BankName} 无搜索结果,请您根据实际情况自行把控风险!"
                    };
                    InforSearchOperateService.CreateModel(inforSearchObj);
                }
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public async Task <BlackList> AddUserInBlock(string id, string blockUserId)
        {
            try
            {
                var userInBlock = new BlackList
                {
                    UserId         = id,
                    ContactBlockId = blockUserId,
                };
                var currentUserInBlock = new BlackList
                {
                    UserId         = blockUserId,
                    ContactBlockId = id,
                };

                await db.BlackLists.Create(userInBlock);

                await db.Contacts.Save();

                return(userInBlock);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #7
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Checking if sniffers active
            if (BlackList.CheckDebuggers())
            {
                MessageBox.Show("Debugger detected!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Запуск
            if (BlackList.CheckStudio() > 0)
            {
                MessageBox.Show("The Doorway Studio already running!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (BlackList.CheckAutomator() > 1)
            {
                MessageBox.Show("Automator already running!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Application.Run(new StartUp());
        }
        private async void OnClearList()
        {
            OnInfoRequested(LanguageChanger.Instance["BlackListVm_Code4"]);
            await Task.Run(() =>
            {
                var result = _ioSecurity.StoreData(new List <ProcessModel>());
                if (result.Success)
                {
                    _isError = false;
                    OnInfoRequested(LanguageChanger.Instance["BlackListVm_Code5"]);
                    var refreshResult = _serviceLifetimeController.RefreshService();
                    if (refreshResult.Success)
                    {
                        OnInfoRequested(LanguageChanger.Instance["BlackListVm_Code6"]);
                    }
                    else
                    {
                        OnError(refreshResult.ErrorMessage);
                    }
                }
                else
                {
                    OnError(result.ErrorMessage);
                    OnInfoRequested(LanguageChanger.Instance["BlackListVm_Code7"]);
                }
            });

            if (!_isError)
            {
                BlackList.Clear(); //to avoid CrossThreadException
            }
        }
Example #9
0
        private void DownloadFailHandler()
        {
            ObservableCollection <DownloadItem> downloadItemList
                = PhoneApplicationService.Current.State[Constants.DOWNLOAD_IMAGE_LIST] as ObservableCollection <DownloadItem>;
            DownloadItem downloadItem = downloadItemList[0];

            if (downloadItem.SourceOrigin == SourceOrigin.Search)
            {
                if (MessageBox.Show(AppResources.MsgWrongImage + AppResources.MsgAllowDomainFilter, AppResources.DomainFilter, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    BlackList blackList = new BlackList();
                    blackList.Add(new BlackDomain()
                    {
                        AddedDateTime = DateTime.Now,
                        BlackListMode = BlackListMode.Domain,
                        Host          = DomainHelper.GetDomainFromUrl(downloadItem.DownloadPath as string),
                        SearchKeyword = searchQuery == null ? string.Empty : searchQuery
                    });
                    blackList.SaveData();
                }
            }
            else
            {
                MessageBox.Show(AppResources.MsgWrongImage);
            }
            NavigationService.GoBack();
        }
        public IActionResult Block(string blockedUserName)
        {
            try
            {
                User user = _userRepository.GetUserByName(blockedUserName);
                if (user == null)
                {
                    return(BadRequest("User could not found!"));
                }

                BlackList message = new BlackList();
                message.BlockedUserId = user.UserId;
                message.UserId        = Convert.ToInt32(this.User.FindFirst("UserId").Value);

                _blackListRepository.Insert(message);
                return(Ok(true));
            }
            catch (Exception ex)
            {
                _errorLogRepository.Insert(new ErrorLog()
                {
                    Text = ex.ToString()
                });
                return(BadRequest("Error Occured!"));
            }
        }
Example #11
0
        public async Task <ActionResult <BlackList> > PostBlackList(BlackList blackList)
        {
            _context.BlackList.Add(blackList);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBlackList", new { id = blackList.Id }, blackList));
        }
Example #12
0
        public static bool ParseModFile(string modFileData)
        {
            if (ModSystem.Singleton.ModControl == ModControlMode.DISABLED)
            {
                return(true);
            }

            ModSystem.Singleton.LastModFileData = modFileData; //Save mod file so we can recheck it.

            StringBuilder = new StringBuilder();
            ParseRequired.Clear();
            ParseOptional.Clear();
            WhiteList.Clear();
            BlackList.Clear();
            PartsList.Clear();

            SaveCurrentModConfigurationFile();

            ReadModConfigurationFile(modFileData);

            CheckFiles();

            if (!ModCheckOk)
            {
                ModSystem.Singleton.FailText = StringBuilder.ToString();
                ModWindow.Singleton.Display  = true;
                return(false);
            }

            ModSystem.Singleton.AllowedParts = PartsList;
            Debug.Log("[LMP]: Mod check passed!");
            return(true);
        }
Example #13
0
    void _Packet(ScFriendApplyDetail p)
    {
        ScFriendApplyDetail pp = p.Clone();

        if (pp.applyInfo == null || pp.applyInfo?.playerInfo == null)
        {
            return;
        }
        var black = BlackList.Exists(a => a.roleId == pp.applyInfo.playerInfo.roleId);

        if (black)
        {
            return;
        }

        PPlayerInfo apply = Apply_playerList.Find(a => a.roleId == pp.applyInfo.playerInfo.roleId);

        if (apply != null)
        {
            RemoveApply(apply);
        }
        AddApply(pp.applyInfo);
        Apply_playerList.Reverse();//按接收顺序翻转所以就会是最早的在第一个
        DispatchModuleEvent(EventFriendApplyList);

        if (moduleFriend.FriendList.Count < FriendNumTop)
        {
            moduleHome.UpdateIconState(HomeIcons.Friend, true);
        }
    }
Example #14
0
        private void SetExpirationDate(BlackList blackList)
        {
            var expirationDate = DateTime.UtcNow.AddMonths(1);
            var metadata       = RavenSession.Advanced.GetMetadataFor(blackList);

            metadata[Raven.Client.Constants.Documents.Metadata.Expires] = expirationDate;
        }
Example #15
0
        private void GetBlackList()
        {
            BlackList.Clear();
            BlacklistPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Blacklist.conf");

            if (File.Exists(BlacklistPath))
            {
                FileStream stream = File.OpenRead(BlacklistPath);

                using (var streamReader = new StreamReader(stream, Encoding.UTF8))
                {
                    string line;
                    while ((line = streamReader.ReadLine()) != null)
                    {
                        if (line.Substring(0, 2).Equals("//") || line == string.Empty)
                        {
                            continue;
                        }

                        BlackList.Add(line);
                    }
                }

                stream.Close();
            }
            else
            {
                File.Create(BlacklistPath);
            }
        }
Example #16
0
        static void Main(string[] args)
        {
            BasicConfigurator.Configure();
            SetConsoleCtrlHandler(new HandlerRoutine(ConsoleCtrlCheck), true);
            log.Info("Application Started");
            _priceEngine = new PriceEngine(new SecurityPriceRetrieverStrategy(new YahooMarketDataPriceSource()));
            string apiKey = ConfigurationManager.AppSettings["EdgarApiKey"];

            _statementEngine = new StatementEngine(new StatementRetrieverStrategy(new EdgarMarketDataFinancialStatementSource(apiKey)));
            _ncavEngine      = new NcavEngine();
            log.Info("Starting to retrieve prices");
            while (_priceEngine.ShouldWork)
            {
                _priceEngine.DoCycle();
            }
            log.Info("Prices retrieved.");
            log.Info("Starting to retrieve financial statements");
            while (_statementEngine.ShouldWork)
            {
                _statementEngine.DoCycle();
            }
            log.Info("Financial statements retrieved.");
            log.Info("Starting to Update Ncav and discounts on Ncav");
            while (_ncavEngine.ShouldWork)
            {
                _ncavEngine.DoCycle();
            }
            log.Info("Calculus on Net current asset value done.");
            //log.Info("Exiting Application.");
            using (var unitOfWork = new UnitOfWork(new MidasContext()))
            {
                var securitiesToInvest =
                    SecurityDalFactory.GetInstance()
                    .GetSecurityDal()
                    .GetAllSecurities()
                    .Where(x => x.DiscountOnNcav > (Decimal)0.25)
                    .Where(x => !BlackList.IsBlackListed(x.Ticker))
                    .OrderBy(x => x.DiscountOnNcav).Reverse()
                    .ToList();
                foreach (var security in securitiesToInvest)
                {
                    log.Info(string.Format("Found security {0} with discount on Ncav : {1}", security.Ticker, security.DiscountOnNcav));
                }
                log.Info(string.Format("Total : {0}", securitiesToInvest.Count));

                //var ssl = unitOfWork.Securities.Find(s => s.Ticker == "NTWK").First();
                //var statements = unitOfWork.FinancialStatements.Find(s => s.PrimarySymbol == "NTWK");
                //var latestStatement = statements.OrderBy(s => s.PeriodEnd).Last();
                //var ncav = latestStatement.BalanceSheet.TotalCurrentAssets -
                //           latestStatement.BalanceSheet.TotalCurrentLiabilities;
                //var last = ssl.Last;
                //var ticker = "DAL";
                //var fcau = unitOfWork.Securities.Find(x => x.Ticker == ticker);
                //var statements = unitOfWork.FinancialStatements.GetAll().Where(s => s.PrimarySymbol == ticker).Where(x => x.FormType == "10-K");
                int test = 0;

                Console.ReadLine();
            }
        }
Example #17
0
 private BlackListResultDto Ok(BlackList blackList)
 {
     return(new BlackListResultDto
     {
         Success = true,
         Entity = _mapper.Map <BlackList, BlackListDto>(blackList)
     });
 }
        private List <HFile> GetFiles(SnapshotLocation snapshotLocation)
        {
            BlackList blackList = GetBlackList(snapshotLocation);

            IEnumerable <HFile> files = snapshotRepository.EnumerateFiles(snapshotLocation, blackList);

            return(files.ToList());
        }
Example #19
0
 public static bool BackgroundCheck(ICitizen citizen)
 {
     if (BlackList.Contains(citizen))
     {
         return(true);
     }
     return(false);
 }
 public bool IsBlackWord(string name)
 {
     if (BlackList.ContainsKey(name.ToLowerInvariant()))
     {
         return(true);
     }
     return(false);
 }
Example #21
0
        public List <BlackList> GetBlackLists(int?userId = null, bool?banned = null, int?id = null)
        {
            StringBuilder sqlCommandBuilder = new StringBuilder("SELECT * FROM public.black_list");

            if (id != null)
            {
                sqlCommandBuilder.Append(" WHERE id=" + id);
            }
            else if (userId != null && banned != null)
            {
                sqlCommandBuilder.Append(String.Format(" WHERE user_id='{0}'", userId));
            }
            else if (userId != null)
            {
                sqlCommandBuilder.Append(" WHERE user_id=" + userId);
            }
            else if (banned != null)
            {
                sqlCommandBuilder.Append(" WHERE banned=" + (banned.Value ? "1" : "0"));
            }


            List <BlackList> userDetailsList = new List <BlackList>();

            using (DbConnection connection = DBUtils.GetPostgreSQLDBConnection())
            {
                DbDataReader reader = DBUtils.ExecuteCommand(sqlCommandBuilder.ToString(), connection);

                BlackList blackListToAdd = null;

                try
                {
                    while (reader.Read())
                    {
                        blackListToAdd = new BlackList()
                        {
                            Id       = Convert.ToInt32(reader["id"].ToString()),
                            Warnings = Convert.ToInt32(reader["warnings"].ToString()),
                            Banned   = reader["banned"].ToString().Equals("1"),
                            UserId   = Convert.ToInt32(reader["user_id"].ToString()),
                        };

                        userDetailsList.Add(blackListToAdd);
                    }
                }
                catch (FormatException ex)
                {
                    DebugLog.WriteLine(ex);
                }
                finally
                {
                    reader.Close();
                }
            }

            return(userDetailsList);
        }
Example #22
0
 public long CreateBlackList(BlackList blackList)
 {
     DbParameter[] parms =
     {
         DbHelper.MakeInParam("@UID",       (DbType)SqlDbType.BigInt, 8, blackList.UID),
         DbHelper.MakeInParam("@PulledUID", (DbType)SqlDbType.BigInt, 8, blackList.PulledUID)
     };
     return(TypeConverter.ObjectToLong(DbHelper.ExecuteScalar(CommandType.StoredProcedure, "CreateBlackList", parms), -1));
 }
Example #23
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="container">container for the kernel manager</param>
        /// <param name="comparer">used to compare to export strategies for which one should be used</param>
        /// <param name="blackList">export strategy black list</param>
        public InjectionKernelManager(DependencyInjectionContainer container,
			ExportStrategyComparer comparer,
			BlackList blackList)
        {
            Container = container;

            this.comparer = comparer;
            this.blackList = blackList;
        }
        public IActionResult DeleteBlackLisedPassword(int id)
        {
            BlackList blackList = context.BlackListedPasswords.Find(id);

            context.BlackListedPasswords.Remove(blackList);
            context.SaveChanges();

            return(RedirectToAction("PasswordBlackList"));
        }
Example #25
0
        private bool IsIpAddressBlocked()
        {
            var ip = Request.UserHostAddress;

            var blacklistId = BlackList.GetId(ip);

            var documentExists = RavenSession.Advanced.Exists(blacklistId);

            return(documentExists);
        }
Example #26
0
 internal void WriteBlackList(ulong user)
 {
     using (var db = new TwitterBotContext())
     {
         var blackList = new BlackList();
         blackList.UserId = Convert.ToInt64(user);
         db.BlackLists.Add(blackList);
         db.SaveChanges();
     }
 }
        private bool IsInBlacklist(string NewPassword)
        {
            BlackList blackList = context.BlackListedPasswords.FirstOrDefault(u => u.BlackListedPassword == NewPassword);

            if (blackList == null)
            {
                return(false);
            }
            return(true);
        }
Example #28
0
        public override void Write()
        {
            _worldPacket.WriteInt32(Dungeons.Count);
            BlackList.Write(_worldPacket);

            foreach (var dungeonInfo in Dungeons)
            {
                dungeonInfo.Write(_worldPacket);
            }
        }
Example #29
0
        public void Update(BlackList blackList)
        {
            string sqlCommand = String.Format("UPDATE public.black_list SET warnings='{0}', banned=b'{1}', user_id='{2}' WHERE id='{3}'",
                                              blackList.Warnings, blackList.Banned ? "1" : "0", blackList.UserId, blackList.Id);

            using (DbConnection connection = DBUtils.GetPostgreSQLDBConnection())
            {
                DBUtils.ExecuteCommand(sqlCommand, connection);
            }
        }
Example #30
0
		public void BasicClassTest()
		{
			BlackList blackList = new BlackList { "Hello", "World" };

			List<string> newList = new List<string>(blackList);

			Assert.Equal(2, newList.Count);
			Assert.Equal("Hello", newList[0]);
			Assert.Equal("World", newList[1]);
		}
Example #31
0
        public static WebSession CreateSession(HttpRequest request)
        {
            int    visitTimes = 1;
            string clientID   = string.Empty;
            string empty      = string.Empty;
            string source;
            string keyword;

            SessionService.TryToFindSearchEnginSourceAndKeyword(request, out source, out keyword);
            if (request.Cookies["VisitTime"] != null)
            {
                visitTimes = Convert.ToInt32(request.Cookies["VisitTime"].Value) + 1;
            }
            if (request.Cookies["ClientID"] != null && request.Cookies["ClientID"].Value != "")
            {
                clientID = request.Cookies["ClientID"].Value;
            }
            else
            {
                clientID = Guid.NewGuid().ToString();
            }
            WebSession webSession = new WebSession();

            StringHelper.isNullOrEmpty(empty);
            webSession.AccountID           = empty;
            webSession.Browser             = request.ServerVariables["HTTP_USER_AGENT"];
            webSession.ClientID            = clientID;
            webSession.ClientIP            = WebClientOperator.GetClientIP(request);
            webSession.CreateTime          = DateTime.Now;
            webSession.EndTime             = webSession.CreateTime;
            webSession.HostName            = request.ServerVariables["HTTP_HOST"];
            webSession.LastRequestTime     = webSession.CreateTime;
            webSession.SessionID           = Guid.NewGuid().ToString();
            webSession.StartTime           = webSession.CreateTime;
            webSession.UpdateStamp         = Guid.NewGuid().ToString();
            webSession.UpdateTime          = webSession.CreateTime;
            webSession.VisitTimes          = visitTimes;
            webSession.Source              = source;
            webSession.Keyword             = keyword;
            webSession.StoragePath         = ConfigurationManager.AppSettings["StoragePath"];
            webSession.StorageRelativePath = ConfigurationManager.AppSettings["StorageRelativePath"];
            BlackList blackList = SiteProtectService.TryToFindIPInBlackList(webSession.ClientIP);

            if (blackList == null)
            {
                webSession.BlockType = BlockType.NoBlock;
            }
            else
            {
                webSession.BlockType = (BlockType)blackList.BlockType;
            }
            SessionService.sessionGateway.AddNew(webSession);
            return(webSession);
        }
Example #32
0
        public void Allowed()
        {
            var policy = new BlackList <string>();

            policy.Add("c");
            policy.Add("d");
            Assert.IsTrue(policy.IsAllowed("a"));
            Assert.IsTrue(policy.IsAllowed("b"));
            Assert.IsFalse(policy.IsAllowed("c"));
            Assert.IsFalse(policy.IsAllowed("d"));
        }
Example #33
0
		public void EnumerableTest()
		{
			BlackList blackList = new BlackList { "Hello", "World" };

			List<string> newList = new List<string>();

			foreach (object o in (IEnumerable)blackList)
			{
				newList.Add((string)o);
			}

			Assert.Equal(2, newList.Count);
			Assert.Equal("Hello", newList[0]);
			Assert.Equal("World", newList[1]);
		}
 protected void Add_Click(object sender, EventArgs e)
 {
     try
     {
         ThonStarcraftDataContext sdc = new ThonStarcraftDataContext();
         BlackList bl = new BlackList();
         bl.Name = Name.Text;
         bl.Genre = Genre.SelectedValue;
         bl.Rating = Int32.Parse(Rating.SelectedValue);
         bl.ID = Guid.NewGuid();
         sdc.BlackLists.InsertOnSubmit(bl);
         sdc.SubmitChanges();
     }
     catch (Exception e11)
     { ErrorLbl.Visible = true; e11 = null; }
 }
Example #35
0
		public void IsBlackedListedTest()
		{
			BlackList blackList = new BlackList { "Hello", "World" };

			Assert.True(blackList.IsExportStrategyBlackedOut(new FauxExportStrategy(() => new object())
			                                                 {
				                                                 ActivationName = "Hello",
			                                                 }));

			Assert.True(blackList.IsExportStrategyBlackedOut(new FauxExportStrategy(() => new object())
			                                                 {
				                                                 ActivationName = "World"
			                                                 }));

			Assert.False(blackList.IsExportStrategyBlackedOut(new FauxExportStrategy(() => new object())
			                                                  {
				                                                  ActivationName = "GoodBye"
			                                                  }));
		}
 partial void InsertBlackList(BlackList instance);
 partial void UpdateBlackList(BlackList instance);
 partial void DeleteBlackList(BlackList instance);