private static NetAction getAction(Atom atom) { NetAction.ActionType actionType = translate(atom.Action.Action_type); NetAction action = new NetAction(actionType); switch (actionType) { case NetAction.ActionType.ACCEPTED: action.AcceptedMessage = getAcceptedMessage(atom); break; case NetAction.ActionType.NOTIFICATION: action.NotificationMessage = getNotificationMessage(atom); break; case NetAction.ActionType.FAULT: action.FaultMessage = getFaultMessage(atom); break; case NetAction.ActionType.PONG: action.PongMessage = getPongMessage(atom); break; default: throw new Exception("Unexpected ActionType while unmarshalling message " + actionType.ToString()); } return(action); }
private static ActionType translate(NetAction.ActionType actionType) { switch (actionType) { case NetAction.ActionType.PUBLISH: return(ActionType.PUBLISH); case NetAction.ActionType.POLL: return(ActionType.POLL); case NetAction.ActionType.ACKNOWLEDGE: return(ActionType.ACKNOWLEDGE); case NetAction.ActionType.SUBSCRIBE: return(ActionType.SUBSCRIBE); case NetAction.ActionType.UNSUBSCRIBE: return(ActionType.UNSUBSCRIBE); case NetAction.ActionType.PING: return(ActionType.PING); case NetAction.ActionType.AUTH: return(ActionType.AUTH); } throw new Exception("Unexpected ActionType while marshalling message " + actionType.ToString()); }