Skip to content

Commit

Permalink
1.0.3.736 - fixed issues where program would crash on first run. v12.…
Browse files Browse the repository at this point in the history
…1 ready
  • Loading branch information
adamcongdon committed Sep 27, 2023
1 parent be152dc commit 9c57f8b
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 21 deletions.
80 changes: 64 additions & 16 deletions vHC/HC_Reporting/Functions/Reporting/Html/CHtmlExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,24 @@ public int ExportVb365Html(string htmlString)
}
public int ExportVbrHtml(string htmlString, bool scrub)
{
log.Info("exporting xml to html");
_latestReport = SetReportNameAndPath(scrub, "VBR");


WriteHtmlToFile(htmlString);
log.Info("exporting xml to html..done!");
try
{
log.Info("exporting xml to html");
_latestReport = SetReportNameAndPath(scrub, "VBR");
WriteHtmlToFile(htmlString);
log.Info("exporting xml to html..done!");

OpenHtmlIfEnabled(CGlobals.OpenHtml);
return 0;
OpenHtmlIfEnabled(CGlobals.OpenHtml);
return 0;
}
catch(Exception e)
{
log.Error("Failed at HTML Export:");
log.Error("\t" +e.Message); return 1;
}


}

Expand Down Expand Up @@ -121,21 +131,53 @@ private void WriteHtmlToFile(string htmlString)

private string SetReportNameAndPath(bool scrub, string vbrOrVb365)
{
DateTime dateTime = DateTime.Now;
string installID = TrySetInstallId(CLogOptions.INSTALLID);

string installID = null;
string htmlCore = "";
if (scrub)
htmlCore = _anonPath + "\\" + _htmlName + "_" + vbrOrVb365 + "_" + installID + dateTime.ToString("_yyyy.MM.dd.HHmmss") + ".html";
else if (!scrub)

try
{
htmlCore = _origPath + "\\" + _htmlName + "_" + vbrOrVb365 + "_" + _backupServerName + dateTime.ToString("_yyyy.MM.dd.HHmmss") + ".html";
//log.Warning("htmlcore = " + htmlCore, false);
DateTime dateTime = DateTime.Now;

if (scrub)
{
installID = TrySetInstallId(CLogOptions.INSTALLID);

htmlCore = _anonPath + "\\" + _htmlName + "_" + vbrOrVb365 + "_" + installID + dateTime.ToString("_yyyy.MM.dd.HHmmss") + ".html";

}
else if (!scrub)
{
htmlCore = _origPath + "\\" + _htmlName + "_" + vbrOrVb365 + "_" + _backupServerName + dateTime.ToString("_yyyy.MM.dd.HHmmss") + ".html";
//log.Warning("htmlcore = " + htmlCore, false);
}
return htmlCore;
}
catch(Exception ex)
{
//log.Debug("Failed to set report name & path");
//log.Debug(ex.Message);
//log.Debug("variables below:");
//log.Debug("\t" + scrub.ToString());
//log.Debug("\t" + vbrOrVb365);
//log.Debug("\t" + htmlCore);
//log.Debug("\t" + installID);
//log.Debug("\t" + _anonPath);
//log.Debug("\t" + _htmlName);
//log.Debug("\t" + _origPath);
//log.Debug("\t" + _backupServerName);
//log.Debug("\t" + _anonPath);
//log.Debug("\t" + _anonPath);
//log.Debug("\t" + );
return null;
}
return htmlCore;

}
private string TrySetInstallId(string id)
{
log.Debug("InstallID String = " + id);
try
{

if (!string.IsNullOrEmpty(id))
{
return id.Substring(0, 7);
Expand All @@ -144,7 +186,13 @@ private string TrySetInstallId(string id)
{
return "anon";
}

}
catch(Exception ex)
{
log.Error("Failed to get install ID.");
log.Error(ex.Message);
return "anon";
}
}
public void OpenExplorer()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ public void ParseIndividualSessions(bool scrub)
string outDir = "";// CVariables.desiredDir + "\\Original";
string folderName = "\\JobSessionReports";


if (cs.JobName.Contains("/"))
{
log.Debug("Caught invalid char: \"/\", replacing with \"-\": " + cs.JobName);
cs.JobName = cs.JobName.Replace("/", "-");
log.Debug("New Name = " + cs.JobName);
}

if (scrub)
{
outDir = CGlobals._desiredPath + CVariables._safeSuffix + folderName;
Expand Down
4 changes: 2 additions & 2 deletions vHC/HC_Reporting/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"profiles": {
"VeeamHealthCheck": {
"commandName": "Project",
"commandLineArgs": "/import /lite",
"remoteDebugEnabled": true,
"commandLineArgs": "/import",
"remoteDebugEnabled": false,
"authenticationMode": "Windows",
"remoteDebugMachine": "adam-laptop:4026"
}
Expand Down
4 changes: 2 additions & 2 deletions vHC/HC_Reporting/VeeamHealthCheck.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<Company>Veeam</Company>
<Authors>AdamC</Authors>
<ApplicationIcon>Veeam_HealthCheck_228x228.ico</ApplicationIcon>
<AssemblyVersion>1.0.3.726</AssemblyVersion>
<AssemblyVersion>1.0.3.736</AssemblyVersion>
<SignAssembly>False</SignAssembly>
<AssemblyOriginatorKeyFile>vhc_keyfile2.pfx</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<FileVersion>1.0.3.726</FileVersion>
<FileVersion>1.0.3.736</FileVersion>
<DebugType>full</DebugType>
<SelfContained>true</SelfContained>
<!--These 2 lines are what produce the single file utility. Possibly doesn't work...-->
Expand Down

0 comments on commit 9c57f8b

Please sign in to comment.