Exemplo n.º 1
0
Arquivo: CPU.cs Projeto: 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);
               }
        }
Exemplo n.º 2
0
Arquivo: CPU.cs Projeto: 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")
             );
     }
 }
Exemplo n.º 3
0
 public void AssertValidDelegateCall(IUserDelegate userDelegate)
 {
     throw new NotImplementedException();
 }