Example #1
0
File: CPU.cs Project: CalebJ2/KOS
 /// <summary>Throw exception if the user delegate is not one the CPU can call right now.</summary>
 /// <param name="userDelegate">The userdelegate being checked</param>
 /// <exception cref="KOSInvalidDelegateContextException">thrown if the cpu is in a state where it can't call this delegate.</exception>
 public void AssertValidDelegateCall(IUserDelegate userDelegate)
 {
     if (userDelegate.ProgContext != currentContext)
     {
         throw new KOSInvalidDelegateContextException(
             (currentContext == contexts[0] ? "the interpreter" : "a program"),
             (currentContext == contexts[0] ? "a program" : "the interpreter")
             );
     }
 }
Example #2
0
File: CPU.cs Project: KSP-KOS/KOS
        /// <summary>Throw exception if the user delegate is not one the CPU can call right now.</summary>
        /// <param name="userDelegate">The userdelegate being checked</param>
        /// <exception cref="KOSInvalidDelegateContextException">thrown if the cpu is in a state where it can't call this delegate.</exception>
        public void AssertValidDelegateCall(IUserDelegate userDelegate)
        {
            if (userDelegate.ProgContext != currentContext)
            {
                string currentContextName;
                if (currentContext == contexts[0])
                {
                    currentContextName = "the interpreter";
                }
                else
                {
                    currentContextName = "a program";
                }

                string delegateContextName;
                if (userDelegate.ProgContext == contexts[0])
                {
                    delegateContextName = "the interpreter";
                }
                else if (currentContext == contexts[0])
                {
                    delegateContextName = "a program";
                }
                else
                {
                    delegateContextName = "a different program from a previous run";
                }

                throw new KOSInvalidDelegateContextException(currentContextName, delegateContextName);
               }
        }
Example #3
0
 public void AssertValidDelegateCall(IUserDelegate userDelegate)
 {
     throw new NotImplementedException();
 }
Example #4
0
 public void AssertValidDelegateCall(IUserDelegate userDelegate)
 {
     throw new NotImplementedException();
 }