Browse Source

intel bullshit

Florian Mueller 7 years ago
parent
commit
0919ae584e
2 changed files with 18 additions and 8 deletions
  1. BIN
      .vs/bbiwarg/v14/.suo
  2. 18 8
      bbiwarg/Input/InputProviding/InputProviderIntel.cs

BIN
.vs/bbiwarg/v14/.suo


+ 18 - 8
bbiwarg/Input/InputProviding/InputProviderIntel.cs

@@ -82,11 +82,24 @@ namespace BBIWARG.Input.InputProviding
 
             startId++;
 
-            wrapper = (IntelCameraWrapper) domain.CreateInstanceAndUnwrap(typeof(IntelCameraWrapper).Assembly.GetName().ToString(), typeof(IntelCameraWrapper).FullName);
+            Task startTask = null;
+            bool errorDuringInit = false;
 
-            var startTask = Task.Run(() => wrapper.init(this));
+            try
+            {
+                wrapper = (IntelCameraWrapper)domain.CreateInstanceAndUnwrap(typeof(IntelCameraWrapper).Assembly.GetName().ToString(), typeof(IntelCameraWrapper).FullName);
+                startTask = Task.Run(() => wrapper.init(this));
+                errorDuringInit = startTask.Wait(TimeSpan.FromSeconds(4));
+            }
+            catch (Exception)
+            {
+                Console.WriteLine("Camera crashed while init");
+                errorstate = true;
+                scheduledForRestart = false;
+                errorDuringInit = true;
+            }
 
-            if (!startTask.Wait(TimeSpan.FromSeconds(4)))
+            if (errorDuringInit)
             {
                 Console.WriteLine("Timeout during init");
                 errorstate = true;
@@ -105,7 +118,8 @@ namespace BBIWARG.Input.InputProviding
 
                 try
                 {
-                    wrapper.run();
+                    if(!errorDuringInit)
+                        wrapper.run();
                 }
                 catch (System.AccessViolationException)
                 {
@@ -117,10 +131,6 @@ namespace BBIWARG.Input.InputProviding
                     Console.WriteLine("Camera Thread crashed.");
                     errorstate = true;
                 }
-                
-
-
-                
             }
 
             checkExitErrorstate();