/// <summary> /// imports monitored items and stores them in arraylist /// for program to insert into list view. /// </summary> internal static void ImportItems() { XMLDataListEntry current = head; while (current != null) { Console.WriteLine("exporting"); Monitee monitee = new Monitee(current.Data); MoniteeList.InsertMonitee(monitee); current = current.Next; } }
internal static void DumpAll() { try{ StreamWriter sWriter = new StreamWriter("monitoredfolder.dump"); for (XMLDataListEntry current = head; current != null; current = current.Next) { sWriter.WriteLine( String.Format("{0},{1},{2}", current.Data.MoniteePath, current.Data.DestinationPath, current.Data.Type)); } sWriter.Close(); } catch { //handle dump failure here. } }
public static bool RemoveFile(String monitee) { if (monitee == "") { return(false); } XMLDataListEntry current = head; XMLDataListEntry previous = null; for (int i = 0; i < MoniteeList.length; i++) { while (current != null && (current.Data.MoniteePath != monitee)) { previous = current; current = current.Next; } Console.WriteLine("found {0}", i); if (current == null) { return(false); } else if (current == head) { head = current.Next; current = head; length--; } else if (current == tail) { tail = null; length--; } else { previous.Next = current.Next; current = previous; length--; } Console.WriteLine(length); } return(true); }
public static void RemoveFileDestination(string destination) { if (destination == "") { return; } XMLDataListEntry current = head; XMLDataListEntry previous = null; while (current != null && (current.Data.DestinationPath != destination)) { previous = current; current = current.Next; } if (current == null || previous == null) { return; } else if (current == head) { head = current.Next; current = head; length--; } else if (current == tail) { tail = null; length--; } else { previous.Next = current.Next; current = previous; length--; } Console.WriteLine(length); }
internal static void CreateXMLFile() { xDoc = new System.Xml.XmlDocument(); xDoc.AppendChild(xDoc.CreateXmlDeclaration("1.0", "UTF-8", null)); System.Xml.XmlElement root = xDoc.CreateElement("FolderMonitor"); Console.WriteLine("creating file"); try { XMLDataListEntry current = head; while (current != null) { root.AppendChild(CreateXMLNodes(current.Data)); current = current.Next; } xDoc.AppendChild(root); xDoc.Save(srcFileName); } catch (System.Exception e) { System.Console.WriteLine(e.ToString()); } }
public static bool InsertFile(XMLData xmlData) { Console.WriteLine("Inserting..."); if (xmlData.DestinationPath == "" || xmlData.MoniteePath == "") { return(false); } XMLDataListEntry tmp = new XMLDataListEntry(xmlData); //XMLDataListEntry current = head; /*while (current != null) * { * if (tmp.Data.MoniteePath == current.Data.MoniteePath) * { * return false; * } * else * { * current = current.Next; * } * }*/ if (head == null) { head = tmp; tail = tmp; length = 1; } else { tail.Next = tmp; tail = tmp; length++; } return(true); }
public static void Clear() { head = null; tail = null; length = 0; }
/// <summary> /// list entry class. /// </summary> /// <param name="xData">item to be stored in list</param> public XMLDataListEntry(XMLData xData) { data = xData; next = null; }