public void ImportTest()
        {
            //arrange
            FileWrapper fileWrapper = new FileWrapper("", "");
            String regFile = GetRegFile();

            //act: import
            fileWrapper.ImportFrom(regFile);

            //assert
            Assert.IsFalse(String.IsNullOrEmpty(fileWrapper.Path_ProgramFilesDir), "imported 64x value missing");
            Assert.IsFalse(String.IsNullOrEmpty(fileWrapper.Path_ProgramFilesDir86), "imported 32x value missing");

            //clean up after yourself
            FileInfo fileInfo = new FileInfo(regFile);
            if (fileInfo.Exists)
                fileInfo.Delete();
        }
        public void ExportTest()
        {
            //arrange
            FileWrapper fileWrapper = new FileWrapper("C:\\test64\\", "D:\\test32\\");
            String savepath = Path.GetTempPath() + Guid.NewGuid() + ".reg";

            //act: export
            fileWrapper.ExportTo(savepath);

            //assert
            String actualContent;
            using (StreamReader reader = new StreamReader(new FileStream(savepath, FileMode.Open)))
            {
                actualContent = reader.ReadToEnd();
            }

            String expectedContent;
            if (Environment.Is64BitOperatingSystem)
                expectedContent = @"Windows Registry Editor Version 5.00

            [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]
            ""ProgramFilesDir""=""C:\\test64\\""
            ""ProgramFilesDir (x86)""=""D:\\test32\\""
            ";
            else
                expectedContent = @"Windows Registry Editor Version 5.00

            [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]
            ""ProgramFilesDir""=""C:\\test64\\""
            ";
            Assert.AreEqual(expectedContent, actualContent);

            //clean up after yourself
            FileInfo fileInfo = new FileInfo(savepath);
            if (fileInfo.Exists)
                fileInfo.Delete();
        }
 /// <summary>
 /// Opens import dialog and writes imported values into classwide variables
 /// </summary>
 private void ImportReg()
 {
     FileWrapper fileWrapper = new FileWrapper(Path_ProgramFilesDir, Path_ProgramFilesDir86);
     fileWrapper.ImportWithDialog();
     Path_ProgramFilesDir = fileWrapper.Path_ProgramFilesDir;
     Path_ProgramFilesDir86 = fileWrapper.Path_ProgramFilesDir86;
 }
 /// <summary>
 /// Opens export dialog and writes current values into user selected .reg file
 /// </summary>
 private void ExportReg()
 {
     FileWrapper fileWrapper = new FileWrapper(Path_ProgramFilesDir, Path_ProgramFilesDir86);
     fileWrapper.ExportWithDialog();
 }
        /// <summary>
        /// Call this after ReadCommandLineArguments() to execute the commands the user wants
        /// </summary>
        private void ProcessCommandLineArgs()
        {
            if (opts.Help)
            {
                opts.PrintUsage();
                Environment.Exit(0);
            }

            if (opts.Version)
            {
                Console.WriteLine(Assembly.GetExecutingAssembly().GetName().Name + " " +
                                  Assembly.GetExecutingAssembly().GetName().Version);
                Environment.Exit(0);
            }

            if (!String.IsNullOrWhiteSpace(opts.Export))
            {
                FileWrapper fileWrapper = new FileWrapper(Path_ProgramFilesDir, Path_ProgramFilesDir86);
                fileWrapper.ExportTo(opts.Export);
            }

            if (!String.IsNullOrWhiteSpace(opts.Import))
            {
                FileWrapper fileWrapper = new FileWrapper(Path_ProgramFilesDir, Path_ProgramFilesDir86);
                fileWrapper.ImportFrom(opts.Import);

                if (IsAdminLevel())
                {
                    registry.ProgramFilesDir = Path_ProgramFilesDir;
                    registry.ProgramFilesDir86 = Path_ProgramFilesDir86;
                }
                else
                {
                    Console.WriteLine(@"E: Unable to change registry value.");
                    Console.WriteLine(@"E: Application has no admin priviledge.");
                }
            }

            if (!String.IsNullOrWhiteSpace(opts.Change32))
            {
                if (!Environment.Is64BitOperatingSystem)
                {
                    Console.WriteLine(@"Attention! 32-bit-computers don't differenciate between 32 and 64 bit applications.");
                    Console.WriteLine(@"Changing the x86 value is ignored on 32-bit machines. Please use the normal registry key instead");
                }

                if (IsAdminLevel())
                {
                    registry.ProgramFilesDir86 = opts.Change32;
                }
                else
                {
                    Console.WriteLine(@"E: Unable to change registry value.");
                    Console.WriteLine(@"E: Application has no admin priviledge.");
                }
            }

            if (!String.IsNullOrWhiteSpace(opts.Change64))
            {
                if (IsAdminLevel())
                {
                    registry.ProgramFilesDir = opts.Change64;
                }
                else
                {
                    Console.WriteLine(@"E: Unable to change registry value.");
                    Console.WriteLine(@"E: Application has no admin priviledge.");
                }
            }

            if (opts.NoPopup)
                RateThisPopup_WasAlreadyOpened = true;

            if (opts.IgnoreWin10)
                Win10PopupOpen = false;

            //Call this only after processing all other arguments
            if (opts.Quiet)
                Environment.Exit(0);              
        }