ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/AnywhereTS-MSSQL/trunk/MSBUILD_ATSInstaller_ReleaseHelper/Program.cs
Revision: 218
Committed: Thu Aug 23 17:00:34 2012 UTC (11 years, 3 months ago) by william
File size: 2626 byte(s)
Log Message:

File Contents

# Content
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.IO;
6
7 namespace MSBUILD_ATSInstaller_ReleaseHelper
8 {
9 class Program
10 {
11 static void Main(string[] args)
12 {
13 List<string> cargs = new List<string>(args);
14
15 if (cargs.Count < 2 || cargs.Count > 2) { ShowUsage(); return; }
16
17 string dst = cargs.First();
18 string raw_msis = cargs.Last();
19
20 List<string> msis = new List<string>(raw_msis.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
21
22 DirectoryInfo d_dst = new DirectoryInfo(dst);
23 if (!d_dst.Exists)
24 {
25 Console.WriteLine("MSI Installer Destination: {0} could not be found", d_dst.FullName);
26 ShowUsage(); return;
27 }
28 Console.WriteLine("MSI Installer Destination: {0}", d_dst.FullName);
29
30 msis.ForEach((f) =>
31 {
32 FileInfo f_msi = new FileInfo(f);
33 if (f_msi.Exists)
34 {
35 Console.WriteLine("MSI Installer: {0} copying to {1}", f_msi.FullName, d_dst.FullName);
36 if (d_dst.Exists)
37 {
38 FileInfo f_msi_new = f_msi.CopyTo(string.Format(@"{0}\{1}", d_dst.FullName, f_msi.Name), true);
39 if (f_msi_new.Exists)
40 {
41 Console.WriteLine("MSI Installer: {0} copied to {1}", f_msi.FullName, d_dst.FullName);
42 }
43 else
44 {
45 Console.WriteLine("MSI Installer: {0} failed to copy to {1}", f_msi.FullName, d_dst.FullName);
46 }
47 }
48 else
49 {
50 Console.WriteLine("MSI Installer Destination: {0} could not be found", d_dst.FullName);
51 ShowUsage(); return;
52 }
53 }
54 else
55 {
56 Console.WriteLine("MSI Installer: {0} could not be found", f_msi.FullName);
57 ShowUsage(); return;
58 }
59 });
60
61
62 }
63 static void ShowUsage()
64 {
65 Console.WriteLine("Usage: MSBUILD_ATSInstaller_ReleaseHelper \"<msi destination path>\" \"<msi1>;<msi2>;etc\" ");
66 }
67 }
68 }