public static PNStatus CreatePNStatus(PNStatusCategory category, string errorString, Exception errorException, bool error, PNOperationType operation, ChannelEntity channelEntity, RequestState pnRequestState, PubNubUnity pnUnity) { PNErrorData errorData = null; if ((!string.IsNullOrEmpty(errorString)) || (errorException != null)) { errorData = new PNErrorData(); errorData.Info = errorString; errorData.Ex = errorException; } List <string> affectedChannels = null; List <string> affectedChannelGroups = null; if (channelEntity.ChannelID.IsChannelGroup) { affectedChannelGroups = new List <string>(); affectedChannelGroups.Add(channelEntity.ChannelID.ChannelOrChannelGroupName); } else { affectedChannels = new List <string>(); affectedChannels.Add(channelEntity.ChannelID.ChannelOrChannelGroupName); } return(CreatePNStatus(category, errorData, error, operation, affectedChannels, affectedChannelGroups, pnRequestState, pnUnity)); }
public static PNStatus CreatePNStatus(PNStatusCategory category, string errorString, Exception errorException, bool error, PNOperationType operation, List <ChannelEntity> affectedChannels, List <ChannelEntity> affectedChannelGroups, RequestState pnRequestState, PubNubUnity pnUnity) { PNErrorData errorData = CreateErrorData(errorString, errorException); List <string> channels = CreateListOfStringFromListOfChannelEntity(affectedChannels); List <string> channelGroups = CreateListOfStringFromListOfChannelEntity(affectedChannelGroups); return(CreatePNStatus(category, errorData, error, operation, channels, channelGroups, pnRequestState, pnUnity)); }
internal static PNStatus CreatePNStatus(PNStatusCategory category, PNErrorData errorData, bool error, PNOperationType operation, List <string> channels, List <string> channelGroups, RequestState pnRequestState, PubNubUnity pnUnity) { long statusCode = 0; string url = ""; if (pnRequestState != null) { statusCode = pnRequestState.ResponseCode; url = pnRequestState.URL; } PNStatus pnStatus = new PNStatus( category, errorData, error, statusCode, operation, pnUnity.PNConfig.Secure, pnUnity.PNConfig.UUID, pnUnity.PNConfig.AuthKey, pnUnity.PNConfig.Origin, channels, channelGroups, url ); #if (ENABLE_PUBNUB_LOGGING) pnUnity.PNLog.WriteToLog(string.Format("CreatePNStatus: \n" + "category={0} \n" + "errorData={1} \n" + "error={2} \n" + "statusCode={3} \n" + "operation={4} \n" + "tlsEnabled={5} \n" + "uuid={6} \n" + "authKey={7} \n" + "origin={8} \n" + "channels={9} \n" + "channelGroups={10} \n" + "clientRequest={11} \n", category.ToString(), ((errorData != null) && (errorData.Ex != null)) ? errorData.Ex.ToString() : "null", error.ToString(), statusCode.ToString(), operation.ToString(), pnUnity.PNConfig.Secure, pnUnity.PNConfig.UUID, pnUnity.PNConfig.AuthKey, pnUnity.PNConfig.Origin, (channels != null) ? string.Join(",", channels.ToArray()) : "null", (channelGroups != null) ? string.Join(",", channelGroups.ToArray()) : "null", url ), PNLoggingMethod.LevelInfo); #endif return(pnStatus); }
internal static PNErrorData CreateErrorData(string errorString, Exception errorException) { PNErrorData errorData = null; if ((!string.IsNullOrEmpty(errorString)) || (errorException != null)) { errorData = new PNErrorData(); errorData.Info = errorString; errorData.Ex = errorException; } return(errorData); }
public PNStatus(PNStatusCategory category, PNErrorData errorData, bool error, long statusCode, PNOperationType operation, bool tlsEnabled, string uuid, string authKey, string origin, List <String> affectedChannels, List <String> affectedChannelGroups, object clientRequest) { this.Category = category; this.ErrorData = errorData; this.Error = error; this.StatusCode = statusCode; this.Operation = operation; this.TlsEnabled = tlsEnabled; this.UUID = uuid; this.AuthKey = authKey; this.Origin = origin; this.ClientRequest = clientRequest; this.AffectedChannelGroups = affectedChannelGroups; this.AffectedChannels = affectedChannels; }