コード例 #1
0
ファイル: PathAnalyzer.cs プロジェクト: PiotrKaszuba/Labeller
        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);
        }
コード例 #2
0
        public void saveToCSV(CSVStructure record, String path)
        {
            CSVRecord rec = record.getRecordFromStructure(path);

            saveRecordsToCsv(new CSVRecord[] { rec });
            MessageBox.Show("Zapisano wiersz:\n" + buildRecordString(rec));
        }
コード例 #3
0
        public void deleteRecord(CSVRecord record)
        {
            if (record == null)
            {
                return;
            }

            deleteTemplate(readCSV(), record);
        }
コード例 #4
0
 public void storeCSVRecord(CSVRecord CSVRecord)
 {
     if (records.Count <= currentPath)
     {
         records.Add(CSVRecord);
     }
     else
     {
         records[currentPath] = CSVRecord;
     }
 }
コード例 #5
0
        public void addDeleted()
        {
            if (deleted == null)
            {
                return;
            }

            saveRecordsToCsv(new CSVRecord[] { deleted });
            MessageBox.Show("Ponownie dopisano wiersz:\n" + buildRecordString(deleted));
            deleted = null;
        }
コード例 #6
0
ファイル: CSVStructure.cs プロジェクト: PiotrKaszuba/Labeller
 public static CSVStructure getStructure(CSVRecord CSVRecord = null)
 {
     if (CSVRecord != null)
     {
         return(Mapper.Map <CSVStructure>(CSVRecord));
     }
     else
     {
         return(new CSVStructure());
     }
 }
コード例 #7
0
        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);
            }
        }
コード例 #8
0
        public void deleteRecord()
        {
            List <CSVRecord> records = readCSV();

            if (records.Count == 0)
            {
                return;
            }
            CSVRecord removed = records.Last();

            deleteTemplate(records, removed);
        }
コード例 #9
0
        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());
        }
コード例 #10
0
        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);
            }
        }
コード例 #11
0
ファイル: PathAnalyzer.cs プロジェクト: PiotrKaszuba/Labeller
        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);
            }
        }
コード例 #12
0
ファイル: PathAnalyzer.cs プロジェクト: PiotrKaszuba/Labeller
        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);
            }
        }