Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Content.Core/Assembly/BaseAssembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public AssembledFile AssembleFiles()
stringBuilder.AppendLine($@"
# Prototype assembled with Prototype Assembler by SpyDev14
# github: https://github.com/SpyDev14/PrototypeAssembler
# Thank's for using!
# Thanks for using!
");

// combining files
Expand Down
60 changes: 39 additions & 21 deletions Content.Core/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,25 @@ namespace Content.Core;

public class Program
{
private const string wrongArgumentsErrorMessage
=@"At least 3 arguments are needed!
arg[0] - workFolderPath*
arg[1] - assembledFileSavePath*
arg[2] - assembledFileName*
arg[3] - (optional) OnFileExistOperation: int or string = 1 (CreateWithIndex)
├─ 0 - Overwrite
├─ 1 - CreateWithIndex
└─ 2 - ThrowException
arg[4] - (optional) author = null";

static void Main(string[] args)
{
/*
arg[0] - workFolderPath
arg[1] - assembledFileSavePath
arg[2] - assembledFileName
arg[3] - author (optional)
arg[4] - OnFileExistOperation: int (optional)
arg[3] - OnFileExistOperation: int or string (optional)
arg[4] - author (optional)
*/

string workFolderPath, assembledFileSavePath, assembledFileName;
Expand All @@ -29,37 +40,33 @@ static void Main(string[] args)

if (args.Length >= 4)
{
author = args[3];
try {
onFileAlreadyExist = Enum.Parse<OnFileAlreadyExist>(args[3]); }

catch {
WriteError("Unknow on file already exsist operation!");
throw new ArgumentException("this OnFileExistOperation not exsist");
}

if (args.Length >= 5)
{
Enum.TryParse(args[4], out onFileAlreadyExist);
author = args[4];
}
}
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(@"At least 3 arguments are needed!
arg[0] - workFolderPath
arg[1] - assembledFileSavePath
arg[2] - assembledFileName
arg[3] - (optional) author = null
arg[4] - (optional) OnFileExistOperation: int or string = 1 (CreateWithIndex)
├─ 0 - Overwrite
├─ 1 - CreateWithIndex
└─ 2 - ThrowException");

Console.ResetColor();
WriteError(wrongArgumentsErrorMessage);

throw new ArgumentException("At least 3 arguments are needed");
}

Console.WriteLine($"Work folder path: {workFolderPath}");
Console.WriteLine($"Assembled file path: {assembledFileSavePath}");
Console.WriteLine($"Assembled file name: {assembledFileName}");
Console.WriteLine($"Author: {author}");
Console.WriteLine($"On file already exst operation: {onFileAlreadyExist}\n");
Console.WriteLine($"Work folder path: {workFolderPath}");
Console.WriteLine($"Assembled file path: {assembledFileSavePath}");
Console.WriteLine($"Assembled file name: {assembledFileName}");
Console.WriteLine($"On file already exst: {onFileAlreadyExist}");
Console.WriteLine($"Author: {author}");
Console.WriteLine();

AssemblyData assemblyData = new(workFolderPath)
{
Expand All @@ -81,4 +88,15 @@ static void Main(string[] args)
Console.WriteLine("\nУспешно!");
Console.ResetColor();
}

private static void WriteError(string msg, bool addErrorPrefix = true, string endsWith = "\n")
{
const string errorPrefix = "ERROR:";
ConsoleColor beforeColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Red;

Console.Write($"{(addErrorPrefix? errorPrefix : null)} {msg}{endsWith}");

Console.ForegroundColor = beforeColor;
}
}
2 changes: 1 addition & 1 deletion Content.Core/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"Content.Core": {
"commandName": "Project",
"commandLineArgs": "C:\\Users\\User\\Desktop\\_b.VV()\\prototypes\r\nC:\\Users\\User\\Desktop\\_b.VV()\r\nTest_25.03.25\r\nSpyDev14\r\nOverwrite"
"commandLineArgs": "C:\\Users\\User\\Desktop\\_b.VV()\\prototypes\r\nC:\\Users\\User\\Desktop\\_b.VV()\r\nTest_26.03.25\r\nOverwrite\r\nSpyDev14"
}
}
}