2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-05-07 20:12:57 +00:00

.Net 6 Upgrade

This commit is contained in:
Ahmed Zamil 2021-12-01 12:17:45 +03:00
parent 1166e93ba9
commit 530df018ec
164 changed files with 21247 additions and 21425 deletions

View File

@ -32,8 +32,7 @@ using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel; using System.ComponentModel;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
namespace Esiur.Stores.EntityCore namespace Esiur.Stores.EntityCore;
{
public class EntityResource : IResource public class EntityResource : IResource
{ {
@ -72,4 +71,3 @@ namespace Esiur.Stores.EntityCore
} }
}

View File

@ -34,8 +34,7 @@ using System.Linq;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using System.Reflection; using System.Reflection;
namespace Esiur.Stores.EntityCore namespace Esiur.Stores.EntityCore;
{
public class EntityStore : IStore public class EntityStore : IStore
{ {
public Instance Instance { get; set; } public Instance Instance { get; set; }
@ -239,4 +238,3 @@ namespace Esiur.Stores.EntityCore
OnDestroy?.Invoke(this); OnDestroy?.Invoke(this);
} }
} }
}

View File

@ -5,8 +5,8 @@ using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
namespace Esiur.Stores.EntityCore namespace Esiur.Stores.EntityCore;
{
struct EntityTypeInfo struct EntityTypeInfo
{ {
public string Name; public string Name;
@ -14,4 +14,3 @@ namespace Esiur.Stores.EntityCore
public PropertyInfo PrimaryKey; public PropertyInfo PrimaryKey;
// public Func<DbContext> Getter; // public Func<DbContext> Getter;
} }
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<AssemblyName>Esiur.Stores.EntityCore</AssemblyName> <AssemblyName>Esiur.Stores.EntityCore</AssemblyName>
<Authors>Ahmed Kh. Zamil</Authors> <Authors>Ahmed Kh. Zamil</Authors>
<Company>Esiur Foundation</Company> <Company>Esiur Foundation</Company>
@ -10,6 +10,7 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>Esiur.Stores.EntityCore</PackageId> <PackageId>Esiur.Stores.EntityCore</PackageId>
<Version>1.2.5</Version> <Version>1.2.5</Version>
<LangVersion>latest</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -21,7 +22,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Include="System.Collections" Version="4.3.0" /> <PackageReference Include="System.Collections" Version="4.3.0" />
</ItemGroup> </ItemGroup>

View File

@ -36,8 +36,8 @@ using System.Reflection;
using Esiur.Proxy; using Esiur.Proxy;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Esiur.Stores.EntityCore namespace Esiur.Stores.EntityCore;
{
public class EsiurExtensionOptions : IDbContextOptionsExtension public class EsiurExtensionOptions : IDbContextOptionsExtension
{ {
@ -102,13 +102,17 @@ namespace Esiur.Stores.EntityCore
public override string LogFragment => "Esiur"; public override string LogFragment => "Esiur";
public override long GetServiceProviderHashCode() => 2312; public override int GetServiceProviderHashCode() => 2312;
public override void PopulateDebugInfo(IDictionary<string, string> debugInfo) public override void PopulateDebugInfo(IDictionary<string, string> debugInfo)
{ {
} }
public override bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other)
{
return true;
}
} }
} }
}

View File

@ -37,8 +37,8 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
namespace Esiur.Stores.EntityCore namespace Esiur.Stores.EntityCore;
{
public static class EsiurExtensions public static class EsiurExtensions
{ {
//public static T CreateResource<T>(this DbContext dbContext, object properties = null) where T:class,IResource //public static T CreateResource<T>(this DbContext dbContext, object properties = null) where T:class,IResource
@ -198,4 +198,3 @@ namespace Esiur.Stores.EntityCore
//} //}
} }
}

View File

@ -30,8 +30,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Stores.EntityCore namespace Esiur.Stores.EntityCore;
{
public class EsiurPlugin : IConventionSetPlugin public class EsiurPlugin : IConventionSetPlugin
{ {
private readonly IDbContextOptions _options; private readonly IDbContextOptions _options;
@ -57,4 +56,3 @@ namespace Esiur.Stores.EntityCore
} }
} }
}

View File

@ -39,8 +39,8 @@ using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Esiur.Data; using Esiur.Data;
namespace Esiur.Stores.EntityCore namespace Esiur.Stores.EntityCore;
{
public class EsiurProxyRewrite : IModelFinalizingConvention public class EsiurProxyRewrite : IModelFinalizingConvention
{ {
private static readonly MethodInfo _createInstance private static readonly MethodInfo _createInstance
@ -48,23 +48,11 @@ namespace Esiur.Stores.EntityCore
private readonly ConstructorBindingConvention _directBindingConvention; private readonly ConstructorBindingConvention _directBindingConvention;
//public static object CreateInstance(IDbContextOptions dbContextOptions, IEntityType entityType,
// object[] constructorArguments, DbContext context, long id)
//{
// return CreateInstance(dbContextOptions, entityType,
// constructorArguments, context, id);
//}
public static object CreateInstance(
IDbContextOptions dbContextOptions, public static object CreateInstance(IDbContextOptions dbContextOptions,
IEntityType entityType, IEntityType entityType,
//object id object[] properties)
object[] properties
// ILazyLoader loader,
// object[] constructorArguments,
//DbContext context,
)
{ {
var id = properties.First(); var id = properties.First();
@ -116,15 +104,16 @@ namespace Esiur.Stores.EntityCore
// var ann = entityType.GetAnnotation(CoreAnnotationNames.ConstructorBinding); // var ann = entityType.GetAnnotation(CoreAnnotationNames.ConstructorBinding);
#pragma warning disable EF1001 // Internal EF Core API usage. #pragma warning disable EF1001 // Internal EF Core API usage.
var binding = (InstantiationBinding)entityType[CoreAnnotationNames.ConstructorBinding]; var binding = ((EntityType)entityType).ConstructorBinding;// (InstantiationBinding)entityType[CoreAnnotationNames.ConstructorBinding];
#pragma warning restore EF1001 // Internal EF Core API usage. #pragma warning restore EF1001 // Internal EF Core API usage.
if (binding == null) if (binding == null)
{
_directBindingConvention.ProcessModelFinalizing(modelBuilder, context); _directBindingConvention.ProcessModelFinalizing(modelBuilder, context);
#pragma warning disable EF1001 // Internal EF Core API usage. #pragma warning disable EF1001 // Internal EF Core API usage.
binding = (InstantiationBinding)entityType[CoreAnnotationNames.ConstructorBinding]; binding = ((EntityType)entityType).ConstructorBinding; // (InstantiationBinding)entityType[CoreAnnotationNames.ConstructorBinding];
#pragma warning restore EF1001 // Internal EF Core API usage. #pragma warning restore EF1001 // Internal EF Core API usage.
}
try try
{ {
@ -133,31 +122,43 @@ namespace Esiur.Stores.EntityCore
if (key == null) if (key == null)
continue; continue;
//var keys = entityType.FindPrimaryKey().Properties.Select(x=>new PropertyParameterBinding(x));
entityType.SetAnnotation( ((EntityType)entityType).SetConstructorBinding(
#pragma warning disable EF1001 // Internal EF Core API usage. UpdateConstructorBindings(key, proxyType),
CoreAnnotationNames.ConstructorBinding, ConfigurationSource.Convention);
#pragma warning restore EF1001 // Internal EF Core API usage.
new FactoryMethodBinding( binding = ((EntityType)entityType).ServiceOnlyConstructorBinding;
_createInstance, if (binding != null)
new List<ParameterBinding>
{ {
new DependencyInjectionParameterBinding(typeof(IDbContextOptions), typeof(IDbContextOptions)), ((EntityType)entityType).SetServiceOnlyConstructorBinding(
new EntityTypeParameterBinding(), UpdateConstructorBindings(key, proxyType),
//new PropertyParameterBinding(key) ConfigurationSource.Convention);
// constructor arguments }
//new ObjectArrayParameterBinding(binding.ParameterBindings),
//new ContextParameterBinding(typeof(DbContext)),
//new ObjectArrayParameterBinding(entityType.FindPrimaryKey().Properties.Select(x=>new PropertyParameterBinding(x)).ToArray())
new ObjectArrayParameterBinding(new ParameterBinding[]{
new PropertyParameterBinding(key) })
//})
// new Microsoft.EntityFrameworkCore.Metadata.ObjectArrayParameterBinding(),
//new ObjectArrayParameterBinding()
},
proxyType)); // entityType.SetAnnotation(
//#pragma warning disable EF1001 // Internal EF Core API usage.
// CoreAnnotationNames.ConstructorBinding,
//#pragma warning restore EF1001 // Internal EF Core API usage.
// new FactoryMethodBinding(
// _createInstance,
// new List<ParameterBinding>
// {
// new DependencyInjectionParameterBinding(typeof(IDbContextOptions), typeof(IDbContextOptions)),
// new EntityTypeParameterBinding(),
// //new PropertyParameterBinding(key)
// // constructor arguments
// //new ObjectArrayParameterBinding(binding.ParameterBindings),
// //new ContextParameterBinding(typeof(DbContext)),
// //new ObjectArrayParameterBinding(entityType.FindPrimaryKey().Properties.Select(x=>new PropertyParameterBinding(x)).ToArray())
// new ObjectArrayParameterBinding(new ParameterBinding[]{
// new PropertyParameterBinding(key) })
// //})
// // new Microsoft.EntityFrameworkCore.Metadata.ObjectArrayParameterBinding(),
// //new ObjectArrayParameterBinding()
// },
// proxyType));
} }
catch catch
@ -165,9 +166,30 @@ namespace Esiur.Stores.EntityCore
} }
}
}
} }
}
private InstantiationBinding UpdateConstructorBindings(
IConventionProperty key,
Type proxyType)
{
return new FactoryMethodBinding(
_createInstance,
new List<ParameterBinding>
{
new DependencyInjectionParameterBinding(typeof(IDbContextOptions), typeof(IDbContextOptions)),
new EntityTypeParameterBinding(),
new ObjectArrayParameterBinding(new ParameterBinding[]{
new PropertyParameterBinding((IProperty)key) })
},
proxyType);
}
} }

View File

@ -13,6 +13,7 @@
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Version>1.5.2</Version> <Version>1.5.2</Version>
<PackageId>Esiur.Stores.MongoDB</PackageId> <PackageId>Esiur.Stores.MongoDB</PackageId>
<LangVersion>latest</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -37,8 +37,8 @@ using System.Linq;
using Esiur.Security.Permissions; using Esiur.Security.Permissions;
using Esiur.Proxy; using Esiur.Proxy;
namespace Esiur.Stores.MongoDB namespace Esiur.Stores.MongoDB;
{
public class MongoDBStore : IStore public class MongoDBStore : IStore
{ {
public Instance Instance { get; set; } public Instance Instance { get; set; }
@ -271,7 +271,7 @@ namespace Esiur.Stores.MongoDB
else else
{ {
return new AsyncReply<object>(value.RawValue); return new AsyncReply<object>(BsonTypeMapper.MapToDotNetValue(value));
} }
} }
@ -917,4 +917,3 @@ namespace Esiur.Stores.MongoDB
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
}

View File

@ -4,8 +4,8 @@ using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Core namespace Esiur.Core;
{
public class AsyncAwaiter : INotifyCompletion public class AsyncAwaiter : INotifyCompletion
{ {
Action callback = null; Action callback = null;
@ -50,4 +50,3 @@ namespace Esiur.Core
} }
}

View File

@ -4,8 +4,8 @@ using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Core namespace Esiur.Core;
{
public class AsyncAwaiter<T> : INotifyCompletion public class AsyncAwaiter<T> : INotifyCompletion
{ {
Action callback = null; Action callback = null;
@ -49,5 +49,3 @@ namespace Esiur.Core
} }
}

View File

@ -28,8 +28,8 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Core namespace Esiur.Core;
{
public class AsyncBag : AsyncReply public class AsyncBag : AsyncReply
{ {
@ -128,4 +128,3 @@ namespace Esiur.Core
} }
} }
}

View File

@ -4,8 +4,8 @@ using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Core namespace Esiur.Core;
{
public class AsyncBagAwaiter : INotifyCompletion public class AsyncBagAwaiter : INotifyCompletion
{ {
Action callback = null; Action callback = null;
@ -49,5 +49,3 @@ namespace Esiur.Core
} }
}

View File

@ -4,8 +4,8 @@ using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Core namespace Esiur.Core;
{
public class AsyncBagAwaiter<T> : INotifyCompletion public class AsyncBagAwaiter<T> : INotifyCompletion
{ {
Action callback = null; Action callback = null;
@ -49,5 +49,3 @@ namespace Esiur.Core
} }
}

View File

@ -28,8 +28,8 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Core namespace Esiur.Core;
{
public class AsyncBag<T> : AsyncBag public class AsyncBag<T> : AsyncBag
{ {
public AsyncBag<T> Then(Action<T[]> callback) public AsyncBag<T> Then(Action<T[]> callback)
@ -72,4 +72,3 @@ namespace Esiur.Core
} }
} }
}

View File

@ -26,8 +26,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Core namespace Esiur.Core;
{
public class AsyncException : Exception public class AsyncException : Exception
{ {
public readonly ErrorType Type; public readonly ErrorType Type;
@ -54,4 +54,3 @@ namespace Esiur.Core
return Code.ToString() + ": " + Message; return Code.ToString() + ": " + Message;
} }
} }
}

View File

@ -28,8 +28,8 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Core namespace Esiur.Core;
{
public class AsyncQueue<T> : AsyncReply<T> public class AsyncQueue<T> : AsyncReply<T>
{ {
List<AsyncReply<T>> list = new List<AsyncReply<T>>(); List<AsyncReply<T>> list = new List<AsyncReply<T>>();
@ -81,4 +81,3 @@ namespace Esiur.Core
} }
} }
}

View File

@ -33,8 +33,8 @@ using System.Threading;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Diagnostics; using System.Diagnostics;
namespace Esiur.Core namespace Esiur.Core;
{
[AsyncMethodBuilder(typeof(AsyncReplyBuilder))] [AsyncMethodBuilder(typeof(AsyncReplyBuilder))]
public class AsyncReply public class AsyncReply
{ {
@ -356,5 +356,4 @@ namespace Esiur.Core
}
} }

View File

@ -3,8 +3,8 @@ using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
namespace Esiur.Core namespace Esiur.Core;
{
public class AsyncReplyBuilder public class AsyncReplyBuilder
{ {
AsyncReply reply; AsyncReply reply;
@ -65,4 +65,3 @@ namespace Esiur.Core
} }
} }
}

View File

@ -3,8 +3,8 @@ using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
namespace Esiur.Core namespace Esiur.Core;
{
public class AsyncReplyBuilder<T> public class AsyncReplyBuilder<T>
{ {
AsyncReply<T> reply; AsyncReply<T> reply;
@ -58,10 +58,10 @@ namespace Esiur.Core
public AsyncReply<T> Task public AsyncReply<T> Task
{ {
get { get
{
return reply; return reply;
} }
} }
} }
}

View File

@ -33,8 +33,8 @@ using System.Threading;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Diagnostics; using System.Diagnostics;
namespace Esiur.Core namespace Esiur.Core;
{
[AsyncMethodBuilder(typeof(AsyncReplyBuilder<>))] [AsyncMethodBuilder(typeof(AsyncReplyBuilder<>))]
public class AsyncReply<T> : AsyncReply public class AsyncReply<T> : AsyncReply
{ {
@ -375,5 +375,4 @@ namespace Esiur.Core
}
} }

View File

@ -28,8 +28,8 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Core namespace Esiur.Core;
{
public class AsyncReply public class AsyncReply
{ {
@ -182,4 +182,3 @@ namespace Esiur.Core
this.result = result; this.result = result;
} }
} }
}

View File

@ -2,11 +2,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Core namespace Esiur.Core;
{
public enum ErrorType public enum ErrorType
{ {
Management, Management,
Exception Exception
} }
}

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Core namespace Esiur.Core;
{
public enum ExceptionCode : ushort public enum ExceptionCode : ushort
{ {
HostNotReachable, HostNotReachable,
@ -42,4 +42,3 @@ namespace Esiur.Core
AlreadyUnlistened, AlreadyUnlistened,
NotListenable NotListenable
} }
}

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Core namespace Esiur.Core;
{
public enum ExceptionLevel public enum ExceptionLevel
{ {
Code = 0x1, Code = 0x1,
@ -11,4 +11,3 @@ namespace Esiur.Core
Source = 0x4, Source = 0x4,
Trace = 0x8 Trace = 0x8
} }
}

View File

@ -3,8 +3,8 @@ using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
namespace Esiur.Core namespace Esiur.Core;
{
public interface IAsyncReply<out T>//IAsyncEnumerator<T> public interface IAsyncReply<out T>//IAsyncEnumerator<T>
{ {
IAsyncReply<T> Then(Action<T> callback); IAsyncReply<T> Then(Action<T> callback);
@ -18,4 +18,3 @@ namespace Esiur.Core
T Wait(); T Wait();
} }
}

View File

@ -27,8 +27,8 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Core namespace Esiur.Core;
{
public delegate void DestroyedEvent(object sender); public delegate void DestroyedEvent(object sender);
public interface IDestructible public interface IDestructible
@ -36,4 +36,3 @@ namespace Esiur.Core
event DestroyedEvent OnDestroy; event DestroyedEvent OnDestroy;
void Destroy(); void Destroy();
} }
}

View File

@ -29,12 +29,11 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Core namespace Esiur.Core;
{
public enum LogType public enum LogType
{ {
Debug, Debug,
Warning, Warning,
Error, Error,
} }
}

View File

@ -2,11 +2,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Core namespace Esiur.Core;
{
public enum ProgressType public enum ProgressType
{ {
Execution, Execution,
Network, Network,
} }
}

View File

@ -30,8 +30,8 @@ using System.Collections;
using Esiur.Core; using Esiur.Core;
using System.Reflection; using System.Reflection;
namespace Esiur.Data namespace Esiur.Data;
{
public class AutoList<T, ST> : IEnumerable<T>, ICollection, ICollection<T> public class AutoList<T, ST> : IEnumerable<T>, ICollection, ICollection<T>
{ {
@ -311,4 +311,3 @@ namespace Esiur.Data
// return Remove(item); // return Remove(item);
//} //}
} }
}

View File

@ -30,8 +30,8 @@ using Esiur.Misc;
using System.Reflection; using System.Reflection;
using Esiur.Core; using Esiur.Core;
namespace Esiur.Data namespace Esiur.Data;
{
/// <summary> /// <summary>
/// BinaryList holds a list of items to be converted to binary for storage and transmission /// BinaryList holds a list of items to be converted to binary for storage and transmission
/// </summary> /// </summary>
@ -711,4 +711,3 @@ namespace Esiur.Data
// //
} }
} }
}

View File

@ -38,8 +38,8 @@ using System.Runtime.CompilerServices;
using System.Collections; using System.Collections;
using System.Dynamic; using System.Dynamic;
namespace Esiur.Data namespace Esiur.Data;
{
public static class Codec public static class Codec
{ {
/// <summary> /// <summary>
@ -415,7 +415,8 @@ namespace Esiur.Data
} }
else else
{ {
connection.GetTemplate((Guid)classId).Then(tmp => { connection.GetTemplate((Guid)classId).Then(tmp =>
{
ParseVarArray(data, offset, length, connection).Then(ar => ParseVarArray(data, offset, length, connection).Then(ar =>
{ {
var record = new Record(); var record = new Record();
@ -1610,4 +1611,3 @@ namespace Esiur.Data
} }
} }
}

View File

@ -37,8 +37,8 @@ using Esiur.Data;
using Esiur.Core; using Esiur.Core;
using Esiur.Resource; using Esiur.Resource;
namespace Esiur.Data namespace Esiur.Data;
{
public static class DC // Data Converter public static class DC // Data Converter
{ {
public static object CastConvert(object value, Type destinationType) public static object CastConvert(object value, Type destinationType)
@ -988,4 +988,3 @@ namespace Esiur.Data
} }
}

View File

@ -28,8 +28,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Data namespace Esiur.Data;
{
public enum DataType : byte public enum DataType : byte
{ {
Void = 0x0, Void = 0x0,
@ -116,4 +115,3 @@ namespace Esiur.Data
} }
} }
} }
}

View File

@ -2,10 +2,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Data namespace Esiur.Data;
{
public interface IRecord public interface IRecord
{ {
} }
}

View File

@ -2,11 +2,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Data namespace Esiur.Data;
{
public interface IUserType public interface IUserType
{ {
object Get(); object Get();
void Set(object value); void Set(object value);
} }
}

View File

@ -33,8 +33,7 @@ using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using Esiur.Core; using Esiur.Core;
namespace Esiur.Data namespace Esiur.Data;
{
public class KeyList<KT, T> : IEnumerable<KeyValuePair<KT, T>> public class KeyList<KT, T> : IEnumerable<KeyValuePair<KT, T>>
{ {
@ -241,4 +240,3 @@ namespace Esiur.Data
dic = new Dictionary<KT, T>(); dic = new Dictionary<KT, T>();
} }
} }
}

View File

@ -28,10 +28,8 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Data namespace Esiur.Data;
{
public class NotModified public class NotModified
{ {
} }
}

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Data namespace Esiur.Data;
{
public class PropertyValue public class PropertyValue
{ {
/// <summary> /// <summary>
@ -32,4 +32,3 @@ namespace Esiur.Data
Date = date; Date = date;
} }
} }
}

View File

@ -2,10 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Data namespace Esiur.Data;
{
public class Record : KeyList<string, object>, IRecord public class Record : KeyList<string, object>, IRecord
{ {
} }
}

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Data namespace Esiur.Data;
{
public enum RecordComparisonResult : byte public enum RecordComparisonResult : byte
{ {
Null, Null,
@ -11,4 +11,3 @@ namespace Esiur.Data
RecordSameType, RecordSameType,
Same Same
} }
}

View File

@ -2,12 +2,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Data namespace Esiur.Data;
{
public enum ResourceArrayType public enum ResourceArrayType
{ {
Dynamic = 0x0, Dynamic = 0x0,
Static = 0x10, Static = 0x10,
Wrapper = 0x20, Wrapper = 0x20,
} }
}

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Data namespace Esiur.Data;
{
public enum ResourceComparisonResult public enum ResourceComparisonResult
{ {
Null, // null Null, // null
@ -11,4 +11,3 @@ namespace Esiur.Data
Local, // resource is local Local, // resource is local
Same, // Same as previous Same, // Same as previous
} }
}

View File

@ -1,5 +1,4 @@
using Esiur.Net.IIP; 
using Esiur.Resource;
/* /*
Copyright (c) 2017-2021 Ahmed Kh. Zamil Copyright (c) 2017-2021 Ahmed Kh. Zamil
@ -24,14 +23,16 @@ SOFTWARE.
*/ */
using Esiur.Net.IIP;
using Esiur.Resource;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Esiur.Data namespace Esiur.Data;
{
class ResourceJsonConverter : JsonConverter<IResource> class ResourceJsonConverter : JsonConverter<IResource>
{ {
public override IResource Read( public override IResource Read(
@ -96,4 +97,3 @@ namespace Esiur.Data
} }
} }
}

View File

@ -30,8 +30,8 @@ using System.Collections;
using Esiur.Core; using Esiur.Core;
using System.Reflection; using System.Reflection;
namespace Esiur.Data namespace Esiur.Data;
{
public class ResourceList<T, ST> : IEnumerable<T>, ICollection, ICollection<T> public class ResourceList<T, ST> : IEnumerable<T>, ICollection, ICollection<T>
{ {
@ -271,4 +271,3 @@ namespace Esiur.Data
return list.Remove(item); return list.Remove(item);
} }
} }
}

View File

@ -31,8 +31,8 @@ using System.Text;
using System.Reflection; using System.Reflection;
using System.Linq; using System.Linq;
namespace Esiur.Data namespace Esiur.Data;
{
public class StringKeyList : IEnumerable<KeyValuePair<string, string>> public class StringKeyList : IEnumerable<KeyValuePair<string, string>>
{ {
@ -217,4 +217,3 @@ namespace Esiur.Data
//} //}
} }
}

View File

@ -34,8 +34,8 @@ using Esiur.Core;
using System.Reflection; using System.Reflection;
using System.Dynamic; using System.Dynamic;
namespace Esiur.Data namespace Esiur.Data;
{
public class Structure : IEnumerable<KeyValuePair<string, object>> public class Structure : IEnumerable<KeyValuePair<string, object>>
{ {
@ -178,4 +178,3 @@ namespace Esiur.Data
} }
} }
}

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Data namespace Esiur.Data;
{
public enum StructureComparisonResult : byte public enum StructureComparisonResult : byte
{ {
Null, Null,
@ -12,4 +12,3 @@ namespace Esiur.Data
StructureSameTypes, StructureSameTypes,
Same Same
} }
}

View File

@ -4,20 +4,20 @@
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<Description>Distributed Resources Platform</Description> <Description>Distributed Resources Platform</Description>
<Copyright>Ahmed Kh. Zamil</Copyright> <Copyright>Ahmed Kh. Zamil</Copyright>
<PackageLicenseUrl>https://github.com/Esiur/Esiur-dotnet/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>http://www.esiur.com</PackageProjectUrl> <PackageProjectUrl>http://www.esiur.com</PackageProjectUrl>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.8.8</Version> <Version>2.0.0-alpha</Version>
<RepositoryUrl>https://github.com/esiur/esiur-dotnet</RepositoryUrl> <RepositoryUrl>https://github.com/esiur/esiur-dotnet</RepositoryUrl>
<Authors>Ahmed Kh. Zamil</Authors> <Authors>Ahmed Kh. Zamil</Authors>
<AssemblyVersion>1.8.8.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion>
<Company>Esiur Foundation</Company> <Company>Esiur Foundation</Company>
<FileVersion>1.8.8.0</FileVersion> <FileVersion>2.0.0.0</FileVersion>
<AssemblyName>Esiur</AssemblyName> <AssemblyName>Esiur</AssemblyName>
<RootNamespace>Esiur</RootNamespace> <RootNamespace>Esiur</RootNamespace>
<PackageId>Esiur</PackageId> <PackageId>Esiur</PackageId>
<Product>Esiur</Product> <Product>Esiur</Product>
<LangVersion>9.0</LangVersion> <LangVersion>latest</LangVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@ -79,10 +79,13 @@
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" /> <None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<!-- Package the Newtonsoft.Json dependency alongside the generator assembly --> <!-- Package the Newtonsoft.Json dependency alongside the generator assembly -->
<None Include="$(PkgSystem_Text_Json)\lib\netstandard2.0\*.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" /> <None Include="$(PkgSystem_Text_Json)\lib\netstandard2.0\*.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="Tools/*" Pack="true" PackagePath="tools/" /> <None Include="Tools/*" Pack="true" PackagePath="tools/" />
</ItemGroup>
<ItemGroup>
<None Include="LICENSE" Pack="true" PackagePath="">
</None>
</ItemGroup> </ItemGroup>
</Project> </Project>

21
Esiur/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017-2021 Esiur Foundation, Ahmed Kh. Zamil.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -42,8 +42,7 @@ using System.Text.Json;
using Esiur.Resource; using Esiur.Resource;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Esiur.Misc namespace Esiur.Misc;
{
public static class Global public static class Global
{ {
private static KeyList<string, object> variables = new KeyList<string, object>(); private static KeyList<string, object> variables = new KeyList<string, object>();
@ -66,7 +65,8 @@ namespace Esiur.Misc
try try
{ {
return JsonSerializer.Serialize(resource, Global.SerializeOptions); return JsonSerializer.Serialize(resource, Global.SerializeOptions);
}catch (Exception ex) }
catch (Exception ex)
{ {
Console.WriteLine(ex.ToString()); Console.WriteLine(ex.ToString());
return "{}"; return "{}";
@ -487,4 +487,3 @@ namespace Esiur.Misc
// Expression.IndexOf( // Expression.IndexOf(
//} //}
} }
}

View File

@ -31,8 +31,7 @@ using Esiur.Data;
using Esiur.Net.Packets; using Esiur.Net.Packets;
using Esiur.Resource; using Esiur.Resource;
namespace Esiur.Net.DataLink namespace Esiur.Net.DataLink;
{
public abstract class PacketFilter : IResource public abstract class PacketFilter : IResource
{ {
@ -53,4 +52,3 @@ namespace Esiur.Net.DataLink
OnDestroy?.Invoke(this); OnDestroy?.Invoke(this);
} }
} }
}

View File

@ -32,8 +32,7 @@ using System.Runtime.InteropServices;
using Esiur.Net.Packets; using Esiur.Net.Packets;
using Esiur.Resource; using Esiur.Resource;
namespace Esiur.Net.DataLink namespace Esiur.Net.DataLink;
{
public class PacketServer : IResource public class PacketServer : IResource
{ {
List<PacketSource> sources = new List<PacketSource>(); List<PacketSource> sources = new List<PacketSource>();
@ -120,4 +119,3 @@ namespace Esiur.Net.DataLink
} }
} }
} }
}

View File

@ -30,8 +30,7 @@ using System.Text;
using Esiur.Core; using Esiur.Core;
using Esiur.Resource; using Esiur.Resource;
namespace Esiur.Net.DataLink namespace Esiur.Net.DataLink;
{
public abstract class PacketSource : IResource public abstract class PacketSource : IResource
{ {
public delegate void NewPacket(Packet Packet); public delegate void NewPacket(Packet Packet);
@ -92,4 +91,3 @@ namespace Esiur.Net.DataLink
get; get;
} }
} }
}

View File

@ -38,8 +38,7 @@ using Esiur.Misc;
using System.Security.Cryptography; using System.Security.Cryptography;
using Esiur.Core; using Esiur.Core;
namespace Esiur.Net.HTTP namespace Esiur.Net.HTTP;
{
public class HTTPConnection : NetworkConnection public class HTTPConnection : NetworkConnection
{ {
@ -416,7 +415,8 @@ namespace Esiur.Net.HTTP
{ {
Close(); Close();
} }
finally { finally
{
} }
@ -434,4 +434,3 @@ namespace Esiur.Net.HTTP
// do nothing // do nothing
} }
} }
}

View File

@ -35,8 +35,7 @@ using Esiur.Data;
using Esiur.Core; using Esiur.Core;
using Esiur.Resource; using Esiur.Resource;
namespace Esiur.Net.HTTP namespace Esiur.Net.HTTP;
{
public abstract class HTTPFilter : IResource public abstract class HTTPFilter : IResource
{ {
@ -79,4 +78,3 @@ namespace Esiur.Net.HTTP
OnDestroy?.Invoke(this); OnDestroy?.Invoke(this);
} }
} }
}

View File

@ -39,8 +39,7 @@ using Esiur.Net.Packets;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using Esiur.Resource; using Esiur.Resource;
namespace Esiur.Net.HTTP namespace Esiur.Net.HTTP;
{
public class HTTPServer : NetworkServer<HTTPConnection>, IResource public class HTTPServer : NetworkServer<HTTPConnection>, IResource
{ {
Dictionary<string, HTTPSession> sessions = new Dictionary<string, HTTPSession>(); Dictionary<string, HTTPSession> sessions = new Dictionary<string, HTTPSession>();
@ -297,4 +296,3 @@ namespace Esiur.Net.HTTP
// cServer.StopServer(); // cServer.StopServer();
//} //}
} }
}

View File

@ -35,8 +35,7 @@ using Esiur.Data;
using Esiur.Misc; using Esiur.Misc;
using Esiur.Core; using Esiur.Core;
namespace Esiur.Net.HTTP namespace Esiur.Net.HTTP;
{
public class HTTPSession : IDestructible //<T> where T : TClient public class HTTPSession : IDestructible //<T> where T : TClient
{ {
public delegate void SessionModifiedEvent(HTTPSession session, string key, object oldValue, object newValue); public delegate void SessionModifiedEvent(HTTPSession session, string key, object oldValue, object newValue);
@ -127,4 +126,3 @@ namespace Esiur.Net.HTTP
} }
} }
}

View File

@ -6,8 +6,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Net.HTTP namespace Esiur.Net.HTTP;
{
public class IIPoHTTP : HTTPFilter public class IIPoHTTP : HTTPFilter
{ {
[Attribute] [Attribute]
@ -36,4 +35,3 @@ namespace Esiur.Net.HTTP
return new AsyncReply<bool>(true); return new AsyncReply<bool>(true);
} }
} }
}

View File

@ -32,8 +32,7 @@ using Esiur.Net.IIP;
using Esiur.Net.Sockets; using Esiur.Net.Sockets;
using Esiur.Core; using Esiur.Core;
namespace Esiur.Net.HTTP namespace Esiur.Net.HTTP;
{
public class IIPoWS : HTTPFilter public class IIPoWS : HTTPFilter
{ {
[Attribute] [Attribute]
@ -121,5 +120,3 @@ namespace Esiur.Net.HTTP
} }
} }
}

View File

@ -40,8 +40,7 @@ using System.Linq;
using System.Diagnostics; using System.Diagnostics;
using static Esiur.Net.Packets.IIPPacket; using static Esiur.Net.Packets.IIPPacket;
namespace Esiur.Net.IIP namespace Esiur.Net.IIP;
{
public partial class DistributedConnection : NetworkConnection, IStore public partial class DistributedConnection : NetworkConnection, IStore
{ {
public delegate void ReadyEvent(DistributedConnection sender); public delegate void ReadyEvent(DistributedConnection sender);
@ -1278,4 +1277,3 @@ namespace Esiur.Net.IIP
*/ */
} }
}

View File

@ -38,8 +38,8 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
namespace Esiur.Net.IIP namespace Esiur.Net.IIP;
{
partial class DistributedConnection partial class DistributedConnection
{ {
KeyList<uint, DistributedResource> resources = new KeyList<uint, DistributedResource>(); KeyList<uint, DistributedResource> resources = new KeyList<uint, DistributedResource>();
@ -2624,4 +2624,3 @@ namespace Esiur.Net.IIP
.Done(); .Done();
} }
} }
}

View File

@ -2,8 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Net.IIP namespace Esiur.Net.IIP;
{
public class DistributedPropertyContext public class DistributedPropertyContext
{ {
public object Value { get; private set; } public object Value { get; private set; }
@ -24,4 +23,3 @@ namespace Esiur.Net.IIP
public static implicit operator DistributedPropertyContext(Func<DistributedConnection, object> method) public static implicit operator DistributedPropertyContext(Func<DistributedConnection, object> method)
=> new DistributedPropertyContext(method); => new DistributedPropertyContext(method);
} }
}

View File

@ -42,8 +42,7 @@ using System.Threading.Tasks;
using Esiur.Resource; using Esiur.Resource;
using Esiur.Resource.Template; using Esiur.Resource.Template;
namespace Esiur.Net.IIP namespace Esiur.Net.IIP;
{
//[System.Runtime.InteropServices.ComVisible(true)] //[System.Runtime.InteropServices.ComVisible(true)]
public class DistributedResource : DynamicObject, IResource public class DistributedResource : DynamicObject, IResource
@ -503,4 +502,3 @@ namespace Esiur.Net.IIP
return new AsyncReply<bool>(true); return new AsyncReply<bool>(true);
} }
} }
}

View File

@ -28,7 +28,6 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Net.IIP namespace Esiur.Net.IIP;
{
public delegate void DistributedResourceEvent(DistributedResource sender, object argument); public delegate void DistributedResourceEvent(DistributedResource sender, object argument);
}

View File

@ -28,8 +28,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Net.IIP namespace Esiur.Net.IIP;
{
public class DistributedResourceQueueItem public class DistributedResourceQueueItem
{ {
public enum DistributedResourceQueueItemType public enum DistributedResourceQueueItemType
@ -70,4 +69,3 @@ namespace Esiur.Net.IIP
get { return value; } get { return value; }
} }
} }
}

View File

@ -35,8 +35,7 @@ using System.Net;
using Esiur.Resource; using Esiur.Resource;
using Esiur.Security.Membership; using Esiur.Security.Membership;
namespace Esiur.Net.IIP namespace Esiur.Net.IIP;
{
public class DistributedServer : NetworkServer<DistributedConnection>, IResource public class DistributedServer : NetworkServer<DistributedConnection>, IResource
{ {
[Attribute] [Attribute]
@ -174,4 +173,3 @@ namespace Esiur.Net.IIP
} }
}

View File

@ -28,11 +28,9 @@ using System.Text;
using Esiur.Net.Sockets; using Esiur.Net.Sockets;
using Esiur.Security.Authority; using Esiur.Security.Authority;
namespace Esiur.Net.IIP namespace Esiur.Net.IIP;
{
public class DistributedSession : NetworkSession public class DistributedSession : NetworkSession
{ {
public Source Source { get; set; } public Source Source { get; set; }
public Authentication Authentication { get; set; } public Authentication Authentication { get; set; }
} }
}

View File

@ -29,12 +29,11 @@ using Esiur.Data;
using Esiur.Resource; using Esiur.Resource;
using Esiur.Resource.Template; using Esiur.Resource.Template;
namespace Esiur.Net.IIP namespace Esiur.Net.IIP;
{
public abstract class EntryPoint : Esiur.Resource.Resource public abstract class EntryPoint : Esiur.Resource.Resource
{ {
public abstract AsyncReply<IResource[]> Query(string path, DistributedConnection sender); public abstract AsyncReply<IResource[]> Query(string path, DistributedConnection sender);
protected abstract override bool Create(); protected abstract override bool Create();
} }
}

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Net namespace Esiur.Net;
{
public interface INetworkReceiver<T> public interface INetworkReceiver<T>
{ {
void NetworkClose(T sender); void NetworkClose(T sender);
@ -12,4 +12,3 @@ namespace Esiur.Net
void NetworkConnect(T sender); void NetworkConnect(T sender);
} }
}

View File

@ -29,8 +29,7 @@ using System.Text;
using Esiur.Data; using Esiur.Data;
using Esiur.Misc; using Esiur.Misc;
namespace Esiur.Net namespace Esiur.Net;
{
public class NetworkBuffer public class NetworkBuffer
{ {
byte[] data; byte[] data;
@ -205,4 +204,3 @@ namespace Esiur.Net
} }
} }
} }
}

View File

@ -36,8 +36,7 @@ using Esiur.Data;
using Esiur.Net.Sockets; using Esiur.Net.Sockets;
using Esiur.Resource; using Esiur.Resource;
namespace Esiur.Net namespace Esiur.Net;
{
public abstract class NetworkConnection : IDestructible, INetworkReceiver<ISocket>// <TS>: IResource where TS : NetworkSession public abstract class NetworkConnection : IDestructible, INetworkReceiver<ISocket>// <TS>: IResource where TS : NetworkSession
{ {
private Sockets.ISocket sock; private Sockets.ISocket sock;
@ -364,4 +363,3 @@ namespace Esiur.Net
//throw new NotImplementedException(); //throw new NotImplementedException();
//} //}
} }
}

View File

@ -33,14 +33,13 @@ using Esiur.Resource;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Diagnostics; using System.Diagnostics;
namespace Esiur.Net namespace Esiur.Net;
{
public abstract class NetworkServer<TConnection> : IDestructible where TConnection : NetworkConnection, new() public abstract class NetworkServer<TConnection> : IDestructible where TConnection : NetworkConnection, new()
{ {
//private bool isRunning; //private bool isRunning;
private Sockets.ISocket listener; private Sockets.ISocket listener;
public AutoList<TConnection, NetworkServer<TConnection>> Connections { get; private set; } public AutoList<TConnection, NetworkServer<TConnection>> Connections { get; internal set; }
private Thread thread; private Thread thread;
@ -308,4 +307,3 @@ namespace Esiur.Net
} }
} }
}

View File

@ -35,8 +35,7 @@ using Esiur.Data;
using Esiur.Misc; using Esiur.Misc;
using Esiur.Core; using Esiur.Core;
namespace Esiur.Net namespace Esiur.Net;
{
public class NetworkSession : IDestructible //<T> where T : TClient public class NetworkSession : IDestructible //<T> where T : TClient
{ {
public delegate void SessionModifiedEvent(NetworkSession session, string key, object oldValue, object newValue); public delegate void SessionModifiedEvent(NetworkSession session, string key, object oldValue, object newValue);
@ -127,4 +126,3 @@ namespace Esiur.Net
} }
} }
}

View File

@ -32,8 +32,7 @@ using Esiur.Data;
using System.Net; using System.Net;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Esiur.Net.Packets namespace Esiur.Net.Packets;
{
public class HTTPRequestPacket : Packet public class HTTPRequestPacket : Packet
{ {
@ -314,5 +313,3 @@ namespace Esiur.Net.Packets
return headerSize; return headerSize;
} }
} }
}

View File

@ -28,8 +28,7 @@ using System.Text;
using Esiur.Misc; using Esiur.Misc;
using Esiur.Data; using Esiur.Data;
namespace Esiur.Net.Packets namespace Esiur.Net.Packets;
{
public class HTTPResponsePacket : Packet public class HTTPResponsePacket : Packet
{ {
@ -301,4 +300,3 @@ namespace Esiur.Net.Packets
} }
} }
} }
}

View File

@ -31,8 +31,7 @@ using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Net.Packets namespace Esiur.Net.Packets;
{
class IIPAuthPacket : Packet class IIPAuthPacket : Packet
{ {
public enum IIPAuthPacketCommand : byte public enum IIPAuthPacketCommand : byte
@ -412,4 +411,4 @@ namespace Esiur.Net.Packets
} }
} }
}

View File

@ -32,8 +32,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Net.Packets namespace Esiur.Net.Packets;
{
class IIPPacket : Packet class IIPPacket : Packet
{ {
@ -827,4 +826,3 @@ namespace Esiur.Net.Packets
return offset - originalOffset; return offset - originalOffset;
} }
} }
}

View File

@ -2,8 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Net.Packets namespace Esiur.Net.Packets;
{
struct IIPPacketAttachInfo struct IIPPacketAttachInfo
{ {
public string Link; public string Link;
@ -19,4 +19,3 @@ namespace Esiur.Net.Packets
Link = link; Link = link;
} }
} }
}

View File

@ -38,8 +38,7 @@ using Esiur.Net.DataLink;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using Esiur.Data; using Esiur.Data;
namespace Esiur.Net.Packets namespace Esiur.Net.Packets;
{
internal static class Functions internal static class Functions
{ {
public static void AddData(ref byte[] dest, byte[] src) public static void AddData(ref byte[] dest, byte[] src)
@ -363,7 +362,6 @@ namespace Esiur.Net.Packets
} }
} }
}
/************************************ EOF *************************************/ /************************************ EOF *************************************/

View File

@ -29,8 +29,7 @@ using System.Text;
using Esiur.Misc; using Esiur.Misc;
using Esiur.Data; using Esiur.Data;
namespace Esiur.Net.Packets namespace Esiur.Net.Packets;
{
public class WebsocketPacket : Packet public class WebsocketPacket : Packet
{ {
public enum WSOpcode : byte public enum WSOpcode : byte
@ -214,4 +213,3 @@ namespace Esiur.Net.Packets
} }
} }
} }
}

View File

@ -4,8 +4,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Net namespace Esiur.Net;
{
public class SendList : BinaryList public class SendList : BinaryList
{ {
NetworkConnection connection; NetworkConnection connection;
@ -23,4 +23,3 @@ namespace Esiur.Net
return reply; return reply;
} }
} }
}

View File

@ -36,8 +36,7 @@ using System.Collections.Concurrent;
using Esiur.Resource; using Esiur.Resource;
using Esiur.Core; using Esiur.Core;
namespace Esiur.Net.Sockets namespace Esiur.Net.Sockets;
{
//public delegate void ISocketReceiveEvent(NetworkBuffer buffer); //public delegate void ISocketReceiveEvent(NetworkBuffer buffer);
//public delegate void ISocketConnectEvent(); //public delegate void ISocketConnectEvent();
//public delegate void ISocketCloseEvent(); //public delegate void ISocketCloseEvent();
@ -71,4 +70,3 @@ namespace Esiur.Net.Sockets
void Unhold(); void Unhold();
} }
}

View File

@ -37,8 +37,7 @@ using Esiur.Resource;
using System.Threading.Tasks; using System.Threading.Tasks;
using Esiur.Data; using Esiur.Data;
namespace Esiur.Net.Sockets namespace Esiur.Net.Sockets;
{
public class SSLSocket : ISocket public class SSLSocket : ISocket
{ {
@ -552,4 +551,4 @@ namespace Esiur.Net.Sockets
} }
} }
} }
}

View File

@ -28,8 +28,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Net.Sockets namespace Esiur.Net.Sockets;
{
public enum SocketState public enum SocketState
{ {
Initial, Initial,
@ -39,4 +38,3 @@ namespace Esiur.Net.Sockets
Closed, Closed,
//Terminated //Terminated
} }
}

View File

@ -35,8 +35,7 @@ using Esiur.Resource;
using System.Threading.Tasks; using System.Threading.Tasks;
using Esiur.Data; using Esiur.Data;
namespace Esiur.Net.Sockets namespace Esiur.Net.Sockets;
{
public class TCPSocket : ISocket public class TCPSocket : ISocket
{ {
public INetworkReceiver<ISocket> Receiver { get; set; } public INetworkReceiver<ISocket> Receiver { get; set; }
@ -656,4 +655,3 @@ namespace Esiur.Net.Sockets
} }
} }
} }
}

View File

@ -36,8 +36,7 @@ using Esiur.Resource;
using Esiur.Data; using Esiur.Data;
using System.Globalization; using System.Globalization;
namespace Esiur.Net.Sockets namespace Esiur.Net.Sockets;
{
public class WSocket : ISocket, INetworkReceiver<ISocket> public class WSocket : ISocket, INetworkReceiver<ISocket>
{ {
WebsocketPacket pkt_receive = new WebsocketPacket(); WebsocketPacket pkt_receive = new WebsocketPacket();
@ -358,4 +357,3 @@ namespace Esiur.Net.Sockets
Receiver?.NetworkConnect(this); Receiver?.NetworkConnect(this);
} }
} }
}

View File

@ -32,9 +32,9 @@ using System.Collections;
using Esiur.Misc; using Esiur.Misc;
using Esiur.Data; using Esiur.Data;
namespace Esiur.Net.TCP namespace Esiur.Net.TCP;
public class TCPConnection : NetworkConnection
{ {
public class TCPConnection:NetworkConnection {
private KeyList<string, object> variables = new KeyList<string, object>(); private KeyList<string, object> variables = new KeyList<string, object>();
@ -63,4 +63,3 @@ namespace Esiur.Net.TCP
// do nothing // do nothing
} }
} }
}

View File

@ -32,8 +32,8 @@ using Esiur.Net.Sockets;
using Esiur.Core; using Esiur.Core;
using Esiur.Resource; using Esiur.Resource;
namespace Esiur.Net.TCP namespace Esiur.Net.TCP;
{
public abstract class TCPFilter : IResource public abstract class TCPFilter : IResource
{ {
public Instance Instance public Instance Instance
@ -63,4 +63,3 @@ namespace Esiur.Net.TCP
OnDestroy?.Invoke(this); OnDestroy?.Invoke(this);
} }
} }
}

View File

@ -34,8 +34,7 @@ using Esiur.Core;
using System.Net; using System.Net;
using Esiur.Resource; using Esiur.Resource;
namespace Esiur.Net.TCP namespace Esiur.Net.TCP;
{
public class TCPServer : NetworkServer<TCPConnection>, IResource public class TCPServer : NetworkServer<TCPConnection>, IResource
{ {
@ -153,4 +152,3 @@ namespace Esiur.Net.TCP
} }
} }
}

View File

@ -28,10 +28,8 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Esiur.Net.TCP namespace Esiur.Net.TCP;
{
public class TCPSession : NetworkSession public class TCPSession : NetworkSession
{ {
} }
}

View File

@ -32,8 +32,7 @@ using Esiur.Data;
using Esiur.Core; using Esiur.Core;
using Esiur.Resource; using Esiur.Resource;
namespace Esiur.Net.UDP namespace Esiur.Net.UDP;
{
public abstract class UDPFilter : IResource public abstract class UDPFilter : IResource
{ {
public Instance Instance public Instance Instance
@ -54,4 +53,3 @@ namespace Esiur.Net.UDP
OnDestroy?.Invoke(this); OnDestroy?.Invoke(this);
} }
} }
}

View File

@ -33,8 +33,7 @@ using Esiur.Misc;
using Esiur.Resource; using Esiur.Resource;
using Esiur.Core; using Esiur.Core;
namespace Esiur.Net.UDP namespace Esiur.Net.UDP;
{
/* public class IIPConnection /* public class IIPConnection
{ {
@ -201,4 +200,3 @@ namespace Esiur.Net.UDP
return true; return true;
} }
} }
}

View File

@ -14,8 +14,8 @@ using Esiur.Data;
using System.IO; using System.IO;
using Esiur.Core; using Esiur.Core;
namespace Esiur.Proxy namespace Esiur.Proxy;
{
[Generator] [Generator]
public class ResourceGenerator : ISourceGenerator public class ResourceGenerator : ISourceGenerator
{ {
@ -181,11 +181,10 @@ public virtual void Destroy() {{ OnDestroy?.Invoke(this); }}
context.AddSource(ci.Name + ".Generated.cs", code); context.AddSource(ci.Name + ".Generated.cs", code);
} }
catch (Exception ex) catch //(Exception ex)
{ {
//System.IO.File.AppendAllText("c:\\gen\\error.log", ci.Name + " " + ex.ToString() + "\r\n"); //System.IO.File.AppendAllText("c:\\gen\\error.log", ci.Name + " " + ex.ToString() + "\r\n");
} }
} }
} }
} }
}

View File

@ -4,8 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Proxy namespace Esiur.Proxy;
{
public struct ResourceGeneratorClassInfo public struct ResourceGeneratorClassInfo
{ {
public string Name { get; set; } public string Name { get; set; }
@ -18,4 +17,3 @@ namespace Esiur.Proxy
public ClassDeclarationSyntax ClassDeclaration { get; set; } public ClassDeclarationSyntax ClassDeclaration { get; set; }
} }
}

View File

@ -3,11 +3,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Esiur.Proxy namespace Esiur.Proxy;
{
public struct ResourceGeneratorFieldInfo public struct ResourceGeneratorFieldInfo
{ {
public IFieldSymbol FieldSymbol { get; set; } public IFieldSymbol FieldSymbol { get; set; }
public string[] Attributes { get; set; } public string[] Attributes { get; set; }
} }
}

View File

@ -6,8 +6,7 @@ using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
namespace Esiur.Proxy namespace Esiur.Proxy;
{
public class ResourceGeneratorReceiver : ISyntaxContextReceiver public class ResourceGeneratorReceiver : ISyntaxContextReceiver
{ {
@ -74,7 +73,8 @@ namespace Esiur.Proxy
c.HasInterface = cls.Interfaces.Any(x => x.ToDisplayString() == "Esiur.Resource.IResource"); c.HasInterface = cls.Interfaces.Any(x => x.ToDisplayString() == "Esiur.Resource.IResource");
if (!c.HasTrigger) if (!c.HasTrigger)
c.HasTrigger = hasTrigger; c.HasTrigger = hasTrigger;
} else }
else
{ {
Classes.Add(fullName, new ResourceGeneratorClassInfo() Classes.Add(fullName, new ResourceGeneratorClassInfo()
{ {
@ -94,4 +94,3 @@ namespace Esiur.Proxy
} }
} }
}

View File

@ -7,8 +7,7 @@ using System.Reflection;
using System.Reflection.Emit; using System.Reflection.Emit;
using System.Text; using System.Text;
namespace Esiur.Proxy namespace Esiur.Proxy;
{
public static class ResourceProxy public static class ResourceProxy
{ {
static Dictionary<Type, Type> cache = new Dictionary<Type, Type>(); static Dictionary<Type, Type> cache = new Dictionary<Type, Type>();
@ -252,4 +251,3 @@ namespace Esiur.Proxy
} }
} }
}

View File

@ -10,8 +10,7 @@ using Esiur.Resource;
using Esiur.Net.IIP; using Esiur.Net.IIP;
using System.Diagnostics; using System.Diagnostics;
namespace Esiur.Proxy namespace Esiur.Proxy;
{
public static class TemplateGenerator public static class TemplateGenerator
{ {
internal static Regex urlRegex = new Regex(@"^(?:([\S]*)://([^/]*)/?)"); internal static Regex urlRegex = new Regex(@"^(?:([\S]*)://([^/]*)/?)");
@ -235,4 +234,3 @@ namespace Esiur.Proxy
} }
} }
}

Some files were not shown because too many files have changed in this diff Show More