Skip to content

Commit

Permalink
do not support .NET 3.5 anymore.
Browse files Browse the repository at this point in the history
  • Loading branch information
hecomi committed Nov 29, 2017
1 parent 4faa759 commit cc19364
Show file tree
Hide file tree
Showing 19 changed files with 50 additions and 180 deletions.
Binary file modified Assets/uREPL/Examples/Scenes/Multi Line.unity
Binary file not shown.
Binary file modified Assets/uREPL/Examples/Scenes/Multiple GUIs.unity
Binary file not shown.
Binary file modified Assets/uREPL/Examples/Scenes/Runtime Command.unity
Binary file not shown.
Binary file modified Assets/uREPL/Examples/Scenes/Screen Overlay.unity
Binary file not shown.
Binary file modified Assets/uREPL/Examples/Scenes/Single Line.unity
Binary file not shown.
Binary file modified Assets/uREPL/Examples/Scenes/World Space.unity
Binary file not shown.
Binary file removed Assets/uREPL/Plugins/Mono.CSharp.3.5.dll
Binary file not shown.
108 changes: 0 additions & 108 deletions Assets/uREPL/Plugins/Mono.CSharp.4.x.dll.meta

This file was deleted.

File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Assets/uREPL/Resources/uREPL/Prefabs/uREPL.prefab
Binary file not shown.
10 changes: 2 additions & 8 deletions Assets/uREPL/Scripts/Core/Evaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,14 @@ static public CompileResult Evaluate(string code, bool autoCompleteComma = true)
// eval the code using Mono.
object ret = null;
bool hasReturnValue = false;

var originalOutput = Mono.MessageOutput;
var errorWriter = new System.IO.StringWriter();
bool isPartial = false;
Mono.MessageOutput = errorWriter;
try {
isPartial = Mono.Evaluate(code, out ret, out hasReturnValue) != null;
} catch (System.Exception e) {
errorWriter.Write(e.Message);
UnityEngine.Debug.LogError(e.Message);
}
Mono.MessageOutput = originalOutput;

var error = errorWriter.ToString();
var error = Mono.lastOutput;
if (!string.IsNullOrEmpty(error)) {
error = error.Replace("{interactive}", "");
var lastLineBreakPos = error.LastIndexOf('\n');
Expand All @@ -106,7 +101,6 @@ static public CompileResult Evaluate(string code, bool autoCompleteComma = true)
result.error = error;
return result;
}
errorWriter.Dispose();

if (isPartial) {
result.type = CompileResult.Type.Partial;
Expand Down
96 changes: 37 additions & 59 deletions Assets/uREPL/Scripts/Core/Mono.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,52 @@
namespace uREPL
using System.IO;
using System.Text;

namespace uREPL
{

#if NET_4_6
public class MonoMessageReporter : TextWriter
{
public string lastOutput { get; private set; }

public override void Write(string value)
{
lastOutput = value;
}

public override void WriteLine(string value)
{
lastOutput = value;
}

public void Reset()
{
lastOutput = "";
}

public override Encoding Encoding
{
get { return Encoding.Default; }
}
}

static public class Mono
{
static global::Mono.CSharp.Evaluator evaluator;

static public System.IO.StringWriter MessageOutput
static MonoMessageReporter reporter = new MonoMessageReporter();
static public string lastOutput
{
get { return null; }
set {}
get
{
var output = reporter.lastOutput;
reporter.Reset();
return output;
}
}

static public void Initialize()
{
var settings = new global::Mono.CSharp.CompilerSettings();
var printer = new global::Mono.CSharp.ConsoleReportPrinter();
var printer = new global::Mono.CSharp.ConsoleReportPrinter(reporter);
var context = new global::Mono.CSharp.CompilerContext(settings, printer);
evaluator = new global::Mono.CSharp.Evaluator(context);
}
Expand Down Expand Up @@ -57,56 +87,4 @@ static public string GetUsing()
}
}

#else

static public class Mono
{
static public System.IO.TextWriter MessageOutput
{
get { return global::Mono.CSharp.Evaluator.MessageOutput; }
set { global::Mono.CSharp.Evaluator.MessageOutput = value; }
}

static public void Initialize()
{
}

static public void ReferenceAssembly(System.Reflection.Assembly asm)
{
global::Mono.CSharp.Evaluator.ReferenceAssembly(asm);
}

static public object Evaluate(string input)
{
return global::Mono.CSharp.Evaluator.Evaluate(input);
}

static public string Evaluate(string input, out object result, out bool result_set)
{
return global::Mono.CSharp.Evaluator.Evaluate(input, out result, out result_set);
}

static public bool Run(string input)
{
return global::Mono.CSharp.Evaluator.Run(input);
}

static public string[] GetCompletions(string input, out string prefix)
{
return global::Mono.CSharp.Evaluator.GetCompletions(input, out prefix);
}

static public string GetVars()
{
return global::Mono.CSharp.Evaluator.GetVars();
}

static public string GetUsing()
{
return global::Mono.CSharp.Evaluator.GetUsing();
}
}

#endif

}
4 changes: 4 additions & 0 deletions Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"dependencies": {
}
}
Binary file modified ProjectSettings/EditorBuildSettings.asset
Binary file not shown.
Binary file modified ProjectSettings/GraphicsSettings.asset
Binary file not shown.
Binary file modified ProjectSettings/ProjectSettings.asset
Binary file not shown.
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
m_EditorVersion: 2017.2.0f3
m_EditorVersion: 2017.3.0b11
Binary file removed ProjectSettings/UnityAdsSettings.asset
Binary file not shown.

0 comments on commit cc19364

Please sign in to comment.