コード例 #1
0
        public static List <TSK_Param> AddParam(List <TSK_Param> @params, String name, String value)
        {
            TSK_Param param = null;

            if (@params == null || String.IsNullOrEmpty(name))
            {
                TSK_Debug.Error("Invalid parameter");
                return(@params);
            }

            if ((param = TSK_Param.GetByName(@params, name)) != null)
            {
                param.Value = value;/* Already exist ==> update the value. */
            }
            else
            {
                @params.Add(TSK_Param.Create(name, value));
            }

            return(@params);
        }
コード例 #2
0
        public static TSK_Param Parse(String line)
        {
            if (!String.IsNullOrEmpty(line))
            {
                int    start = 0;
                int    end   = line.Length;
                int    equal = line.IndexOf("=");
                String name  = null;
                String value = null;

                if (equal >= 0 && equal < end)
                {
                    name  = line.Substring(start, (equal - start));
                    value = line.Substring(equal + 1, (end - equal - 1));
                }
                else
                {
                    name = line.Substring(start, end);
                }

                return(TSK_Param.Create(name, value));
            }
            return(null);
        }