示例#1
0
		void OnApply()
		{
			Exception exception = null;
			OpenSauceIDE.GameInterface.UnlockXna patcher = null;
			try					{ patcher = new OpenSauceIDE.GameInterface.UnlockXna(txtPathOutput.Text, txtPathXnaNative.Text); }
			catch (Exception ex){ exception = ex; }

			if (patcher != null) // If the patcher api was initialized OK, run the unlocking operations
			{
				try
				{
					patcher.Unlock(false);
					patcher.Close();
				}
				catch (Exception ex)	{ exception = ex; }
			}

			if (exception != null)
				OnApplyException(exception);

			string msg = exception == null ?
				"XNA successfully patcher!" :
				"There was an error while trying to patch the XNA. Validate that you selected copies of the original exes and try again.";

			if (patcher.EncounteredInvalidExe)
				OnApplyMsg(true, "Couldn't patch some or all of the exes. Check the debug log for more details");
			else
				OnApplyMsg(exception != null, msg);
		}
        void OnApply()
        {
            Exception exception = null;

            OpenSauceIDE.GameInterface.UnlockXna patcher = null;
            try                                     { patcher = new OpenSauceIDE.GameInterface.UnlockXna(txtPathOutput.Text, txtPathXnaNative.Text); }
            catch (Exception ex) { exception = ex; }

            if (patcher != null)             // If the patcher api was initialized OK, run the unlocking operations
            {
                try
                {
                    patcher.Unlock(false);
                    patcher.Close();
                }
                catch (Exception ex)    { exception = ex; }
            }

            if (exception != null)
            {
                OnApplyException(exception);
            }

            string msg = exception == null ?
                         "XNA successfully patcher!" :
                         "There was an error while trying to patch the XNA. Validate that you selected copies of the original exes and try again.";

            if (patcher.EncounteredInvalidExe)
            {
                OnApplyMsg(true, "Couldn't patch some or all of the exes. Check the debug log for more details");
            }
            else
            {
                OnApplyMsg(exception != null, msg);
            }
        }
        static ExitCode PatchXna(params string[] args)
        {
            const string kModifcationName     = "OpenSauce-XNA";
            const string kSupportedExeVersion = "4.0";

            if (args.Length < 1)
            {
                Console.WriteLine("error: invalid command argument count");
                return(ExitCode.InvalidArgsCount);
            }

            string output_path = args[0];
            string hint_path   = "";

            if (args.Length >= 2)
            {
                hint_path = args[1];
            }
            else
            {
                hint_path = Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles);
                hint_path = Path.Combine(hint_path, @"Microsoft Shared\XNA\Framework\v" + kSupportedExeVersion + @"\");
            }

            if (!Directory.Exists(output_path))
            {
                Console.WriteLine("Output path does not exist: {0}", output_path);
                return(ExitCode.InvalidArgs);
            }
            if (!Directory.Exists(hint_path))
            {
                Console.WriteLine("XnaNative path does not exist: {0}", hint_path);
                return(ExitCode.InvalidArgs);
            }

            Console.WriteLine("Applying {0} modifications...", kModifcationName);
            DumpArguments(0, args);

            Exception exception = null;

            OpenSauceIDE.GameInterface.UnlockXna patcher = null;
            try                                     { patcher = new OpenSauceIDE.GameInterface.UnlockXna(output_path, hint_path); }
            catch (Exception ex) { exception = ex; }

            if (patcher != null)             // If the patcher api was initialized OK, run the unlocking operations
            {
                try
                {
                    patcher.Unlock(false);
                    patcher.Close();
                }
                catch (Exception ex)    { exception = ex; }
            }

            DumpModificationException(kModifcationName, exception);

            ExitCode exit_code = ExitCode.Success;
            string   msg;

            if (exception == null)
            {
                msg = kModifcationName + " successfully applied!";
            }
            else if (patcher.EncounteredInvalidExe)
            {
                msg       = kModifcationName + " couldn't be applied to some or all of the exes. Check the debug log for more details";
                exit_code = ExitCode.InvalidInput;
            }
            else
            {
                msg = "There was an error while trying to apply " + kModifcationName + ". Validate that you selected original copies of the " +
                      "v" + kSupportedExeVersion + " exe(s) and try again.";
                exit_code = ExitCode.Failure;
            }

            Console.WriteLine(msg);

            return(exit_code);
        }
示例#4
0
		static ExitCode PatchXna(params string[] args)
		{
			const string kModifcationName = "OpenSauce-XNA";
			const string kSupportedExeVersion = "4.0";

			if (args.Length < 1)
			{
				Console.WriteLine("error: invalid command argument count");
				return ExitCode.InvalidArgsCount;
			}

			string output_path = args[0];
			string hint_path = "";
			if (args.Length >= 2) hint_path = args[1];
			else
			{
				hint_path = Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles);
				hint_path = Path.Combine(hint_path, @"Microsoft Shared\XNA\Framework\v" + kSupportedExeVersion + @"\");
			}

			if (!Directory.Exists(output_path))
			{
				Console.WriteLine("Output path does not exist: {0}", output_path);
				return ExitCode.InvalidArgs;
			}
			if (!Directory.Exists(hint_path))
			{
				Console.WriteLine("XnaNative path does not exist: {0}", hint_path);
				return ExitCode.InvalidArgs;
			}

			Console.WriteLine("Applying {0} modifications...", kModifcationName);
			DumpArguments(0, args);

			Exception exception = null;
			OpenSauceIDE.GameInterface.UnlockXna patcher = null;
			try					{ patcher = new OpenSauceIDE.GameInterface.UnlockXna(output_path, hint_path); }
			catch (Exception ex){ exception = ex; }

			if (patcher != null) // If the patcher api was initialized OK, run the unlocking operations
			{
				try
				{
					patcher.Unlock(false);
					patcher.Close();
				}
				catch (Exception ex)	{ exception = ex; }
			}

			DumpModificationException(kModifcationName, exception);

			ExitCode exit_code = ExitCode.Success;
			string msg;
			if (exception == null)
				msg = kModifcationName + " successfully applied!";
			else if (patcher.EncounteredInvalidExe)
			{
				msg = kModifcationName + " couldn't be applied to some or all of the exes. Check the debug log for more details";
				exit_code = ExitCode.InvalidInput;
			}
			else
			{
				msg = "There was an error while trying to apply " + kModifcationName + ". Validate that you selected original copies of the " +
					"v" + kSupportedExeVersion + " exe(s) and try again.";
				exit_code = ExitCode.Failure;
			}

			Console.WriteLine(msg);

			return exit_code;
		}