Example #1
0
        private static bool CreateDeviceInternalSafe(IntPtr windowHandle, MyRenderDeviceSettings?settingsToTry, out MyRenderExceptionEnum exceptionType)
        {
            exceptionType = MyRenderExceptionEnum.Unassigned;
            string errorDesc = "No details";

            try
            {
                CreateDeviceInternal(windowHandle, settingsToTry);
                return(true);
            }
            catch (MyRenderException ex)
            {
                errorDesc     = ex.Message;
                exceptionType = ex.Type;
            }
            catch (Exception ex)
            {
                errorDesc = ex.Message;
            }

            Log.WriteLine("CreateDevice failed: " + errorDesc);
            DisposeDevice();
            return(false);
        }
 public MyRenderException(string message, MyRenderExceptionEnum type = MyRenderExceptionEnum.Unassigned)
     : base(message)
 {
     m_type = type;
 }
Example #3
0
 public MyRenderException(string message, MyRenderExceptionEnum type = MyRenderExceptionEnum.Unassigned)
     : base(message)
 {
     m_type = type;
 }
Example #4
0
        private static bool CreateDeviceInternalSafe(IntPtr windowHandle, MyRenderDeviceSettings? settingsToTry, out MyRenderExceptionEnum exceptionType)
        {
            exceptionType = MyRenderExceptionEnum.Unassigned;
            string errorDesc = "No details";

            try
            {
                CreateDeviceInternal(windowHandle, settingsToTry);
                return true;
            }
            catch (MyRenderException ex)
            {
                errorDesc = ex.Message;
                exceptionType = ex.Type;
            }
            catch (Exception ex)
            {
                errorDesc = ex.Message;
            }

            Log.WriteLine("CreateDevice failed: " + errorDesc);
            DisposeDevice();
            return false;
        }
Example #5
0
        private static bool CreateDeviceInternalSafe(IntPtr windowHandle, MyRenderDeviceSettings?settingsToTry, bool forceDebugDevice, out MyRenderExceptionEnum exceptionType)
        {
            exceptionType = MyRenderExceptionEnum.Unassigned;

            bool success = false;

            try
            {
                if (settingsToTry.HasValue)
                {
                    Log.WriteLine(settingsToTry.Value.ToString());
                }
                else
                {
                    Log.WriteLine("settingsToTry is null!");
                }
                CreateDeviceInternal(windowHandle, settingsToTry, forceDebugDevice);
                success = true;
            }
            catch (MyRenderException ex)
            {
                Log.WriteLine("CreateDevice failed: MyRenderException occurred");
                Log.IncreaseIndent();
                Log.WriteLine(ex);
                Log.DecreaseIndent();

                exceptionType = ex.Type;
            }
            catch (Exception ex)
            {
                Log.WriteLine("CreateDevice failed: Regular exception occurred");
                Log.IncreaseIndent();
                Log.WriteLine(ex);
                Log.DecreaseIndent();
            }

            if (!success)
            {
                Log.WriteLine("CreateDevice failed: Disposing Device");
                DisposeDevice();
                return(false);
            }

            return(true);
        }