-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
272 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
</PropertyGroup> | ||
|
||
</Project> |
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,11 +1,9 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using JetBrains.Annotations; | ||
using JetBrains.Annotations; | ||
using Microsoft.CodeAnalysis; | ||
|
||
namespace MirrorSharp.Advanced { | ||
[PublicAPI] | ||
public interface IRoslynSession { | ||
[NotNull] Project Project { get; } | ||
[PublicAPI, NotNull] Project Project { get; } | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
using System; | ||
using System.Collections.Immutable; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using JetBrains.Annotations; | ||
using Microsoft.CodeAnalysis; | ||
|
||
namespace MirrorSharp.Internal.Abstraction { | ||
internal interface ILanguageSession : IDisposable { | ||
[NotNull] string GetText(); | ||
void ReplaceText([CanBeNull] string newText, int start = 0, [CanBeNull] int? length = null); | ||
|
||
[NotNull] Task<ImmutableArray<Diagnostic>> GetDiagnosticsAsync(CancellationToken cancellationToken); | ||
} | ||
} |
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 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 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 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,9 @@ | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
[assembly: InternalsVisibleTo("MirrorSharp.Tests.Roslyn2.Net46")] |
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,75 @@ | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
using JetBrains.Annotations; | ||
using Microsoft.FSharp.Compiler.AbstractIL.Internal; | ||
|
||
namespace MirrorSharp.FSharp { | ||
internal class RestrictedFileSystem : Library.Shim.IFileSystem { | ||
public Assembly AssemblyLoad(AssemblyName assemblyName) { | ||
return Assembly.Load(assemblyName); | ||
} | ||
|
||
public Assembly AssemblyLoadFrom(string fileName) { | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public void FileDelete(string fileName) { | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public Stream FileStreamCreateShim(string fileName) { | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public Stream FileStreamReadShim(string fileName) { | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public Stream FileStreamWriteExistingShim(string fileName) { | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public string GetFullPathShim(string fileName) { | ||
EnsureAllowed(fileName); | ||
if (!Path.IsPathRooted(fileName)) | ||
throw new NotSupportedException(); | ||
return fileName; | ||
} | ||
|
||
public DateTime GetLastWriteTimeShim(string fileName) { | ||
EnsureAllowed(fileName); | ||
return File.GetLastWriteTime(fileName); | ||
} | ||
|
||
public string GetTempPathShim() { | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public bool IsInvalidPathShim(string filename) { | ||
return filename.IndexOfAny(Path.GetInvalidPathChars()) >= 0; | ||
} | ||
|
||
public bool IsPathRootedShim(string path) { | ||
return Path.IsPathRooted(path); | ||
} | ||
|
||
public byte[] ReadAllBytesShim(string fileName) { | ||
EnsureAllowed(fileName); | ||
return File.ReadAllBytes(fileName); | ||
} | ||
|
||
public bool SafeExists(string fileName) { | ||
EnsureAllowed(fileName); | ||
return File.Exists(fileName); | ||
} | ||
|
||
[AssertionMethod] | ||
private static void EnsureAllowed(string fileName) { | ||
if (!fileName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) | ||
&& !fileName.EndsWith(".optdata", StringComparison.OrdinalIgnoreCase) | ||
&& !fileName.EndsWith(".sigdata", StringComparison.OrdinalIgnoreCase)) | ||
throw new NotSupportedException(); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.