nuget bump

2023-11-02
2023-11-08
net8.0
editorconfig
NuGet NuSpec
Kanban
This commit is contained in:
2023-11-14 07:54:34 -07:00
parent 948937d8a5
commit 5fe51ef645
27 changed files with 429 additions and 170 deletions

125
Day/Helper-2023-10-24.cs Normal file
View File

@ -0,0 +1,125 @@
using Microsoft.Extensions.Logging;
using System.Diagnostics;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace File_Folder_Helper.Day;
internal record Drive(string Share,
bool Use,
string User);
internal static class Helper20231024
{
internal static void NetUse(ILogger<Worker> logger, string argsZero)
{
Process? process;
string arguments;
string[] segments;
string standardError;
string standardOutput;
string fileName = "net";
StringBuilder stringBuilder = new();
string json = File.ReadAllText(Path.Combine(argsZero, ".json"));
string decrypted = File.ReadAllText(Path.Combine(argsZero, ".password"));
List<Drive> drives = JsonSerializer.Deserialize(json, DrivesSourceGenerationContext.Default.ListDrive) ?? throw new NullReferenceException();
foreach (Drive drive in drives)
{
if (!drive.Use)
continue;
arguments = $"use * \"{drive.Share}\" /p:yes /user:{drive.User} {decrypted}";
_ = stringBuilder.Clear();
segments = arguments.Split(' ');
for (int j = 0; j < segments.Length - 1; j++)
_ = stringBuilder.Append(segments[j]).Append(' ');
logger.LogInformation("// {stringBuilder}", stringBuilder);
ProcessStartInfo processStartInfo = new(fileName, arguments)
{
RedirectStandardError = true,
RedirectStandardOutput = true,
UseShellExecute = false
};
try
{
process = Process.Start(processStartInfo);
if (process is null)
continue;
for (int j = 1; j < 45; j++)
{
_ = process.WaitForExit(1000);
if (process.HasExited)
break;
}
if (!process.HasExited)
logger.LogError("// Never exited!");
else
{
standardError = process.StandardError.ReadToEnd();
standardOutput = process.StandardOutput.ReadToEnd();
logger.LogInformation("// {standardError}{Environment.NewLine}{Environment.NewLine}// {standardOutput}", standardError, Environment.NewLine, Environment.NewLine, standardOutput);
try
{
_ = Directory.CreateDirectory($"{drive.Share}\\Tmp\\Phares");
string reg = """
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\SPCEPIWORLD]
"Driver"="C:\\WINDOWS\\system32\\SQLSRV32.dll"
"Description"="InfinityQS SPC (Si)"
"Server"="messqlec1.infineon.com\\PROD1,53959"
"Database"="SPCEPIWORLD"
"LastUser"=""
"Trusted_Connection"="Yes"
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\ODBC Data Sources]
"SPCEPIWORLD"="SQL Server"
""";
string bat = """
@ECHO OFF
NET USE G: /delete
NET USE H: /delete
NET USE M: /delete
NET USE P: /delete
NET USE R: /delete
NET USE T: /delete
NET USE V: /delete
NET USE Y: /delete
NET USE G: \\mesfs.infineon.com\EC_Engineering /PERSISTENT:YES
NET USE H: \\mesfs.infineon.com\EC_TempHumidity_Controls /PERSISTENT:YES
NET USE M: \\mesfs.infineon.com\EC_Maintenance /PERSISTENT:YES
NET USE P: \\mesfs.infineon.com\EC_Production /PERSISTENT:YES
NET USE R: \\mesfs.infineon.com\EC_Customer_Service /PERSISTENT:YES
NET USE T: \\mesfs.infineon.com\EC_Materials /PERSISTENT:YES
NET USE V: \\mesfs.infineon.com\EC_Engineering /PERSISTENT:YES
NET USE Y: \\mesfs.infineon.com\EC_EpiReactorRecipes /PERSISTENT:YES
""";
File.WriteAllText($"{drive.Share}\\Tmp\\Phares\\SPCEPIWORLD_hklm.reg", reg);
File.WriteAllText($"{drive.Share}\\Tmp\\Phares\\MESA-Users-Drives.bat", bat);
File.WriteAllText($"{drive.Share}\\Tmp\\Phares\\lnk.txt", """"\\messa04ec.infineon.com\EC_SPC_Si\SPC\Projects\Active\ir epi services database.ipj"""");
}
catch (Exception)
{ }
}
}
catch (Exception ex)
{
logger.LogError(ex, "Error:");
}
}
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(Drive))]
internal partial class DriveSourceGenerationContext : JsonSerializerContext
{
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(List<Drive>))]
internal partial class DrivesSourceGenerationContext : JsonSerializerContext
{
}

35
Day/Helper-2023-11-02.cs Normal file
View File

@ -0,0 +1,35 @@
using Microsoft.Extensions.Logging;
namespace File_Folder_Helper.Day;
internal static class Helper20231102
{
internal static void NuSpec(ILogger<Worker> logger, string argsZero)
{
string[] lines;
string? idLine;
string? versionLine;
string[] files = Directory.GetFiles(argsZero);
logger.LogInformation("{fileCount}", files.Length.ToString());
foreach (string file in files)
{
idLine = null;
versionLine = null;
lines = File.ReadAllLines(file);
foreach (string line in lines)
{
if (!line.EndsWith("</id>") && !line.EndsWith("</version>"))
continue;
if (line.EndsWith("</id>"))
idLine = line.TrimEnd();
if (line.EndsWith("</version>"))
versionLine = line.TrimEnd();
if (idLine is not null && versionLine is not null)
break;
}
File.AppendAllText(".txt", $"{idLine}{versionLine}{Environment.NewLine}");
}
}
}

37
Day/Helper-2023-11-08.cs Normal file
View File

@ -0,0 +1,37 @@
using Microsoft.Extensions.Logging;
namespace File_Folder_Helper.Day;
internal static class Helper20231108
{
internal static void MasterImage(ILogger<Worker> logger, List<string> args)
{
string fileName;
string checkFile;
string[] aSegments;
string[] bSegments;
if (!Directory.Exists(args[0]))
throw new Exception(args[0]);
if (!Directory.Exists(args[2]))
throw new Exception(args[2]);
string directoryName = Path.GetFileName(args[0]) ?? throw new Exception();
string[] files = Directory.GetFiles(args[0]);
logger.LogInformation("{fileCount}", files.Length.ToString());
foreach (string file in files)
{
aSegments = Path.GetFileNameWithoutExtension(file).Split('-');
if (aSegments.Length != 2)
continue;
bSegments = aSegments[1].Split('_');
if (bSegments.Length != 3)
continue;
fileName = $"{directoryName}-{bSegments[1]}-{bSegments[0]}{Path.GetExtension(file)}";
checkFile = Path.Combine(args[2], fileName);
if (File.Exists(checkFile))
continue;
File.Copy(file, checkFile);
}
}
}

View File

@ -14,6 +14,12 @@ internal static class HelperDay
Day.Helper20231010.HgCV(logger, args[0]);
else if (args[1] == "Day-Helper-2023-10-16")
Day.Helper20231016.MoveDirectory(logger, args[0]);
else if (args[1] == "Day-Helper-2023-10-24")
Day.Helper20231024.NetUse(logger, args[0]);
else if (args[1] == "Day-Helper-2023-11-02")
Day.Helper20231102.NuSpec(logger, args[0]);
else if (args[1] == "Day-Helper-2023-11-08")
Day.Helper20231108.MasterImage(logger, args);
else
throw new Exception(appSettings.Company);
}