예제 #1
0
        protected override void OnLoad(ConfigNode configNode)
        {
            try
            {
                onState = ConfigNodeUtil.ParseValue <State>(configNode, "onState");
            }
            catch (ArgumentException ae)
            {
                try
                {
                    LegacyState state = ConfigNodeUtil.ParseValue <LegacyState>(configNode, "onState");
                    switch (state)
                    {
                    case LegacyState.ContractAccepted:
                        onState = State.CONTRACT_ACCEPTED;
                        break;

                    case LegacyState.ContractCompletedFailure:
                        onState = State.CONTRACT_FAILED;
                        break;

                    case LegacyState.ContractCompletedSuccess:
                        onState = State.CONTRACT_SUCCESS;
                        break;

                    case LegacyState.ParameterCompleted:
                        onState = State.PARAMETER_COMPLETED;
                        break;
                    }
                }
                catch
                {
                    throw ae;
                }
            }
            parameter = ConfigNodeUtil.ParseValue <List <string> >(configNode, "parameter", new List <string>());
        }
예제 #2
0
            private static void LegacyEnd <TState>(IAsyncResult result)
            {
                LegacyState <TState> legacy = (LegacyState <TState>)result.AsyncState;

                legacy.End(result);
            }
예제 #3
0
            private static IAsyncResult LegacyBegin <TState>(AsyncCallback callback, object state)
            {
                LegacyState <TState> legacy = (LegacyState <TState>)state;

                return(legacy.Begin(callback, state));
            }