Пример #1
0
 internal LimitEventArgs(string fileName, IoOperation operation, int maxRowCount, int worksheetCount, bool writeWarningWorksheet)
 {
     this.fileName              = fileName;
     this.operation             = operation;
     this.maxRowCount           = maxRowCount;
     this.worksheetCount        = worksheetCount;
     this.writeWarningWorksheet = writeWarningWorksheet;
 }
Пример #2
0
        internal LimitEventArgs OnLimitReached(string fileName, IoOperation operation, int maxRowCount, int worksheetCount, bool writeWarningWorksheet)
        {
            LimitEventArgs e = new LimitEventArgs(fileName, operation, maxRowCount, worksheetCount, writeWarningWorksheet);

            if (this.LimitReached != null)
            {
                this.LimitReached(this, e);
            }
            return(e);
        }
Пример #3
0
        public async Task readcsv()
        {
            IoOperation obj   = new IoOperation();
            var         task1 = obj.ReadFile(@"../../../../AggregateGDPPopulation/data/datafile.csv");
            var         task2 = obj.ReadFile(@"../../../../AggregateGDPPopulation/data/country-continent.json");

            await Task.WhenAll(task1, task2);

            string  csv = task1.Result;
            string  jos = task2.Result;
            JObject CountryVsContinent = JObject.Parse(jos);


            string[]   csv1    = csv.Split('\n');
            string[][] array2d = new string[csv1.Length][];
            int        r       = 0;

            foreach (string s in csv1)
            {
                string trim = s.Replace("\"", "");
                array2d[r++] = trim.Split(',');
            }

            Dictionary <string, class2> dict = new Dictionary <string, class2>();

            for (int i = 1; i < array2d.Length - 2; i++)
            {
                if (!dict.ContainsKey((string)CountryVsContinent[array2d[i][0]]))
                {
                    dict[(string)CountryVsContinent[array2d[i][0]]]                 = new class2();
                    dict[(string)CountryVsContinent[array2d[i][0]]].GDP_2012        = double.Parse(array2d[i][7]);
                    dict[(string)CountryVsContinent[array2d[i][0]]].POPULATION_2012 = double.Parse(array2d[i][4]);
                }
                else
                {
                    dict[(string)CountryVsContinent[array2d[i][0]]].GDP_2012        += double.Parse(array2d[i][7]);
                    dict[(string)CountryVsContinent[array2d[i][0]]].POPULATION_2012 += double.Parse(array2d[i][4]);
                }
            }


            string json = JsonConvert.SerializeObject(dict, Formatting.Indented);
            await obj.WriteFile(@"../../../../AggregateGDPPopulation/data/output.json", json);
        }
Пример #4
0
 internal IoWarningEventArgs(string fileName, IoOperation operation, string warningMsg)
 {
     this.fileName   = fileName;
     this.operation  = operation;
     this.warningMsg = warningMsg;
 }
Пример #5
0
        internal static IoWarningEventArgs OnIoWarning(ExcelFile excelFile, string fileName, IoOperation operation, string warningMsg)
        {
            IoWarningEventArgs e = new IoWarningEventArgs(fileName, operation, warningMsg);

            if ((excelFile != null) && (excelFile.IoWarning != null))
            {
                excelFile.IoWarning(null, e);
            }
            return(e);
        }
Пример #6
0
 public IoOperationInfo(ExcelFile excelFile, string fileName, IoOperation operation)
 {
     this.excelFile = excelFile;
     this.fileName  = fileName;
     this.operation = operation;
 }