Skip to content

Commit 0b3e2d7

Browse files
authored
Merge pull request #13 from mcrossley/master
v1.4.0
2 parents 7f9f1f9 + ddfe4eb commit 0b3e2d7

File tree

5 files changed

+35
-9
lines changed

5 files changed

+35
-9
lines changed

CreateMissing.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
6-
<AssemblyVersion>1.3.1.3</AssemblyVersion>
7-
<FileVersion>1.3.1.3</FileVersion>
5+
<AssemblyVersion>1.4.0.4</AssemblyVersion>
6+
<FileVersion>1.4.0.4</FileVersion>
87
<Version></Version>
98
<StartupObject>CreateMissing.Program</StartupObject>
109
<TargetFramework>net48</TargetFramework>
1110
<Authors>Mark Crossley</Authors>
1211
<Company>Cumulus MX</Company>
12+
<PlatformTarget>AnyCPU</PlatformTarget>
1313
</PropertyGroup>
1414

1515
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
1616
<DefineConstants>DEBUG;TRACE</DefineConstants>
1717
</PropertyGroup>
1818

1919
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
20-
<Exec Command="if $(ConfigurationName)==Release (&#xD;&#xA;echo.&#xD;&#xA;echo Update Distribution folder&#xD;&#xA;echo copy MX exe&#xD;&#xA;xcopy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)..\CumulusMX-Dist\CumulusMX&quot; /D /-I /Q /Y&#xD;&#xA;echo copy MX config&#xD;&#xA;xcopy &quot;$(TargetPath).config&quot; &quot;$(SolutionDir)..\CumulusMX-Dist\CumulusMX&quot; /D /-I /Q /Y&#xD;&#xA;)" />
20+
<Exec Command="if $(ConfigurationName)==Release (&#xD;&#xA;echo.&#xD;&#xA;echo Update Distribution folder&#xD;&#xA;echo copy .exe&#xD;&#xA;xcopy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)..\CumulusMX-Dist\CumulusMX&quot; /D /-I /Q /Y&#xD;&#xA;echo copy .config&#xD;&#xA;xcopy &quot;$(TargetPath).config&quot; &quot;$(SolutionDir)..\CumulusMX-Dist\CumulusMX&quot; /D /-I /Q /Y&#xD;&#xA;)" />
2121
</Target>
2222

2323
</Project>

Cumulus.cs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
using CumulusMX;
22
using System;
33
using System.Collections.Generic;
4+
using System.Globalization;
45
using System.Text;
56

67
namespace CreateMissing
78
{
89
class Cumulus
910
{
10-
public string RecordsBeganDate;
1111
public int RolloverHour;
1212
public bool Use10amInSummer;
1313

@@ -30,6 +30,8 @@ class Cumulus
3030

3131
public double CalibRainMult;
3232

33+
public DateTime RecordsBeganDateTime;
34+
3335
private readonly StationOptions StationOptions = new StationOptions();
3436
internal StationUnits Units = new StationUnits();
3537
private readonly int[] WindDPlaceDefaults = { 1, 0, 0, 0 }; // m/s, mph, km/h, knots
@@ -72,7 +74,26 @@ private void ReadIniFile()
7274

7375
var IncrementPressureDP = ini.GetValue("Station", "DavisIncrementPressureDP", false);
7476

75-
RecordsBeganDate = ini.GetValue("Station", "StartDate", DateTime.Now.ToLongDateString());
77+
if (ini.ValueExists("Station", "StartDate"))
78+
{
79+
var RecordsBeganDate = ini.GetValue("Station", "StartDate", DateTime.Now.ToLongDateString());
80+
try
81+
{
82+
RecordsBeganDateTime = DateTime.Parse(RecordsBeganDate);
83+
}
84+
catch (Exception ex)
85+
{
86+
Program.LogMessage($"Error parsing the RecordsBegan date {RecordsBeganDate}: {ex.Message}");
87+
}
88+
}
89+
else
90+
{
91+
var RecordsBeganDate = ini.GetValue("Station", "StartDateIso", DateTime.Now.ToString("yyyy-MM-dd"));
92+
RecordsBeganDateTime = DateTime.ParseExact(RecordsBeganDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);
93+
}
94+
95+
Program.LogMessage($"Cumulus start date Parsed: {RecordsBeganDateTime:yyyy-MM-dd}");
96+
7697

7798

7899
if ((StationType == 0) || (StationType == 1))

Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static void Main()
5858
dayfile = new DayFile();
5959

6060
// for each day since records began date
61-
var currDate = DateTime.Parse(cumulus.RecordsBeganDate);
61+
var currDate = cumulus.RecordsBeganDateTime;
6262
var dayfileStart = dayfile.DayfileRecs.Count > 0 ? dayfile.DayfileRecs[0].Date : DateTime.MaxValue;
6363
var endDate = SetStartTime(DateTime.Now.AddDays(-1).Date);
6464

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ The entry in Cumulus.ini can be found in the [Station] section of the file...
2929

3030
```` ini
3131
[Station]
32-
StartDate=13 Jan 2010
32+
StartDateIso=YYYY-MM-DD
3333
````
3434

35-
The format of the date will depend on your locale, if you edit this entry **you must retain the same format**.
35+
**you must retain the same format**.
3636

3737
However, if CreateMissing finds that the first date in your existing dayfile.txt is earlier than the Records Began Date, it will use that date instead.
3838

Updates.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
1.4.0
2+
—————
3+
- Change to AnyCPU - will now run as 64 bit process on 64 bit OS
4+
- Now uses StartDateIso from Cumulus.ini
5+
16
1.3.1
27
—————
38
- Now skips (with a warning in the diags log) blank lines in the monthly log files

0 commit comments

Comments
 (0)