internal CrashData(HockeyClient hockeyClient, Exception ex, CrashLogInformation crashLogInfo)
        {
            if (hockeyClient == null)
            {
                throw new ArgumentNullException("hockeyClient");
            }

            this._hockeyClient = hockeyClient;

            StringBuilder builder = new StringBuilder();

            builder.Append(crashLogInfo.ToString());
            builder.AppendLine();
            builder.Append(ex.StackTraceToString());
            this.Log = builder.ToString();

            this.UserID     = this._hockeyClient.UserID;
            this.Contact    = this._hockeyClient.ContactInformation;
            this.SDKName    = this._hockeyClient.SdkName;
            this.SDKVersion = this._hockeyClient.SdkVersion;
            if (this._hockeyClient.DescriptionLoader != null)
            {
                try
                {
                    this.Description = this._hockeyClient.DescriptionLoader(ex);
                }
                catch (Exception e) {
                    hockeyClient.HandleInternalUnhandledException(e);
                }
            }
        }
        internal CrashData(HockeyClient hockeyClient, Exception ex, CrashLogInformation crashLogInfo){
            if (hockeyClient == null) { throw new ArgumentNullException("hockeyClient"); }
            
            this._hockeyClient = hockeyClient;

            StringBuilder builder = new StringBuilder();
            builder.Append(crashLogInfo.ToString());
            builder.AppendLine();
            builder.Append(ex.StackTraceToString());
            this.Log = builder.ToString();

            this.UserID = this._hockeyClient.UserID;
            this.Contact = this._hockeyClient.ContactInformation;
            this.SDKName = this._hockeyClient.SdkName;
            this.SDKVersion = this._hockeyClient.SdkVersion;
            if (this._hockeyClient.DescriptionLoader != null)
            {
                try
                {
                    this.Description = this._hockeyClient.DescriptionLoader(ex);
                }
                catch (Exception e) {
                    hockeyClient.HandleInternalUnhandledException(e);
                }
            }
        }
        internal static async Task <FeedbackThread> OpenFeedbackThreadAsync(HockeyClient client, string threadToken)
        {
            FeedbackThread retVal = null;

            _logger.Info("Try to get thread with ID={0}", new object[] { threadToken });

            var request = WebRequest.CreateHttp(new Uri(client.ApiBaseVersion2 + "apps/" + client.AppIdentifier + "/feedback/" + threadToken + ".json", UriKind.Absolute));

            request.Method = "Get";
            request.SetHeader(HttpRequestHeader.UserAgent.ToString(), client.UserAgentString);

            try
            {
                var response = await request.GetResponseAsync();

                var fbResp = await TaskEx.Run <FeedbackResponseSingle>(() => FeedbackResponseSingle.FromJson(response.GetResponseStream()));

                if (fbResp.Status.Equals("success"))
                {
                    retVal = fbResp.Feedback;
                }
                else
                {
                    throw new Exception("Server error. Server returned status " + fbResp.Status);
                }
            }
            catch (Exception e)
            {
                var webex = e as WebException;
                if (webex != null)
                {
                    if (webex.Response == null || String.IsNullOrWhiteSpace(webex.Response.ContentType))
                    {
                        //Connection error during call
                        throw webex;
                    }
                    else
                    {
                        //404 Response from server => thread got deleted
                        retVal = null;
                    }
                }
                else
                {
                    throw;
                }
            }
            return(retVal);
        }
        //needed for crashes from unity-log
        internal CrashData(HockeyClient hockeyClient, string logString, string stackTrace, CrashLogInformation crashLogInfo)
        {
            this._hockeyClient = hockeyClient;
            StringBuilder builder = new StringBuilder();
            builder.Append(crashLogInfo.ToString());
            builder.AppendLine();
            builder.Append(logString);
            builder.AppendLine();
            builder.AppendLine(string.IsNullOrEmpty(stackTrace) ? "  at unknown location" : stackTrace);
            this.Log = builder.ToString();

            this.UserID = this._hockeyClient.UserID;
            this.Contact = this._hockeyClient.ContactInformation;
            this.SDKName = this._hockeyClient.SdkName;
            this.SDKVersion = this._hockeyClient.SdkVersion;
            //we don't support DescriptionLoader from unity at the moment
        }
        //needed for crashes from unity-log
        internal CrashData(HockeyClient hockeyClient, string logString, string stackTrace, CrashLogInformation crashLogInfo)
        {
            this._hockeyClient = hockeyClient;
            StringBuilder builder = new StringBuilder();

            builder.Append(crashLogInfo.ToString());
            builder.AppendLine();
            builder.Append(logString);
            builder.AppendLine();
            builder.AppendLine(string.IsNullOrEmpty(stackTrace) ? "  at unknown location" : stackTrace);
            this.Log = builder.ToString();

            this.UserID     = this._hockeyClient.UserID;
            this.Contact    = this._hockeyClient.ContactInformation;
            this.SDKName    = this._hockeyClient.SdkName;
            this.SDKVersion = this._hockeyClient.SdkVersion;
            //we don't support DescriptionLoader from unity at the moment
        }
Exemple #6
0
 public void Configure(string appIdentifier, string apiDomain)
 {
     #if (UNITY_WP8 && !UNITY_EDITOR)
     appId = appIdentifier;
     Dispatcher.InvokeOnUIThread(() =>
     {
         _wp8Extensions      = Type.GetType("HockeyApp.HockeyClientWP8SLExtension,HockeyApp");
         HockeyClient client = (HockeyClient)_wp8Extensions.GetMethod("Configure").Invoke(null, new object[] {
             HockeyClient.Current,
             appIdentifier,
             (PhoneApplicationFrame)Application.Current.RootVisual
         });
         client.SetApiDomain(apiDomain);
         client.SdkName    = HockeyUnityConstants.SdkName;
         client.SdkVersion = HockeyUnityConstants.SdkVersion;
     });
     #endif
 }
        internal static async Task<FeedbackThread> OpenFeedbackThreadAsync(HockeyClient client, string threadToken)
        {
            FeedbackThread retVal = null;
            _logger.Info("Try to get thread with ID={0}", new object[] { threadToken });

            var request = WebRequest.CreateHttp(new Uri(client.ApiBaseVersion2 + "apps/" + client.AppIdentifier + "/feedback/" + threadToken + ".json", UriKind.Absolute));
            request.Method = "Get";
            request.SetHeader(HttpRequestHeader.UserAgent.ToString(), client.UserAgentString);

            try
            {
                var response = await request.GetResponseAsync();

                var fbResp = await TaskEx.Run<FeedbackResponseSingle>(() => FeedbackResponseSingle.FromJson(response.GetResponseStream()));

                if (fbResp.Status.Equals("success"))
                {
                    retVal = fbResp.Feedback;
                }
                else
                {
                    throw new Exception("Server error. Server returned status " + fbResp.Status);
                }
            }
            catch (Exception e)
            {
                var webex = e as WebException;
                if (webex != null)
                {
                    if (webex.Response == null || String.IsNullOrWhiteSpace(webex.Response.ContentType))
                    {
                        //Connection error during call
                        throw webex;
                    }
                    else
                    {
                        //404 Response from server => thread got deleted
                        retVal = null;
                    }
                }
                else
                {
                    throw;
                }
            }
            return retVal;
        }
 public void OnDeserializing(StreamingContext context)
 {
     this._hockeyClient = HockeyClient.Current as HockeyClient;
     _logger            = HockeyLogManager.GetLog(typeof(CrashData));
 }
 public void OnDeserializing(StreamingContext context)
 {
     this._hockeyClient = HockeyClient.Current as HockeyClient;
     _logger = HockeyLogManager.GetLog(typeof(CrashData));
 }