Esempio n. 1
0
        /// <summary>
        /// Configures the HockeyAppSDK
        /// </summary>
        /// <param name="appIdentifier">Identifier of the app</param>
        /// <param name="appVersionInformation">optional version of the app. If null the executing assembly version is used</param>
        /// <param name="userID">optional user id - e.g. the logged in user</param>
        /// <param name="contactInformation">optional contact information like an email adress</param>
        /// <param name="descriptionLoader">optional delegate for attaching description information like event logs etc. Can be null.</param>
        /// <param name="apiBase">optional: apiBase - if not the standard is used</param>
        /// <param name="userAgentString">The user agent string.</param>
        /// <param name="keepRunning">optional: if an unhandled exception is thrown on the dispatcher thread, the system can be kept alive - default is false</param>
        /// <exception cref="System.Exception">ApiBase must not be empty!</exception>
        public void Configure(string appIdentifier,
                              string appVersionInformation = null,
                              string userID             = null,
                              string contactInformation = null,
                              Func <Exception, string> descriptionLoader = null,
                              string apiBase         = "https://rink.hockeyapp.net",
                              string userAgentString = null,
                              bool keepRunning       = false)

        {
            if (String.IsNullOrWhiteSpace(apiBase))
            {
                throw new Exception("ApiBase must not be empty!");
            }

            logger.Info("Configure HockeyClientWPF with appIdentifier={0}, userID={1}, contactInformation={2}, descriptionLoader available{3}, sendCrashesAutomatically={4}, apiBase={5}",
                        new object[] { appIdentifier, userID, contactInformation, (descriptionLoader != null).ToString(), apiBase });

            string myAppVersion = string.IsNullOrEmpty(appVersionInformation)?
                                  Assembly.GetCallingAssembly().GetName().Version.ToString()
                :appVersionInformation;

            HockeyClient.ConfigureInternal(appIdentifier,
                                           myAppVersion,
                                           apiBase: apiBase,
                                           userID: userID,
                                           contactInformation: contactInformation,
                                           userAgentName: Constants.USER_AGENT_STRING,
                                           sdkName: Constants.SDKNAME,
                                           sdkVersion: Constants.SDKVERSION,
                                           os: Environment.OSVersion.Platform.ToString(),
                                           osVersion: Environment.OSVersion.Version.ToString() + Environment.OSVersion.ServicePack);
            this._crashHandler = new CrashHandler(HockeyClient.Instance, descriptionLoader, keepRunning);
        }
Esempio n. 2
0
        public static void ConfigureInternal(string appIdentifier,
                                             string versionInfo,
                                             string apiBase            = null,
                                             string userID             = null,
                                             string contactInformation = null,
                                             string userAgentName      = null,
                                             string sdkName            = null,
                                             string sdkVersion         = null,
                                             Func <Exception, string> descriptionLoader = null,
                                             string os        = null,
                                             string osVersion = null,
                                             string device    = null,
                                             string oem       = null,
                                             string uuid      = null)
        {
            _instance = new HockeyClient();
            _instance.AppIdentifier      = appIdentifier;
            _instance.VersionInfo        = versionInfo;
            _instance.UserID             = userID;
            _instance.ContactInformation = contactInformation;
            _instance.DescriptionLoader  = descriptionLoader;
#pragma warning disable 618 // disable obsolete warning!
            _instance.ApiBase = apiBase ?? SDKConstants.PublicApiDomain;
#pragma warning restore 618
            _instance.UserAgentString = userAgentName ?? SDKConstants.UserAgentString;
            _instance.SdkName         = sdkName ?? SDKConstants.SdkName;
            _instance.SdkVersion      = sdkVersion ?? SDKConstants.SdkVersion;
            _instance.Os        = os;
            _instance.OsVersion = os;
            _instance.Device    = device;
            _instance.Oem       = oem;
            _instance.Uuid      = uuid;
        }
Esempio n. 3
0
        /// <summary>
        /// Configures the HockeyAppSDK
        /// </summary>
        /// <param name="appIdentifier">Identifier of the app</param>
        /// <param name="appVersionInformation">version of the app</param>
        /// <param name="userID">optional user id - e.g. the logged in user</param>
        /// <param name="contactInformation">optional contact information like an email adress</param>
        /// <param name="descriptionLoader">optional delegate for attaching description information like event logs etc. Can be null.</param>
        /// <param name="apiBase">optional: apiBase - if not the standard is used</param>
        public void Configure(string appIdentifier,
                              string appVersionInformation,
                              string userID             = null,
                              string contactInformation = null,
                              Func <Exception, string> descriptionLoader = null,
                              string apiBase         = "https://rink.hockeyapp.net",
                              string userAgentString = null)

        {
            if (String.IsNullOrWhiteSpace(apiBase))
            {
                throw new Exception("ApiBase must not be empty!");
            }

            logger.Info("Configure HockeyClientWPF with appIdentifier={0}, userID={1}, contactInformation={2}, descriptionLoader available{3}, sendCrashesAutomatically={4}, apiBase={5}",
                        new object[] { appIdentifier, userID, contactInformation, (descriptionLoader != null).ToString(), apiBase });

            HockeyClient.ConfigureInternal(appIdentifier,
                                           appVersionInformation,
                                           apiBase: apiBase,
                                           userID: userID,
                                           contactInformation: contactInformation,
                                           userAgentName: "",
                                           sdkName: Constants.SDKNAME,
                                           sdkVersion: Constants.SDKVERSION);

            this._crashHandler = new CrashHandler(HockeyClient.Instance, descriptionLoader);
        }
Esempio n. 4
0
        /// <summary>
        /// Configures the HockeyAppSDK
        /// </summary>
        /// <param name="appIdentifier">Identifier of the app</param>
        /// <param name="appVersionInformation">version of the app</param>
        /// <param name="userID">optional user id - e.g. the logged in user</param>
        /// <param name="contactInformation">optional contact information like an email adress</param>
        /// <param name="descriptionLoader">optional delegate for attaching description information like event logs etc. Can be null.</param>
        /// <param name="rootFrame">optional: rootFrame - if the rootframe is provided async void exception handling is improved</param>
        public void Configure(string appIdentifier,
                              string appVersionInformation,
                              string userID             = null,
                              string contactInformation = null,
                              Func <Exception, string> descriptionLoader = null,
                              string apiBase  = "https://rink.hockeyapp.net/api/2/",
                              Frame rootFrame = null)
        {
            if (String.IsNullOrWhiteSpace(apiBase))
            {
                throw new Exception("ApiBase must not be empty!");
            }

            logger.Info("Configure HockeyClientWPF with appIdentifier={0}, userID={1}, contactInformation={2}, descriptionLoader available{3}, sendCrashesAutomatically={4}, apiBase={5}",
                        new object[] { appIdentifier, userID, contactInformation, (descriptionLoader != null).ToString(), apiBase });

            HockeyClient.ConfigureInternal(appIdentifier,
                                           appVersionInformation,
                                           apiBase: apiBase,
                                           userID: userID,
                                           contactInformation: contactInformation,
                                           userAgentName: "",
                                           sdkName: Constants.SDKNAME,
                                           sdkVersion: Constants.SDKVERSION);

            this._crashHandler = new CrashHandler(HockeyClient.Instance, descriptionLoader);

            if (rootFrame != null)
            {
                //Idea based on http://www.markermetro.com/2013/01/technical/handling-unhandled-exceptions-with-asyncawait-on-windows-8-and-windows-phone-8/
                AsyncSynchronizationContext.RegisterForFrame(rootFrame, this._crashHandler);
            }
        }
Esempio n. 5
0
        public void Configure(Application application,
                              string identifier,
                              Frame rootFrame = null,
                              Func <Exception, string> descriptionLoader = null,
                              string apiBase            = null,
                              string userId             = null,
                              string contactInformation = null)
        {
            if (this._application == null)
            {
                this._crashLogInfo = new CrashLogInformation()
                {
                    PackageName  = application.GetType().Namespace,
                    ProductID    = ManifestHelper.GetProductID(),
                    Version      = ManifestHelper.GetAppVersion(),
                    WindowsPhone = Environment.OSVersion.Version.ToString(),
                    Manufacturer = GetDeviceManufacturer(),
                    Model        = GetDeviceModel()
                };


                this._application = application;
                this._application.UnhandledException += OnUnhandledException;
                HockeyClient.ConfigureInternal(identifier,
                                               ManifestHelper.GetAppVersion(),
                                               userID: userId,
                                               apiBase: apiBase,
                                               contactInformation: contactInformation,
                                               userAgentName: Constants.UserAgentString,
                                               sdkName: Constants.SdkName,
                                               sdkVersion: Constants.SdkVersion,
                                               descriptionLoader: descriptionLoader,
                                               os: Environment.OSVersion.Platform.ToString(),
                                               osVersion: Environment.OSVersion.Version.ToString(),
                                               device: GetDeviceModel(),
                                               oem: GetDeviceManufacturer());
                if (rootFrame != null)
                {
                    //Idea based on http://www.markermetro.com/2013/01/technical/handling-unhandled-exceptions-with-asyncawait-on-windows-8-and-windows-phone-8/
                    AsyncSynchronizationContext.RegisterForFrame(rootFrame, this);
                }
            }
            else
            {
                throw new InvalidOperationException("CrashHandler was already configured!");
            }
        }
        private void InitializeHockeyAppClient()
        {
            // reset the disposed value
            _disposed = false;

            // generate the assembly version
            _packageVersion = Assembly.GetEntryAssembly().GetName().Version.ToString();

            // init the client
            HockeyClient.Configure(_applicationId, _packageVersion);

            // configure the location of crash dumps
            _crashFileLocaton = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            _crashFileLocaton = Path.Combine(_crashFileLocaton, Assembly.GetEntryAssembly().GetName().Name);
            _crashFileLocaton = Path.Combine(_crashFileLocaton, "HockeyCrashLogs");

            // add the crash handler
            AppDomain.CurrentDomain.UnhandledException += ExceptionHandler;

            // try to push existing crash logs
            List <String> failedReports = null;

            TryPushCrashLogs(out failedReports);
        }
Esempio n. 7
0
        public static void ConfigureInternal(string appIdentifier,
                                        string versionInfo,
                                        string apiBase = null,
                                        string userID = null,
                                        string contactInformation = null,
                                        string userAgentName = null,
                                        string sdkName = null,
                                        string sdkVersion = null,
                                        Func<Exception, string> descriptionLoader = null,
                                        string os = null,
                                        string osVersion = null,
                                        string device = null,
                                        string oem = null,
                                        string uuid = null)
        {
            _instance = new HockeyClient();
            _instance.AppIdentifier = appIdentifier;
            _instance.VersionInfo = versionInfo;
            _instance.UserID = userID;
            _instance.ContactInformation = contactInformation;
            _instance.DescriptionLoader = descriptionLoader;
#pragma warning disable 618 // disable obsolete warning!
            _instance.ApiBase = apiBase ?? SDKConstants.PublicApiDomain;
#pragma warning restore 618
            _instance.UserAgentString = userAgentName ?? SDKConstants.UserAgentString;
            _instance.SdkName = sdkName ?? SDKConstants.SdkName;
            _instance.SdkVersion = sdkVersion ?? SDKConstants.SdkVersion;
            _instance.Os = os;
            _instance.OsVersion = os;
            _instance.Device = device;
            _instance.Oem = oem;
            _instance.Uuid = uuid;
        }