|
Wersja 2, 1.8 KB
(wprowadzona przez dorota, 17 years temu)
|
|
|
| Rev | Line | |
|---|
| [2] | 1 | using System;
|
|---|
| 2 | using System.Collections.Generic;
|
|---|
| 3 | using System.Text;
|
|---|
| 4 | using System.IO;
|
|---|
| 5 |
|
|---|
| 6 | namespace Baza_Reklam.Classes
|
|---|
| 7 | {
|
|---|
| 8 | class XTGFile
|
|---|
| 9 | {
|
|---|
| 10 | /// <summary>
|
|---|
| 11 | /// Zczytuje reklamy z pliku xtg // UWAGA : w przypadku gieldy i autosalonu wpisuje rowniez strony dla autosalonu
|
|---|
| 12 | /// dla zamowienin o tej samej nazwie np. CCC001 i GCCC001
|
|---|
| 13 | /// </summary>
|
|---|
| 14 | public List<Reklama> zczytajStronyZplikuXTG(string filename)
|
|---|
| 15 | {
|
|---|
| 16 | List<Reklama> lista = new List<Reklama>();
|
|---|
| 17 |
|
|---|
| 18 | StreamReader st = new StreamReader(filename);
|
|---|
| 19 |
|
|---|
| 20 | string read = null;
|
|---|
| 21 | string[] read2 = new string[20];
|
|---|
| 22 |
|
|---|
| 23 | while ((read = st.ReadLine()) != null)
|
|---|
| 24 | {
|
|---|
| 25 | Reklama nowa = new Reklama();
|
|---|
| 26 |
|
|---|
| 27 | if (read.Contains("REKLAMAFILES"))
|
|---|
| 28 | {
|
|---|
| 29 | read = read.Trim();
|
|---|
| 30 | read = read.Substring(read.Length - 10, 6);
|
|---|
| 31 | nowa.nrRek = read;
|
|---|
| 32 |
|
|---|
| 33 | read = st.ReadLine();
|
|---|
| 34 |
|
|---|
| 35 | read2 = read.Split("\t".ToCharArray(), 20);
|
|---|
| 36 |
|
|---|
| 37 | for (int i = 0; i < read2.Length; i++)
|
|---|
| 38 | {
|
|---|
| 39 | if (read2[i] != "")
|
|---|
| 40 | {
|
|---|
| 41 | nowa.costam.Add(read2[i]);
|
|---|
| 42 | }
|
|---|
| 43 | }
|
|---|
| 44 | lista.Add(nowa);
|
|---|
| 45 | }
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | st.Close();
|
|---|
| 49 |
|
|---|
| 50 | return lista;
|
|---|
| 51 | }
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 | #region Nested type: Reklama
|
|---|
| 57 |
|
|---|
| 58 | /// <summary>
|
|---|
| 59 | /// Klasa pomocnicza,u¿ywana przy zczytywaniu stron z pliku xtg
|
|---|
| 60 | /// </summary>
|
|---|
| 61 | public class Reklama
|
|---|
| 62 | {
|
|---|
| 63 | public List<string> costam = new List<string>();
|
|---|
| 64 | public string nrRek;
|
|---|
| 65 | public bool wpisana = false;
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | #endregion
|
|---|
| 69 | }
|
|---|
Notatka: Zobacz
TracBrowser
aby uzyskać więcej informacji.