feat: run hook inside a thread
							parent
							
								
									6c5bf6bdd0
								
							
						
					
					
						commit
						15466d165b
					
				| 
						 | 
				
			
			@ -59,16 +59,32 @@ namespace SkyHook
 | 
			
		|||
 | 
			
		||||
        private void _StartHook()
 | 
			
		||||
        {
 | 
			
		||||
            if (_started) return;
 | 
			
		||||
            
 | 
			
		||||
            var result = SkyHookNative.StartHook(HookCallback);
 | 
			
		||||
            var started = false;
 | 
			
		||||
            Exception exception = null;
 | 
			
		||||
 | 
			
		||||
            if (result != null)
 | 
			
		||||
            new Thread(() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (_started) return;
 | 
			
		||||
 | 
			
		||||
                var result = SkyHookNative.StartHook(HookCallback);
 | 
			
		||||
 | 
			
		||||
                if (result != null)
 | 
			
		||||
                {
 | 
			
		||||
                    exception = new SkyHookException(result);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                _started = true;
 | 
			
		||||
                started = true;
 | 
			
		||||
            }).Start();
 | 
			
		||||
 | 
			
		||||
            while (!started && exception == null)
 | 
			
		||||
            {
 | 
			
		||||
                throw new SkyHookException(result);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            _started = true;
 | 
			
		||||
            if (exception != null)
 | 
			
		||||
            {
 | 
			
		||||
                throw exception;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void _StopHook()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -11,17 +11,53 @@ PluginImporter:
 | 
			
		|||
  isExplicitlyReferenced: 0
 | 
			
		||||
  validateReferences: 1
 | 
			
		||||
  platformData:
 | 
			
		||||
  - first:
 | 
			
		||||
      : Any
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        Exclude Editor: 1
 | 
			
		||||
        Exclude Linux64: 0
 | 
			
		||||
        Exclude OSXUniversal: 0
 | 
			
		||||
        Exclude Win: 0
 | 
			
		||||
        Exclude Win64: 1
 | 
			
		||||
  - first:
 | 
			
		||||
      Any: 
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings: {}
 | 
			
		||||
  - first:
 | 
			
		||||
      Editor: Editor
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
        DefaultValueInitialized: true
 | 
			
		||||
        OS: AnyOS
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Linux64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: OSXUniversal
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Win
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 1
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: x86
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Win64
 | 
			
		||||
    second:
 | 
			
		||||
      enabled: 0
 | 
			
		||||
      settings:
 | 
			
		||||
        CPU: None
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -6,7 +6,7 @@ PluginImporter:
 | 
			
		|||
  iconMap: {}
 | 
			
		||||
  executionOrder: {}
 | 
			
		||||
  defineConstraints: []
 | 
			
		||||
  isPreloaded: 0
 | 
			
		||||
  isPreloaded: 1
 | 
			
		||||
  isOverridable: 1
 | 
			
		||||
  isExplicitlyReferenced: 0
 | 
			
		||||
  validateReferences: 1
 | 
			
		||||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ PluginImporter:
 | 
			
		|||
      settings:
 | 
			
		||||
        CPU: AnyCPU
 | 
			
		||||
        DefaultValueInitialized: true
 | 
			
		||||
        OS: Windows
 | 
			
		||||
        OS: AnyOS
 | 
			
		||||
  - first:
 | 
			
		||||
      Standalone: Linux64
 | 
			
		||||
    second:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in New Issue