public static int Main(string[] args) { int result = 0; try { string unparsedScript = ParseCommandLine(args); CommandLibrary.FindCommands(); OpsContext context = new OpsContext(CreateDevice()); OpsScript script = new OpsScript(CommandLibrary, unparsedScript); script.Run(context); if (OpsConsole.Verbose) { OpsConsole.WriteLine("Success"); } } catch { OpsConsole.WriteLine("Application cannot continue due to errors."); result = -1; } finally { Close(); } return(result); }
public void Run(OpsContext context) { if(Statements == null) return; if(OpsConsole.Verbose) OpsConsole.WriteLine("Processing script starting"); for( int i = 0; i < Statements.Length; i++) { try { if(OpsConsole.Verbose) OpsConsole.WriteLine("Processing statement #{0}: \"{1}\"", i+1, Statements[i].Parsed); Statements[i].Run(context); } catch(Exception e) { OpsConsole.WriteError(i+1, e, "Failure processing statement."); throw; } } if(OpsConsole.Verbose) OpsConsole.WriteLine("Processing script finished"); }
public void Run(OpsContext context) { if (Statements == null) { return; } if (OpsConsole.Verbose) { OpsConsole.WriteLine("Processing script starting"); } for (int i = 0; i < Statements.Length; i++) { try { if (OpsConsole.Verbose) { OpsConsole.WriteLine("Processing statement #{0}: \"{1}\"", i + 1, Statements[i].Parsed); } Statements[i].Run(context); } catch (Exception e) { OpsConsole.WriteError(i + 1, e, "Failure processing statement."); throw; } } if (OpsConsole.Verbose) { OpsConsole.WriteLine("Processing script finished"); } }
public static int Main(string[] args) { int result = 0; try { string unparsedScript = ParseCommandLine(args); CommandLibrary.FindCommands(); OpsContext context = new OpsContext( CreateDevice()); OpsScript script = new OpsScript(CommandLibrary, unparsedScript); script.Run(context); if(OpsConsole.Verbose) OpsConsole.WriteLine("Success"); } catch { OpsConsole.WriteLine("Application cannot continue due to errors." ); result = -1; } finally { Close(); } return result; }
public ArrayList GetContent( OpsContext context ) { if( Command.Content == ContentType.MODELS ) return context.FindModels(ContentRegex); else if( Command.Content == ContentType.TEXTURES ) return context.FindTextures(ContentRegex); string errorStr = "OpsStatement.GetContent should not be used with commands for content type: " + Command.Content; System.Diagnostics.Debug.Assert(false, errorStr); throw new OpsException(errorStr); }
public ArrayList GetContent(OpsContext context) { if (Command.Content == ContentType.MODELS) { return(context.FindModels(ContentRegex)); } else if (Command.Content == ContentType.TEXTURES) { return(context.FindTextures(ContentRegex)); } string errorStr = "OpsStatement.GetContent should not be used with commands for content type: " + Command.Content; System.Diagnostics.Debug.Assert(false, errorStr); throw new OpsException(errorStr); }
public void Run(OpsContext context) { Command.Run(context, this); }
//IOpsCommand public void Run(OpsContext context, OpsStatement statement) { UnloadArguments args = statement.Arguments as UnloadArguments; if( args.Type == ContentType.GENERIC || args.Type == ContentType.MODELS ) { ArrayList models = context.FindModels(args.Src); foreach( OpsModel model in models ) { OpsConsole.WriteLine( "Unloading model: '{0}'", model.Name ); context.RemoveModel(model.Name); } } if( args.Type == ContentType.GENERIC || args.Type == ContentType.TEXTURES ) { ArrayList textures = context.FindTextures(args.Src); foreach( OpsTexture texture in textures ) { OpsConsole.WriteLine( "Unloading texture: '{0}'", texture.Name ); context.RemoveTexture(texture.Name); } } }