Пример #1
0
        public static PBOList FindPBOinDirectory(string basePath)
        {
            // Recurse through the directory
            PBOList list = new PBOList();

            try
            {
                string[] files = Directory.GetFiles(basePath, "*.*", SearchOption.AllDirectories);
                foreach (string file in files)
                {
                    string fileName = Path.GetFileName(file);
                    string filePath = file.TrimEnd(fileName.ToCharArray());
                    // for each file get the hash
                    //string fileHash = HashGenerator.GetHash(file);
                    string fileHash = "";

                    // store data in new pbo
                    list.Add(new PBO(fileName, filePath, fileHash));
                }
                return(list);
            }
            catch
            {
                return(list);
            };
        }
Пример #2
0
        public static PBOList ReadRepoXML(string s)
        {
            IsSyntaxCorrect(s);

            var doc  = XDocument.Load(s);
            var list = from x in doc.Descendants("FileNode")
                       select new PBO
                       (
                (string)x.Element("FileName"),
                (string)x.Element("FilePath"),
                (string)x.Element("FileHash")
                       );
            PBOList p = new PBOList();

            foreach (PBO x in list)
            {
                p.Add(x);
            }
            return(p);
        }
Пример #3
0
        public static PBOList ReadXML(string s)
        {
            CheckSyntax(s);

            var doc  = XDocument.Load(s);
            var list = from x in doc.Descendants("FILE")
                       select new PBO
                       (
                (string)x.Element("NAME"),
                (string)x.Element("SDIR"),
                (string)x.Element("HASH")
                       );
            PBOList p = new PBOList();

            foreach (PBO x in list)
            {
                p.Add(x);
            }
            return(p);
        }