当前位置: 首页>>代码示例>>C#>>正文


C# Properties.GetProperty方法代码示例

本文整理汇总了C#中Properties.GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Properties.GetProperty方法的具体用法?C# Properties.GetProperty怎么用?C# Properties.GetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Properties的用法示例。


在下文中一共展示了Properties.GetProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDepth

 ///<summary> Gets the depth.  Used if the field is of type <b><i>path</i></b>. </summary>
 ///<returns> depth </returns>
 public static int GetDepth(Properties selectionProp)
 {
     try
     {
         return Convert.ToInt32(selectionProp.GetProperty(PathFacetHandler.SEL_PROP_NAME_DEPTH));
     }
     catch
     {
         return 1;
     }
 }
开发者ID:NightOwl888,项目名称:Bobo-Browse.Net,代码行数:13,代码来源:PathFacetHandler.cs

示例2: IsStrict

 ///<summary> Gets if strict applied for counting. Used if the field is of type <b><i>path</i></b>. </summary>
 ///<returns> is strict applied </returns>
 public static bool IsStrict(Properties selectionProp)
 {
     try
     {
         return Convert.ToBoolean(selectionProp.GetProperty(PathFacetHandler.SEL_PROP_NAME_STRICT));
     }
     catch
     {
         return false;
     }
 }
开发者ID:NightOwl888,项目名称:Bobo-Browse.Net,代码行数:13,代码来源:PathFacetHandler.cs

示例3: ReadAppProps

		public AppProps ReadAppProps()
		{
			if (null == appPropsObj) {
				Properties appProps = new Properties();
				Stream input = null;
				ILogService logger = ServiceFinder.Resolve<ILogService>();
                bool foundLocalDevProps = false;
				try {
                    try
                    {
                        input = Application.Context.Assets.Open(LOCAL_DEV_APP_PROP_FILE);
                        foundLocalDevProps = true;
                    }
                    catch (Exception ex)
                    {
                        input = null;
                        foundLocalDevProps = false;
                        input = Application.Context.Assets.Open(APP_PROP_FILE);
                    }
					appProps.Load(input);
					appPropsObj = new AppProps();
					appPropsObj.projectid = appProps.GetProperty(PROJECT_ID_PROP);
					appPropsObj.appid = appProps.GetProperty(APP_ID_PROP);
					appPropsObj.appkey = appProps.GetProperty(APP_KEY_PROP);
					appPropsObj.host = appProps.GetProperty(HOST_PROP);
					appPropsObj.connectiontag = appProps.GetProperty(CONNECTION_TAG_PROP);
					appPropsObj.mode = appProps.GetProperty(MODE_PROP);
                    if(foundLocalDevProps){
                        appPropsObj.IsLocalDevelopment = true;
                    }
					return appPropsObj;
				} catch (Exception ex) {
					if(null != logger) {
						logger.e(TAG, "Failed to load " + APP_PROP_FILE, ex);
					}
					return null;

				} finally {
					if(null != input){
						try {
							input.Close();
						} catch (Exception exc) {
							if(null != logger){
								logger.w(TAG, "Failed to close stream", exc);
							}
						}
					}
				}
			}
			return appPropsObj;
		}
开发者ID:swizzley,项目名称:fh-dotnet-sdk,代码行数:51,代码来源:DeviceService.cs

示例4: ReadAppProps

 public AppProps ReadAppProps()
 {
     if (null != _appPropsObj) return _appPropsObj;
     var appProps = new Properties();
     Stream input = null;
     var logger = ServiceFinder.Resolve<ILogService>();
     try
     {
         bool foundLocalDevProps;
         try
         {
             input = Application.Context.Assets.Open(LocalDevAppPropFile);
             foundLocalDevProps = true;
         }
         catch (Exception)
         {
             input = null;
             foundLocalDevProps = false;
             input = Application.Context.Assets.Open(AppPropFile);
         }
         appProps.Load(input);
         _appPropsObj = new AppProps
         {
             projectid = appProps.GetProperty(ProjectIdProp),
             appid = appProps.GetProperty(AppIdProp),
             appkey = appProps.GetProperty(AppKeyProp),
             host = appProps.GetProperty(HostProp),
             connectiontag = appProps.GetProperty(ConnectionTagProp),
             mode = appProps.GetProperty(ModeProp)
         };
         if (foundLocalDevProps)
         {
             _appPropsObj.IsLocalDevelopment = true;
         }
         return _appPropsObj;
     }
     catch (Exception ex)
     {
         logger?.e(Tag, "Failed to load " + AppPropFile, ex);
         return null;
     }
     finally
     {
         input?.Dispose();
     }
 }
开发者ID:secondsun,项目名称:fh-dotnet-sdk,代码行数:46,代码来源:DeviceService.cs

示例5: ReadPushConfig

        public PushConfig ReadPushConfig()
        {
            var appProps = new Properties();
            Stream input = null;
            var logger = ServiceFinder.Resolve<ILogService>();
            try
            {
                input = Application.Context.Assets.Open(AppPropFile);
                appProps.Load(input);

                var pushServerUrl = appProps.GetProperty(HostProp) + "/api/v2/ag-push/";
                var pushSenderId = appProps.GetProperty("PUSH_SENDER_ID");
                var pushVariant = appProps.GetProperty("PUSH_VARIANT");
                var pushSecret = appProps.GetProperty("PUSH_SECRET");

                if (appProps.GetProperty(HostProp) != null && pushSenderId != null && pushVariant != null && pushSecret != null)
                    return new AndroidPushConfig
                    {
                        UnifiedPushUri = new Uri(pushServerUrl),
                        SenderId = pushSenderId,
                        VariantId = pushVariant,
                        VariantSecret = pushSecret
                    };
                var ex =
                    new InvalidOperationException(
                        "fhconfig.properties must define PUSH_SERVER_URL, PUSH_SENDER_ID, PUSH_VARIANT, and PUSH_SECRET.  One or more were not defined.");
                logger.e(Tag,
                    "fhconfig.properties must define PUSH_SERVER_URL, PUSH_SENDER_ID, PUSH_VARIANT, and PUSH_SECRET.  One or more were not defined.",
                    ex);
                throw ex;
            }
            catch (Exception ex)
            {
                logger?.e(Tag, "Failed to load " + AppPropFile, ex);
                return null;
            }
            finally
            {
                input?.Dispose();
            }
        }
开发者ID:secondsun,项目名称:fh-dotnet-sdk,代码行数:41,代码来源:DeviceService.cs

示例6: OnStart

        protected override void OnStart()
        {
            try {

                // Read the manager server address from the properties file,
                Properties p = new Properties();

                // Contains the root properties,
                string propFile = Path.Combine(path, "00.properties");
                if (File.Exists(propFile)) {
                    FileStream fin = new FileStream(propFile, FileMode.Open, FileAccess.Read, FileShare.Read);
                    p.Load(fin);
                    fin.Close();
                }

                // Fetch the manager server property,
                String v = p.GetProperty("manager_server_address");
                if (v != null) {
                    String[] addresses = v.Split(',');
                    int sz = addresses.Length;
                    ManagerServices = new IServiceAddress[sz];
                    for (int i = 0; i < sz; ++i) {
                        ManagerServices[i] = ServiceAddresses.ParseString(addresses[i]);
                    }
                }

            } catch (IOException e) {
                throw new ApplicationException("IO Error: " + e.Message);
            }

            // Adds all the files to the path info queue,
            string[] rootFiles = Directory.GetFiles(path);
            foreach (string f in rootFiles) {
                String fname = Path.GetFileName(f);
                if (!fname.Contains(".")) {
                    pathInitializationQueue.Add(f);
                }
            }

            base.OnStart();
        }
开发者ID:erpframework,项目名称:cloudb,代码行数:41,代码来源:FileSystemRootService.cs


注:本文中的Properties.GetProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。