Should be all set to work with args being passed in now.

This commit is contained in:
Dan Dembinski
2020-05-07 11:57:55 -04:00
parent f8f21972f7
commit 0e5e919776

View File

@@ -4,23 +4,27 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml; using System.Xml;
using System.IO;
namespace orderRenamer namespace orderRenamer
{ {
class Program class Program
{ {
static string confirmation;
static string client; static string client;
static string jobNumber; static string jobNumber;
static string path; static string path;
static string ClientConfig = "\\\\aapp01\\c$\\Program Files (x86)\\AKSESS\\Storefront\\Order Delivery Service\\ClientConfig.xml"; static string ClientConfig = "\\\\aapp01\\c$\\Program Files (x86)\\AKSESS\\Storefront\\Order Delivery Service\\ClientConfig.xml";
static void Main(string[] args) static void Main(string[] args)
{ {
//Console.WriteLine("test");
client = "ADA"; confirmation = args[0];
// jobNumber = "123"; jobNumber = args[1];
client = args[2];
string orderNumber = confirmation.Split('-')[3];
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
//try { doc.Load("\\\\aapp01\\c$\\Program Files (x86)\\AKSESS\\Storefront\\Order Delivery Service\\ClientConfig.xml"); }
try { doc.Load(ClientConfig); } try { doc.Load(ClientConfig); }
catch (System.IO.FileNotFoundException) catch (System.IO.FileNotFoundException)
@@ -32,16 +36,17 @@ namespace orderRenamer
for (int i = 0; i < elemList.Count; i++) for (int i = 0; i < elemList.Count; i++)
{ {
// Console.WriteLine(elemList[i].InnerXml);
if (elemList[i].InnerXml == client) if (elemList[i].InnerXml == client)
{ {
XmlNodeList elemPath = doc.GetElementsByTagName("DPCFolder"); XmlNodeList elemPath = doc.GetElementsByTagName("DPCFolder");
path = elemPath[i].InnerXml; path = elemPath[i].InnerXml;
Console.WriteLine(path);
break; break;
} }
} }
Console.WriteLine(path); string[] filename = Directory.GetFiles(path).Where(f => f.Contains(orderNumber)).ToArray();
Console.WriteLine(filename[0].Split('\\').Last());
System.IO.File.Move(filename[0], path + '\\' + jobNumber + '-' + filename[0].Split('\\').Last());
} }
} }
} }