privatestaticboolCheckForAdminRights(){string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows),string.Format("tfadxp{0}.txt","80"));try{if(File.Exists(path)){
File.Delete(path);}using(StreamWriter streamWriter = File.CreateText(path)){
streamWriter.WriteLine("test successful - {0}", DateTime.Now);
streamWriter.Close();}if(!File.Exists(path)){returnAdminRightsError();}
File.Delete(path);}catch(Exception){returnAdminRightsError();}returntrue;}privatestaticboolAdminRightsError(){
MessageBox.Show("I can not continue, You should run me with administrative priveleges.
Right click on me and select "Run as administrator" menu.","You are NOT ADMINISTRATOR!", MessageBoxButtons.OK, MessageBoxIcon.Hand);returnfalse;}