//----------------------------- private ScriptCollection getModified() { ScriptCollection r = new ScriptCollection(); foreach (ScriptItem script in ScriptMgr.Items) { if (!script.IsModified) { continue; } r.AddNotExists(script); script.Level = 0; // string super_name = script.GetSuper(); if (string.IsNullOrEmpty(super_name)) { continue; } ScriptItem super_script = ScriptMgr.Get(super_name); while (super_script != null) { r.AddNotExists(super_script); super_script.Level = 0; // super_name = super_script.GetSuper(); if (string.IsNullOrEmpty(super_name)) { break; } super_script = ScriptMgr.Get(super_name); } } return(r); }
public void Load(string name) { Clear(); if (ScriptMgr == null) { throw new Exception("A Script Manager has not been assigned!"); } try { Script = ScriptMgr.Get(name); } catch (Exception) {} // is_loading = true; if (Script != null) { if (ScriptManager.ENABLE_DECOMPILER) { if (!Script.IsDecompiled) { decompileTask = new ScriptDecompileWorker(Script.Source); decompileTask.OnComplete += decompileTask_OnComplete; decompileTask.Run(null); } else { setText(Script.Data); parseEventHandlers(); } } else { setText(Script.Source); } // gridScriptError.Visibility = Visibility.Collapsed; } else { gridScriptError.Visibility = Visibility.Visible; lblScriptErrorTitle.Text = "Warning:"; lblScriptErrorMessage.Text = "Script \"" + name + "\" not found!"; } is_loading = false; has_changes = false; }
public void Run() { ScriptCollection modified = getModified(); Result = new CompilerParser(); if (modified.Count > 0) { if (!checkDuplicateEventHandlers(modified)) { return; } // createRegex(); modified.SortByLevel(); writeItems(modified); compileItems(); // Result.Load(); if (!Result.IsSuccess) { return; } // ScriptItem x_script; ScriptParser parser = new ScriptParser(); parser.Load(output_filename); foreach (ScriptItem script in parser.Items) { x_script = ScriptMgr.Get(script.Name); if (x_script != null) { x_script.Source = script.Source; } } // ScriptMgr.Header = parser.Header; } else { Result.IsSuccess = true; } }