Browse Source

Merge branch 'master' of ssh://gogs.topcl.net:3022/coder/StrangeTools

# Conflicts:
#	StrangeTools.sln
HOME 3 months ago
parent
commit
62da41193c

+ 3 - 0
ConsoleIcon/app.config

@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

+ 10 - 0
CreateTimePrefixRen/CreateTimePrefixRen.csproj

@@ -0,0 +1,10 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net8.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+</Project>

+ 19 - 0
CreateTimePrefixRen/Program.cs

@@ -0,0 +1,19 @@
+// See https://aka.ms/new-console-template for more information
+Console.WriteLine("Hello, World!");
+Console.WriteLine();
+
+foreach (var arg in args)
+{
+    var fi = new FileInfo(arg);
+    var prefix = fi.CreationTime.ToString("yyMMddHHmm");
+    if(fi.Name.StartsWith(prefix)) continue;
+    var dir = Path.GetDirectoryName(fi.FullName);
+    var name = Path.GetFileName(fi.FullName);
+    var to = Path.Combine(dir,$"{prefix}-{name}");
+    Console.WriteLine($"{prefix} - {name} @ {dir}");
+    fi.MoveTo(to);
+}
+
+Console.WriteLine();
+Console.Write("Done. Press ENTER to exit...");
+Console.ReadLine();

+ 8 - 0
CreateTimePrefixRen/Properties/launchSettings.json

@@ -0,0 +1,8 @@
+{
+  "profiles": {
+    "CreateTimePrefixRen": {
+      "commandName": "Project",
+      "commandLineArgs": "Z:\\1.txt"
+    }
+  }
+}

+ 3 - 0
FileNameCharsetConvert/app.config

@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

+ 10 - 0
InstallerIsSuck/InstallerIsSuck.csproj

@@ -0,0 +1,10 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net7.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+</Project>

+ 61 - 0
InstallerIsSuck/Program.cs

@@ -0,0 +1,61 @@
+// See https://aka.ms/new-console-template for more information
+
+
+using System.Runtime.InteropServices;
+using System.Security.Cryptography;
+
+
+[DllImport("Kernel32.dll", CharSet = CharSet.Unicode)]
+static extern bool CreateHardLink(
+    string lpFileName,
+    string lpExistingFileName,
+    IntPtr lpSecurityAttributes
+);
+
+
+Console.WriteLine("Installer is suck");
+
+
+if (args.Length == 0)
+{
+    Console.WriteLine("Usage: <inDir> <outDir>");
+    return;
+}
+
+var files = Directory.GetFiles(args[0]);
+foreach (var file in files)
+{
+    try
+    {
+        Console.WriteLine($"> {file}");
+        var info = new FileInfo(file);
+        Console.WriteLine($" Len: {info.Length:N0}");
+        Console.Write(" SHA256...");
+        string hexHash;
+        {
+            using var inputStream = info.OpenRead();
+            using var sha256 = SHA256.Create();
+            var hash = sha256.ComputeHash(inputStream);
+            hexHash = Convert.ToHexString(hash);
+        }
+        Console.WriteLine($" {hexHash}");
+
+        var targetPath = Path.Combine(args[1], $"{info.Length:0-000-000-000}_{hexHash}{info.Extension}");
+        if (File.Exists(targetPath))
+        {
+            File.Delete(file);
+        }
+        else
+        {
+            File.Move(file, targetPath);
+        }
+
+        CreateHardLink(file, targetPath, nint.Zero);
+        Console.WriteLine($" Collapse to {targetPath} <");
+    }
+    catch (Exception e)
+    {
+        Console.WriteLine($"Error:{e.Message}");
+    }
+    Console.WriteLine();
+}

+ 8 - 0
InstallerIsSuck/Properties/launchSettings.json

@@ -0,0 +1,8 @@
+{
+  "profiles": {
+    "InstallerIsSuck": {
+      "commandName": "Project",
+      "commandLineArgs": "z:/iis-in z:/iis-out"
+    }
+  }
+}

+ 3 - 0
MojibakeCorrecting/app.config

@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

+ 6 - 0
StrangeTools.sln

@@ -44,6 +44,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConnectionStat-net7", "Conn
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SubtitleFontCollection", "SubtitleFontCollection\SubtitleFontCollection.csproj", "{4DF53F11-E296-4E40-83AB-B91B51750B81}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstallerIsSuck", "InstallerIsSuck\InstallerIsSuck.csproj", "{443F2A10-DF96-4EA6-9CD9-6C2E2C782D3B}"
+EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileCharsetConvert", "FileCharsetConvert\FileCharsetConvert.csproj", "{50E8583A-2B8B-44C0-A397-95A0BD1B0807}"
 EndProject
 Global
@@ -124,6 +126,10 @@ Global
 		{4DF53F11-E296-4E40-83AB-B91B51750B81}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{4DF53F11-E296-4E40-83AB-B91B51750B81}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{4DF53F11-E296-4E40-83AB-B91B51750B81}.Release|Any CPU.Build.0 = Release|Any CPU
+		{443F2A10-DF96-4EA6-9CD9-6C2E2C782D3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{443F2A10-DF96-4EA6-9CD9-6C2E2C782D3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{443F2A10-DF96-4EA6-9CD9-6C2E2C782D3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{443F2A10-DF96-4EA6-9CD9-6C2E2C782D3B}.Release|Any CPU.Build.0 = Release|Any CPU
 		{50E8583A-2B8B-44C0-A397-95A0BD1B0807}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{50E8583A-2B8B-44C0-A397-95A0BD1B0807}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{50E8583A-2B8B-44C0-A397-95A0BD1B0807}.Release|Any CPU.ActiveCfg = Release|Any CPU