Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 23e8ae04

Přidáno uživatelem Alex Konig před více než 3 roky(ů)

re #9036 Edits to be able to survive wrong inputs

Zobrazit rozdíly:

Server/ServerApp/Parser/Parsers/WeatherParser.cs
47 47
            if (weatherFiles == null || interval <= 0)
48 48
                return list;
49 49

  
50
            // get all files in folder
51
            foreach (string fileName in weatherFiles)
50
            string current = "";
51
            try
52 52
            {
53
                if (!File.Exists(fileName))
54
                    continue;
55

  
56
                // parse as one instance per day
57
                List<WeatherInfo> loadedData = null;
58
                if (wholeDay)
59
                    loadedData = ProcessOneWeatherFileAsDays(fileName, startTime, endTime);
60
                // parse according to interval
61
                else
53
                // get all files in folder
54
                foreach (string fileName in weatherFiles)
62 55
                {
63
                    loadedData = ProcessOneWeatherFileAsIntervals(fileName, interval, startTime, endTime);
64
                }
56
                    current = fileName;
65 57

  
66
                list.AddRange(loadedData);
58
                    if (!File.Exists(fileName))
59
                        continue;
60

  
61
                    // parse as one instance per day
62
                    List<WeatherInfo> loadedData = null;
63
                    if (wholeDay)
64
                        loadedData = ProcessOneWeatherFileAsDays(fileName, startTime, endTime);
65
                    // parse according to interval
66
                    else
67
                    {
68
                        loadedData = ProcessOneWeatherFileAsIntervals(fileName, interval, startTime, endTime);
69
                    }
70

  
71
                    list.AddRange(loadedData);
72
                }
73
            } catch
74
            {
75
                Console.WriteLine("Incorrect Weather input file " + current);
67 76
            }
68 77

  
69 78
            return list;

Také k dispozici: Unified diff