This commit is contained in:
Mike Phares 2025-02-28 16:11:48 -07:00
parent 3044da0413
commit e66eea0c83
14 changed files with 1343 additions and 1066 deletions

1
.vscode/format-report.json vendored Normal file
View File

@ -0,0 +1 @@
[]

19
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
},
{
"type": "node",
"request": "launch",
"name": "node Launch Current Opened File",
"program": "${file}"
}
]
}

31
.vscode/mklink.md vendored Normal file
View File

@ -0,0 +1,31 @@
---
type: "note"
created: "2023-10-20T03:53:13.742Z"
updated: "2023-10-20T04:00:37.259Z"
---
# mklink
```bash
mklink /J "L:\DevOps\Mesa_FI\File-Folder-Helper\.kanbn" "D:\5-Other-Small\Kanban\File-Folder-Helper"
```
```bash
mklink /J "L:\DevOps\Mesa_FI\File-Folder-Helper\.kanbn" "D:\5-Other-Small\Kanban\File-Folder-Helper"
```
```bash
del "L:\DevOps\Mesa_FI\File-Folder-Helper\.extensions-vscode"
del "L:\DevOps\Mesa_FI\File-Folder-Helper\.extensions-vscode-oss"
del "L:\DevOps\Mesa_FI\File-Folder-Helper\.extensions-vscode-insiders"
mkdir "C:\Users\phares\.vscode\extensions\ifx.type-script-helper-1.111.0\net8.0\win-x64\publish"
mkdir "C:\Users\phares\.vscode-oss\extensions\ifx.type-script-helper-1.111.0\net8.0\win-x64\publish"
mkdir "C:\Users\phares\.vscode-insiders\extensions\ifx.type-script-helper-1.111.0\net8.0\win-x64\publish"
mklink /J "L:\DevOps\Mesa_FI\File-Folder-Helper\.extensions-vscode" "C:\Users\phares\.vscode\extensions\ifx.type-script-helper-1.111.0"
mklink /J "L:\DevOps\Mesa_FI\File-Folder-Helper\.extensions-vscode-oss" "C:\Users\phares\.vscode-oss\extensions\ifx.type-script-helper-1.111.0"
mklink /J "L:\DevOps\Mesa_FI\File-Folder-Helper\.extensions-vscode-insiders" "C:\Users\phares\.vscode-insiders\extensions\ifx.type-script-helper-1.111.0"
```
```bash Thu Jul 18 2024 13:47:40 GMT-0700 (Mountain Standard Time)
mklink /J "L:\DevOps\Mesa_FI\File-Folder-Helper\.vscode\.UserSecrets" "C:\Users\phares\AppData\Roaming\Microsoft\UserSecrets\8da397d4-13ec-4576-9722-3c79cad25563"
```

20
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,20 @@
{
"[markdown]": {
"editor.wordWrap": "off"
},
"cSpell.words": [
"Amstrad",
"doesnt",
"dont",
"Doubleclick",
"Finalizers",
"harddrive",
"propval",
"propvals",
"refrences",
"SETTINGSROOT",
"subdirs",
"subfolders",
"treeview"
]
}

163
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,163 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "User Secrets Init",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Snap2HTML.sln",
"init"
],
"problemMatcher": "$msCompile"
},
{
"label": "User Secrets Set",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Snap2HTML.sln",
"set",
"_UserSecretsId",
"0c43f9aa-96e9-4298-967c-ed069d79e262"
],
"problemMatcher": "$msCompile"
},
{
"label": "Format",
"command": "dotnet",
"type": "process",
"args": [
"format",
"--report",
".vscode",
"--verbosity",
"detailed",
"--severity",
"warn"
],
"problemMatcher": "$msCompile"
},
{
"label": "Format-Whitespaces",
"command": "dotnet",
"type": "process",
"args": [
"format",
"whitespace"
],
"problemMatcher": "$msCompile"
},
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"-r",
"win-x64",
"${workspaceFolder}/Snap2HTML.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "build Linux",
"command": "dotnet",
"type": "process",
"args": [
"build",
"-r",
"linux-x64",
"${workspaceFolder}/Snap2HTML.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/Snap2HTML.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/Snap2HTML.sln"
],
"problemMatcher": "$msCompile"
},
{
"label": "Publish AOT",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"-r",
"win-x64",
"-c",
"Release",
"-p:PublishAot=true",
"${workspaceFolder}/Snap2HTML.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "Publish AOT Linux",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"-r",
"linux-x64",
"-c",
"Release",
"-p:PublishAot=true",
"${workspaceFolder}/Snap2HTML.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "MSBuild for EAF Deployment Packages",
"command": "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe",
"type": "process",
"args": [
"/target:Build",
"/restore:True",
"/p:RestoreSources=https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/%3Bhttps://tfs.intra.infineon.com/tfs/FactoryIntegration/_packaging/EAF/nuget/v3/index.json%3Bhttps://tfs.intra.infineon.com/tfs/FactoryIntegration/_packaging/EAF%40Local/nuget/v3/index.json%3Bhttps://api.nuget.org/v3/index.json",
"/detailedsummary",
"/consoleloggerparameters:PerformanceSummary;ErrorsOnly;",
"/property:Configuration=Debug;TargetFrameworkVersion=v4.8",
"Snap2HTML.sln"
],
"problemMatcher": "$msCompile"
},
{
"label": "Jest",
"type": "shell",
"command": "npx jest",
"problemMatcher": []
}
]
}

View File

@ -4,30 +4,36 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Collections.Specialized;
using System.Configuration; using System.Configuration;
using System.Configuration.Provider; using System.Configuration.Provider;
using System.Windows.Forms;
using System.Collections.Specialized;
using Microsoft.Win32;
using System.Xml;
using System.IO; using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using Microsoft.Win32;
public class PortableSettingsProvider : SettingsProvider { public class PortableSettingsProvider : SettingsProvider
{
const string SETTINGSROOT = "Settings"; const string SETTINGSROOT = "Settings";
//XML Root Node //XML Root Node
public override void Initialize(string name, NameValueCollection col) { public override void Initialize(string name, NameValueCollection col)
{
base.Initialize(this.ApplicationName, col); base.Initialize(this.ApplicationName, col);
} }
public override string ApplicationName { public override string ApplicationName
get { {
if (Application.ProductName.Trim().Length > 0) { get
{
if (Application.ProductName.Trim().Length > 0)
{
return Application.ProductName; return Application.ProductName;
} }
else { else
{
FileInfo fi = new FileInfo(Application.ExecutablePath); FileInfo fi = new FileInfo(Application.ExecutablePath);
return fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length); return fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length);
} }
@ -36,41 +42,50 @@ public class PortableSettingsProvider : SettingsProvider {
//Do nothing //Do nothing
} }
public override string Name { public override string Name
{
get { return "PortableSettingsProvider"; } get { return "PortableSettingsProvider"; }
} }
public virtual string GetAppSettingsPath() { public virtual string GetAppSettingsPath()
{
//Used to determine where to store the settings //Used to determine where to store the settings
System.IO.FileInfo fi = new System.IO.FileInfo(Application.ExecutablePath); System.IO.FileInfo fi = new System.IO.FileInfo(Application.ExecutablePath);
return fi.DirectoryName; return fi.DirectoryName;
} }
public virtual string GetAppSettingsFilename() { public virtual string GetAppSettingsFilename()
{
//Used to determine the filename to store the settings //Used to determine the filename to store the settings
return ApplicationName + ".settings"; return ApplicationName + ".settings";
} }
public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection propvals) { public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection propvals)
{
//Iterate through the settings to be stored //Iterate through the settings to be stored
//Only dirty settings are included in propvals, and only ones relevant to this provider //Only dirty settings are included in propvals, and only ones relevant to this provider
foreach (SettingsPropertyValue propval in propvals) { foreach (SettingsPropertyValue propval in propvals)
{
SetValue(propval); SetValue(propval);
} }
try { try
{
SettingsXML.Save(Path.Combine(GetAppSettingsPath(), GetAppSettingsFilename())); SettingsXML.Save(Path.Combine(GetAppSettingsPath(), GetAppSettingsFilename()));
} }
catch (Exception ex) { catch (Exception)
{
} }
//Ignore if cant save, device been ejected //Ignore if cant save, device been ejected
} }
public override SettingsPropertyValueCollection GetPropertyValues(SettingsContext context, SettingsPropertyCollection props) { public override SettingsPropertyValueCollection GetPropertyValues(SettingsContext context, SettingsPropertyCollection props)
{
//Create new collection of values //Create new collection of values
SettingsPropertyValueCollection values = new SettingsPropertyValueCollection(); SettingsPropertyValueCollection values = new SettingsPropertyValueCollection();
//Iterate through the settings to be retrieved //Iterate through the settings to be retrieved
foreach (SettingsProperty setting in props) { foreach (SettingsProperty setting in props)
{
SettingsPropertyValue value = new SettingsPropertyValue(setting); SettingsPropertyValue value = new SettingsPropertyValue(setting);
value.IsDirty = false; value.IsDirty = false;
@ -82,17 +97,22 @@ public class PortableSettingsProvider : SettingsProvider {
private XmlDocument _settingsXML = null; private XmlDocument _settingsXML = null;
private XmlDocument SettingsXML { private XmlDocument SettingsXML
get { {
get
{
//If we dont hold an xml document, try opening one. //If we dont hold an xml document, try opening one.
//If it doesnt exist then create a new one ready. //If it doesnt exist then create a new one ready.
if (_settingsXML == null) { if (_settingsXML == null)
{
_settingsXML = new XmlDocument(); _settingsXML = new XmlDocument();
try { try
{
_settingsXML.Load(Path.Combine(GetAppSettingsPath(), GetAppSettingsFilename())); _settingsXML.Load(Path.Combine(GetAppSettingsPath(), GetAppSettingsFilename()));
} }
catch (Exception ex) { catch (Exception)
{
//Create new document //Create new document
XmlDeclaration dec = _settingsXML.CreateXmlDeclaration("1.0", "utf-8", string.Empty); XmlDeclaration dec = _settingsXML.CreateXmlDeclaration("1.0", "utf-8", string.Empty);
_settingsXML.AppendChild(dec); _settingsXML.AppendChild(dec);
@ -108,23 +128,30 @@ public class PortableSettingsProvider : SettingsProvider {
} }
} }
private string GetValue(SettingsProperty setting) { private string GetValue(SettingsProperty setting)
{
string ret = ""; string ret = "";
try { try
if (IsRoaming(setting)) { {
if (IsRoaming(setting))
{
ret = SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + setting.Name).InnerText; ret = SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + setting.Name).InnerText;
} }
else { else
{
ret = SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + Environment.MachineName + "/" + setting.Name).InnerText; ret = SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + Environment.MachineName + "/" + setting.Name).InnerText;
} }
} }
catch (Exception ex) { catch (Exception)
if ((setting.DefaultValue != null)) { {
if ((setting.DefaultValue != null))
{
ret = setting.DefaultValue.ToString(); ret = setting.DefaultValue.ToString();
} }
else { else
{
ret = ""; ret = "";
} }
} }
@ -132,7 +159,8 @@ public class PortableSettingsProvider : SettingsProvider {
return ret; return ret;
} }
private void SetValue(SettingsPropertyValue propVal) { private void SetValue(SettingsPropertyValue propVal)
{
XmlElement MachineNode = default(XmlElement); XmlElement MachineNode = default(XmlElement);
XmlElement SettingNode = default(XmlElement); XmlElement SettingNode = default(XmlElement);
@ -140,42 +168,53 @@ public class PortableSettingsProvider : SettingsProvider {
//Determine if the setting is roaming. //Determine if the setting is roaming.
//If roaming then the value is stored as an element under the root //If roaming then the value is stored as an element under the root
//Otherwise it is stored under a machine name node //Otherwise it is stored under a machine name node
try { try
if (IsRoaming(propVal.Property)) { {
if (IsRoaming(propVal.Property))
{
SettingNode = (XmlElement)SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + propVal.Name); SettingNode = (XmlElement)SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + propVal.Name);
} }
else { else
{
SettingNode = (XmlElement)SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + Environment.MachineName + "/" + propVal.Name); SettingNode = (XmlElement)SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + Environment.MachineName + "/" + propVal.Name);
} }
} }
catch (Exception ex) { catch (Exception)
{
SettingNode = null; SettingNode = null;
} }
//Check to see if the node exists, if so then set its new value //Check to see if the node exists, if so then set its new value
if ((SettingNode != null)) { if ((SettingNode != null))
{
SettingNode.InnerText = propVal.SerializedValue.ToString(); SettingNode.InnerText = propVal.SerializedValue.ToString();
} }
else { else
if (IsRoaming(propVal.Property)) { {
if (IsRoaming(propVal.Property))
{
//Store the value as an element of the Settings Root Node //Store the value as an element of the Settings Root Node
SettingNode = SettingsXML.CreateElement(propVal.Name); SettingNode = SettingsXML.CreateElement(propVal.Name);
SettingNode.InnerText = propVal.SerializedValue.ToString(); SettingNode.InnerText = propVal.SerializedValue.ToString();
SettingsXML.SelectSingleNode(SETTINGSROOT).AppendChild(SettingNode); SettingsXML.SelectSingleNode(SETTINGSROOT).AppendChild(SettingNode);
} }
else { else
{
//Its machine specific, store as an element of the machine name node, //Its machine specific, store as an element of the machine name node,
//creating a new machine name node if one doesnt exist. //creating a new machine name node if one doesnt exist.
try { try
{
MachineNode = (XmlElement)SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + Environment.MachineName); MachineNode = (XmlElement)SettingsXML.SelectSingleNode(SETTINGSROOT + "/" + Environment.MachineName);
} }
catch (Exception ex) { catch (Exception)
{
MachineNode = SettingsXML.CreateElement(Environment.MachineName); MachineNode = SettingsXML.CreateElement(Environment.MachineName);
SettingsXML.SelectSingleNode(SETTINGSROOT).AppendChild(MachineNode); SettingsXML.SelectSingleNode(SETTINGSROOT).AppendChild(MachineNode);
} }
if (MachineNode == null) { if (MachineNode == null)
{
MachineNode = SettingsXML.CreateElement(Environment.MachineName); MachineNode = SettingsXML.CreateElement(Environment.MachineName);
SettingsXML.SelectSingleNode(SETTINGSROOT).AppendChild(MachineNode); SettingsXML.SelectSingleNode(SETTINGSROOT).AppendChild(MachineNode);
} }
@ -187,11 +226,14 @@ public class PortableSettingsProvider : SettingsProvider {
} }
} }
private bool IsRoaming(SettingsProperty prop) { private bool IsRoaming(SettingsProperty prop)
{
//Determine if the setting is marked as Roaming //Determine if the setting is marked as Roaming
foreach (DictionaryEntry d in prop.Attributes) { foreach (DictionaryEntry d in prop.Attributes)
{
Attribute a = (Attribute)d.Value; Attribute a = (Attribute)d.Value;
if (a is System.Configuration.SettingsManageabilityAttribute) { if (a is System.Configuration.SettingsManageabilityAttribute)
{
return true; return true;
} }
} }

View File

@ -233,7 +233,7 @@
Fixed a threading issue that caused the program to hang on some systems Fixed a threading issue that caused the program to hang on some systems
v2.12 (2020-04-29) v2.12 (2020-04-29)
Reduced memory consumsion when generating HTML Reduced memory consumption when generating HTML
Parent folder link [..] is now sticky Parent folder link [..] is now sticky
Reworked command line code to fix issues in 2.11 Reworked command line code to fix issues in 2.11
A few small tweaks too A few small tweaks too

View File

@ -1,4 +1,5 @@
namespace Snap2HTML.Properties { namespace Snap2HTML.Properties
{
// This class allows you to handle specific events on the settings class: // This class allows you to handle specific events on the settings class:
// The SettingChanging event is raised before a setting's value is changed. // The SettingChanging event is raised before a setting's value is changed.
// The PropertyChanged event is raised after a setting's value is changed. // The PropertyChanged event is raised after a setting's value is changed.

View File

@ -2,12 +2,12 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using CommandLine.Utility; using CommandLine.Utility;
using System.IO;
using System.Diagnostics;
namespace Snap2HTML namespace Snap2HTML
{ {
@ -377,7 +377,7 @@ namespace Snap2HTML
// for each folder, add its index to its parent folder list of subdirs // for each folder, add its index to its parent folder list of subdirs
subdirs[dir.Path].Add(dirIndexes[dir.GetFullPath()]); subdirs[dir.Path].Add(dirIndexes[dir.GetFullPath()]);
} }
catch( Exception ex ) catch (Exception)
{ {
// orphan file or folder? // orphan file or folder?
} }
@ -411,7 +411,7 @@ namespace Snap2HTML
result.Append("])"); result.Append("])");
result.Append("\n"); result.Append("\n");
// Write result in chunks to limit memory consumtion // Write result in chunks to limit memory consumption
if (result.Length > 10240) if (result.Length > 10240)
{ {
writer.Write(result.ToString()); writer.Write(result.ToString());