Skip to content

Commit

Permalink
Merge pull request #86 from cyberman1/patch-1
Browse files Browse the repository at this point in the history
Update BatchCsvOut.cs
  • Loading branch information
EricZimmerman authored Jan 15, 2025
2 parents 92ca9c1 + 7f79d1a commit 103c406
Showing 1 changed file with 41 additions and 20 deletions.
61 changes: 41 additions & 20 deletions RECmd/BatchCsvOut.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,48 @@
using System;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;

namespace RECmd;

public class BatchCsvOut
namespace RECmd
{
public string HivePath { get; set; }
public string HiveType { get; set; }
public string Description { get; set; }
public string Category { get; set; }
public string KeyPath { get; set; }
public string ValueName { get; set; }
public class BatchCsvOut
{
public string HivePath { get; set; }
public string HiveType { get; set; }
public string Description { get; set; }
public string Category { get; set; }
public string KeyPath { get; set; }
public string ValueName { get; set; }

public string ValueType { get; set; }
public string ValueData { get; set; }
public string ValueData2 { get; set; }
public string ValueData3 { get; set; }

public string ValueType { get; set; }
public string ValueData { get; set; }
public string ValueData2 { get; set; }
public string ValueData3 { get; set; }
public string Comment { get; set; }
public bool Recursive { get; set; }
public bool Deleted { get; set; }

public string Comment { get; set; }
public bool Recursive { get; set; }
public bool Deleted { get; set; }
public DateTimeOffset? LastWriteTimestamp { get; set; }

public string PluginDetailFile { get; set; }

public DateTimeOffset? LastWriteTimestamp { get; set; }
// Method to write the CSV
public static void WriteCsv(string filePath, List<BatchCsvOut> data)
{
string dateTimeFormat = "yyyy-MM-dd HH:mm:ss.fffffff";
using (StreamWriter writer = new StreamWriter(filePath))
{
// Write CSV header
writer.WriteLine("HivePath,HiveType,Description,Category,KeyPath,ValueName,ValueType,ValueData,ValueData2,ValueData3,Comment,Recursive,Deleted,LastWriteTimestamp,PluginDetailFile");

public string PluginDetailFile { get; set; }
}
// Write CSV rows
foreach (var item in data)
{
string formattedTimestamp = item.LastWriteTimestamp?.ToString(dateTimeFormat, CultureInfo.InvariantCulture) ?? string.Empty;
writer.WriteLine($"{item.HivePath},{item.HiveType},{item.Description},{item.Category},{item.KeyPath},{item.ValueName},{item.ValueType},{item.ValueData},{item.ValueData2},{item.ValueData3},{item.Comment},{item.Recursive},{item.Deleted},{formattedTimestamp},{item.PluginDetailFile}");
}
}
}
}
}

0 comments on commit 103c406

Please sign in to comment.