public override string ToString() { List <string> list = arg0.ToList().OrderBy(x => x).ToList(); if (list.Count == 0) { return(""); } if (list.Count == 1) { return(list[0]); } string first = list.First(); string last = list.Last(); int shortest = list.Min(y => y.Length); StringBuilder stringb = new StringBuilder(); for (int i = 0; i < shortest; i++) { if (first[i].Equals(last[i])) { stringb.Append(first[i]); } else { break; } } return(stringb.ToString()); }
public void RunListOfFiles() { decimal previousIndex = RuntimeVariables.GetInstance().GetValueNumber("index"); string previousThis = RuntimeVariables.GetInstance().GetValueString("this"); RuntimeVariables.GetInstance().Actualize("index", 0); List <string> elements = list.ToList(); foreach (string element in elements) { RuntimeVariables.GetInstance().Actualize("this", element); try { Action(element); } catch (CommandException ce) { Logger.GetInstance().LogCommandError(ce.GetMessage()); } RuntimeVariables.GetInstance().IncrementBy("index", 1); } RuntimeVariables.GetInstance().Actualize("index", previousIndex); RuntimeVariables.GetInstance().Actualize("this", previousThis); }
public override bool ToBool() { List <string> leftValue = leftSide.ToList(); List <string> rightValue = rightSide.ToList(); switch (type) { case ComparisonType.Equals: return(leftValue.SequenceEqual(rightValue) ? true : false); case ComparisonType.NotEquals: return(leftValue.SequenceEqual(rightValue) ? false : true); case ComparisonType.Bigger: return(leftValue.Count > rightValue.Count ? true : false); case ComparisonType.Smaller: return(leftValue.Count < rightValue.Count ? true : false); case ComparisonType.BiggerOrEquals: return(leftValue.Count >= rightValue.Count ? true : false); case ComparisonType.SmallerOrEquals: return(leftValue.Count <= rightValue.Count ? true : false); } return(false); }
public override List <string> ToList() { List <string> result = new List <string>(); decimal oldIndex = RuntimeVariables.GetInstance().GetValueNumber("index"); string oldThis = RuntimeVariables.GetInstance().GetValueString("this"); RuntimeVariables.GetInstance().Actualize("index", 0); foreach (string element in leftSide.ToList()) { RuntimeVariables.GetInstance().Actualize("this", element); string value = rightSide.ToString(); if (unique) { if (!result.Contains(value)) { result.Add(value); } } else { result.Add(value); } RuntimeVariables.GetInstance().PlusPlus("index"); } RuntimeVariables.GetInstance().Actualize("index", oldIndex); RuntimeVariables.GetInstance().Actualize("this", oldThis); return(result); }
public override decimal ToNumber() { List <string> list = arg0.ToList().OrderBy(x => x.Length).ToList(); if (list.Count == 0) { return(0); } return(list[list.Count - 1].Length); }
public void Run() { if (list is IStringable) { Logger.GetInstance().Log((list as IStringable).ToString()); } else { foreach (string element in list.ToList()) { Logger.GetInstance().Log(element); } } }
public void Run() { string location = RuntimeVariables.GetInstance().GetWholeLocation(); IntPtr nativeFolder; uint psfgaoOut; SHParseDisplayName(location, IntPtr.Zero, out nativeFolder, 0, out psfgaoOut); // location not exists if (nativeFolder == IntPtr.Zero) { return; } List <string> selected = new List <string>(); foreach (string str in list.ToList()) { if (FileInnerVariable.Exist(str)) { selected.Add(str); } } // escape if there is nothing to select if (selected.Count == 0) { return; } //fill array of files and directories IntPtr[] fileArray = new IntPtr[selected.Count]; for (int i = 0; i < selected.Count; i++) { SHParseDisplayName(System.IO.Path.Combine(location, selected[i]), IntPtr.Zero, out fileArray[i], 0, out psfgaoOut); Logger.GetInstance().LogCommand("Select " + selected[i]); } SHOpenFolderAndSelectItems(nativeFolder, (uint)fileArray.Length, fileArray, 0); // free memory Marshal.FreeCoTaskMem(nativeFolder); for (int i = 0; i < selected.Count; i++) { Marshal.FreeCoTaskMem(fileArray[i]); } }
public override decimal ToNumber() { string d = directory.ToString(); if (d.Trim().Equals("")) { return(0); } RuntimeVariables.GetInstance().ExpandLocation(d); if (!RuntimeVariables.GetInstance().WholeLocationExists()) { RuntimeVariables.GetInstance().RetreatLocation(); return(0); } decimal count = list.ToList().Count; RuntimeVariables.GetInstance().RetreatLocation(); return(count); }
public override string ToString() { List <string> list = arg0.ToList(); if (list.Count == 0) { return(""); } else if (list.Count == 1) { return(list[0]); } StringBuilder sb = new StringBuilder(); foreach (string l in list) { sb.Append(l); } return(sb.ToString()); }
public override bool ToBool() { return(compared.ToList().Any(e => e.ToString().Equals(value.ToString()))); }
public override bool ToBool() { return(arg0.ToList().Contains(arg1.ToString()) ? true : false); }
public void Run() { RuntimeVariables.GetInstance().Add(name, values.ToList()); }
public void Run() { RuntimeVariables.GetInstance().Actualize(name, value.ToList()); }
public List <string> GetValue() { return(value.ToList()); }
public override decimal ToNumber() { return(list.ToList().Count); }
public override List <string> ToList() { return(condition.ToBool() ? leftValue.ToList() : rightValue.ToList()); }
public List <string> ToList() { return(list.ToList()); }
public override bool ToBool() { return(arg0.ToList().Count() == 0); }