Analysis-Services/BismNormalizer/AlmToolkit/Program.cs

73 lines
2.3 KiB
C#
Raw Normal View History

2019-12-14 13:26:04 +08:00
using BismNormalizer;
using Microsoft.AnalysisServices;
2019-12-08 11:53:15 +08:00
using System;
2019-09-14 13:26:01 +08:00
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AlmToolkit
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
2019-12-09 13:42:49 +08:00
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
2019-09-14 13:26:01 +08:00
2019-12-14 13:26:04 +08:00
//If new install, see if need to migrate settings file from previous version
try
{
if (Settings.Default.UpgradeRequired)
{
Settings.Default.Upgrade();
Settings.Default.UpgradeRequired = false;
Settings.Default.Save();
}
}
catch { }
2021-05-01 10:49:31 +08:00
// Default web requests like AAD Auth to use windows credentials for proxy auth
System.Net.WebRequest.DefaultWebProxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
2019-09-14 13:26:01 +08:00
if (args != null && args.Length > 0)
{
2019-12-08 11:53:15 +08:00
if (args.Length > 1)
//User opened from Desktop with server/db name
2019-09-14 13:26:01 +08:00
{
2019-12-08 11:53:15 +08:00
string serverName = args[0];
string databaseName = args[1];
2019-09-14 13:26:01 +08:00
ComparisonForm MainFrom = new ComparisonForm();
2019-12-08 11:53:15 +08:00
MainFrom.LoadFromDesktop(serverName, databaseName);
2019-09-14 13:26:01 +08:00
Application.Run(MainFrom);
2019-12-08 11:53:15 +08:00
return;
2019-09-14 13:26:01 +08:00
}
else
2019-12-08 11:53:15 +08:00
//User opened file with the program
2019-09-14 13:26:01 +08:00
{
2019-12-08 11:53:15 +08:00
string fileName = args[0];
//Check file exists, if not will run without args below
if (File.Exists(fileName))
{
ComparisonForm MainFrom = new ComparisonForm();
MainFrom.LoadFile(fileName);
Application.Run(MainFrom);
return;
}
2019-09-14 13:26:01 +08:00
}
}
2019-12-08 11:53:15 +08:00
//Without valid args
Application.Run(new ComparisonForm());
2019-09-14 13:26:01 +08:00
}
}
}