Allow multiple paths passed through args
This commit is contained in:
@@ -6,7 +6,7 @@ using System.Text.RegularExpressions;
|
|||||||
|
|
||||||
namespace EtchBendLines
|
namespace EtchBendLines
|
||||||
{
|
{
|
||||||
class BendLineExtractor
|
public class BendLineExtractor
|
||||||
{
|
{
|
||||||
public BendLineExtractor(string dxfFile)
|
public BendLineExtractor(string dxfFile)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,25 +3,41 @@ using System.Collections.Generic;
|
|||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace EtchBendLines
|
namespace EtchBendLines
|
||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
static Etcher etcher = new Etcher();
|
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var path = AppDomain.CurrentDomain.BaseDirectory;
|
var etcher = new Etcher();
|
||||||
var files = Directory.GetFiles(path, "*.dxf", SearchOption.AllDirectories);
|
|
||||||
|
|
||||||
etcher.EtchLength = GetAppSettingAsDouble("EtchLength");
|
etcher.EtchLength = GetAppSettingAsDouble("EtchLength");
|
||||||
etcher.MaxBendRadius = GetAppSettingAsDouble("MaxBendRadius");
|
etcher.MaxBendRadius = GetAppSettingAsDouble("MaxBendRadius");
|
||||||
|
|
||||||
if (files == null || files.Length == 0)
|
var paths = new List<string>(args);
|
||||||
|
|
||||||
|
if (paths.Count == 0)
|
||||||
|
{
|
||||||
|
paths.Add(AppDomain.CurrentDomain.BaseDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
var files = new List<string>();
|
||||||
|
|
||||||
|
foreach (var path in paths)
|
||||||
|
{
|
||||||
|
if (File.Exists(path))
|
||||||
|
{
|
||||||
|
files.Add(path);
|
||||||
|
}
|
||||||
|
else if (Directory.Exists(path))
|
||||||
|
{
|
||||||
|
files.AddRange(Directory.GetFiles(path, "*.dxf", SearchOption.AllDirectories));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (files.Count == 0)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"No DXF files founds. Place DXF files in \"{AppDomain.CurrentDomain.BaseDirectory}\" and run this program again.");
|
Console.WriteLine($"No DXF files founds. Place DXF files in \"{AppDomain.CurrentDomain.BaseDirectory}\" and run this program again.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user