spc-kiosk-pb/WinEtc/NewPosInstaller/Program.cs
2019-06-16 14:12:09 +09:00

61 lines
2.1 KiB
C#
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Security.Principal;
namespace NewPosInstaller
{
static class Program
{
/// <summary>
/// 해당 응용 프로그램의 주 진입점입니다.
/// </summary>
[STAThread]
static void Main(string[] args)
{
// 작업디렉토리 설정
ComLib.CreateDirectory(DirInfo.WorkDir);
ComLib.CreateDirectory(DirInfo.LogDir);
ComLib.CreateDirectory(DirInfo.DownDir);
ComLib.CreateDirectory(DirInfo.TempDir);
// 로그 리스너 시작
ComLog.Start();
string processName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
System.Diagnostics.Process[] process = System.Diagnostics.Process.GetProcessesByName(processName);
if (process.Length > 1)
{
ComLog.WriteLog(ComLog.Level.trace
, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "."
+ System.Reflection.MethodBase.GetCurrentMethod().Name + "()"
, "The Application is already running.");
}
else
{
//IsAdministrator();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmInstaller());
}
// 로그 리스너 종료
ComLog.Stop();
}
        private static bool IsAdministrator()
        {
            WindowsIdentity identity = WindowsIdentity.GetCurrent();
 
            if (null != identity)
            {
                WindowsPrincipal principal = new WindowsPrincipal(identity);
                return principal.IsInRole(WindowsBuiltInRole.Administrator);
            }
            return false;
        }
}
}