public PredefinedNameStrippingAnalyzer(IReportLog reportLog, IEnumerable <string> suspiciousNames, INameAnalyzer underlyingAnalyzer) { m_ReportLog = reportLog ?? throw new ArgumentNullException(nameof(reportLog)); m_UnderlyingAnalyzer = underlyingAnalyzer ?? throw new ArgumentNullException(nameof(underlyingAnalyzer)); m_SuspiciousNames = suspiciousNames.OrderByDescending(x => x.Length).ToArray(); }
public static RenameProcessor Build(SearchType searchType, string searchString, bool searchCaseSensitive, ReplaceType replaceType, string replaceString) { INameAnalyzer nameAnalyzer = null; switch (searchType) { case SearchType.WhiteSpace: { nameAnalyzer = new WhiteSpaceAnalyzer(); break; } case SearchType.Special: { nameAnalyzer = new SpecialEndingAnalyzer(); break; } case SearchType.Characters: { var splitParts = searchString.Split(',') .Select(split => split.Trim()); var isMultiSearch = false; if (splitParts.Count() > 1) { if (splitParts.All(split => split.StartsWith("\"") && split.EndsWith("\""))) { isMultiSearch = true; } } if (isMultiSearch) { nameAnalyzer = new MultiStringAnalyzer(searchString, searchCaseSensitive); } else { nameAnalyzer = new SingleStringAnalyzer(searchString, searchCaseSensitive); } break; } } INameRefactorer nameRefactorer = null; switch (replaceType) { case ReplaceType.Delete: { nameRefactorer = new StringRefactorer(""); break; } case ReplaceType.WhiteSpace: { nameRefactorer = new StringRefactorer(" "); break; } case ReplaceType.Characters: { nameRefactorer = new StringRefactorer(replaceString); break; } } return(new RenameProcessor(nameAnalyzer, nameRefactorer)); }
private static void Main(string[] args) { m_Log = new ConsoleLogger() .WithConsoleColours() .WithTimeStampLogging(DateTimeKind.Local) .WithLogLevelPrefixes(); m_ReportLog = new FileReportLog(m_Log); m_MatchAnalyzer = CreateCompositeAnalyzer(); m_NameAnalyzer = CreateNameAnalyzer(); m_MatchRepository = new MatchRepository(CreateHttpClient, m_Log); m_SummonerRepository = new SummonerRepository(CreateHttpClient, m_Log); var patientZero = m_SummonerRepository.GetAccountBySummonerName("uEeTLydia"); RunAnalysis(patientZero); while (true) { var toSearch = AccountsToAnalyze.ToArray(); if (toSearch.Length == 0) { m_Log.Log("We have no accounts to search, something's clearly wrong, exiting :D", LogLevel.error); Environment.Exit(0); } foreach (var n in toSearch) { Console.WriteLine(); AccountsToAnalyze.RemoveAll(a => a.AccountId == n.AccountId); try { if (File.Exists($@".\Reports\{n.SummonerName}.json")) { m_Log.Log($"Already analysed {n.SummonerName}, skipping", LogLevel.info); continue; } var next = m_SummonerRepository.GetAccountById(n.AccountId); if (File.Exists($@".\Reports\{next.SummonerName}.json")) { m_Log.Log($"Already analysed {next.SummonerName}, skipping", LogLevel.info); continue; } RunAnalysis(next); } catch (SummonerRepositoryFailureException) { m_Log.Log($"{n.SummonerName} has played no bot games", LogLevel.info); } finally { AnalyzedAccounts.Add(n); } } } }
public RenameProcessor(INameAnalyzer analyzer, INameRefactorer refactorer) { this.analyzer = analyzer; this.refactorer = refactorer; }