-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
quantum
authored and
quantum
committed
Jun 4, 2024
1 parent
cb6d765
commit c469ecd
Showing
4 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.9.34902.65 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObfustatorBat", "ObfustatorBat\ObfustatorBat.csproj", "{43F4652C-6032-445E-A1F6-A4028BC9F848}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{43F4652C-6032-445E-A1F6-A4028BC9F848}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{43F4652C-6032-445E-A1F6-A4028BC9F848}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{43F4652C-6032-445E-A1F6-A4028BC9F848}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{43F4652C-6032-445E-A1F6-A4028BC9F848}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {031F9C46-7180-4CE6-892B-D677C1F2CEB3} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> | ||
<Costura /> | ||
</Weavers> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Colorful.Console" Version="1.2.15" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Console = Colorful.Console; | ||
|
||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
|
||
if (args.Length == 0) | ||
{ | ||
Console.WriteLine("Перетащите файл .bat на иконку этого приложения."); | ||
return; | ||
} | ||
|
||
string filePath = args[0]; | ||
if (File.Exists(filePath) && Path.GetExtension(filePath).ToLower() == ".bat") | ||
{ | ||
byte[] hexPrefix = { 0xFF, 0xFE, 0x26, 0x63, 0x6C, 0x73, 0x0D, 0x0A, 0xFF, 0xFE, 0x0A, 0x0D }; | ||
byte[] originalFileBytes = File.ReadAllBytes(filePath); | ||
byte[] newFileBytes = new byte[hexPrefix.Length + originalFileBytes.Length]; | ||
|
||
Array.Copy(hexPrefix, 0, newFileBytes, 0, hexPrefix.Length); | ||
Array.Copy(originalFileBytes, 0, newFileBytes, hexPrefix.Length, originalFileBytes.Length); | ||
|
||
string newFilePath = Path.Combine(Path.GetDirectoryName(filePath), "save.bat"); | ||
File.WriteAllBytes(newFilePath, newFileBytes); | ||
|
||
Console.WriteLine($"Файл успешно обновлен и сохранен как {newFilePath}"); | ||
} | ||
else | ||
{ | ||
Console.WriteLine("Неправильный файл. Пожалуйста, перетащите корректный файл .bat."); | ||
} | ||
} | ||
} |