-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
69 lines (59 loc) · 2.06 KB
/
Program.cs
File metadata and controls
69 lines (59 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* Init-Venv - Initialize a virtual environment automatically
* Copyright 2025 - 2025 Dev2Forge
* Licence: GPL-3
* More information: https://github.com/Dev2Forge/Init-Venv/blob/main/LICENSE
* Author: tutosrive (tutosrive@Dev2Forge.software)
*
* File: \Program.cs
* Created: Friday, 18th July 2025 7:00:41 pm
* -----
* Last Modified: Tuesday, 6th January 2026 9:07:27 pm
* Modified By: tutosrive (tutosrive@Dev2Forge.software)
* -----
*/
using App;
using InitVenv.src.App.utils;
namespace InitVenv
{
class App
{
public static async Task Main(string[] args)
{
Console.WriteLine("---------\nInit-Venv (C) 2025 - Dev2Forge\nVisit https://pypi.org/project/initvenv/\nAll Rights Reserved.\n---------\n");
try
{
if (!(args.Length > 0))
{
throw new ArgumentException("The working directory could not be obtained.");
}
if (args[0].Length < 1)
{
throw new ArgumentException("The path to the directory is not valid or incorrect.");
}
await Init.Run(args[0]).ContinueWith(t => WaitCloseOnlyWindows(t: t));
}
catch (Exception e)
{
WaitCloseOnlyWindows(msg: $"[ERROR] {e.Message}\n\nPlease, try execute again...");
}
}
private static void FinishProgram(Task? t, string? msg)
{
string message = msg ?? "";
if (msg == null && t != null)
{
message = t.IsCompleted ? "Program exit Sucessfully!" : "Program exit with Errors";
}
Console.Write($"{message}\nPress ENTER to close...");
Console.Read();
}
private static void WaitCloseOnlyWindows(Task? t = null, string? msg = null)
{
if(OS.GetOS() == "windows")
{
FinishProgram(t, msg);
}
}
}
}