/// <summary> /// Converts a DisconnectCauseEnum value to a corresponding string value /// </summary> /// <param name="enumValue">The DisconnectCauseEnum value to convert</param> /// <returns>The representative string value</returns> public static string ToValue(DisconnectCauseEnum enumValue) { switch (enumValue) { //only valid enum elements can be used //this is necessary to avoid errors case DisconnectCauseEnum.Busy: case DisconnectCauseEnum.Callbackerror: case DisconnectCauseEnum.Cancel: case DisconnectCauseEnum.Error: case DisconnectCauseEnum.Hangup: case DisconnectCauseEnum.Invalidbxml: case DisconnectCauseEnum.Rejected: case DisconnectCauseEnum.Timeout: case DisconnectCauseEnum.Accountlimit: case DisconnectCauseEnum.Nodecapacityexceeded: case DisconnectCauseEnum.Unknown: case DisconnectCauseEnum.Applicationerror: return(stringValues[(int)enumValue]); //an invalid enum value was requested default: return(null); } }
public override void FromStream(DataStreamReader reader, ref DataStreamReader.Context ctx) { DisconnectCauseEnum = (DisconnectCauseEnum)reader.ReadUShort(ref ctx); }