private static bool CheckCommandLineArgs(string[] args) { if (Windows7Security.IsAdmin()) { return(true); } MessageBox.Show(@"Administrative elevation is needed. Program will close now.", @"CodeSmith Extension Handler", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); }
private void Init() { _targetDir = Application.StartupPath + "\\"; if (Windows7Security.IsVistaOrHigher()) { Icon = new Icon(SystemIcons.Shield, 16, 16); PictureBox.Image = Resources.Security; Windows7Security.AddShieldToButton(InstallCodeSmith); Windows7Security.AddShieldToButton(UninstallCodeSmith); } else { Icon = new Icon(Resources.Cgf, 16, 16); PictureBox.Image = Resources.Cgf.ToBitmap(); } UpdateCodeSmithExtensionStatus(); }