public SearcherF() { InitializeComponent(); Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); MinimumSize = MaximumSize = Size; MaximizeBox = false; Load += (sender, e) => { ImageList imgList = new ImageList(); for (int i = 0; i < FilesManager.BuildSets.Count; i++) { BuildSet set = FilesManager.BuildSets[i]; imgList.Images.Add(set.Image); } listView1.SmallImageList = imgList; }; textBox1.TextChanged += (sender, e) => { if (textBox1.Text.Length > 1) { SearchByWord(textBox1.Text); } else if (textBox1.Text.Length == 0) { listView1.Items.Clear(); } }; listView1.MouseDoubleClick += (sender, e) => { if (listView1.SelectedIndices.Count == 0 || listView1.SelectedIndices[0] < 0) { return; } ListViewItem item = listView1.GetItemAt(e.X, e.Y); if (item?.Tag is BuildingEntry entry) { if (!Global.FreeView) { Global.FreeView = true; } Global.X = entry.Location.X; Global.Y = entry.Location.Y; Global.Facet = entry.Map == 7 ? 0 : entry.Map; } }; FormClosing += (sender, e) => { if (Global.FreeView) { Global.FreeView = false; } }; }
public static BuildSet GetMatchBuild(MatchDetail match, Participant participant) { if (PotentialUpgrades == null) { InitializePotentialUpgrades(); } var set = new BuildSet() { HasMatchData = true }; set.TimeSince = GetTimeSince(match.MatchCreation); var timeline = match.Timeline; var allPurchasedItems = getAllPurchasedItems(timeline, participant.ParticipantId); set.InitialPurchase = getStartingItems(timeline, participant.ParticipantId); set.FinalBuild = getFinalBuild(participant); set.RushItem = getRushItem(allPurchasedItems.ToList(), set.InitialPurchase.Items.ToList()); var allConsumables = getConsumables(allPurchasedItems.ToList()); if (allConsumables.Count > 0) { set.Consumables = (getPurchaseSet("Consumables", allConsumables, includePrice: false)); } set.FullBuild = set.FinalBuild.Items.Count == 7 && !(set.FinalBuild.Items.Any(x => PotentialUpgrades.ContainsKey(x.Id.ToString()))); set.Id = match.MatchId; set.MatchDataFetched = true; return(set); }
private Node AddRoot(string name, Bitmap img, CheckState enabled, BuildSet set) { MyRoot node = new MyRoot(name, img, enabled) { Tag = set }; _model.Nodes.Add(node); return(node); }
public static bool Start(BuildSet BuildSettings) { try { mset = new MergeSet().ConvertMergeSet(BuildSettings); Console.WriteLine("[+] Merging with an application binary..."); start_merge(); // Start merge return(true); } catch (StartMergeError) { return(false); } }
/// <summary> /// Start check BuildSet data /// </summary> /// <param name="bset">BuildSet Object</param> /// <returns></returns> public static bool Start(ref BuildSet bset) { try { Directory.Delete(bset.tmp_folder_path, true); } catch { } Console.WriteLine("[+] Checking file path data..."); if (!File.Exists(bset.source_path)) { Console.WriteLine("[-] This file is not found: [" + bset.source_path + "]\r\n"); return(false); } else if (!Directory.Exists(bset.python_path)) { Console.WriteLine("[-] This directory is not found: [" + bset.python_path + "]\r\n"); return(false); } else if (!File.Exists(bset.python_binary_path)) { Console.WriteLine("[-] The compiler is missing: [" + bset.python_binary_path + "]\r\n"); return(false); } try { // Can read output binary if (bset.output_path == Path.GetFileName(bset.output_path)) { bset.output_path = bset.source_folder_path + @"\" + bset.output_path; } using (FileStream fs = new FileStream(bset.output_path, FileMode.Create)) { } } catch { if (bset.one_file) { bset.output_path = bset.source_folder_path + @"\" + Path.GetFileNameWithoutExtension(bset.source_path) + ".exe"; } else { bset.output_path = bset.source_folder_path + @"\pyDotexe_" + Path.GetFileNameWithoutExtension(bset.source_path) + @"\" + Path.GetFileNameWithoutExtension(bset.source_path) + ".exe"; } } return(true); }
public void LoadXML(XmlElement root) { foreach (XmlElement node in root["labels"]) { string name = node.ToText("name"); if (!string.IsNullOrEmpty(name)) { BuildSet set = FilesManager.BuildSets.FirstOrDefault(s => s.Name == name); if (set != null) { set.IsEnabled = node.ToText("enabled").ToBool(); } } } }
public static BuildSet GetGameBuild(Game game, Summoner summoner) { if (PotentialUpgrades == null) { InitializePotentialUpgrades(); } var set = new BuildSet(); set.TimeSince = GetTimeSince(game.CreateDate); set.FinalBuild = getFinalBuild(game.Statistics); set.Champion = getChampion(game.ChampionId); set.FullBuild = set.FinalBuild.Items.Count == 7 && !(set.FinalBuild.Items.Any(x => PotentialUpgrades.ContainsKey(x.Id.ToString()))); set.Id = game.GameId; set.SummonerId = summoner.Id; set.MatchDataFetched = false; set.TotalDamageDealt = game.Statistics.TotalDamageDealt; return(set); }
public ActionResult Index(BuildSet typeId = BuildSet.Random) { if (typeId == BuildSet.Random) { typeId = (BuildSet)new Random(Guid.NewGuid().GetHashCode()).Next(1, Enum.GetNames(typeof(BuildSet)).Length); } var builds = _buildsDomain.GetBuilds(Server.MapPath(string.Format(@"~/App_Data/BuildSets/{0}.json", typeId.GetDescription()))); var vm = new ViewModels.BuildStatus { BuildSet = typeId, Builds = builds, IsRedAlertEnabled = _commonDomain.GetRedAlert(Server.MapPath(@"~/App_Data/RedAlert.json")).IsEnabled }; return View(vm.Builds.Count() > 8 ? "HighCount" : "LowCount", vm); }
void OnRepositoryChange(GithubRepository repository, List <Commit> commits) { foreach (var commit in commits) { if (commit.BuildSet != null) { continue; } // Spawn a set of builds for this commit. var buildSet = new BuildSet { Commit = commit }; commit.BuildSet = buildSet; Branch branch; commit.Branch.TryGetTarget(out branch); Repository repo; branch.Repository.TryGetTarget(out repo); var buildConfiguration = repo.Project.DefaultBuildConfiguration; buildConfiguration.Directory = Options.OutputDir; Log.Message("Spawning new build for {0}/{1}", repo.Project.Name, commit.ToString()); var build = new Build(repo.Project, commit, buildConfiguration); buildSet.Builds.Add(build); Database.AddBuild(build); BuildQueue.AddBuild(build); } }
public override void OnFrame(Tyr tyr) { tyr.NexusAbilityManager.PriotitizedAbilities.Add(948); tyr.NexusAbilityManager.PriotitizedAbilities.Add(950); tyr.buildingPlacer.BuildCompact = true; FlyerAttackTask.Task.RequiredSize = RequiredSize; IdleTask.Task.FearEnemies = true; DefenseTask.Task.IgnoreEnemyTypes.Add(UnitTypes.VIKING_FIGHTER); FlyerDestroyTask.Task.Stopped = !DefendReapers; FlyerAttackTask.Task.Stopped = DefendReapers; if (Count(UnitTypes.PROBE) <= 18) { BaseWorkers.WorkersPerGas = 0; } else { BaseWorkers.WorkersPerGas = 3; } if (tyr.EnemyRace == Race.Zerg) { Beyond2Cannons = tyr.EnemyStrategyAnalyzer.TotalCount(UnitTypes.ZERGLING) > 0 || Count(UnitTypes.STARGATE) >= 3; } if (tyr.Frame == 118) { tyr.Chat("Time for some monobattles!"); } if (tyr.Frame == 163) { if (BuildCarriers) { tyr.Chat("I choose Carriers! :D"); } else { tyr.Chat("I choose Skillrays! :D"); } } if (!LiftingDetected) { foreach (Unit unit in tyr.Enemies()) { if (unit.IsFlying && UnitTypes.BuildingTypes.Contains(unit.UnitType)) { LiftingDetected = true; } } } if (LiftingDetected && tyr.EnemyManager.EnemyBuildings.Count == 0 && !ChasingLiftedBuildings) { ChasingLiftedBuildings = true; tyr.TaskManager.Add(new ElevatorChaserTask()); } if (!DefendRush && tyr.Frame <= 4800 && Tyr.Bot.EnemyRace != Race.Zerg) { int enemyCount = 0; foreach (Unit enemy in tyr.Enemies()) { if (SC2Util.DistanceSq(enemy.Pos, tyr.MapAnalyzer.StartLocation) <= 40 * 40) { enemyCount++; } } if (enemyCount >= 3) { DefendRush = true; } } if ((tyr.EnemyRace == Race.Terran || tyr.EnemyRace == Race.Random) && ReaperDefenseCannonStep.DesiredPos == null && !SkipDefenses) { foreach (Unit unit in tyr.Enemies()) { if (unit.UnitType == UnitTypes.REAPER && Tyr.Bot.MapAnalyzer.StartArea[(int)System.Math.Round(unit.Pos.X), (int)System.Math.Round(unit.Pos.Y)]) { Point2D dir = SC2Util.Point(unit.Pos.X - tyr.MapAnalyzer.StartLocation.X, unit.Pos.Y - tyr.MapAnalyzer.StartLocation.Y); float length = (float)System.Math.Sqrt(dir.X * dir.X + dir.Y * dir.Y); dir = SC2Util.Point(dir.X / length, dir.Y / length); ReaperDefenseCannonStep.DesiredPos = SC2Util.Point(tyr.MapAnalyzer.StartLocation.X + dir.X * 4f, tyr.MapAnalyzer.StartLocation.Y + dir.Y * 4f); break; } } } if (!DefendReapers && tyr.EnemyStrategyAnalyzer.Count(UnitTypes.REAPER) >= 2) { FearVikingsController.Stopped = false; DefendReapers = true; tyr.buildingPlacer.SpreadCannons = false; tyr.buildingPlacer.BuildCompact = true; WorkerTask.Task.StopTransfers = true; HideBaseTask.Task.BuildNexus = true; IdleTask.Task.OverrideTarget = FarBase.BaseLocation.Pos; DefenseTask.Task.Stopped = true; RequiredSize = 8; Set = new BuildSet(); Set += HiddenBasePylons(); Set += HiddenBaseBuild(); } /* * if (tyr.EnemyStrategyAnalyzer.Count(UnitTypes.REAPER) >= 2 * && NaturalMirrorCannonStep.DesiredBase == null) * { * PotentialHelper helper = new PotentialHelper(tyr.BaseManager.Natural.BaseLocation.Pos); * helper.Magnitude = 8; * helper.From(tyr.BaseManager.NaturalDefensePos); * NaturalMirrorCannonStep.DesiredPos = helper.Get(); * NaturalMirrorPylonStep.DesiredPos = helper.Get(); * } */ }
/// <summary> /// Start source-file analysis /// </summary> /// <param name="BuildSettings">BuildSet Object</param> /// <returns></returns> public static bool Start(ref BuildSet BuildSettings) { try { bset = BuildSettings; if (!bset.standalone) { bset.module_path.Add(bset.source_path); bset.except_file_list.Add(bset.python_path.Replace(@"\", @"\\")); } Console.WriteLine("[+] Getting imported default modules path..."); get_import_modules_name(); // Get imported module names by source code. make_module_loader(); // // Make module loader file. (pyDotexe_module_loader.py) get_import_file_path(); // Start module loader by Python-Shell and Get module paths. Console.WriteLine("\r\n[+] Searching selected modules..."); if (bset.hooks) { check_copy_hooks(); // Check some modules. } import_pyfilecmd(); // Search selected python file by Regex. import_pydircmd(); // Search seletcted python folder by Regex. if (bset.except_file_list.Count != 0) { Console.WriteLine("\r\n[+] Excluding selected module files and folders..."); exc_pyfile(); // Exclude selected module names by file. } if (extract_pyd()) // Search for pyd files by Python module paths list { Console.WriteLine("\r\n[+] Getting Dynamic-Link-Library by *.pyd files..."); analysis_pyd(); // Open pyd files and Get some DLL file names. search_dll_in_folder(); // Search DLL file by names. } if (bset.check_only) { show_module_list(); return(false); } return(true); } catch (GetImportDataError ex) { Console.WriteLine("[-] Could not read main-source file.\r\n[!] " + ex.Message); } catch (MakeModuleLoaderError ex) { Console.WriteLine("[-] Could not make 'module_load_pyDotexe.py' file.\r\n[!] " + ex.Message); } catch (GetImportFilePathError) { Console.WriteLine("[-] Import error found. Please check your code or file path."); } catch (GetModulesByProcessError ex) { Console.WriteLine("[-] Could not get python modules.\r\n[!] " + ex.Message); } finally { try { File.Delete(bset.module_load_path); } catch { } } return(false); }
/// <summary> /// Start build and marge /// </summary> /// <param name="BuildSettings">BuildSet Object</param> /// <returns></returns> public static bool Start(ref BuildSet BuildSettings) { try { bset = BuildSettings; if (bset.standalone) { if (bset.all_imports) { Console.WriteLine("\r\n[+] Copying all modules file..."); copy_all_modules(); // Import all modules. } else { Console.WriteLine("\r\n[+] Copying Python libraries and compiler..."); import_dll_compiler(); // Copy python libraries to TMP folder. } } Console.WriteLine("\r\n[+] Copying imported modules..."); copy_module_file(); // Copy selected files to TMP folder. if ((bset.resource_folder.Count != 0) | (bset.resource_file.Count != 0)) { Console.WriteLine("[+] Copying selected resources data..."); copy_resources(); // Copy delected resource files to TMP folder. Console.WriteLine(); } if (bset.debug) // Debug mode only. { Console.WriteLine("\r\n"); Analysis.show_module_list(); Console.WriteLine("\r\n[+] Debug path and command-options extracted. You can start in Command-Lines."); string startCMD = ""; string startApp = ""; if (bset.standalone) { startApp = "\"" + bset.tmp_module_path + @"\" + Path.GetFileName(bset.default_python_bin) + "\""; startCMD = "\"" + bset.tmp_module_path + @"\" + Path.GetFileNameWithoutExtension(bset.source_path) + bset.default_src_ex + "\""; } else { startApp = "python"; startCMD = "\"" + bset.tmp_module_path + @"\" + Path.GetFileNameWithoutExtension(bset.source_path) + bset.default_src_ex + "\""; } Console.WriteLine("[*] " + startApp + " " + startCMD); try { using (StreamWriter sw = new StreamWriter(bset.tmp_folder_path + @"\pydotexe_debug.bat")) { sw.WriteLine(startApp + " " + startCMD); sw.WriteLine("pause"); } Process.Start(bset.tmp_folder_path + @"\pydotexe_debug.bat"); } catch { } return(false); } if (!bset.zip_out & bset.add_fixed) { add_fixes_argv_path(); // Add file path fixed. } if (bset.optimize) { Console.WriteLine("[+] Optimizing Python modules..."); optimize_code_start(); } if (bset.standalone) { Console.WriteLine("[+] Compiling imported modules..."); replace_compile_file(); // Replace default source codes file to compiled file. } if (bset.one_file) { Console.WriteLine("[+] Creating image file..."); compress_modules(); // Compress TMP folder. } else { Console.WriteLine("[+] Copying to out-folder path..."); string dir_path = Path.GetDirectoryName(bset.output_path); if (!Directory.Exists(dir_path)) { new DirectoryInfo(dir_path).Create(); } copy_folder(bset.tmp_module_path, dir_path); } if (bset.zip_out) // Zip-out mode only { try { File.Copy(bset.zip_path, bset.source_folder_path + @"\" + Path.GetFileNameWithoutExtension(bset.source_path) + ".zip", true); } catch (Exception ex) { throw new CompressModulesError(ex.Message); } Console.WriteLine("\a\r\n[+] File compression completed."); Console.WriteLine("[*] " + bset.source_folder_path + @"\" + Path.GetFileNameWithoutExtension(bset.source_path) + ".zip"); try { Directory.Delete(bset.tmp_folder_path, true); } catch { } return(false); } marge_application(); // Merge application binary. return(true); } catch (CreateTmpError) { Console.WriteLine("[-] Could not make temporary folder."); } catch (ImportDllCompilerError) { Console.WriteLine("\r\n[-] Could not copy the file: python.exe, pythonw.exe, python" + bset.py_version + ".dll or Source code."); } catch (ReplaceCompileFileError) { Console.WriteLine("[-] Could not compile python sources."); } catch (CompressModulesError) { Console.WriteLine("[-] Could not create image file."); } catch (MargeApplicationError) { } return(false); }