public UInt32 GetChecksum() { UInt32 ch = 0; ch += Consts.checksum(Consts.MAXPAGES); foreach (Page p in pages) { ch += p.GetChecksum(); } return(ch); }
public UInt32 GetChecksum() { UInt32 ch = 0; ch += Consts.checksum(liczba_linii); ch += Consts.checksum(Efekt); ch += Consts.checksum(czas_trwania); if (text != null) { ch += Consts.checksum(text); } ch += Consts.checksum(font); return(ch); }
//w tej konwersjii przyjmujemy ze rekord lini3 w triple line i double line hor przechodzi do lini 1 w sterowniku public Page GetPage() { Page p = new Page(); int temp; if (Int32.TryParse(idx, out temp)) { p.idx = temp; } else { p.idx = 0; } p.czas_trwania = 0; if (Int32.TryParse(czas_trwania, out temp)) { if (temp < Consts.MAXTIME) { p.czas_trwania = temp; } } p.Efekt = 0; if (Int32.TryParse(Efekt, out temp)) { if (temp < Consts.EFFECTCNT) { p.Efekt = temp; } } p.liczba_linii = Consts.SINLE_LINE; if (Int32.TryParse(liczba_linii, out temp)) { if (temp <= 4) { p.liczba_linii = temp - 1; } } p.font = Consts.GetFontCode(p.liczba_linii, _Czcionka1, _Czcionka2, _Czcionka3); if (p.text == null) { p.text = new byte[Consts.MAXCHARS]; } //clear buffer for (int k = 0; k < p.text.Length; k++) { p.text[k] = 0; } byte[] tab; int i = 0; switch (p.liczba_linii) { case Consts.SINLE_LINE: tab = Enc.e.GetBytes(Linia1); for (int j = 0; j < (tab.Length) & (i < (Consts.MAXCHARS - 1));) { p.text[i++] = tab[j++]; } break; case Consts.DOUBLE_LINE: tab = Enc.e.GetBytes(Linia1); for (int j = 0; j < (tab.Length) & (i < (Consts.MAXCHARS - 2));) { p.text[i++] = tab[j++]; } i++; tab = Enc.e.GetBytes(Linia2); for (int j = 0; j < (tab.Length) & (i < (Consts.MAXCHARS - 1));) { p.text[i++] = tab[j++]; } break; case Consts.DOUBLE_LINE_HORIZONTAL: tab = Enc.e.GetBytes(Linia3); for (int j = 0; j < (tab.Length) & (i < (Consts.MAXCHARS - 2));) { p.text[i++] = tab[j++]; } i++; tab = Enc.e.GetBytes(Linia1); for (int j = 0; j < (tab.Length) & (i < (Consts.MAXCHARS - 1));) { p.text[i++] = tab[j++]; } break; case Consts.TRIPLE_LINE: tab = Enc.e.GetBytes(Linia3); for (int j = 0; j < (tab.Length) & (i < (Consts.MAXCHARS - 3));) { p.text[i++] = tab[j++]; } i++; tab = Enc.e.GetBytes(Linia1); for (int j = 0; j < (tab.Length) & (i < (Consts.MAXCHARS - 2));) { p.text[i++] = tab[j++]; } i++; tab = Enc.e.GetBytes(Linia2); for (int j = 0; j < (tab.Length) & (i < (Consts.MAXCHARS - 1));) { p.text[i++] = tab[j++]; } break; } return(p); }