Exemple #1
0
        public static void IssueAndWrapExceptions(this Batch batch, DeviceManager manager)
        {
            if (manager.IsDisposed)
            {
                return;
            }

#if DEBUG
            if (batch.TimesIssued > 0)
            {
                throw new InvalidOperationException("Batch was issued multiple times");
            }

            if (Debugger.IsAttached)
            {
                batch.Issue(manager);
                batch.TimesIssued++;
            }
            else
            {
#endif

            batch.GetState(out bool isInitialized, out bool isCombined, out bool isPrepareQueued, out bool isPrepared, out bool temp1);
            if (!isInitialized)
            {
                throw new BatchIssueFailedException(batch, new Exception("Batch not initialized"));
            }
            else if (isCombined)
            {
                // HACK
                return;
            }
            else if (isPrepareQueued)
            {
                throw new BatchIssueFailedException(batch, new Exception("Batch in prepare queue"));
            }
            else if (!isPrepared)
            {
                throw new BatchIssueFailedException(batch, new Exception("Batch not prepared"));
            }

            try {
                batch.Issue(manager);
            } catch (Exception exc) {
                throw new BatchIssueFailedException(batch, exc);
            } finally {
                batch.TimesIssued++;
            }
#if DEBUG
        }
#endif
        }
Exemple #2
0
        public static void IssueAndWrapExceptions(this Batch batch, DeviceManager manager)
        {
#if DEBUG
            if (Debugger.IsAttached)
            {
                batch.Issue(manager);
            }
            else
            {
#endif

            var state = batch.State;
            if (!state.IsInitialized)
            {
                throw new BatchIssueFailedException(batch, new Exception("Batch not initialized"));
            }
            else if (state.IsCombined)
            {
                // HACK
                return;
            }
            else if (state.IsPrepareQueued)
            {
                throw new BatchIssueFailedException(batch, new Exception("Batch in prepare queue"));
            }
            else if (!state.IsPrepared)
            {
                throw new BatchIssueFailedException(batch, new Exception("Batch not prepared"));
            }

            try {
                batch.Issue(manager);
            } catch (Exception exc) {
                throw new BatchIssueFailedException(batch, exc);
            }
#if DEBUG
        }
#endif
        }
Exemple #3
0
        public static void IssueAndWrapExceptions(this Batch batch, DeviceManager manager)
        {
            try {
                batch.Issue(manager);
            } catch (Exception exc) {
#if DEBUG
                if (Debugger.IsAttached)
                {
                    Debugger.Break();
                }
#endif

                throw new BatchIssueFailedException(batch, exc);
            }
        }