public String getPath(int times = 0, int labelledPatients = 0) { CSVRecord = null; informationCSVMerger = null; if (times > 10) { MessageBox.Show("Przekroczono limit losowania bez powtorzenia - zmien dane"); Environment.FailFast(""); return(null); } String path = pathProvider.getPath(); String final; if (informationCSVMerger == null) { informationCSVMerger = new InformationCSVMerger <CSVRecord>(CSVSaver.CsvPath); } if (labelledPatients > 0 && informationCSVMerger.getRecords().Count > loadedLabelled) { final = getLabelledPath(); } else { if (labelledPatients > 0) { MessageBox.Show("Załadowano nowego pacjenta - nie ma kolejnych rekordów danych do załadowania oznaczonych"); } final = analyzePath(path) && dropPolitics?getPath(times + 1, labelledPatients : labelledPatients) : path; } informationCSVMerger = null; return(final); }
public void saveToCSV(CSVStructure record, String path) { CSVRecord rec = record.getRecordFromStructure(path); saveRecordsToCsv(new CSVRecord[] { rec }); MessageBox.Show("Zapisano wiersz:\n" + buildRecordString(rec)); }
public void deleteRecord(CSVRecord record) { if (record == null) { return; } deleteTemplate(readCSV(), record); }
public void storeCSVRecord(CSVRecord CSVRecord) { if (records.Count <= currentPath) { records.Add(CSVRecord); } else { records[currentPath] = CSVRecord; } }
public void addDeleted() { if (deleted == null) { return; } saveRecordsToCsv(new CSVRecord[] { deleted }); MessageBox.Show("Ponownie dopisano wiersz:\n" + buildRecordString(deleted)); deleted = null; }
public static CSVStructure getStructure(CSVRecord CSVRecord = null) { if (CSVRecord != null) { return(Mapper.Map <CSVStructure>(CSVRecord)); } else { return(new CSVStructure()); } }
private void deleteTemplate(List <CSVRecord> records, CSVRecord toDelete) { bool removed = records.Remove(toDelete); if (removed) { deleted = toDelete; String recordString = buildRecordString(toDelete); MessageBox.Show("Pozostało wierszy: " + records.Count + "\nUsuwanie wiersza:\n" + recordString); rewriteCSV(records); } }
public void deleteRecord() { List <CSVRecord> records = readCSV(); if (records.Count == 0) { return; } CSVRecord removed = records.Last(); deleteTemplate(records, removed); }
public static String buildRecordString(CSVRecord record) { StringBuilder sb = new StringBuilder(); foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(record)) { string name = descriptor.Name; object value = descriptor.GetValue(record); sb.Append(name + ": " + value + ", "); } return(sb.ToString()); }
public override bool Equals(object obj) { CSVRecord ob = (CSVRecord)obj; if (this.Patient.Equals(ob.Patient) && this.Date.Equals(ob.Date) && this.Eye.Equals(ob.Eye) && this.EyeImage.Equals(ob.EyeImage) && this.SrodekImage.Equals(ob.SrodekImage) && this.WyjscieImage.Equals(ob.WyjscieImage) && this.KrawedzImage.Equals(ob.KrawedzImage) && this.ObrzekImage.Equals(ob.ObrzekImage) && this.PierscienImage.Equals(ob.PierscienImage)) { return(true); } else { return(false); } }
private String getLabelledPath() { CSVRecord = informationCSVMerger.getRecords().ElementAt(loadedLabelled); loadedLabelled++; String dir = PropertiesReader.PATH_PROVIDER_ADDITIONAL_ARGS + "/" + CSVRecord.Patient + "/" + CSVRecord.Date; String dirEye = dir + "/" + CSVRecord.Eye; if (Directory.Exists(dirEye)) { return(dirEye); } else { return(dir); } }
public bool analyzePath(String path) { if (informationCSVMerger == null) { informationCSVMerger = new InformationCSVMerger <CSVRecord>(CSVSaver.CsvPath); } CSVRecord = null; CSVRecord = InformationCSVMerger <CSVRecord> .getRecord(path, informationCSVMerger.getRecords()); if (CSVRecord == null) { return(false); } else { return(true); } }