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>()); }
private static void LegacyEnd <TState>(IAsyncResult result) { LegacyState <TState> legacy = (LegacyState <TState>)result.AsyncState; legacy.End(result); }
private static IAsyncResult LegacyBegin <TState>(AsyncCallback callback, object state) { LegacyState <TState> legacy = (LegacyState <TState>)state; return(legacy.Begin(callback, state)); }