Skip to content

Commit ffc61ec

Browse files
author
Ethorbit
committed
Allow multiple directories at once
Opens a separate version of the process for every directory that was dragged onto it, allowing everything to be done at once.
1 parent a3d4832 commit ffc61ec

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

FastDL Generator/Program.cs

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,33 @@
33
using System.IO;
44
using System.Threading;
55
using ICSharpCode.SharpZipLib.BZip2;
6+
using System.Diagnostics;
67

78
namespace FastDL_Generator
89
{
910
class Program
1011
{
11-
1212
public static void Main(string[] args)
1313
{
14-
Console.Title = "FastDL Generator";
14+
// Program only accepts 1 directory,
15+
// run it for every additional directory passed
16+
if (args.Length > 1)
17+
{
18+
string currentProgramPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
19+
20+
for (int i = 0; i < args.Length; i++)
21+
{
22+
var newProc = new Process();
23+
var startInfo = new ProcessStartInfo();
24+
startInfo.FileName = currentProgramPath;
25+
startInfo.Arguments = $"\"{args[i]}\"";
26+
newProc.StartInfo = startInfo;
27+
newProc.Start();
28+
}
29+
30+
return;
31+
}
32+
1533
int RunningTasks = 0;
1634
int MaxTasks = 2;
1735
int HardLimit = 4;
@@ -54,13 +72,7 @@ public static void Main(string[] args)
5472
}
5573

5674
// Same as above but instead quitting just set default path as the target path
57-
string copyPath = MainPath + $"/../fastdl-{Path.GetFileName(MainPath)}";
58-
try
59-
{
60-
if (Directory.Exists(args[1]))
61-
copyPath = args[1];
62-
}
63-
catch (Exception) { }
75+
string copyPath = MainPath + $"/../fastdl-{Path.GetFileName(MainPath).ToLower()}";
6476

6577
// if it exists Clear it because we need a clear folder
6678
if (Directory.Exists(copyPath))
@@ -167,7 +179,7 @@ void ThreadedCompressing()
167179
Console.WriteLine("All Threads Killed, Generator closed");
168180

169181
// Save the fastdl.lua in the target folder
170-
File.WriteAllText(copyPath + $"/fastdl-{Path.GetFileName(MainPath)}.lua", FileData);
182+
File.WriteAllText(copyPath + $"/fastdl-{Path.GetFileName(MainPath).ToLower()}.lua", FileData);
171183
}
172184
}
173185

@@ -210,7 +222,6 @@ private static string[] TreeScan(string mainDir, string search)
210222
{
211223
return new string[] { };
212224
}
213-
214225
}
215226

216227
private static bool BzipFile(string Path)

0 commit comments

Comments
 (0)