Skip to content

Commit

Permalink
Добавьте файлы проекта.
Browse files Browse the repository at this point in the history
  • Loading branch information
quantum authored and quantum committed Jun 4, 2024
1 parent cb6d765 commit c469ecd
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
25 changes: 25 additions & 0 deletions ObfustatorBat.sln
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
3 changes: 3 additions & 0 deletions ObfustatorBat/FodyWeavers.xml
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>
13 changes: 13 additions & 0 deletions ObfustatorBat/ObfustatorBat.csproj
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>
34 changes: 34 additions & 0 deletions ObfustatorBat/Program.cs
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.");
}
}
}

0 comments on commit c469ecd

Please sign in to comment.