示例#1
0
        private void btnConvert_Click(object sender, EventArgs e)
        {
            defineSourcePlatform();
            defineTargetPlatform();
            // VALIDATIONS
            if (SourcePlatform.Equals(TargetPlatform))
            {
                MessageBox.Show("The source and target platform should be different.", MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            // GET FILES
            using (var ofd = new OpenFileDialog())
            {
                ofd.Title       = "Select one DLC for platform conversion";
                ofd.Multiselect = true;
                switch (SourcePlatform.platform)
                {
                case GamePlatform.Pc:
                case GamePlatform.Mac:
                    ofd.Filter = "PC or Mac Rocksmith 2014 DLC (*.psarc)|*.psarc";
                    break;

                case GamePlatform.XBox360:
                    ofd.Filter = "XBox 360 Rocksmith 2014 DLC (*.)|*.*";
                    break;

                case GamePlatform.PS3:
                    ofd.Filter = "PS3 Rocksmith 2014 DLC (*.edat)|*.edat";
                    break;

                default:
                    MessageBox.Show("The converted audio on Wwise 2013 for target platform should be selected.", MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (ofd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                if (!bwConvert.IsBusy && ofd.FileNames.Length > 0)
                {
                    pbUpdateProgress.Value      = 0;
                    pbUpdateProgress.Visible    = true;
                    lblCurrentOperation.Visible = true;
                    ToggleUIControls(false);
                    bwConvert.RunWorkerAsync(ofd.FileNames);
                }
            }
        }
示例#2
0
        private void convertButton_Click(object sender, EventArgs e)
        {
            // VALIDATIONS
            if (SourcePlatform.Equals(TargetPlatform))
            {
                MessageBox.Show("The source and target platform should be different.", MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            // GET FILES
            string[] sourcePackages;

            using (var ofd = new OpenFileDialog()) {
                ofd.Title       = "Select one DLC for platform conversion";
                ofd.Multiselect = true;
                switch (SourcePlatform.platform)
                {
                case GamePlatform.Pc:
                case GamePlatform.Mac:
                    ofd.Filter = "PC or Mac Rocksmith 2014 DLC (*.psarc)|*.psarc";
                    break;

                case GamePlatform.XBox360:
                    ofd.Filter = "XBox 360 Rocksmith 2014 DLC (*.)|*.*";
                    break;

                case GamePlatform.PS3:
                    ofd.Filter = "PS3 Rocksmith 2014 DLC (*.edat)|*.edat";
                    break;

                default:
                    MessageBox.Show("The converted audio on Wwise 2013 for target platform should be selected.", MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (ofd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                sourcePackages = ofd.FileNames;
            }

            // SOURCE
            StringBuilder errorsFound = new StringBuilder();

            foreach (var sourcePackage in sourcePackages)
            {
                if (!sourcePackage.IsValidPSARC())
                {
                    errorsFound.AppendLine(String.Format("File '{0}' isn't valid. File extension was changed to '.invalid'", Path.GetFileName(sourcePackage)));

                    return;
                }

                var alertMessage    = String.Format("Source package '{0}' seems to be not {1} platform, the conversion can't be work.", Path.GetFileName(sourcePackage), SourcePlatform);
                var haveCorrectName = Path.GetFileNameWithoutExtension(sourcePackage).EndsWith(SourcePlatform.GetPathName()[2]);
                if (SourcePlatform.platform == GamePlatform.PS3)
                {
                    haveCorrectName = Path.GetFileNameWithoutExtension(sourcePackage).EndsWith(SourcePlatform.GetPathName()[2] + ".psarc");
                }

                if (!haveCorrectName)
                {
                    errorsFound.AppendLine(alertMessage);
                    if (MessageBox.Show(alertMessage + Environment.NewLine + "Force try to convert this package?", MESSAGEBOX_CAPTION, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                    {
                        continue;
                    }
                }

                // CONVERT
                var output = DLCPackageConverter.Convert(sourcePackage, SourcePlatform, TargetPlatform, AppId);
                if (!String.IsNullOrEmpty(output))
                {
                    errorsFound.AppendLine(output);
                }
            }

            if (errorsFound.Length <= 0)
            {
                MessageBox.Show(String.Format("DLC was converted from '{0}' to '{1}'.", SourcePlatform.platform, TargetPlatform.platform), MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                MessageBox.Show(String.Format("DLC was converted from '{0}' to '{1}' with erros. See below: " + Environment.NewLine + errorsFound.ToString(), SourcePlatform.platform, TargetPlatform.platform), MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
示例#3
0
        private void doConvert(object sender, DoWorkEventArgs e)
        {
            // SOURCE
            var sourceFileNames = e.Argument as string[];

            errorsFound = new StringBuilder();
            var step     = (int)Math.Round(1.0 / sourceFileNames.Length * 100, 0);
            int progress = 0;

            foreach (var sourcePackage in sourceFileNames)
            {
                bwConvert.ReportProgress(progress, String.Format("Converting '{0}' to {1} platform.", Path.GetFileName(sourcePackage), TargetPlatform.platform.GetPathName()[0]));
                if (!sourcePackage.IsValidPSARC())
                {
                    errorsFound.AppendLine(String.Format("File '{0}' isn't valid. File extension was changed to '.invalid'", Path.GetFileName(sourcePackage)));

                    return;
                }

                var alertMessage    = String.Format("Source package '{0}' seems to be not {1} platform, the conversion impossible.", Path.GetFileName(sourcePackage), SourcePlatform);
                var haveCorrectName = Path.GetFileNameWithoutExtension(sourcePackage).EndsWith(SourcePlatform.GetPathName()[2]);
                if (SourcePlatform.platform == GamePlatform.PS3)
                {
                    haveCorrectName = Path.GetFileNameWithoutExtension(sourcePackage).EndsWith(SourcePlatform.GetPathName()[2] + ".psarc");
                }

                if (!haveCorrectName)
                {
                    errorsFound.AppendLine(alertMessage);
                    if (MessageBox.Show(alertMessage + Environment.NewLine + "Force try to convert this package?", MESSAGEBOX_CAPTION, MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning) == DialogResult.Cancel)
                    {
                        continue;
                    }
                }

                try
                {
                    // CONVERT
                    var output = DLCPackageConverter.Convert(sourcePackage, SourcePlatform, TargetPlatform, AppId);
                    if (!String.IsNullOrEmpty(output))
                    {
                        errorsFound.AppendLine(output);
                    }
                }
                catch (Exception ex)
                {
                    errorsFound.AppendLine(String.Format("{0}\n{1}\n", ex.Message, ex.StackTrace));
                }

                progress += step;
                bwConvert.ReportProgress(progress);
            }

            bwConvert.ReportProgress(100);
            e.Result = "done";
        }