using System; using System.Collections.Generic; using System.Text; using System.IO; namespace Baza_Reklam.Classes { class XTGFile { /// /// Zczytuje reklamy z pliku xtg // UWAGA : w przypadku gieldy i autosalonu wpisuje rowniez strony dla autosalonu /// dla zamowienin o tej samej nazwie np. CCC001 i GCCC001 /// public List zczytajStronyZplikuXTG(string filename) { List lista = new List(); StreamReader st = new StreamReader(filename); string read = null; string[] read2 = new string[20]; while ((read = st.ReadLine()) != null) { Reklama nowa = new Reklama(); if (read.Contains("REKLAMAFILES")) { read = read.Trim(); read = read.Substring(read.Length - 10, 6); nowa.nrRek = read; read = st.ReadLine(); read2 = read.Split("\t".ToCharArray(), 20); for (int i = 0; i < read2.Length; i++) { if (read2[i] != "") { nowa.costam.Add(read2[i]); } } lista.Add(nowa); } } st.Close(); return lista; } } #region Nested type: Reklama /// /// Klasa pomocnicza,używana przy zczytywaniu stron z pliku xtg /// public class Reklama { public List costam = new List(); public string nrRek; public bool wpisana = false; } #endregion }