Beispiel #1
0
 public static String ToString(TSK_Param param)
 {
     if (param != null)
     {
         return(String.Format(!String.IsNullOrEmpty(param.Value) ? "{0}={1}" : "{0}", param.Name, param.Value));
     }
     return(String.Empty);
 }
Beispiel #2
0
        public static String GetValueByName(List <TSK_Param> @params, String name)
        {
            TSK_Param param = GetByName(@params, name);

            if (param != null)
            {
                return(param.Value);
            }
            return(null);
        }
            public static List <TSK_Param> AddParam(String data, int p, int tag_start, List <TSK_Param> @params)
            {
                TSK_Param param = Parser.GetParam(data, p, tag_start);

                if (param != null)
                {
                    @params.Add(param);
                }
                return(@params);
            }
            public static void AddParam(String data, int ts, int te, ref List <TSK_Param> @params)
            {
                int       len   = (te - ts);
                TSK_Param param = TSK_Param.Parse(data.Substring(ts, len));

                if (param != null)
                {
                    @params.Add(param);
                }
            }
Beispiel #5
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);
        }
Beispiel #6
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);
        }
Beispiel #7
0
 public override string  ToString()
 {
     return(TSK_Param.ToString(this));
 }
Beispiel #8
0
 public static Boolean HasParam(List <TSK_Param> @params, String name)
 {
     return(TSK_Param.GetByName(@params, name) != null);
 }
Beispiel #9
0
 public static String ToString(TSK_Param param)
 {
     if (param != null)
     {
         return String.Format(!String.IsNullOrEmpty(param.Value) ? "{0}={1}" : "{0}", param.Name, param.Value);
     }
     return String.Empty;
 }
            public static TSK_Param GetParam(String data, int p, int tag_start)
            {
                int len = (p - tag_start);

                return(TSK_Param.Parse(data.Substring(tag_start, len)));
            }