Skip to content

Commit

Permalink
Merge pull request #250 from dotnetcore/any
Browse files Browse the repository at this point in the history
重整项目结构
  • Loading branch information
NMSAzulX authored Dec 30, 2023
2 parents 221c3ba + 2d159a4 commit 929a57d
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 261 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Reflection;
using System.Reflection.Metadata;
using System.Reflection.PortableExecutable;
using System.Runtime.CompilerServices;
using System.Text;

[assembly: InternalsVisibleTo("PluginFunctionUT, PublicKey=002400000480000094000000060200000024000052534131000400000100010069acb31dd0d9918441d6ed2b49cd67ae17d15fd6ded4ccd2f99b4a88df8cddacbf72d5897bb54f406b037688d99f482ff1c3088638b95364ef614f01c3f3f2a2a75889aa53286865463fb1803876056c8b98ec57f0b3cf2b1185de63d37041ba08f81ddba0dccf81efcdbdc912032e8d2b0efa21accc96206c386b574b9d9cb8")]
namespace Natasha.CSharp.Component
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#if NETCOREAPP3_0_OR_GREATER
using System.Reflection;
using System.Runtime.Loader;


public static class NatashaAssemblyDomainExtension
{


public static NatashaReferenceDomain GetDomain(this Assembly assembly)
{

Expand All @@ -16,20 +12,14 @@ public static NatashaReferenceDomain GetDomain(this Assembly assembly)
return NatashaReferenceDomain.DefaultDomain!;
}
return (NatashaReferenceDomain)assemblyDomain!;

}


public static void DisposeDomain(this Assembly assembly)
{

var domain = GetDomain(assembly);
if (domain.Name != "Default")
{
domain.Dispose();
}

}

}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

public static class NatashaDelegateExtension
{

public static NatashaReferenceDomain GetDomain(this Delegate @delegate)
{

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
#if NETCOREAPP3_0_OR_GREATER
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using static System.Runtime.Loader.AssemblyLoadContext;

public static class NatashaDomainExtension
{


/// <summary>
/// 创建一个以该字符串命名的域并锁定
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static void Preheating(Func<AssemblyName?, string?, bool>? excludeReferen
{
return;
}

_excludeReferencesFunc = excludeReferencesFunc;
#if DEBUG
//StopwatchExtension.EnableMemoryMonitor();
Expand All @@ -46,6 +47,7 @@ public static void Preheating(Func<AssemblyName?, string?, bool>? excludeReferen

var task = Task.Run(() =>
{
AssemblyCSharpBuilder tempBuilder = new();
tempBuilder
.UseRandomDomain()
Expand Down Expand Up @@ -147,7 +149,6 @@ public static void Preheating(Func<AssemblyName?, string?, bool>? excludeReferen
{
parallelLoopResults.Enqueue(InitReferenceAndUsingFromPath(paths));
}

}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
using System.Reflection;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;




#if NETCOREAPP3_0_OR_GREATER
using Natasha.CSharp.Component.Domain;
Expand Down Expand Up @@ -179,14 +174,14 @@ public Assembly GetAssembly()
#if NETCOREAPP3_0_OR_GREATER
if (compileResult.Success)
{

if (_compilation.Options.OptimizationLevel == OptimizationLevel.Debug)
{
pdbStream?.Dispose();
}
dllStream.Seek(0, SeekOrigin.Begin);

if (!_notLoadIntoDomain)
{
dllStream.Seek(0, SeekOrigin.Begin);
assembly = Domain.LoadAssemblyFromStream(dllStream, null);
CompileSucceedEvent?.Invoke(_compilation, assembly!);
}
Expand Down

0 comments on commit 929a57d

Please sign in to comment.