/// <summary> /// Converts Signal to SignalData /// </summary> /// <param name="signal">the Signal to convert</param> /// <returns>the converted SignalData</returns> private SignalData ConvertSignal(Signal signal) { List <StateData> states = new List <StateData>(); foreach (DurationState state in signal) { states.Add(new StateData(state.State.ToString(), state.Duration)); } SignalData signalData = new SignalData(signal.Name); signalData.States = states.ToArray(); return(signalData); }
/// <summary> /// Converts a SignalData to a Signal /// </summary> /// <param name="signalData">the SignalData to convert</param> /// <returns>the converted Signal</returns> private Signal ConvertSignalData(SignalData signalData) { Signal signal = new Signal(); signal.Name = signalData.Name; StateTypeConverter stateconv = new StateTypeConverter(); foreach (StateData stateData in signalData.States) { State state = (State)stateconv.ConvertFrom(stateData.Level.Trim()); signal.Add(new DurationState(state, stateData.Duration)); } return(signal); }