本文整理汇总了C#中IScript类的典型用法代码示例。如果您正苦于以下问题:C# IScript类的具体用法?C# IScript怎么用?C# IScript使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IScript类属于命名空间,在下文中一共展示了IScript类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ScriptStarting
public bool ScriptStarting(IScript script)
{
if (AskConfirmation(String.Format("Start script '{0}'", script.Name)))
return scriptRunner.ScriptStarting(script);
else
return false;
}
示例2: ScriptSerializer
/// <summary>
/// Initializes a new instance of the <see cref="ScriptSerializer"/> class.
/// </summary>
/// <param name="script">The script.</param>
public ScriptSerializer(IScript script)
{
if (script == null)
throw new ArgumentNullException("script");
m_Script = script;
}
示例3: ForEachScript
public ForEachScript(ScriptContext scriptContext, string variable, IFunctionGeneric list, IScript loopScript)
{
m_scriptContext = scriptContext;
m_variable = variable;
m_list = list;
m_loopScript = loopScript;
}
示例4: LogPostExecution
public virtual void LogPostExecution(IScript script)
{
if (SimpleSaveExtensions.LogScriptsPostExecution)
{
Log(script, "Executed script");
}
}
示例5: ScriptComponent
public ScriptComponent(int gameObjectId, String gameObjectkey, IScript script)
{
m_ComponentType = ComponentType.Instance(Constant.enumComponent.SCRIPT);
m_Script = script;
m_GameObjectId = gameObjectId;
m_GameObjectkey = gameObjectkey;
}
示例6: LogBuilt
public virtual void LogBuilt(IScript script)
{
if (SimpleSaveExtensions.LogBuiltScripts && Logger.IsDebugEnabled)
{
Logger.Debug(BuildDebugMessage(script, "Built script"));
}
}
示例7: LogExecutionTime
public virtual void LogExecutionTime(long executionTimeMilliseconds, IScript script)
{
if (executionTimeMilliseconds > SimpleSaveExtensions.ExecutionTimeWarningEmitThresholdMilliseconds)
{
if (Logger.IsWarnEnabled)
{
Logger.Warn(string.Format(
@"SIMPLESAVE SCRIPT EXECUTED IN {0}ms:
{1}
CALLING STACK TRACE:
{2}",
executionTimeMilliseconds,
script.Buffer,
Environment.StackTrace));
}
}
else
{
if (Logger.IsInfoEnabled)
{
Logger.Info(string.Format(
"SimpleSave script executed in {0}ms",
executionTimeMilliseconds));
}
}
}
示例8: GetInputScript
public GetInputScript(ScriptContext scriptContext, IScriptFactory scriptFactory, IScript callbackScript)
{
m_scriptContext = scriptContext;
m_worldModel = scriptContext.WorldModel;
m_scriptFactory = scriptFactory;
m_callbackScript = callbackScript;
}
示例9: Recompile
public void Recompile()
{
if (_compiling)
return;
_host.Reset();
Commands.Clear();
_script = null;
_compiling = true;
Send("Compiling...");
ThreadPool.QueueUserWorkItem(a =>
{
try
{
var type = Compile();
if (type == null)
return;
Send("Done!");
SafeInvoke(() =>
{
_script = (IScript)Activator.CreateInstance(type);
_script.Initialize(_host);
});
}
finally
{
_compiling = false;
}
});
}
示例10: IsRemoved
private bool IsRemoved(IScript script, IEnumerable<IScript> currentScripts, IEnumerable<IScript> scriptLog)
{
bool isInLog = scriptLog.Any(s => StrCmp(script.Name, s.Name));
bool isInCurrent = currentScripts.Any(s => StrCmp(script.Name, s.Name));
return isInLog && !isInCurrent;
}
示例11: IfScript
public IfScript(IFunction<bool> expression, IScript thenScript, IScript elseScript, WorldModel worldModel)
{
m_expression = expression;
m_thenScript = thenScript;
m_elseScript = elseScript;
m_worldModel = worldModel;
}
示例12: DoExecute
/// <summary>
/// Executes the script.
/// </summary>
/// <param name="p_scpScript">The C# Script to execute.</param>
/// <returns><c>true</c> if the script completes successfully;
/// <c>false</c> otherwise.</returns>
/// <exception cref="ArgumentException">Thrown if <paramref name="p_scpScript"/> is not a
/// <see cref="CSharpScript"/>.</exception>
public override bool DoExecute(IScript p_scpScript)
{
if (!(p_scpScript is CSharpScript))
throw new ArgumentException("The given script must be of type CSharpScript.", "p_scpScript");
CSharpScript cscScript = (CSharpScript)p_scpScript;
byte[] bteScript = Compile(cscScript.Code);
if (bteScript == null)
return false;
AppDomain admScript = CreateSandbox(p_scpScript);
try
{
m_csfFunctions.TaskStarted += new EventHandler<EventArgs<IBackgroundTask>>(Functions_TaskStarted);
object[] args = { m_csfFunctions };
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
ScriptRunner srnRunner = null;
try
{
srnRunner = (ScriptRunner)admScript.CreateInstanceFromAndUnwrap(typeof(ScriptRunner).Assembly.ManifestModule.FullyQualifiedName, typeof(ScriptRunner).FullName, false, BindingFlags.Default, null, args, null, null);
}
finally
{
AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
}
return srnRunner.Execute(bteScript);
}
finally
{
m_csfFunctions.TaskStarted -= Functions_TaskStarted;
AppDomain.Unload(admScript);
}
}
示例13: FunctionCallScript
public FunctionCallScript(GameLoader loader, string procedure, IList<IFunction> parameters, IScript paramFunction)
{
m_loader = loader;
m_procedure = procedure.Replace(" ", Utility.SpaceReplacementString);
m_parameters = new FunctionCallParameters(parameters);
m_paramFunction = paramFunction;
}
示例14: ForEachScript
public ForEachScript(WorldModel worldModel, string variable, IFunctionGeneric list, IScript loopScript)
{
m_worldModel = worldModel;
m_variable = variable;
m_list = list;
m_loopScript = loopScript;
}
示例15: SqlPlusScript
public SqlPlusScript(IScript script)
{
_script = script;
_wrappedScriptPath = System.IO.Path.GetTempFileName();
var reader = new ScriptReader();
using (var fileStream = File.OpenWrite(_wrappedScriptPath))
{
using (var tempFile = new StreamWriter(fileStream, UTF8.WithoutByteOrderMark))
{
tempFile.WriteLine("SET ECHO ON");
tempFile.WriteLine("WHENEVER SQLERROR EXIT SQL.SQLCODE");
foreach (var scriptLine in reader.GetContents(_script.Path))
{
tempFile.WriteLine(scriptLine);
}
tempFile.WriteLine("COMMIT;");
tempFile.WriteLine("EXIT");
}
}
}