Exemplo n.º 1
0
        public static void RegisterUriScheme(ILogger logger, string appid, string steamid = null)
        {
            //Get the creator
            IUriSchemeCreator creator = null;

            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32Windows:
            case PlatformID.Win32S:
            case PlatformID.Win32NT:
            case PlatformID.WinCE:
                creator = new WindowsUriSchemeCreator();
                break;

            case PlatformID.Unix:
                creator = new UnixUriSchemeCreator();
                break;

                //case PlatformID.MacOSX:
                //    creator = new MacUriSchemeCreator();
                //    break;
            }

            //Make sure its valid
            if (creator == null)
            {
                throw new PlatformNotSupportedException("Platform does not support registration.");
            }

            //Register the endpoitns
            creator.RegisterUriScheme(logger, appid, steamid);
        }
        /// <summary>
        /// Registers the URI scheme, using the correct creator for the correct platform
        /// </summary>
        public bool RegisterUriScheme()
        {
            //Get the creator
            IUriSchemeCreator creator = null;

            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32Windows:
            case PlatformID.Win32S:
            case PlatformID.Win32NT:
            case PlatformID.WinCE:
                _logger.Trace("Creating Windows Scheme Creator");
                creator = new WindowsUriSchemeCreator(_logger);
                break;

            case PlatformID.Unix:
                _logger.Trace("Creating Unix Scheme Creator");
                creator = new UnixUriSchemeCreator(_logger);
                break;

            case PlatformID.MacOSX:
                _logger.Trace("Creating MacOSX Scheme Creator");
                creator = new MacUriSchemeCreator(_logger);
                break;

            default:
                _logger.Error("Unkown Platform: " + Environment.OSVersion.Platform);
                throw new PlatformNotSupportedException("Platform does not support registration.");
            }

            //Regiser the app
            return(creator.RegisterUriScheme(this));
        }