Пример #1
0
    public override ICatchable WhenCatched(IHook hook)
    {
        this.MoveBehaviour.StopMove ();
        Explode();

        return null;
    }
Пример #2
0
        public async void HookedDbContext_MustCallHooks_WhenRunningSaveChangesAsync()
        {
            var hooks = new IHook[]
                            {
                                new TimestampPreInsertHook()
                            };

            var context = new LocalContext(hooks);
            var entity = new TimestampedSoftDeletedEntity();
            context.Entities.Add(entity);
            await context.SaveChangesAsync();

            Assert.AreEqual(entity.CreatedAt.Date, DateTime.Today);
        }
Пример #3
0
 public virtual bool CanConnect(IHook one, IHook two)
 {
     return(HookType.IsInstanceOfType(one) && HookType.IsInstanceOfType(two));
 }
Пример #4
0
 // Constructor
 public CutsceneTracker()
 {
     _moviePlayHook = MoviePlay.Fun_Play.Hook(MoviePlayImpl).Activate();
     _movieEndHook  = MoviePlay.Fun_End.Hook(MovieEndImpl).Activate();
 }
Пример #5
0
 public virtual ICatchable WhenCatched(IHook hook)
 {
     return this;
 }
Пример #6
0
        private void AttachHooks(IHook[] hooks)
        {
            if (hooks == null) {
                InitializeHooks();
                return;
            };

            PreHooks = hooks.OfType<IPreActionHook>().ToList();
            PostHooks = hooks.OfType<IPostActionHook>().ToList();
            PostLoadHooks = hooks.OfType<IPostLoadHook>().ToList();
        }
Пример #7
0
 public TestEventPublisher(IEventPublisher eventPublisher, IHook <object> hook)
 {
     _eventPublisher = eventPublisher;
     _hook           = hook;
 }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookedDbContext" /> class, using the specified <paramref name="nameOrConnectionString"/>, , filling <see cref="_hooks"/> and <see cref="_hooks"/>.
 /// </summary>
 /// <param name="hooks">The hooks.</param>
 /// <param name="nameOrConnectionString">The name or connection string.</param>
 public HookedDbContext(IHook[] hooks, string nameOrConnectionString)
     : base(nameOrConnectionString)
 {
     _hooks = hooks.Select(h => new HookDecorator { Hook = h }).ToList();
 }
Пример #9
0
 public DefaultSettingsHook(DefaultSettings defaultSettings, IReloadedHooks hooks)
 {
     DefaultSettings       = defaultSettings;
     ReadConfigFromIniHook = hooks.CreateHook <ReadConfigfromINI>(ReadConfigFromIni, 0x00629CE0).Activate();
 }
Пример #10
0
		public static void AddHook(IHook hook)
		{
			DeductionHooks[hook.HookedSymbol] = hook;
		}
Пример #11
0
 public Detour(IHook hook, Delegate targetDelegate)
 {
     _hook = hook;
     _targetDelegate = targetDelegate;
 }
 public LocalContext(IHook[] hooks)
     : base(hooks)
 {
 }
Пример #13
0
 void before_each()
 {
     _subject = new SubjectToHook();
     _notToBeGCed = Hook;
     _hook = CreateHook(new InProcessMemory(), _subject.ManagedPointer, Marshal.GetFunctionPointerForDelegate(_notToBeGCed));
 }
Пример #14
0
    // Use this for initialization
    void Start()
    {
        // Устанавливаем крючок, в соответствии с заданной позицией

        if (Mathf.Approximately (this.length, 0.0f)) {	// Если длина крючка равна 0, то используем расположение, заданное в редакторе
            this.length = Vector3.Distance(this.fishingHookPivotPoint.transform.position, this.fishingHookCenterOfRotation.transform.position);
        } else {
            if (this.length < 0) {
                this.length = SimpleSpinning.lengthByDefault;
            }

            this.fishingHookPivotPoint.transform.position = new Vector3 (
                this.fishingHookCenterOfRotation.transform.position.x,
                this.fishingHookCenterOfRotation.transform.position.y - this.length,	// минус, потому что крючок направлен вниз
                this.fishingHookCenterOfRotation.transform.position.z
            );
        }

        if (this.maxLength <= this.length) {
            this.maxLength = SimpleSpinning.maxLengthByDefault;
        }

        if (this.angleSpeed <= 0) {
            this.angleSpeed = SimpleSpinning.angleSpeedByDefault;
        }

        if (this.maxAngleDeviation < 0.0f || this.maxAngleDeviation > 90.0f) {
            this.maxAngleDeviation = SimpleSpinning.maxAngleDeviationByDefault;
        }

        if (this.catchSpeed < 0) {
            this.catchSpeed = SimpleSpinning.catchSpeedByDefault;
        }

        this.directionHookMove = DirectionHookMove.nowhere;

        this.fishingHook = this.fishingHookGameObject.GetComponent<IHook> ();

        this.fishingHook.SetOwner (this);

        this.fishingHook.OnCatchStaff += (ICatchable obj) => {
            this.catchedStuff = obj;
            this.ChangeState(SpinningState.PullStuff);
        };
    }
Пример #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookedDbContext" /> class using the an existing connection to connect 
 /// to a database. The connection will not be disposed when the context is disposed. (see <see cref="DbContext"/> overloaded constructor)
 /// </summary>
 /// <param name="hooks">The hooks.</param>
 /// <param name="existingConnection">An existing connection to use for the new context.</param>
 /// <param name="contextOwnsConnection">If set to true the connection is disposed when the context is disposed, otherwise the caller must dispose the connection.</param>
 /// <remarks>Main reason for allowing this, is to enable reusing another database connection. (For instance one that is profiled by Miniprofiler (http://miniprofiler.com/)).</remarks>
 public HookedDbContext(IHook[] hooks, DbConnection existingConnection, bool contextOwnsConnection)
     : base(existingConnection, contextOwnsConnection)
 {
     PreHooks = hooks.OfType<IPreActionHook>().ToList();
     PostHooks = hooks.OfType<IPostActionHook>().ToList();
 }
Пример #16
0
        public override void Execute(DrawTheory theory, IEnumerable <IFunctionInstance> arguments, IEnumerable <IAtom> body)
        {
            IHook hook = this.ExecuteResult(theory, arguments, body) as IHook;

            theory.AddHook(hook);
        }
Пример #17
0
 public int GetHookIndex(IHook hook) => allHooks.IndexOf(hook);
Пример #18
0
 public HookedDbContext(IHook[] hooks)
 {
     PreHooks = hooks.OfType<IPreActionHook>().ToList();
     PostHooks = hooks.OfType<IPostActionHook>().ToList();
 }
Пример #19
0
 /// <summary>
 /// Registers a hook
 /// </summary>
 /// <param name="hook">The hook to register.</param>
 /// <param name="order">Optional ordering to run the hook in</param>
 public void RegisterHook(IHook hook, Int32? order = null)
 {
     _hooks.Add(new HookDecorator { Hook = hook, Order = order });
 }
Пример #20
0
 public HookedDbContext(IHook[] hooks, string nameOrConnectionString)
     : base(nameOrConnectionString)
 {
     PreHooks = hooks.OfType<IPreActionHook>().ToList();
     PostHooks = hooks.OfType<IPostActionHook>().ToList();
 }
Пример #21
0
 /// <summary>
 /// Hooks the game Draw HUD function
 /// </summary>
 static Queue()
 {
     DrawHudHook = new Hook <DrawHUD>(DrawHudHookImpl, DrawHudAddress);
     DrawHudHook.Activate();
 }
Пример #22
0
 public StageLoadCrashFixHook()
 {
     _cameraInitHook = new Hook <TObjCamera_Init>(TObjCameraInit, 0x0061D3B0).Activate();
 }
Пример #23
0
 public void RemoveController(IHook controller)
 {
     ControllerList.Remove(controller);
 }
Пример #24
0
 public static void AddHook(IHook hook)
 {
     DeductionHooks[hook.HookedSymbol] = hook;
 }
Пример #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookedDbContext" /> class, using the specified <paramref name="nameOrConnectionString"/>, , filling <see cref="PreHooks"/> and <see cref="PostHooks"/>.
 /// </summary>
 /// <param name="hooks">The hooks.</param>
 /// <param name="nameOrConnectionString">The name or connection string.</param>
 public HookedDbContext(IHook[] hooks, string nameOrConnectionString)
     : base(nameOrConnectionString)
 {
     AttachHooks(hooks);
     ListenToObjectMaterialized();
 }
Пример #26
0
 /// <inheritdoc cref="IHook.Install(long, bool)"/>
 /// <param name="hook">Hook to be installed.</param>
 /// <param name="process">Target process.</param>
 public static void Install(this IHook hook, Process process, bool ignoreProcessHasNoWindow = false) => hook.Install(process.Id, ignoreProcessHasNoWindow);
 public TestScheduledCommandPublisher(IScheduledCommandPublisher messageSession, IHook <object> hook)
 {
     _messageSession = messageSession;
     _hook           = hook;
 }
Пример #28
0
 /// <inheritdoc cref="IHook.Combine(IEnumerable{IHook})"/>
 public static IHook Combine(this IEnumerable <IHook> hooks) => IHook.Combine(hooks);
Пример #29
0
 public void AddHook(IHook hook)
 {
     this.hooks.Add(hook);
 }
Пример #30
0
 // Constructor
 public VictoryCounter()
 {
     _tObjTeamExecHook = TObjTeam.Fun_Exec.Hook(CheckScoreIncrementHookFunction).Activate();
 }
Пример #31
0
 public virtual void Init(IHook hook)
 {
     _hook = hook;
 }
Пример #32
0
 public void SetHook(IHook hook)
 {
     _hook = hook;
 }
Пример #33
0
 public DefaultSettingsHook(DefaultSettings defaultSettings)
 {
     DefaultSettings       = defaultSettings;
     ReadConfigFromIniHook = Fun_ReadConfigfromINI.Hook(ReadConfigFromIni).Activate();
 }
Пример #34
0
 void RegisterHook(IHook hook)
 {
     hook.OnRegister(this);
     Harmony.CreateAndPatchAll(hook.GetType());
     hooks.Add(hook);
 }
Пример #35
0
 public void Register(IHook hook)
 {
     hooks.Add(hook);
 }
Пример #36
0
 /// <summary>
 /// Initializes the hook class.
 /// </summary>
 private void SetupHook(WndProc proc, IntPtr address)
 {
     HookFunction = proc;
     Hook         = SDK.Hooks.CreateHook <WndProc>(HookFunction, (long)address).Activate();
 }
Пример #37
0
 /// <summary>
 /// Registers a hook.
 /// </summary>
 /// <param name="hook">The hook to register.</param>
 public void Add(IHook hook)
 {
     RegisterHook(hook as IPreActionHook);
     RegisterHook(hook as IPostActionHook);
 }
Пример #38
0
 public void AddController(IHook controller)
 {
     if (!ControllerList.Contains(controller))
         ControllerList.Add(controller);
 }
Пример #39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookedDbContext" /> class, filling <see cref="_hooks"/> and <see cref="_hooks"/>.
 /// </summary>
 /// <param name="hooks">The hooks.</param>
 public HookedDbContext(IHook[] hooks)
 {
     _hooks = hooks.Select(h => new HookDecorator { Hook = h }).ToList();
 }
Пример #40
0
 public void RemoveController(IHook controller)
 {
     ControllerList.Remove(controller);
 }
Пример #41
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookedDbContext" /> class using the an existing connection to connect 
 /// to a database. The connection will not be disposed when the context is disposed. (see <see cref="DbContext"/> overloaded constructor)
 /// </summary>
 /// <param name="hooks">The hooks.</param>
 /// <param name="existingConnection">An existing connection to use for the new context.</param>
 /// <param name="contextOwnsConnection">If set to true the connection is disposed when the context is disposed, otherwise the caller must dispose the connection.</param>
 /// <remarks>Main reason for allowing this, is to enable reusing another database connection. (For instance one that is profiled by Miniprofiler (http://miniprofiler.com/)).</remarks>
 public HookedDbContext(IHook[] hooks, DbConnection existingConnection, bool contextOwnsConnection)
     : base(existingConnection, contextOwnsConnection)
 {
     _hooks = hooks.Select(h => new HookDecorator { Hook = h }).ToList();
 }
Пример #42
0
 public ClippingPlanesHook(float aspectLimit)
 {
     AspectRatioLimit    = aspectLimit;
     BuildClipPlanesHook = Fun_CameraBuildPerspClipPlanes.Hook(BuildClipPlanesImpl).Activate();
 }
Пример #43
0
 public AspectRatioHook(float aspectRatioLimit)
 {
     AspectRatioLimit  = aspectRatioLimit;
     SetViewWindowHook = Fun_RwCameraSetViewWindow.Hook(SetViewWindowImpl).Activate();
 }
Пример #44
0
 public DefaultSettingsHook(DefaultSettings defaultSettings)
 {
     DefaultSettings       = defaultSettings;
     ReadConfigFromIniHook = new Hook <ReadConfigfromINI>(ReadConfigFromIni, 0x00629CE0).Activate();
 }
 public TestCommandDispatcher(ICommandDispatcher commandDispatcher, IHook <ICommand> hook)
 {
     _commandDispatcher = commandDispatcher;
     _hook = hook;
 }
Пример #46
0
 /// <inheritdoc/>
 public abstract bool TryCreate(T instance, out IHook <T> hook);
Пример #47
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookedDbContext" /> class using the an existing connection to connect 
 /// to a database. The connection will not be disposed when the context is disposed. (see <see cref="DbContext"/> overloaded constructor)
 /// </summary>
 /// <param name="hooks">The hooks.</param>
 /// <param name="existingConnection">An existing connection to use for the new context.</param>
 /// <param name="contextOwnsConnection">If set to true the connection is disposed when the context is disposed, otherwise the caller must dispose the connection.</param>
 /// <remarks>Main reason for allowing this, is to enable reusing another database connection. (For instance one that is profiled by Miniprofiler (http://miniprofiler.com/)).</remarks>
 public HookedDbContext(IHook[] hooks, DbConnection existingConnection, bool contextOwnsConnection)
     : base(existingConnection, contextOwnsConnection)
 {
     AttachHooks(hooks);
     ListenToObjectMaterialized();
 }
 public unsafe DrawDistanceHook(Config config, IReloadedHooks hooks, IReloadedHooksUtilities utilities)
 {
     _config       = config;
     _optimizeHook = hooks.CreateHook <SetParamOptimize>(ModifyObjectDistance, 0x0043DF40).Activate();
 }
Пример #49
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookedDbContext" /> class, filling <see cref="PreHooks"/> and <see cref="PostHooks"/>.
 /// </summary>
 /// <param name="hooks">The hooks.</param>
 public HookedDbContext(IHook[] hooks)
     : base()
 {
     AttachHooks(hooks);
     ListenToObjectMaterialized();
 }
Пример #50
0
 public virtual void OnCreate(object Hook)
 {
     this.m_Hook = Hook as IHook;
 }
Пример #51
0
 public static bool IsConnectedTo(this IHook hook, IHook other)
 {
     return(hook.Connections.Exists(x => x.From == other || x.To == other));
 }
Пример #52
0
 public virtual void OnCreate(object Hook)
 {
     this.m_Hook = Hook as IHook;
 }