public string[] GetAllMembers() { SNode t = Head; string[] members = new string[Count]; for (int i = 0; i < Count; i++) { members[i] += t.Address; t = t.Next; } return(members); }
//for Selecting Exact Object public string SearchByName(string _name) { SNode t = Head; while (t != null) { if (t.Name == _name) { return(t.Address); } t = t.Next; } return(null); }
public string SelectRandomObject() { SNode t = Head; Random rm = new Random(); int index = rm.Next(0, Count - 1); for (int i = 0; i <= index; i++) { if (i == index) { return(t.Address); } t = t.Next; } return(null); }
public void Add(string val) { if (!String.IsNullOrWhiteSpace(val)) { SNode node = new SNode(val); if (Head == null) { Head = node; Tail = node; count++; } else { Tail.Next = node; Tail = Tail.Next; count++; } } }
public void Remove(string val) { SNode t = Head; if (t.Name == val) { Head = Head.Next; count--; return; } while (t.Next != null) { if (t.Next.Name == val) { t.Next = t.Next.Next; count--; return; } t = t.Next; } }
public SNode(string info) { this.Address = info; this.Name = Path.GetFileName(info); this.Next = null; }
public SLLIST() { Head = null; Tail = null; }