示例#1
0
 /// <summary>
 ///     Return the cloud host info as URL
 /// </summary>
 /// <returns>the cloud host url</returns>
 public string GetCloudHost()
 {
     if (null != _hostUrl)
     {
         return(_hostUrl);
     }
     if (null != _cloudPropsJson["url"])
     {
         _hostUrl = (string)_cloudPropsJson["url"];
     }
     else
     {
         var hosts = (JObject)_cloudPropsJson["hosts"];
         if (null != hosts["url"])
         {
             _hostUrl = (string)hosts["url"];
         }
         else
         {
             var appMode = FHConfig.GetInstance().GetMode();
             if ("dev" == appMode)
             {
                 _hostUrl = (string)hosts["debugCloudUrl"];
             }
             else
             {
                 _hostUrl = (string)hosts["releaseCloudUrl"];
             }
         }
     }
     _hostUrl = _hostUrl.EndsWith("/") ? _hostUrl.Substring(0, _hostUrl.Length - 1) : _hostUrl;
     return(_hostUrl);
 }
示例#2
0
        public PushConfig ReadPushConfig()
        {
            var configName = FHConfig.GetInstance().IsLocalDevelopment
                ? Constants.LocalConfigFileName
                : Constants.ConfigFileName;

            var appProps       = ReadAppProps();
            var configLocation = Path.Combine(GetPackageDir(), configName);
            var json           = ServiceFinder.Resolve <IIOService>().ReadFile(configLocation);
            var config         = (JObject)JsonConvert.DeserializeObject(json);
            var configWindows  = config["windows"];

            var pushConfig = new PushConfig
            {
                Alias          = (string)config["Alias"],
                Categories     = config["Categories"]?.ToObject <List <string> >(),
                UnifiedPushUri = new Uri(appProps.host + "/api/v2/ag-push"),
                VariantId      = (string)(configWindows != null ? configWindows["variantID"] : config["variantID"]),
                VariantSecret  =
                    (string)(configWindows != null ? configWindows["variantSecret"] : config["variantSecret"])
            };

            return(pushConfig);
        }