public void ReadScriptFile() { string[] lines = File.ReadAllLines(AbsolutePath); List <string> commands = new List <string>(); Scripts.Clear(); for (int i = 0; i < lines.Length; i++) { if (lines[i].StartsWith("#begin ")) { string name = lines[i++].Substring("#begin ".Length); commands.Clear(); for (int j = i; (i = j) < lines.Length; j++) { if (lines[j].StartsWith("#end")) { i++; break; } commands.Add(lines[j]); } Scripts.Add(name, new Script(commands, this)); } } }
protected override void OnUpdate(GameplayScreen gameplayScreen) { if (Dynamic.Level.ID != 16) { return; } if (teleportTriggered) { return; } if (Scripts.Count != 0) { teleportEnabled = true; Scripts.Clear(); } if (teleportEnabled && Scripts.Count == 0) { LevelReflected.JukeBox.StopSong(); LevelReflected.RequestChangeLevel(new LevelChangeRequest { LevelID = 15, RoomID = 0, IsUsingWarp = true, IsUsingWhiteFadeOut = true, FadeInTime = 0.5f, FadeOutTime = 0.25f }); // Return to Pyramid start LevelReflected.JukeBox.PlaySong(Timespinner.GameAbstractions.EBGM.Level15); teleportTriggered = true; } }
public void LoadAllScripts() { DirectoryInfo basePathInfo = new DirectoryInfo(BasePath); if (!basePathInfo.Exists) { basePathInfo.Create(); } DirectoryInfo macroditorPathInfo = new DirectoryInfo(MacroditorPath); if (!macroditorPathInfo.Exists) { macroditorPathInfo.Create(); } foreach (var manifestResourceName in typeof(MainViewModel).Assembly.GetManifestResourceNames()) { Debug.WriteLine(manifestResourceName); } WriteResourceToFile(ReferencedAssembliesFile, "Macroditor.MacroditorScripsResources.ReferencedAssembliesFile", overrideExisting: false); WriteResourceToFile(GlobalUsingsFile, "Macroditor.MacroditorScripsResources.GlobalUsings", overrideExisting: false); IEnumerable <FileInfo> files = basePathInfo.GetFiles("*.csx").Concat(basePathInfo.GetFiles("*.cs")); Scripts.Clear(); foreach (var file in files) { Scripts.Add(new Script(file.FullName, ReferencedAssembliesFile, GlobalUsingsFile)); } }
bool LoadFile(string pathToFile) { if (!File.Exists(pathToFile)) { Debug.LogError("EgoXproject: Change file does not exist: " + pathToFile); return(false); } SavePath = pathToFile; PList p = new PList(); if (!p.Load(SavePath)) { return(false); } if (!Validate(p)) { return(false); } //set the platform. if non specified will default to ios BuildPlatform platform; if (p.Root.EnumValue(BUILD_PLATFORM_KEY, out platform)) { Platform = platform; } else { Platform = BuildPlatform.iOS; } //reset everything Frameworks.Clear(); FilesAndFolders.Clear(); BuildSettings.Clear(); Scripts.Clear(); Signing.Clear(); Capabilities.Clear(); //load everything InfoPlistChanges = p.Root.DictionaryValue(INFO_PLIST_KEY).Copy() as PListDictionary; AppConfig = p.Root.DictionaryValue(APP_CONFIG_KEY) != null?p.Root.DictionaryValue(APP_CONFIG_KEY).Copy() as PListDictionary : new PListDictionary(); AppConfigEnabled = p.Root.ArrayValue(APP_CONFIG_ENABLED_KEY) != null?p.Root.ArrayValue(APP_CONFIG_ENABLED_KEY).Copy() as PListArray : new PListArray(); ManualEntitlements = p.Root.DictionaryValue(MANUAL_ENTITLEMENTS) != null?p.Root.DictionaryValue(MANUAL_ENTITLEMENTS).Copy() as PListDictionary : new PListDictionary(); LoadFrameworks(p.Root.DictionaryValue(FRAMEWORKS_KEY)); LoadFilesAndFolders(p.Root.DictionaryValue(FILES_AND_FOLDERS_KEY)); LoadScripts(p.Root.ArrayValue(SCRIPTS_KEY)); LoadBuildSettings(p.Root.ArrayValue(BUILD_SETTINGS_KEY)); LoadSigning(p.Root.DictionaryValue(SIGNING_KEY)); LoadCapabilities(p.Root.DictionaryValue(CAPABILITIES_KEY)); IsDirty = false; return(true); }
//_____________________________________________________________________________________________________________________________________________________________ public void AddScripts(string[] names) { Scripts.Clear(); foreach (string name in names) { AddScript(name); } }
public static void Destroy() { if (Scripts != null) { Scripts.ForEach(x => x.KillScript()); Scripts.Clear(); } }
public void ScriptEngineClearScripts() { Scripts TestScriptEngine = new Scripts(); TestScriptEngine.Start(new EnumerableClass().Foo()); TestScriptEngine.Update(); TestScriptEngine.Clear(); Assert.AreEqual(0, TestScriptEngine.ScriptCollection.Count); }
private void UpdateScriptList() { Scripts.Clear(); Scripts.Add(new ScriptViewModel()); foreach (Script script in _scriptRegistry.Scripts) { Scripts.Add(new ScriptViewModel(script)); } }
public void ClearSetsScriptDone() { var TestScriptEngine = new Scripts(); var Enumerable = new EnumerableClass(); var Script = TestScriptEngine.Start(Enumerable.Foo(), "ScriptName"); Assert.IsFalse(Script.Done); TestScriptEngine.Update(); Assert.IsFalse(Script.Done); TestScriptEngine.Clear(); Assert.IsTrue(Script.Done); }
public void Load() { Logger.Info($"Load scripts: {ScriptDirectory}"); var scriptFiles = Directory.EnumerateFiles(ScriptDirectory); Scripts.Clear(); foreach (var scriptFile in scriptFiles) { var script = LoadScript(scriptFile); Scripts.Add(script); } }
public void Dispose() { Log?.Clear(); Entities?.Clear(); Actions?.Clear(); CalculatedFields?.Clear(); Connections?.Clear(); Environments?.Clear(); Maps?.Clear(); Relationships?.Clear(); Scripts?.Clear(); SearchTypes?.Clear(); Templates?.Clear(); }
public void ProcessJson(dynamic scripts) { Scripts.Clear(); foreach (var source in scripts) { var scriptSourceObject = new ScriptSourceObject(); var script = new Script(); script.LoadProperties(source); scriptSourceObject.ScriptSource = script; Scripts.Add(scriptSourceObject); } GridViewScripts.RefreshData(); }
public void Parse(IList <Token> tokens) { Counts[Scope.Global] = 0; Counts[Scope.Flag] = 0; Counts[Scope.Local] = 0; Counts[Scope.Temp] = 0; Counts[Scope.Const] = 0; Contexts.Clear(); Variables.Clear(); Scripts.Clear(); InitConstants(); InScript = false; Tokens = tokens; Index = 0; LineNumber = 0; LastToken = null; while (Index < Tokens.Count) { Token tok = Peek(); switch (tok.Type) { case TokenType.Keyword: Keyword(); break; case TokenType.Identifier: Identifier(); break; // Ignore EOL tokens entirely case TokenType.EOL: Consume(); LineNumber++; break; default: throw new ParseException($"Cannot start line with {tok}"); } } }
protected virtual void Dispose(bool disposing) { if (disposing) { _input.Dispose(); _classesCache.Clear(); Methods.Clear(); Metadata.Clear(); Instances.Clear(); Classes.Clear(); Scripts.Clear(); MethodBodies.Clear(); Pool.Integers.Clear(); Pool.UIntegers.Clear(); Pool.Doubles.Clear(); Pool.Strings.Clear(); Pool.Namespaces.Clear(); Pool.NamespaceSets.Clear(); Pool.Multinames.Clear(); } }
public override void Clear() { Scripts.Clear(); Text.Clear(); }
private void RenderScriptReferences() { // Get scripts that are added by the framework var frameworkScriptPaths = GetFrameworkScripts(); // Construct smart list var smartList = new List <string>(); // Hard-code WebForms.js - it will be rendered here, and not in Page (like by default) smartList.Add(GetUrl(new ScriptReference(this.Page.ClientScript.GetWebResourceUrl(typeof(System.Web.UI.Page), "WebForms.js")))); // Add scripts needed by the framework smartList.AddRange(frameworkScriptPaths); // Add scripts previously added to this control smartList.AddRange(this.Scripts.Select(s => GetUrl(s))); // Add scripts from the smart loader smartList.AddRange(SmartLoader.GetScriptsToLoad()); // Clear previous scripts (they are now part of smartList) Scripts.Clear(); // Initialize bundling var allowJsBundling = PortalContext.Current.BundleOptions.AllowJsBundling; var bundle = allowJsBundling ? new JsBundle() : null; // Go through all scripts foreach (var spath in smartList) { var lower = spath.ToLower(); if (lower.EndsWith(".css")) { UITools.AddStyleSheetToHeader(UITools.GetHeader(), spath); } else { var isPostponed = PortalBundleOptions.JsIsBlacklisted(spath); var isFrameworkScript = frameworkScriptPaths.Contains(spath); if (isPostponed) { _postponedList.Add(spath); } if (allowJsBundling && !isPostponed) { bundle.AddPath(spath); } if (!isPostponed && !isFrameworkScript) { Scripts.Add(new ScriptReference(spath)); } } } // Go through postponed scripts foreach (var spath in _postponedList) { Scripts.Add(new ScriptReference(spath)); } // NOTE: At this point, script order is the following: // 1) scripts added by the framework // 2) scripts added directly to this control // 3) scripts from SmartLoader (that are not blacklisted from bundling) // 4) scripts from SmartLoader (that are blacklisted from bundling) // Finalize bundling if (allowJsBundling) { // If bundling is allowed, close the bundle and process it bundle.Close(); BundleHandler.AddBundleIfNotThere(bundle); ThreadPool.QueueUserWorkItem(x => BundleHandler.AddBundleToCache(bundle)); if (BundleHandler.IsBundleInCache(bundle)) { // If the bundle is complete, use its path to replace the path of all the scripts that are not postponed _bundle = bundle; } } }
public void Dispose() { Namespaces.Clear(); Scripts.Clear(); IndexTable.Clear(); }
public void ClearScripts() { Scripts.Clear(); Apply(); }
/// <summary>Resets the context and clears the script</summary> public virtual void Reset() { Scripts.Clear(); }
public void Clear() { Scripts.Clear(); }
private void ClearScriptsCommandExecute() { Scripts.Clear(); }