public static List <TSK_Param> RemoveParam(List <TSK_Param> @params, String name) { if (@params == null || String.IsNullOrEmpty(name)) { TSK_Debug.Error("Invalid parameter"); return(@params); } #if WINDOWS_PHONE again: foreach (TSK_Param param in @params) { if (String.Equals(param.Name, name, StringComparison.InvariantCultureIgnoreCase)) { @params.Remove(param); goto again; } } #else @params.RemoveAll( (x) => { return(x.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)); } ); #endif return(@params); }
public static Int32 GetInt32(String data, int ts, int te) { int len = (int)(te - ts); if (len >= 0) { try { return(Int32.Parse(data.Substring(ts, len))); } catch (Exception e) { TSK_Debug.Error(e.ToString()); } } return(-1); }
public static String GetString(String data, int ts, int te) { int len = (te - ts); if (len > 0) { try { return(data.Substring(ts, len)); } catch (Exception e) { TSK_Debug.Error(e.ToString()); } } return(null); }
public static Int64 GetInt64(String data, int p, int tag_start) { int len = (p - tag_start); if (len >= 0) { try { return(Int64.Parse(data.Substring(tag_start, len))); } catch (Exception e) { TSK_Debug.Error(e.ToString()); } } return(-1); }
public static String GetString(String data, int p, int tag_start) { int len = (int)(p - tag_start); if (len > 0) { try { return(data.Substring(tag_start, len)); } catch (Exception e) { TSK_Debug.Error(e.ToString()); } } return(null); }
public static Double GetFloat(String data, int ts, int te) { int len = (int)(te - ts); if (len >= 0) { try { return(Double.Parse(data.Substring(ts, len))); } catch (Exception e) { TSK_Debug.Error(e.ToString()); } } return(-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); }