public static List <string> Compare(SieDocument docA, SieDocument docB) { var comp = new SieDocumentComparer(docA, docB); comp.doCompare(); return(comp._errors); }
private void SetDocumentKSUMMA() { using (_stream = new MemoryStream()) { WriteCore(); _stream.Position = 0; var tempDoc = new SieDocument(); tempDoc.ThrowErrors = false; tempDoc.ReadDocument(_stream); _sie.KSUMMA = tempDoc.CRC.Checksum(); } _stream = null; }
internal SieDataItem(string line, SieDocument document) { RawData = line; Document = document; var l = line.Trim(); var p = FirstWhiteSpace(l); if (p == -1) { ItemType = l; Data = new List <string>(); } else { ItemType = l.Substring(0, p); Data = splitLine(l.Substring(p + 1, l.Length - (p + 1))); } }
private void compareVER(SieDocument docA, SieDocument docB, string nameA, string nameB) { foreach (var vA in docA.VER) { bool foundIt = false; foreach (var vB in docB.VER) { if (voucherComparer(vA, vB)) { foundIt = true; break; } } if (!foundIt) { _errors.Add("Vouchers differs Series, Number not found or different in " + nameB + ": " + vA.Series + ", " + vA.Number); } } }
private void compareKONTO(SieDocument docA, SieDocument docB, string nameA, string nameB) { foreach (var kA in docA.KONTO.Values) { if (docB.KONTO.ContainsKey(kA.Number)) { var kB = docB.KONTO[kA.Number]; if (kA.Name != kB.Name) { _errors.Add("KONTO.Name differ " + kA.Number); } if (kA.Type != kB.Type) { _errors.Add("KONTO.Type differ " + kA.Number); } if (kA.Unit != kB.Unit) { _errors.Add("KONTO.Unit differ " + kA.Number); } if (kA.SRU.Count == kB.SRU.Count) { for (int i = 0; i < kA.SRU.Count; i++) { if (kA.SRU.ElementAt(i) != kB.SRU.ElementAt(i)) { _errors.Add("KONTO.SRU differ " + kA.Number); break; } } } else { _errors.Add("KONTO.SRU differ " + kA.Number); } } else { _errors.Add(nameB + " is missing KONTO: " + kA.Number); } } }
private void compareRAR(SieDocument docA, SieDocument docB, string nameA, string nameB) { foreach (var rarA in docA.RAR.Values) { if (docB.RAR.ContainsKey(rarA.ID)) { var rarB = docB.RAR[rarA.ID]; if (rarA.Start != rarB.Start) { _errors.Add(nameB + "RAR differs " + rarA.ID); } if (rarA.End != rarB.End) { _errors.Add(nameB + "RAR differs " + rarA.ID); } } else { _errors.Add(nameB + "RAR is missing " + rarA.ID); } } }
private void compareDIM(SieDocument docA, SieDocument docB, string nameA, string nameB) { foreach (var dimKey in docA.DIM.Keys) { if (docB.DIM.ContainsKey(dimKey)) { if (!docA.DIM[dimKey].Name.Equals(docB.DIM[dimKey].Name)) { _errors.Add("DIM " + dimKey + " Name differ " + nameA + "," + nameB + ":" + docA.DIM[dimKey].Name + " , " + docB.DIM[dimKey].Name); } if (!docA.DIM[dimKey].Number.Equals(docB.DIM[dimKey].Number)) { _errors.Add("DIM " + dimKey + " Number differ " + nameA + "," + nameB + ":" + docA.DIM[dimKey].Number + " , " + docB.DIM[dimKey].Number); } if (docA.DIM[dimKey].SuperDim != null && docB.DIM[dimKey].SuperDim == null) { _errors.Add("DIM " + dimKey + " SuberDim differ " + nameA + " has DIM ," + nameB + " is NULL, "); } if (docA.DIM[dimKey].SuperDim != null && docB.DIM[dimKey].SuperDim != null) { if (!docA.DIM[dimKey].SuperDim.Name.Equals(docB.DIM[dimKey].SuperDim.Name)) { _errors.Add("DIM " + dimKey + " SuperDim.Name differ " + nameA + "," + nameB + ":" + docA.DIM[dimKey].SuperDim.Name + " , " + docB.DIM[dimKey].SuperDim.Name); } if (!docA.DIM[dimKey].SuperDim.Number.Equals(docB.DIM[dimKey].SuperDim.Number)) { _errors.Add("DIM " + dimKey + " SuperDim.Number differ " + nameA + "," + nameB + ":" + docA.DIM[dimKey].SuperDim.Number + " , " + docB.DIM[dimKey].SuperDim.Number); } } } else { _errors.Add(nameB + " DIM is missing " + dimKey); } } }
public SieDocumentWriter(SieDocument sie, WriteOptions options = null) { _sie = sie; _options = options ?? new WriteOptions(); _encoding = Encoding.GetEncoding(437); }
private SieDocumentComparer(SieDocument docA, SieDocument docB) { _docA = docA; _docB = docB; _errors = new List <string>(); }
public SieDocumentWriter(SieDocument sie) { _sie = sie; _encoding = Encoding.GetEncoding(437); }