Skip to content

Commit

Permalink
Merge pull request #22 from Ordisoftware/dev
Browse files Browse the repository at this point in the history
Improve CSV export
  • Loading branch information
Ordisoftware authored Jan 16, 2019
2 parents 822e729 + 8a1d51a commit 1cf5ecb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
22 changes: 13 additions & 9 deletions Project/Source/Forms/MainForm.ExportCSV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ namespace Ordisoftware.HebrewCalendar
public partial class MainForm
{

private enum CSVFieldType { Date, Month, Day, Sunrise, Sunset, Moonrise, Moonset, Events }
private enum CSVFieldType { Date, IsNewMoon, IsFullMoon, Month, Day, Sunrise, Sunset, Moonrise, Moonset, Events }

private const string CSVSeparator = ",";

private void ExportCSV()
{
Expand All @@ -53,7 +55,7 @@ private void DoExportCSV()
{
string headerTxt = "";
foreach ( CSVFieldType v in Enum.GetValues(typeof(CSVFieldType)) )
headerTxt += v.ToString() + ",";
headerTxt += v.ToString() + CSVSeparator;
headerTxt = headerTxt.Remove(headerTxt.Length - 1);
var content = new StringBuilder();
content.AppendLine(headerTxt);
Expand All @@ -67,13 +69,15 @@ private void DoExportCSV()
if ( !UpdateProgress(progress++, count, LocalizerHelper.ProgressGenerateResultText.GetLang()) ) return;
if ( TrimBeforeNewLunarYear && day.LunarMonth == 0 ) continue;
if ( TrimBeforeNewLunarYear && dayDate.Year == lastyear && day.LunarMonth == 1 ) break;
content.Append(day.Date + ',');
content.Append(day.LunarMonth.ToString() + ',');
content.Append(day.LunarDay.ToString() + ',');
content.Append(day.Sunrise + ',');
content.Append(day.Sunset + ',');
content.Append(day.Moonrise + ',');
content.Append(day.Moonset + ',');
content.Append(day.Date + CSVSeparator);
content.Append(day.IsNewMoon + CSVSeparator);
content.Append(day.IsFullMoon + CSVSeparator);
content.Append(day.LunarMonth + CSVSeparator);
content.Append(day.LunarDay + CSVSeparator);
content.Append(day.Sunrise + CSVSeparator);
content.Append(day.Sunset + CSVSeparator);
content.Append(day.Moonrise + CSVSeparator);
content.Append(day.Moonset + CSVSeparator);
string strDesc = "";
string s1 = TorahCelebrations.SeasonEventNames.GetLang((SeasonChangeType)day.SeasonChange);
string s2 = TorahCelebrations.TorahEventNames.GetLang((TorahEventType)day.TorahEvents);
Expand Down
15 changes: 8 additions & 7 deletions Project/Source/Forms/PreferencesForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Project/Source/Forms/PreferencesForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -606,9 +606,6 @@
AAD8HwAA//8AAA==
</value>
</data>
<data name="$this.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="$this.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>10, 10, 10, 10</value>
</data>
Expand Down

0 comments on commit 1cf5ecb

Please sign in to comment.