public ScriptSettingsForm(ScriptSettings settings) { InitializeComponent(); this.settings = settings; ds1r.Checked = settings.IsRemastered; ds1r.Enabled = settings.IsRemasteredSettable; preprocess.Checked = settings.AllowPreprocess; preprocess.Enabled = settings.AllowPreprocessSettable; dataInitialized = true; }
private bool OpenEMEVDFile( string fileName, string gameDocs, EMEVD evd = null, string jsText = null, bool isFancy = false, Dictionary <string, string> extraFields = null) { // Can reuse docs if for the same game if (!AllDocs.TryGetValue(gameDocs, out InstructionDocs docs)) { docs = AllDocs[gameDocs] = new InstructionDocs(gameDocs); } ScriptSettings settings = new ScriptSettings(docs, extraFields); EventScripter scripter = new EventScripter(fileName, docs, evd); string fileVersion = ProgramVersion.VERSION; if (jsText == null) { try { if (isFancy && docs.Translator != null) { jsText = new FancyEventScripter(scripter, docs, settings.CFGOptions).Unpack(); } else { jsText = scripter.Unpack(); } } catch (Exception ex) { // Also try to do it in compatibility mode, for emevd files which are no longer allowed, such as changing EMEDFs. try { jsText = scripter.Unpack(compatibilityMode: true); } catch { // If this also fails, we only care about the original exception. } if (jsText == null) { MessageBox.Show(ex.Message); } else { StringBuilder sb = new StringBuilder(); sb.AppendLine(ex.Message); sb.AppendLine("Proceed anyway? You will have to fix instruction arguments before resaving."); DialogResult result = MessageBox.Show(sb.ToString(), "Error", MessageBoxButtons.YesNoCancel); if (result != DialogResult.Yes) { jsText = null; } } if (jsText == null) { return(false); } } } else { fileVersion = extraFields != null && extraFields.TryGetValue("version", out string version) ? version : null; } if (Editor != null) { display.Panel2.Controls.Clear(); SharedControls.RemoveEditor(Editor); Editor.Dispose(); } Editor = new EditorGUI(SharedControls, scripter, docs, settings, fileVersion, jsText); SharedControls.AddEditor(Editor); SharedControls.RefreshGlobalStyles(); display.Panel2.Controls.Add(Editor); // PerformLayout(); Text = $"DARKSCRIPT 3 - {scripter.FileName}"; // Notify about possible compatibility issues int versionCmp = ProgramVersion.CompareVersions(ProgramVersion.VERSION, fileVersion); if (versionCmp > 0) { SharedControls.SetStatus("Note: File was previously saved using an earlier version of DarkScript3"); } else if (versionCmp < 0) { SharedControls.SetStatus("Note: File was previously saved using an newer version of DarkScript3. Please update!"); } return(true); }