Skip to content

Commit

Permalink
Merge pull request #13 from mcrossley/master
Browse files Browse the repository at this point in the history
v1.4.0
  • Loading branch information
mcrossley authored Nov 6, 2023
2 parents 7f9f1f9 + ddfe4eb commit 0b3e2d7
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
8 changes: 4 additions & 4 deletions CreateMissing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<AssemblyVersion>1.3.1.3</AssemblyVersion>
<FileVersion>1.3.1.3</FileVersion>
<AssemblyVersion>1.4.0.4</AssemblyVersion>
<FileVersion>1.4.0.4</FileVersion>
<Version></Version>
<StartupObject>CreateMissing.Program</StartupObject>
<TargetFramework>net48</TargetFramework>
<Authors>Mark Crossley</Authors>
<Company>Cumulus MX</Company>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>

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

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<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;)" />
<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;)" />
</Target>

</Project>
25 changes: 23 additions & 2 deletions Cumulus.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using CumulusMX;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;

namespace CreateMissing
{
class Cumulus
{
public string RecordsBeganDate;
public int RolloverHour;
public bool Use10amInSummer;

Expand All @@ -30,6 +30,8 @@ class Cumulus

public double CalibRainMult;

public DateTime RecordsBeganDateTime;

private readonly StationOptions StationOptions = new StationOptions();
internal StationUnits Units = new StationUnits();
private readonly int[] WindDPlaceDefaults = { 1, 0, 0, 0 }; // m/s, mph, km/h, knots
Expand Down Expand Up @@ -72,7 +74,26 @@ private void ReadIniFile()

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

RecordsBeganDate = ini.GetValue("Station", "StartDate", DateTime.Now.ToLongDateString());
if (ini.ValueExists("Station", "StartDate"))
{
var RecordsBeganDate = ini.GetValue("Station", "StartDate", DateTime.Now.ToLongDateString());
try
{
RecordsBeganDateTime = DateTime.Parse(RecordsBeganDate);
}
catch (Exception ex)
{
Program.LogMessage($"Error parsing the RecordsBegan date {RecordsBeganDate}: {ex.Message}");
}
}
else
{
var RecordsBeganDate = ini.GetValue("Station", "StartDateIso", DateTime.Now.ToString("yyyy-MM-dd"));
RecordsBeganDateTime = DateTime.ParseExact(RecordsBeganDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);
}

Program.LogMessage($"Cumulus start date Parsed: {RecordsBeganDateTime:yyyy-MM-dd}");



if ((StationType == 0) || (StationType == 1))
Expand Down
2 changes: 1 addition & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static void Main()
dayfile = new DayFile();

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

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ The entry in Cumulus.ini can be found in the [Station] section of the file...

```` ini
[Station]
StartDate=13 Jan 2010
StartDateIso=YYYY-MM-DD
````

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

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.

Expand Down
5 changes: 5 additions & 0 deletions Updates.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
1.4.0
—————
- Change to AnyCPU - will now run as 64 bit process on 64 bit OS
- Now uses StartDateIso from Cumulus.ini

1.3.1
—————
- Now skips (with a warning in the diags log) blank lines in the monthly log files
Expand Down

0 comments on commit 0b3e2d7

Please sign in to comment.