public void hack_multi_level_generics() { Assert.AreEqual( "Fohjin.DDD.CommandHandlers.ICommandHandler`1<T,V> Test.Fohjin.DDD.CommandTestFixture`3::BuildCommandHandler()", Hack.Generics( "Fohjin.DDD.CommandHandlers.ICommandHandler`1<T,V> Test.Fohjin.DDD.CommandTestFixture`3<TCommand,TCommandHandler,TAggregateRoot>::BuildCommandHandler()")); }
internal Detour(Delegate target, Delegate hook, string name, MemoryBase memory) { _memory = memory; Name = name; _targetDelegate = target; _target = Marshal.GetFunctionPointerForDelegate(target); _hookDelegate = hook; _hook = Marshal.GetFunctionPointerForDelegate(hook); //Store the orginal bytes _orginal = new List <byte>(); _orginal.AddRange(memory.ReadBytes(_target, 6)); //Setup the detour bytes _new = new List <byte> { 0x68 }; var tmp = BitConverter.GetBytes(_hook.ToInt32()); _new.AddRange(tmp); _new.Add(0xC3); var parHack = new Hack(_target, _orginal.ToArray(), _new.ToArray(), Name); HookWardenMemScan.AddHack(parHack); }
public void LoadAssemblies() { if (ad != null) { System.Console.Error.WriteLine("Unloading domain"); AppDomain.Unload(ad); } ad = AppDomain.CreateDomain("MyAppDomain"); object o = ad.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, "CompleteSharp+MyAppDomain+Hack"); Hack h = o as Hack; h.ad = this; int idx = 0; foreach (string a in assemblies) { try { FileInfo fi = new FileInfo(a); times[idx] = fi.LastWriteTime; idx++; System.Console.Error.WriteLine("Loading: " + a); h.Load(a); } catch (Exception e) { reportError(e); } } }
public HackMissionWindowPanel(Hack hack) { Hack = hack; MissionText = string.Empty; switch (Hack.CurrentMission.Id) { case 1: Task.Run(() => { Hack.Mission1(AddMissionText, ClearMissionText); }); break; case 2: Task.Run(() => { Hack.Mission2(AddMissionText, ClearMissionText); }); break; case 3: Task.Run(() => { Hack.Mission3(AddMissionText, ClearMissionText); }); break; case 4: Task.Run(() => { Hack.Mission4(AddMissionText, ClearMissionText); }); break; case 5: Task.Run(() => { Hack.Mission5(AddMissionText, ClearMissionText); }); break; default: break; } }
private void btn_ToggleWallClimb_Click(object sender, EventArgs e) { Hack wallClimb = HookWardenMemScan.GetHack("WallClimbPatch"); //setup wall climb patch if unknown to us if (wallClimb == null) { float wc = 0.5f; var wallClimbPatch = new Hack(ZzukBot.Constants.Offsets.Hacks.Wallclimb, BitConverter.GetBytes(wc), "WallClimbPatch"); HookWardenMemScan.AddHack(wallClimbPatch); wallClimb = HookWardenMemScan.GetHack("WallClimbPatch"); } #region toggle wall climb if (!wallClimb.IsActivated) { wallClimb.Apply(); return; } wallClimb.Remove(); #endregion }
// PUT api/Hack/ public async Task <IHttpActionResult> Put(Hack hack) { bool result = _hackRepository.Update(hack); ResponseMessageResult response = null; // TODO: Create a CUSTOM HTTP ERROR CODES if (result) { response = new System.Web.Http.Results.ResponseMessageResult( Request.CreateResponse((HttpStatusCode)210, new HttpError("SupaHack updated correctly. Well done!") ) ); } else { response = new System.Web.Http.Results.ResponseMessageResult( Request.CreateErrorResponse((HttpStatusCode)496, new HttpError("Not this time...") ) ); } return(response); }
void onButtonClick(Hack hack) { if (shopList.Contains(hack)) { if (InventoryManager.Instance.CanBuyHack(hack)) { InventoryManager.Instance.BuyHack(hack); buttonRefs[hack].SetParent(OwnedContainer, false); shopList.Remove(hack); } else { Debug.Log("not enough money"); } } else { if (hack.CurrentMarketPrice > 0) { InventoryManager.Instance.SellHack(hack); buttonRefs[hack].SetParent(ShopContainer, false); shopList.Add(hack); } else { Debug.Log("unsellable hack"); } } }
// POST api/Hack/ public async Task <IHttpActionResult> Post(Hack hack) { bool result = _hackRepository.Add(hack); ResponseMessageResult response = null; // TODO: Create a CUSTOM HTTP ERROR CODES if (result) { response = new System.Web.Http.Results.ResponseMessageResult( Request.CreateResponse((HttpStatusCode)209, new HttpError("SupaHack created correctly + Extra Hidden Hacks!") ) ); } else { response = new System.Web.Http.Results.ResponseMessageResult( Request.CreateErrorResponse((HttpStatusCode)495, new HttpError("Such a petition bro! It didn't work!") ) ); } return(response); }
public bool Add(Hack hack) { if (_dbContextHack != null) { // Begin transaction try { Hack hackType = new Hack(); hackType.Name = hack.Name; hackType.Description = hack.Description; _dbContextHack.Hacks.Add(hackType); _dbContextHack.SaveChangesAsync(); return(true); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return(false); } } return(false); }
public bool Update(Hack hack) { if (_dbContextHack != null) { // Begin transaction try { var hackToModify = _dbContextHack.Hacks.Find(hack.Id); hackToModify.Name = hack.Name; hackToModify.Description = hack.Description; _dbContextHack.SaveChangesAsync(); return(true); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return(false); } } return(false); }
public vHackResult(Hack hack) { ID = hack.ID; HackerID = hack.HackerID; HackerName = Helpers.ColorName.GetNicknameHtml(hack.Hacker.Username, hack.Hacker.Role); HackerGravatar = Helpers.Gravatar.GetAvatarURL(hack.Hacker.Gravatar, 180); DefenderID = hack.DefenderID; DefenderName = Helpers.ColorName.GetNicknameHtml(hack.Defender.Username, hack.Defender.Role); DefenderGravatar = Helpers.Gravatar.GetAvatarURL(hack.Defender.Gravatar, 180); Result = CommonEnums.HackResultDisplay[hack.ResultAsInt]; if (hack.Result == HackResult.Success) { Css = "judgeState1"; } else if (hack.Result == HackResult.BadData || hack.Result == HackResult.DatamakerError || hack.Result == HackResult.SystemError) { Css = "judgeState7"; } else if (hack.Result == HackResult.Failure) { Css = "judgeState3"; } else { Css = "judgeState10"; } ProblemID = hack.Status.ProblemID; ProblemTitle = hack.Status.Problem.Title; StatusID = hack.StatusID; }
public App( SfLocator locator, SfProjectHandler projectHandler, ServiceHashCalculator hasher, IHandleClusterConnection fabricRemote, VersionHandler versionHandler, VersionService versionService, Packager packager, AppConfig baseConfig, DeployScriptCreator scriptCreator, ConsoleWriter log, ManifestHandler manifestReader, VersionMapHandler versionMapHandler, Hack hack) { _locator = locator; _projectHandler = projectHandler; _hasher = hasher; _fabricRemote = fabricRemote; _versionHandler = versionHandler; _versionService = versionService; _packager = packager; _baseConfig = baseConfig; _scriptCreator = scriptCreator; _log = log; _manifestReader = manifestReader; _versionMapHandler = versionMapHandler; _hack = hack; }
/// <summary> /// add a hack to the list from the outside /// hack contains: original bytes, bytes we inject, the address we inject to /// </summary> internal static void AddHack(Hack parHack) { if (Hacks.All(i => i.Address != parHack.Address)) { RemoveHack(parHack.Name); Hacks.Add(parHack); } }
private RawEntry(string audioFile, Hack hack, TextArea textArea, CaptionType captionType, byte[] content) { AudioFile = audioFile; Hack = hack; TextArea = textArea; CaptionType = captionType; Content = content; }
public void SellHack(Hack hack) { if (AvailableHacks.Contains(hack)) { Credits += hack.CurrentMarketPrice; BuyableHacks.Add(hack); AvailableHacks.Remove(hack); } }
public void Initialize(Hack hack, Action <Hack> onPointerEnterCallback, Action <Hack> onPointerExitCallback, Action <Hack> onClickCallback) { this.hack = hack; this.onPointerEnterCallback = onPointerEnterCallback; this.onPointerExitCallback = onPointerExitCallback; this.onClickCallback = onClickCallback; TargetText.text = hack.DisplayName; }
public bool Execute(string[] args, ArrayList modules) { CheckUpdate(); object o = ad.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, "CompleteSharp+MyAppDomain+Hack"); Hack h = o as Hack; h.ad = this; return(h.Execute(args, modules)); }
void onButtonPointerEnter(Hack hack) { bool notBuyable = shopList.Contains(hack) && !InventoryManager.Instance.CanBuyHack(hack); bool notSellable = !shopList.Contains(hack) && hack.CurrentMarketPrice <= 0; string color = (notBuyable || notSellable) ? "red" : "green"; string priceDisplay = notSellable ? "can't be sold" : hack.CurrentMarketPrice + " credits"; InfoBox.text = hack.InfoString() + $"\n<color={color}>Value: {priceDisplay}</color>"; }
internal EventHandler(ChanceGenerator chance, Loot loot, Attack attack, Hack hack, Die die, Sleep sleep, Consume eat) { _chance = chance; _loot = loot; _attack = attack; _hack = hack; _die = die; _sleep = sleep; _eat = eat; }
public void Init(int HackNumber) // Called by GameManager { MonitorCanvas.enabled = true; if (HackNumber == 0) { InTutorial = true; Tutorial.StartTutorial(); } CurrentHack = Hacks[HackNumber].GetComponent <Hack>(); Instantiate(Hacks[HackNumber]); Debug.Log("Started Hack Number: " + HackNumber); }
internal static void Init() { byte[] origNetClientSend = Memory.Reader.ReadBytes((IntPtr)Offsets.Functions.NetClientSend, 5); NetClientSendDelegate = Memory.Reader.RegisterDelegate <NetClientSend>((IntPtr)Offsets.Functions.NetClientSend); _NetClientSend = Memory.Reader.Detours.CreateAndApply(NetClientSendDelegate, new NetClientSend(NetClientSendDetour), "NetClientSend"); byte[] customNetClientSend = Memory.Reader.ReadBytes((IntPtr)Offsets.Functions.NetClientSend, 5); Hack hack = new Hack((IntPtr)Offsets.Functions.NetClientSend, customNetClientSend, origNetClientSend, "NetClientSendHook"); AntiWarden.HookWardenMemScan.AddHack(hack); }
/// <summary> /// Applies a hack. /// </summary> /// <param name="hack">Type of hack to apply.</param> public static void GiveHack(Hack hack) { switch (hack) { case Hack.PayoutIncrease: API.CurrentSave.CodepointMultiplier += 1; break; case Hack.PriceDrop: API.CurrentSave.PriceDivider += 1; break; } }
public static unsafe byte[] Hash(Stream str, Hack hack) { IDictionary <string, byte[]> chunks; using (var br = new BinaryReader(str)) { SanityCheck1(br); chunks = GetChunks(br); } SanityCheck2(chunks); Native.MPEGLAYER3WAVEFORMAT srcfmt; Native.WAVEFORMATEX dstfmt; byte[] pcm; fixed(byte *p = chunks["fmt "]) { srcfmt = Marshal.PtrToStructure <Native.MPEGLAYER3WAVEFORMAT>((IntPtr)p); pcm = Convert(chunks["data"], srcfmt, out dstfmt); } uint trim = BitConverter.ToUInt32(chunks["trim"], 0) * dstfmt.nChannels * (dstfmt.wBitsPerSample / 8u); uint fact = BitConverter.ToUInt32(chunks["fact"], 0) * dstfmt.nChannels * (dstfmt.wBitsPerSample / 8u); if (hack == Hack.Streamed) { //Load 80860 bytes into a 89856 wide buffer padded with 0 and hash that if (fact < 80860 || dstfmt.nSamplesPerSec != 22050 || dstfmt.nChannels != 2) { throw new NotImplementedException("Stream hack is not good enough"); } var pcm2 = new byte[89856]; Array.Copy(pcm, trim, pcm2, 0, 80860); trim = 0; fact = 89856; pcm = pcm2; } Ensure(pcm.Length >= trim + fact, "Decoded PCM is too short for trimming"); var hash = new byte[6]; fixed(byte *p = pcm) fixed(byte *h = hash) { Native.MakeSubtitleKey(p + trim, fact, h); } return(hash); }
void Start() { GameObject enemy = GameObject.FindWithTag("Player"); _agent = GetComponent <NavMeshAgent>(); if (enemy == null) { Debug.Log("Cannot find Player"); } else { hack = enemy.GetComponent <Hack>(); } }
public TaskFeedback_Hack Hack(Problem problem, Record record, Hack hack) { if (!Authenticated) { throw new FaultException <AccessDeniedError>(new AccessDeniedError()); } return(Env.Run(new Task { Problem = problem, Record = record, Hack = hack, Type = TaskType.Hack }, Callback) as TaskFeedback_Hack); }
public vHackResult(Hack hack, bool Defender) { ID = hack.ID; HackerID = hack.HackerID; HackerName = Helpers.ColorName.GetNicknameHtml(hack.Hacker.Username, hack.Hacker.Role); HackerGravatar = Helpers.Gravatar.GetAvatarURL(hack.Hacker.Gravatar, 180); DefenderID = hack.DefenderID; DefenderName = Helpers.ColorName.GetNicknameHtml(hack.Defender.Username, hack.Defender.Role); DefenderGravatar = Helpers.Gravatar.GetAvatarURL(hack.Defender.Gravatar, 180); Result = "Hacked"; Css = "status-text-wa"; ProblemID = hack.Status.ProblemID; ProblemTitle = hack.Status.Problem.Title; StatusID = hack.StatusID; }
static void Main(string[] args) { Hack h1 = new Hack() { { "Hello", 1, 3, 2 }, { "World", 2, 7, 2.9 } }; Console.WriteLine(h1.Total); Hack h2 = new Hack() { LuckyNumber = 42 }; Console.WriteLine(h2.LuckyNumber); }
// Returns List of Hacks available for player based on his level || Parameter id = playerLevel public List <Hack> GetAvailableHacks(int minimalLevel) { List <Hack> hacks = new List <Hack>(); try { using (SqlConnection conn = _dbConnection.GetConnString()) { conn.Open(); using (SqlCommand cmd = new SqlCommand("SELECT H.*, RT.name AS RewardName, SC.name AS SkillCategoryName " + "FROM Hack H " + "INNER JOIN RewardType RT ON RT.RewardTypeID = H.RewardTypeID " + "INNER JOIN SkillCategory SC ON SC.SkillCategoryID = H.SkillCategoryID " + "WHERE minimalLevel <= @id;", conn)) { cmd.Parameters.AddWithValue("@id", minimalLevel); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { Hack hack = new Hack { HackId = (int)reader["HackID"], Name = (string)reader["name"], Description = (string)reader["description"], BaseDifficulty = (int)reader["baseDifficulty"], SkillCategoryId = (int)reader["SkillCategoryID"], SkillDifficulty = (int)reader["skillDifficulty"], EnergyCost = (int)reader["energyCost"], Reward = (int)reader["reward"], RewardTypeId = (int)reader["RewardTypeID"], RewardName = (string)reader["RewardName"], SkillCategoryName = (string)reader["SkillCategoryName"] }; hacks.Add(hack); } } } } } catch (Exception e) { Debug.WriteLine(e); } return(hacks); }
void Start() { Player player = GameManager.Instance().getPlayer(); List <int> completed = player.getCompletedHacks(); foreach (int i in completed) { Hack hack = HackManager.Instance().getHack(i); if (hack != null) { idColumn.GetComponent <Text> ().text += "\n| " + hack.getId(); nameColumn.GetComponent <Text> ().text += "\n| " + hack.getName(); typeColumn.GetComponent <Text> ().text += "\n| " + hack.getType(); rewardColumn.GetComponent <Text> ().text += "\n| $" + hack.getReward(); } } }
private void MetroWindow_Loaded(object sender, RoutedEventArgs e) { _externalWindow.Owner = this; _externalWindow.Show(); while (!_processMemory.OpenProcess(Config.ProcessName)) { Thread.Sleep(100); } Thread.Sleep(1000); Console.WriteLine("Hack on."); _timer.Tick += (o, args) => Hack.Run(_game); _timer.Interval = TimeSpan.FromMilliseconds(10); _timer.Start(); }
protected static int MFGetAttributeUINT32Alt( IMFAttributes pAttributes, Guid guidKey, int unDefault ) { int unRet; IHack h = new Hack() as IHack; try { IntPtr ip = Marshal.GetIUnknownForObject(pAttributes); h.Set(ip, typeof(IMFAttributes).GUID, false); IMFAttributes a = (IMFAttributes)h; try { int hr = a.GetUINT32(guidKey, out unRet); MFError.ThrowExceptionForHR(hr); } catch { unRet = unDefault; } } finally { Marshal.ReleaseComObject(h); } return unRet; }