//string pathLibrary = @"D:\Книги"; //string dir = @"D:/Projects/EditFb2/EditFb2"; //string PathToDB = @"Library.db"; //public static XmlSerializerNamespaces xmlns = new XmlSerializerNamespaces(); public MainWindow() { InitializeComponent(); DB.Init(); int count = DB.GetCountRows(typeof(Book)); if (count == 0) CreateLibrary0(); //Parse.InitLibrary(); //string[] arrFiles = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories); //Regex reg = new Regex(@"(<description[\s\S]*?[>])([\s\S]*?)</description>"); ////MatchCollection matches = reg.Matches(str); //Match match = reg.Match(str); //List<string> lst = new List<string>(); ////foreach (Match match in matches) ////{ // int t = match.Groups.Count; // lst.Add(match.Groups[0].ToString()); //весь текст // lst.Add(match.Groups[1].ToString()); //начальный тэг // lst.Add(match.Groups[2].ToString()); //внутреннее содержимое ////} //string readText = File.ReadAllText(bin1); //byte[] newBytes = Convert.FromBase64String(readText); //BitmapSource bitmap = (BitmapSource)new ImageSourceConverter().ConvertFrom(newBytes); //imgI.Source = bitmap; }
public MainWindow() { InitializeComponent(); DB.Init(); string path = DB.GetPathToLibrary(); string[] arrFiles; List <string> badFiles = new List <string>(); if (Directory.Exists(path)) { arrFiles = Directory.GetFiles(path, "*.fb2", SearchOption.AllDirectories); //List<AllBook> lstAll = new List<AllBook>(); List <ReadFb2> lstReadfb2 = new List <ReadFb2>(); foreach (string name in arrFiles) { //string pathFile = @"D:\Книги\Experiments.fb2"; //ReadWriteFb2.SaveBookToDB(name); //lstAll.Add(XmlFiles.GetFieldFromFile(name)); //lstBooks.Add(ReadFb2.SaveBookToDB(name)); lstReadfb2.Add(new ReadFb2(name), badFiles); } //DB.SaveListData(lstAll); } //XmlDocument doc = new XmlDocument(); //doc.Load(pathFile); //XmlElement root = doc.DocumentElement; //XmlNode node = root.SelectSingleNode("/FictionBook/description"); //foreach (XmlElement child in root) //{ // var s = child.InnerXml; //} //XmlSerializer ser = new XmlSerializer(typeof(FictionBook)); //FictionBook fictionBook; //using (XmlReader reader = XmlReader.Create(pathFile)) //{ // fictionBook = (FictionBook)ser.Deserialize(reader); //} //var description = fictionBook.description; }