Exemple #1
0
 public static PatchList LoadFromXml(string Filename)
 {
     if (!File.Exists(Filename))
         throw new FileNotFoundException(Filename);
     var Serializer = new XmlSerializer(typeof(PatchList));
     var XmlReader = new XmlTextReader(Filename);
     PatchList ReturnObject = new PatchList();
     try
     {
         ReturnObject = (PatchList)Serializer.Deserialize(XmlReader);
     }
     catch { }
     XmlReader.Close();
     return ReturnObject;
 }
Exemple #2
0
        /// <summary>
        /// Funktion um die Patchlist in ein Dictionary zu schreiben
        /// </summary>
        private void PatchListToArray()
        {
            bool DirectoryPart = false;
            string Line;
            StreamReader FilePatchList = new StreamReader(OConfig.PatchList);

            this.AddTextToList("Patchlist wird gelesen...");

            int i = 0;

            while ((Line = FilePatchList.ReadLine()) != null)
            {
                if (Line == "[DIRECTORY]") {
                    DirectoryPart = true;
                    continue;
                }
                else if (Line == "[/DIRECTORY]")
                {
                    DirectoryPart = false;
                    continue;
                }

                if (DirectoryPart == true && !Directory.Exists(Line))
                {
                    Directory.CreateDirectory(Line);
                    this.AddTextToList(String.Format("{0} wurde angelegt.\r\n", GetShortName(Line)));
                }
                else if (DirectoryPart == false)
                {
                    PatchList LPList = new PatchList();
                    try
                    {
                        string[] ArrayLine = Line.Split('|');

                        LPList.FileName = ArrayLine[0];
                        LPList.HashValue = ArrayLine[1];

                        LstPatchlist.Add(i, LPList);
                    }
                    catch { }
                    LPList = null;
                    i++;
                }
            }

            FilePatchList.Close();
            File.Delete(OConfig.PatchList);
            this.AddTextToList("Patchlist wurde gelöscht.\r\n");

            this.RefreshInterface(0);
            this.CheckFiles(0);
        }