init
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
//#define DEBUG
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DBConfiguration
|
||||
{
|
||||
static class DBConfig
|
||||
{
|
||||
[DllImport("kernel32.dll")]
|
||||
static extern IntPtr GetConsoleWindow();
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
||||
|
||||
const int SW_HIDE = 0;
|
||||
const int SW_SHOW = 5;
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var targetDir = string.Empty;
|
||||
var productVersion = new Version();
|
||||
var noUI = string.Empty;
|
||||
var architectureVersion = string.Empty;
|
||||
var sourcePath = string.Empty;
|
||||
var destPath = string.Empty;
|
||||
|
||||
var handle = GetConsoleWindow();
|
||||
var tsrAirGo = false;
|
||||
#if DEBUG
|
||||
//To enable this section, check the "Define DEBUG constant" checkbox in the Build
|
||||
//step of the Properties of the DBConfiguration project.
|
||||
//this should be a real version installed on your system.
|
||||
//it is what we are simulating migrating *to*, so install it with the migration check off
|
||||
//if you are testing *from*, make sure to have a previous and in-the-registry copy as well
|
||||
var _majorMinorVersion = "4.4.309";
|
||||
var version = _majorMinorVersion + ".52976";
|
||||
targetDir = "D:\\DTS\\DTS.Suite\\" + _majorMinorVersion + "\\DataPRO";
|
||||
productVersion = new Version(version);
|
||||
|
||||
//Use this to test the TSR AIR Go installer
|
||||
tsrAirGo = true;
|
||||
#else
|
||||
if (args.Length == 0)
|
||||
{
|
||||
//Don't display the command prompt window while processing (but see below)
|
||||
ShowWindow(handle, SW_HIDE);
|
||||
noUI = "STANDALONE";
|
||||
}
|
||||
else if (args.Length == 2)
|
||||
{
|
||||
//Display the command prompt window during and after processing.
|
||||
ShowWindow(handle, SW_SHOW);
|
||||
noUI = "STANDALONECMD";
|
||||
sourcePath = args[0];
|
||||
destPath = args[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
//Don't display the command prompt window while processing from installer.
|
||||
ShowWindow(handle, SW_HIDE);
|
||||
for (var i = 0; i < args.Length; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
targetDir = args[i];
|
||||
break;
|
||||
case 1:
|
||||
productVersion = new Version(args[i]);
|
||||
break;
|
||||
case 2:
|
||||
noUI = args[i];
|
||||
break;
|
||||
case 3:
|
||||
if (bool.TryParse(args[i], out var b))
|
||||
{
|
||||
tsrAirGo = b;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (noUI != "TRUE")
|
||||
{
|
||||
if (tsrAirGo)
|
||||
{
|
||||
var commonUtilities = new CommonUtilities();
|
||||
commonUtilities.InitializeDbToTSRAIR(targetDir);
|
||||
}
|
||||
else
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new DBTypeChoice(targetDir, productVersion, noUI, sourcePath, destPath));
|
||||
|
||||
if (args.Length == 0)
|
||||
{
|
||||
//If run in a command prompt window, don't close (the window will
|
||||
//flash briefly if run by double-clicking DBConfiguration.exe).
|
||||
ShowWindow(handle, SW_SHOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user