forked from scriptcs/scriptcs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/dev' into wpf-sample
- Loading branch information
Showing
52 changed files
with
1,503 additions
and
1,142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,10 @@ | ||
using System.ComponentModel.Composition; | ||
using System.IO; | ||
using ScriptCs.Exceptions; | ||
|
||
namespace ScriptCs | ||
namespace ScriptCs | ||
{ | ||
[Export(Constants.DebugContractName, typeof(IScriptExecutor))] | ||
public class DebugScriptExecutor : ScriptExecutor | ||
{ | ||
private readonly ICompiledDllDebugger _compiledDllDebugger; | ||
|
||
[ImportingConstructor] | ||
public DebugScriptExecutor( | ||
IFileSystem fileSystem, | ||
[Import(Constants.DebugContractName)]IFilePreProcessor filePreProcessor, | ||
IScriptEngine scriptEngine, | ||
ICompiledDllDebugger compiledDllDebugger, | ||
IScriptHostFactory scriptHostFactory) | ||
: base(fileSystem, filePreProcessor, scriptEngine, scriptHostFactory) | ||
{ | ||
_compiledDllDebugger = compiledDllDebugger; | ||
} | ||
|
||
public DebugScriptExecutor( | ||
IFileSystem fileSystem, | ||
IFilePreProcessor filePreProcessor, | ||
IScriptEngine scriptEngine, | ||
ICompiledDllDebugger compiledDllDebugger) | ||
: this(fileSystem, filePreProcessor, scriptEngine, compiledDllDebugger, new ScriptHostFactory()) | ||
{ | ||
} | ||
|
||
protected override void Execute(string absolutePathToScript, ISession session, string code) | ||
{ | ||
var fileName = Path.GetFileName(absolutePathToScript); | ||
var nameWithoutExtension = fileName.Replace(Path.GetExtension(fileName), string.Empty); | ||
var outputName = nameWithoutExtension + ".dll"; | ||
var pdbName = nameWithoutExtension + ".pdb"; | ||
var outputPath = Path.Combine(session.Engine.BaseDirectory, outputName); | ||
var pdbPath = Path.Combine(session.Engine.BaseDirectory, pdbName); | ||
|
||
ISubmission<object> submission = session.CompileSubmission<object>(code); | ||
|
||
ICompilationResult result; | ||
|
||
using (Stream outputStream = _fileSystem.CreateFileStream(outputPath, FileMode.OpenOrCreate)) | ||
using (Stream pdbStream = _fileSystem.CreateFileStream(pdbPath, FileMode.OpenOrCreate)) | ||
{ | ||
result = submission.Compilation.Emit(outputStream, pdbStream); | ||
} | ||
|
||
if (result.Success) | ||
{ | ||
_compiledDllDebugger.Run(outputPath, session); | ||
} | ||
else | ||
{ | ||
throw new CompilationException(result.ErrorMessage); | ||
} | ||
} | ||
} | ||
public class DebugScriptExecutor : ScriptExecutor | ||
{ | ||
public DebugScriptExecutor(IFileSystem fileSystem, IFilePreProcessor filePreProcessor, IScriptEngine scriptEngine) | ||
: base(fileSystem, filePreProcessor, scriptEngine) | ||
{ | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
|
||
namespace ScriptCs.Exceptions | ||
{ | ||
public class ScriptExecutionException : Exception | ||
{ | ||
public ScriptExecutionException(string message) : base(message) | ||
{ | ||
} | ||
} | ||
} |
Oops, something went wrong.