AvalonPatch.AvalonPatch.installPatch C# (CSharp) Метод

installPatch() публичный Метод

public installPatch ( patchFile thePatch ) : void
thePatch patchFile
Результат void
        void installPatch(patchFile thePatch)
        {
            try
            {
                if (thePatch.patchAction.Contains("install"))
                {
                    if (thePatch.patchLocation.ToLower().StartsWith("process") || thePatch.patchLocation.ToLower().StartsWith("windows"))
                    {
                        File.Copy(Path.Combine(tempExtractPath, thePatch.patchFileName), Path.Combine(thePatch.destinationPath, thePatch.patchFileName), true);
                    }
                    if (thePatch.patchLocation.ToLower().StartsWith("mediaportal"))
                    {
                        File.Copy(Path.Combine(tempExtractPath, thePatch.patchFileName), Path.Combine(thePatch.destinationPath, thePatch.patchFileName), true);
                    }
                }
            }
            catch (UnauthorizedAccessException ex)
            {
                // catch access issues...maybe from UAC
                // really need to elevate
                string message = "User Account Control maybe preventing Avalon from updating the required file: ";
                string message2 = "Its recommended you address the issue and run the patch again.";
                DialogResult result = MessageBox.Show(string.Format("{0}{1}.\n\n{2}\n\n{3}", message, thePatch.patchFileName, ex.Message, message2), "AvalonPatch", MessageBoxButtons.OK, MessageBoxIcon.Error);
                // exit now, so we dont update version and prevent user from applying patch again
                Application.Exit();
            }
            catch (Exception e)
            {
                // This is to catch the issue where we are running the patch from SMPMediaPortalRestart
                // and cannot then update SMPMediaPortalRestart.
                // Check it is SMPMediaPortalRestart we are trying to update, continue if we are
                // otherwise show the error and abort update process.
                if (!thePatch.patchFileName.ToLower().Contains("avalonmediaportalrestart"))
                {
                    string message = "Exception due update while updating:";
                    string message2 = "Its recommended you address the issue and run the patch again.";
                    DialogResult result = MessageBox.Show(string.Format("{0}{1}.\n\n{2}\n\n{3}", message, thePatch.patchFileName, e.Message, message2), "AvalonPatch", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    // exit now, so we dont update version and prevent user from applying patch again
                    Application.Exit();
                }
            }

            if (thePatch.patchAction.ToLower() == "unzip")
            {
                installZip(thePatch);
            }

            if (thePatch.patchAction.ToLower() == "run")
            {
            }
        }