public static bool Insert(ref LogUnit Log)
        {
            if (!CheckDocument())
            {
                return(false);
            }

            XmlElement root = xmlDoc.DocumentElement;
            XmlElement log  = xmlDoc.CreateElement("Log");

            XmlElement id = xmlDoc.CreateElement("id");

            id.InnerText = freeID.ToString();
            Log.id       = freeID;
            freeID       = freeID + 1;
            log.AppendChild(id);

            XmlElement name = xmlDoc.CreateElement("name");

            name.InnerText = Log.message;
            log.AppendChild(name);



            root.AppendChild(log);

            SaveDocument();

            return(true);
        }
 public static void Fill(XmlNode logNode, ref LogUnit log)
 {
     foreach (XmlNode child in logNode.ChildNodes)
     {
         if (child.Name == "id")
         {
             log.id = int.Parse(child.InnerText);
         }
         if (child.Name == "name")
         {
             log.message = child.InnerText;
         }
     }
 }
        public static Collection <LogUnit> SelectAll()
        {
            Collection <LogUnit> Logs = new Collection <LogUnit>();

            if (!CheckDocument())
            {
                return(Logs);
            }

            XmlNode     root = xmlDoc.DocumentElement;
            XmlNodeList list = root.SelectNodes("Log");

            foreach (XmlNode logNode in list)
            {
                LogUnit log = new LogUnit();
                Fill(logNode, ref log);

                Logs.Add(log);
            }

            return(Logs);
        }