mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-05-06 11:32:59 +00:00
Rename
This commit is contained in:
parent
ba084b79e6
commit
8ff832d6f1
@ -26,13 +26,13 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace Esyur.Stores.EntityCore
|
namespace Esiur.Stores.EntityCore
|
||||||
{
|
{
|
||||||
public class EntityResource : IResource
|
public class EntityResource : IResource
|
||||||
{
|
{
|
@ -22,19 +22,19 @@ SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using Esyur.Resource.Template;
|
using Esiur.Resource.Template;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Esyur.Proxy;
|
using Esiur.Proxy;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace Esyur.Stores.EntityCore
|
namespace Esiur.Stores.EntityCore
|
||||||
{
|
{
|
||||||
public class EntityStore : IStore
|
public class EntityStore : IStore
|
||||||
{
|
{
|
||||||
@ -43,6 +43,7 @@ namespace Esyur.Stores.EntityCore
|
|||||||
public event DestroyedEvent OnDestroy;
|
public event DestroyedEvent OnDestroy;
|
||||||
|
|
||||||
Dictionary<Type, Dictionary<object, WeakReference>> DB = new Dictionary<Type, Dictionary<object, WeakReference>>();
|
Dictionary<Type, Dictionary<object, WeakReference>> DB = new Dictionary<Type, Dictionary<object, WeakReference>>();
|
||||||
|
object DBLock = new object();
|
||||||
|
|
||||||
internal struct TypeInfo
|
internal struct TypeInfo
|
||||||
{
|
{
|
||||||
@ -58,19 +59,27 @@ namespace Esyur.Stores.EntityCore
|
|||||||
|
|
||||||
bool Loaded;
|
bool Loaded;
|
||||||
|
|
||||||
public async AsyncReply<IResource> Get(string path)
|
public AsyncReply<IResource> Get(string path)
|
||||||
{
|
{
|
||||||
var p = path.Split('/');
|
var p = path.Split('/');
|
||||||
var ti = TypesByName[p[0]];
|
var ti = TypesByName[p[0]];
|
||||||
var id = Convert.ChangeType(p[1], ti.PrimaryKey.PropertyType);// Convert.ToInt32();
|
var id = Convert.ChangeType(p[1], ti.PrimaryKey.PropertyType);// Convert.ToInt32();
|
||||||
//Type.cas ti.PrimaryKey.PropertyType.
|
|
||||||
return DbContextProvider().Find(ti.Type.ClrType, id) as IResource;
|
|
||||||
|
var db = DbContextProvider();
|
||||||
|
var res = db.Find(ti.Type.ClrType, id);
|
||||||
|
var ent = db.Entry(res);
|
||||||
|
|
||||||
|
foreach (var rf in ent.References)
|
||||||
|
rf.Load();
|
||||||
|
|
||||||
|
return new AsyncReply<IResource>(res as IResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async AsyncReply<bool> Put(IResource resource)
|
public AsyncReply<bool> Put(IResource resource)
|
||||||
{
|
{
|
||||||
if (resource is EntityStore)
|
if (resource is EntityStore)
|
||||||
return false;
|
return new AsyncReply<bool>(false);
|
||||||
|
|
||||||
var type = ResourceProxy.GetBaseType(resource);//.GetType().;
|
var type = ResourceProxy.GetBaseType(resource);//.GetType().;
|
||||||
|
|
||||||
@ -78,15 +87,20 @@ namespace Esyur.Stores.EntityCore
|
|||||||
|
|
||||||
var eid = TypesByType[type].PrimaryKey.GetValue(resource);
|
var eid = TypesByType[type].PrimaryKey.GetValue(resource);
|
||||||
|
|
||||||
|
lock (DBLock)
|
||||||
|
{
|
||||||
if (DB[type].ContainsKey(eid))
|
if (DB[type].ContainsKey(eid))
|
||||||
DB[type].Remove(eid);
|
DB[type].Remove(eid);
|
||||||
|
|
||||||
DB[type].Add(eid, new WeakReference(resource));
|
DB[type].Add(eid, new WeakReference(resource));
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return new AsyncReply<bool>(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IResource GetById(Type type, object id)
|
public IResource GetById(Type type, object id)
|
||||||
|
{
|
||||||
|
lock (DBLock)
|
||||||
{
|
{
|
||||||
if (!DB[type].ContainsKey(id))
|
if (!DB[type].ContainsKey(id))
|
||||||
return null;
|
return null;
|
||||||
@ -96,6 +110,7 @@ namespace Esyur.Stores.EntityCore
|
|||||||
|
|
||||||
return DB[type][id].Target as IResource;
|
return DB[type][id].Target as IResource;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Attribute]
|
[Attribute]
|
||||||
public Func<DbContext> DbContextProvider { get; set; }
|
public Func<DbContext> DbContextProvider { get; set; }
|
||||||
@ -140,7 +155,7 @@ namespace Esyur.Stores.EntityCore
|
|||||||
//throw new NotImplementedException();
|
//throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public new bool Remove(IResource resource)
|
public bool Remove(IResource resource)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
@ -2,12 +2,13 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<AssemblyName>Esyur.Stores.EntityCore</AssemblyName>
|
<AssemblyName>Esiur.Stores.EntityCore</AssemblyName>
|
||||||
<Authors>Ahmed Kh. Zamil</Authors>
|
<Authors>Ahmed Kh. Zamil</Authors>
|
||||||
<Company>Esyur Foundation</Company>
|
<Company>Esiur Foundation</Company>
|
||||||
<Description>Esyur for Entity Framework Core</Description>
|
<Description>Esiur for Entity Framework Core</Description>
|
||||||
<Product>Esyur Entity Framework Extension</Product>
|
<Product>Esiur Entity Framework Extension</Product>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
|
<PackageId>Esiur.Stores.EntityCore</PackageId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -16,7 +17,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Esyur\Esyur.csproj" />
|
<ProjectReference Include="..\Esiur\Esiur.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -33,11 +33,11 @@ using Microsoft.EntityFrameworkCore.Utilities;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Esyur.Proxy;
|
using Esiur.Proxy;
|
||||||
|
|
||||||
namespace Esyur.Stores.EntityCore
|
namespace Esiur.Stores.EntityCore
|
||||||
{
|
{
|
||||||
public class EsyurExtensionOptions : IDbContextOptionsExtension
|
public class EsiurExtensionOptions : IDbContextOptionsExtension
|
||||||
{
|
{
|
||||||
|
|
||||||
//public Dictionary<Type, PropertyInfo> Cache { get; } = new Dictionary<Type, PropertyInfo>();
|
//public Dictionary<Type, PropertyInfo> Cache { get; } = new Dictionary<Type, PropertyInfo>();
|
||||||
@ -62,7 +62,7 @@ namespace Esyur.Stores.EntityCore
|
|||||||
// services.AddEntityFrameworkProxies();
|
// services.AddEntityFrameworkProxies();
|
||||||
|
|
||||||
new EntityFrameworkServicesBuilder(services)
|
new EntityFrameworkServicesBuilder(services)
|
||||||
.TryAdd<IConventionSetPlugin, EsyurPlugin>();
|
.TryAdd<IConventionSetPlugin, EsiurPlugin>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Validate(IDbContextOptions options)
|
public void Validate(IDbContextOptions options)
|
||||||
@ -72,14 +72,14 @@ namespace Esyur.Stores.EntityCore
|
|||||||
{
|
{
|
||||||
var scope = internalServiceProvider.CreateScope();
|
var scope = internalServiceProvider.CreateScope();
|
||||||
var conventionPlugins = scope.ServiceProvider.GetService<IEnumerable<IConventionSetPlugin>>();
|
var conventionPlugins = scope.ServiceProvider.GetService<IEnumerable<IConventionSetPlugin>>();
|
||||||
if (conventionPlugins?.Any(s => s is EsyurPlugin) == false)
|
if (conventionPlugins?.Any(s => s is EsiurPlugin) == false)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("");
|
throw new InvalidOperationException("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public EsyurExtensionOptions(EntityStore store)
|
public EsiurExtensionOptions(EntityStore store)
|
||||||
{
|
{
|
||||||
_info = new ExtensionInfo(this);
|
_info = new ExtensionInfo(this);
|
||||||
_store = store;
|
_store = store;
|
||||||
@ -94,12 +94,12 @@ namespace Esyur.Stores.EntityCore
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private new EsyurExtensionOptions Extension
|
private new EsiurExtensionOptions Extension
|
||||||
=> (EsyurExtensionOptions)base.Extension;
|
=> (EsiurExtensionOptions)base.Extension;
|
||||||
|
|
||||||
public override bool IsDatabaseProvider => false;
|
public override bool IsDatabaseProvider => false;
|
||||||
|
|
||||||
public override string LogFragment => "Esyur";
|
public override string LogFragment => "Esiur";
|
||||||
|
|
||||||
public override long GetServiceProviderHashCode() => 2312;
|
public override long GetServiceProviderHashCode() => 2312;
|
||||||
|
|
@ -22,8 +22,8 @@ SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using Esyur.Security.Permissions;
|
using Esiur.Security.Permissions;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
@ -32,9 +32,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Stores.EntityCore
|
namespace Esiur.Stores.EntityCore
|
||||||
{
|
{
|
||||||
public static class EsyurExtensions
|
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
|
||||||
//{
|
//{
|
||||||
@ -44,7 +44,7 @@ namespace Esyur.Stores.EntityCore
|
|||||||
|
|
||||||
public static T AddResource<T>(this DbSet<T> dbSet, object properties = null) where T : class, IResource
|
public static T AddResource<T>(this DbSet<T> dbSet, object properties = null) where T : class, IResource
|
||||||
{
|
{
|
||||||
var store = dbSet.GetInfrastructure().GetService<IDbContextOptions>().FindExtension<EsyurExtensionOptions>().Store;
|
var store = dbSet.GetInfrastructure().GetService<IDbContextOptions>().FindExtension<EsiurExtensionOptions>().Store;
|
||||||
var manager = store.Instance.Managers.FirstOrDefault();// > 0 ? store.Instance.Managers.First() : null;
|
var manager = store.Instance.Managers.FirstOrDefault();// > 0 ? store.Instance.Managers.First() : null;
|
||||||
|
|
||||||
//var db = dbSet.GetService<ICurrentDbContext>().Context;
|
//var db = dbSet.GetService<ICurrentDbContext>().Context;
|
||||||
@ -64,7 +64,7 @@ namespace Esyur.Stores.EntityCore
|
|||||||
|
|
||||||
public static T CreateResource<T>(this IServiceProvider serviceProvider, object properties = null) where T : class, IResource
|
public static T CreateResource<T>(this IServiceProvider serviceProvider, object properties = null) where T : class, IResource
|
||||||
{
|
{
|
||||||
var options = serviceProvider.GetService<IDbContextOptions>().FindExtension<EsyurExtensionOptions>();
|
var options = serviceProvider.GetService<IDbContextOptions>().FindExtension<EsiurExtensionOptions>();
|
||||||
|
|
||||||
var resource = Warehouse.New<T>("", options.Store, null, null, null, properties);
|
var resource = Warehouse.New<T>("", options.Store, null, null, null, properties);
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ namespace Esyur.Stores.EntityCore
|
|||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DbContextOptionsBuilder UseEsyur(this DbContextOptionsBuilder optionsBuilder,
|
public static DbContextOptionsBuilder UseEsiur(this DbContextOptionsBuilder optionsBuilder,
|
||||||
//DbContext context,
|
//DbContext context,
|
||||||
string name = null,
|
string name = null,
|
||||||
IResource parent = null,
|
IResource parent = null,
|
||||||
@ -81,13 +81,13 @@ namespace Esyur.Stores.EntityCore
|
|||||||
Func<DbContext> dbContextProvider = null
|
Func<DbContext> dbContextProvider = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
var extension = optionsBuilder.Options.FindExtension<EsyurExtensionOptions>();
|
var extension = optionsBuilder.Options.FindExtension<EsiurExtensionOptions>();
|
||||||
|
|
||||||
if (extension == null)
|
if (extension == null)
|
||||||
{
|
{
|
||||||
|
|
||||||
var store = Warehouse.New<EntityStore>(name, null, parent, manager, new { Options = optionsBuilder, DbContextProvider = dbContextProvider });
|
var store = Warehouse.New<EntityStore>(name, null, parent, manager, new { Options = optionsBuilder, DbContextProvider = dbContextProvider });
|
||||||
extension = new EsyurExtensionOptions(store);
|
extension = new EsiurExtensionOptions(store);
|
||||||
//store.Options = optionsBuilder;
|
//store.Options = optionsBuilder;
|
||||||
//store.DbContext = context;
|
//store.DbContext = context;
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ namespace Esyur.Stores.EntityCore
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DbContextOptionsBuilder<TContext> UseEsyur<TContext>(
|
public static DbContextOptionsBuilder<TContext> UseEsiur<TContext>(
|
||||||
this DbContextOptionsBuilder<TContext> optionsBuilder,
|
this DbContextOptionsBuilder<TContext> optionsBuilder,
|
||||||
//DbContext context,
|
//DbContext context,
|
||||||
string name = null,
|
string name = null,
|
||||||
@ -109,12 +109,12 @@ namespace Esyur.Stores.EntityCore
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
var extension = optionsBuilder.Options.FindExtension<EsyurExtensionOptions>();
|
var extension = optionsBuilder.Options.FindExtension<EsiurExtensionOptions>();
|
||||||
|
|
||||||
if (extension == null)
|
if (extension == null)
|
||||||
{
|
{
|
||||||
var store = Warehouse.New<EntityStore>(name, null, parent, manager, new { Options = optionsBuilder, DbContextProvider = dbContextProvider });
|
var store = Warehouse.New<EntityStore>(name, null, parent, manager, new { Options = optionsBuilder, DbContextProvider = dbContextProvider });
|
||||||
extension = new EsyurExtensionOptions(store);
|
extension = new EsiurExtensionOptions(store);
|
||||||
//store.Options = optionsBuilder;
|
//store.Options = optionsBuilder;
|
||||||
//store.Options = extension;
|
//store.Options = extension;
|
||||||
//store.DbContext = context;
|
//store.DbContext = context;
|
@ -30,14 +30,14 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Stores.EntityCore
|
namespace Esiur.Stores.EntityCore
|
||||||
{
|
{
|
||||||
public class EsyurPlugin : IConventionSetPlugin
|
public class EsiurPlugin : IConventionSetPlugin
|
||||||
{
|
{
|
||||||
private readonly IDbContextOptions _options;
|
private readonly IDbContextOptions _options;
|
||||||
private readonly ProviderConventionSetBuilderDependencies _conventionSetBuilderDependencies;
|
private readonly ProviderConventionSetBuilderDependencies _conventionSetBuilderDependencies;
|
||||||
|
|
||||||
public EsyurPlugin(
|
public EsiurPlugin(
|
||||||
IDbContextOptions options,
|
IDbContextOptions options,
|
||||||
ProviderConventionSetBuilderDependencies conventionSetBuilderDependencies)
|
ProviderConventionSetBuilderDependencies conventionSetBuilderDependencies)
|
||||||
{
|
{
|
||||||
@ -48,8 +48,8 @@ namespace Esyur.Stores.EntityCore
|
|||||||
|
|
||||||
public ConventionSet ModifyConventions(ConventionSet conventionSet)
|
public ConventionSet ModifyConventions(ConventionSet conventionSet)
|
||||||
{
|
{
|
||||||
var extension = _options.FindExtension<EsyurExtensionOptions>();
|
var extension = _options.FindExtension<EsiurExtensionOptions>();
|
||||||
conventionSet.ModelFinalizedConventions.Add(new EsyurProxyRewrite(
|
conventionSet.ModelFinalizedConventions.Add(new EsiurProxyRewrite(
|
||||||
extension,
|
extension,
|
||||||
_conventionSetBuilderDependencies));
|
_conventionSetBuilderDependencies));
|
||||||
return conventionSet;
|
return conventionSet;
|
@ -27,8 +27,8 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Proxy;
|
using Esiur.Proxy;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Internal;
|
using Microsoft.EntityFrameworkCore.Internal;
|
||||||
@ -38,12 +38,12 @@ using Microsoft.EntityFrameworkCore.Metadata.Conventions;
|
|||||||
using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||||
|
|
||||||
namespace Esyur.Stores.EntityCore
|
namespace Esiur.Stores.EntityCore
|
||||||
{
|
{
|
||||||
public class EsyurProxyRewrite : IModelFinalizedConvention
|
public class EsiurProxyRewrite : IModelFinalizedConvention
|
||||||
{
|
{
|
||||||
private static readonly MethodInfo _createInstance
|
private static readonly MethodInfo _createInstance
|
||||||
= typeof(EsyurProxyRewrite).GetTypeInfo().GetDeclaredMethod(nameof(EsyurProxyRewrite.CreateInstance));
|
= typeof(EsiurProxyRewrite).GetTypeInfo().GetDeclaredMethod(nameof(EsiurProxyRewrite.CreateInstance));
|
||||||
|
|
||||||
private readonly ConstructorBindingConvention _directBindingConvention;
|
private readonly ConstructorBindingConvention _directBindingConvention;
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ namespace Esyur.Stores.EntityCore
|
|||||||
///var id = constructorArguments.Last();
|
///var id = constructorArguments.Last();
|
||||||
var id = properties.First();
|
var id = properties.First();
|
||||||
|
|
||||||
var options = dbContextOptions.FindExtension<EsyurExtensionOptions>();
|
var options = dbContextOptions.FindExtension<EsiurExtensionOptions>();
|
||||||
var manager = options.Store.Instance.Managers.Count > 0 ? options.Store.Instance.Managers.First() : null;
|
var manager = options.Store.Instance.Managers.Count > 0 ? options.Store.Instance.Managers.First() : null;
|
||||||
|
|
||||||
var cache = options.Store.GetById(entityType.ClrType, id);
|
var cache = options.Store.GetById(entityType.ClrType, id);
|
||||||
@ -87,7 +87,7 @@ namespace Esyur.Stores.EntityCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public EsyurProxyRewrite(EsyurExtensionOptions ext, ProviderConventionSetBuilderDependencies conventionSetBuilderDependencies)
|
public EsiurProxyRewrite(EsiurExtensionOptions ext, ProviderConventionSetBuilderDependencies conventionSetBuilderDependencies)
|
||||||
{
|
{
|
||||||
_directBindingConvention = new ConstructorBindingConvention(conventionSetBuilderDependencies);
|
_directBindingConvention = new ConstructorBindingConvention(conventionSetBuilderDependencies);
|
||||||
|
|
||||||
@ -102,18 +102,24 @@ namespace Esyur.Stores.EntityCore
|
|||||||
|
|
||||||
// var ann = entityType.GetAnnotation(CoreAnnotationNames.ConstructorBinding);
|
// var ann = entityType.GetAnnotation(CoreAnnotationNames.ConstructorBinding);
|
||||||
|
|
||||||
|
#pragma warning disable EF1001 // Internal EF Core API usage.
|
||||||
var binding = (InstantiationBinding)entityType[CoreAnnotationNames.ConstructorBinding];
|
var binding = (InstantiationBinding)entityType[CoreAnnotationNames.ConstructorBinding];
|
||||||
|
#pragma warning restore EF1001 // Internal EF Core API usage.
|
||||||
if (binding == null)
|
if (binding == null)
|
||||||
_directBindingConvention.ProcessModelFinalized(modelBuilder, context);
|
_directBindingConvention.ProcessModelFinalized(modelBuilder, context);
|
||||||
|
|
||||||
|
#pragma warning disable EF1001 // Internal EF Core API usage.
|
||||||
binding = (InstantiationBinding)entityType[CoreAnnotationNames.ConstructorBinding];
|
binding = (InstantiationBinding)entityType[CoreAnnotationNames.ConstructorBinding];
|
||||||
|
#pragma warning restore EF1001 // Internal EF Core API usage.
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
||||||
{
|
{
|
||||||
entityType.SetAnnotation(
|
entityType.SetAnnotation(
|
||||||
|
#pragma warning disable EF1001 // Internal EF Core API usage.
|
||||||
CoreAnnotationNames.ConstructorBinding,
|
CoreAnnotationNames.ConstructorBinding,
|
||||||
|
#pragma warning restore EF1001 // Internal EF Core API usage.
|
||||||
new FactoryMethodBinding(
|
new FactoryMethodBinding(
|
||||||
_createInstance,
|
_createInstance,
|
||||||
new List<ParameterBinding>
|
new List<ParameterBinding>
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"Esyur.Stores.EntityCore": {
|
"Esiur.Stores.EntityCore": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"commandLineArgs": "--migrate"
|
"commandLineArgs": "--migrate"
|
||||||
}
|
}
|
@ -3,15 +3,16 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<Authors>Ahmed Kh. Zamil</Authors>
|
<Authors>Ahmed Kh. Zamil</Authors>
|
||||||
<Company>Esyur</Company>
|
<Company>Esiur</Company>
|
||||||
<Product>Esyur MongoDB Store</Product>
|
<Product>Esiur MongoDB Store</Product>
|
||||||
<Description>MongoDB Store for Esyur Library</Description>
|
<Description>MongoDB Store for Esiur Library</Description>
|
||||||
<Copyright>Ahmed Kh. Zamil</Copyright>
|
<Copyright>Ahmed Kh. Zamil</Copyright>
|
||||||
<PackageLicenseUrl>https://github.com/Esyur/Esyur-dotnet/blob/master/LICENSE</PackageLicenseUrl>
|
<PackageLicenseUrl>https://github.com/Esiur/Esiur-dotnet/blob/master/LICENSE</PackageLicenseUrl>
|
||||||
<PackageProjectUrl>http://www.esyur.com</PackageProjectUrl>
|
<PackageProjectUrl>http://www.esiur.com</PackageProjectUrl>
|
||||||
<RepositoryUrl>https://github.com/esyur/esyur-dotnet/</RepositoryUrl>
|
<RepositoryUrl>https://github.com/esiur/esiur-dotnet/</RepositoryUrl>
|
||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||||
<Version>1.4.0</Version>
|
<Version>1.4.0</Version>
|
||||||
|
<PackageId>Esiur.Stores.MongoDB</PackageId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -20,7 +21,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Esyur\Esyur.csproj" />
|
<ProjectReference Include="..\Esiur\Esiur.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -22,22 +22,22 @@ SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using System;
|
using System;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using MongoDB.Driver.Core;
|
using MongoDB.Driver.Core;
|
||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
using MongoDB.Bson;
|
using MongoDB.Bson;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Esyur.Resource.Template;
|
using Esiur.Resource.Template;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Esyur.Security.Permissions;
|
using Esiur.Security.Permissions;
|
||||||
using Esyur.Proxy;
|
using Esiur.Proxy;
|
||||||
|
|
||||||
namespace Esyur.Stores.MongoDB
|
namespace Esiur.Stores.MongoDB
|
||||||
{
|
{
|
||||||
public class MongoDBStore : IStore
|
public class MongoDBStore : IStore
|
||||||
{
|
{
|
||||||
@ -523,7 +523,7 @@ namespace Esyur.Stores.MongoDB
|
|||||||
{
|
{
|
||||||
|
|
||||||
var collectionName = Collection ?? "resources";
|
var collectionName = Collection ?? "resources";
|
||||||
var dbName = Database ?? "Esyur";
|
var dbName = Database ?? "Esiur";
|
||||||
client = new MongoClient(Connection ?? "mongodb://localhost");
|
client = new MongoClient(Connection ?? "mongodb://localhost");
|
||||||
database = client.GetDatabase(dbName);
|
database = client.GetDatabase(dbName);
|
||||||
|
|
@ -22,16 +22,16 @@ SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Proxy;
|
using Esiur.Proxy;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Stores.MongoDB
|
namespace Esiur.Stores.MongoDB
|
||||||
{
|
{
|
||||||
public class MongoDBStore<T> : MongoDBStore where T:IResource
|
public class MongoDBStore<T> : MongoDBStore where T:IResource
|
||||||
{
|
{
|
@ -2,11 +2,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 16
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 16.0.29324.140
|
VisualStudioVersion = 16.0.29324.140
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Esyur", "Esyur\Esyur.csproj", "{4F74A8C1-D38F-4CC0-ACD1-24459BA0EAFC}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Esiur", "Esiur\Esiur.csproj", "{4F74A8C1-D38F-4CC0-ACD1-24459BA0EAFC}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Esyur.Stores.MongoDB", "Esyur.Stores.MongoDB\Esyur.Stores.MongoDB.csproj", "{4C90D4B3-8EA2-48AE-A2F9-2B722FCEF9C4}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Esiur.Stores.MongoDB", "Esiur.Stores.MongoDB\Esiur.Stores.MongoDB.csproj", "{4C90D4B3-8EA2-48AE-A2F9-2B722FCEF9C4}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Esyur.Stores.EntityCore", "Esyur.Stores.EntityCore\Esyur.Stores.EntityCore.csproj", "{53DE5A30-CFA9-4DE7-A840-77CFF519D31B}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Esiur.Stores.EntityCore", "Esiur.Stores.EntityCore\Esiur.Stores.EntityCore.csproj", "{53DE5A30-CFA9-4DE7-A840-77CFF519D31B}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public class AsyncAwaiter : INotifyCompletion
|
public class AsyncAwaiter : INotifyCompletion
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public class AsyncAwaiter<T> : INotifyCompletion
|
public class AsyncAwaiter<T> : INotifyCompletion
|
||||||
{
|
{
|
@ -28,7 +28,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public class AsyncBag: AsyncReply
|
public class AsyncBag: AsyncReply
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public class AsyncBagAwaiter : INotifyCompletion
|
public class AsyncBagAwaiter : INotifyCompletion
|
||||||
{
|
{
|
@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public class AsyncBagAwaiter<T> : INotifyCompletion
|
public class AsyncBagAwaiter<T> : INotifyCompletion
|
||||||
{
|
{
|
@ -28,7 +28,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public class AsyncBag<T>: AsyncBag
|
public class AsyncBag<T>: AsyncBag
|
||||||
{
|
{
|
@ -26,7 +26,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public class AsyncException : Exception
|
public class AsyncException : Exception
|
||||||
{
|
{
|
@ -28,7 +28,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public class AsyncQueue<T> : AsyncReply<T>
|
public class AsyncQueue<T> : AsyncReply<T>
|
||||||
{
|
{
|
@ -27,13 +27,13 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
[AsyncMethodBuilder(typeof(AsyncReplyBuilder))]
|
[AsyncMethodBuilder(typeof(AsyncReplyBuilder))]
|
||||||
public class AsyncReply
|
public class AsyncReply
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public class AsyncReplyBuilder
|
public class AsyncReplyBuilder
|
||||||
{
|
{
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public class AsyncReplyBuilder<T>
|
public class AsyncReplyBuilder<T>
|
||||||
{
|
{
|
@ -27,13 +27,13 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
[AsyncMethodBuilder(typeof(AsyncReplyBuilder<>))]
|
[AsyncMethodBuilder(typeof(AsyncReplyBuilder<>))]
|
||||||
public class AsyncReply<T> : AsyncReply
|
public class AsyncReply<T> : AsyncReply
|
@ -28,7 +28,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public class AsyncReply
|
public class AsyncReply
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public enum ErrorType
|
public enum ErrorType
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public enum ExceptionCode : ushort
|
public enum ExceptionCode : ushort
|
||||||
{
|
{
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public interface IAsyncReply<out T>//IAsyncEnumerator<T>
|
public interface IAsyncReply<out T>//IAsyncEnumerator<T>
|
||||||
{
|
{
|
@ -27,7 +27,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public delegate void DestroyedEvent(object sender);
|
public delegate void DestroyedEvent(object sender);
|
||||||
|
|
@ -29,7 +29,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public enum LogType
|
public enum LogType
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Core
|
namespace Esiur.Core
|
||||||
{
|
{
|
||||||
public enum ProgressType
|
public enum ProgressType
|
||||||
{
|
{
|
@ -27,10 +27,10 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace Esyur.Data
|
namespace Esiur.Data
|
||||||
{
|
{
|
||||||
public class AutoList<T, ST> : IEnumerable<T>, ICollection, ICollection<T>
|
public class AutoList<T, ST> : IEnumerable<T>, ICollection, ICollection<T>
|
||||||
{
|
{
|
||||||
@ -217,10 +217,10 @@ namespace Esyur.Data
|
|||||||
/// Remove an item from the list
|
/// Remove an item from the list
|
||||||
/// <param name="value">Item to remove</param>
|
/// <param name="value">Item to remove</param>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Remove(T value)
|
public bool Remove(T value)
|
||||||
{
|
{
|
||||||
if (!list.Contains(value))
|
if (!list.Contains(value))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if (removableList)
|
if (removableList)
|
||||||
if (value != null)
|
if (value != null)
|
||||||
@ -230,6 +230,8 @@ namespace Esyur.Data
|
|||||||
list.Remove(value);
|
list.Remove(value);
|
||||||
|
|
||||||
OnRemoved?.Invoke(State, value);
|
OnRemoved?.Invoke(State, value);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -242,7 +244,7 @@ namespace Esyur.Data
|
|||||||
|
|
||||||
public bool IsSynchronized => (list as ICollection).IsSynchronized;
|
public bool IsSynchronized => (list as ICollection).IsSynchronized;
|
||||||
|
|
||||||
public bool IsReadOnly => throw new NotImplementedException();
|
public bool IsReadOnly => false;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -290,17 +292,20 @@ namespace Esyur.Data
|
|||||||
|
|
||||||
public void CopyTo(Array array, int index)
|
public void CopyTo(Array array, int index)
|
||||||
{
|
{
|
||||||
|
lock (syncRoot)
|
||||||
(list as ICollection).CopyTo(array, index);
|
(list as ICollection).CopyTo(array, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CopyTo(T[] array, int arrayIndex)
|
public void CopyTo(T[] array, int arrayIndex)
|
||||||
{
|
{
|
||||||
|
lock (syncRoot)
|
||||||
list.CopyTo(array, arrayIndex);
|
list.CopyTo(array, arrayIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ICollection<T>.Remove(T item)
|
//bool ICollection<T>.Remove(T item)
|
||||||
{
|
//{
|
||||||
return list.Remove(item);
|
// lock(syncRoot)
|
||||||
}
|
// return Remove(item);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,11 +26,11 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
|
|
||||||
namespace Esyur.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
|
@ -25,19 +25,19 @@ SOFTWARE.
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Net.IIP;
|
using Esiur.Net.IIP;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Esyur.Resource.Template;
|
using Esiur.Resource.Template;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
||||||
namespace Esyur.Data
|
namespace Esiur.Data
|
||||||
{
|
{
|
||||||
public static class Codec
|
public static class Codec
|
||||||
{
|
{
|
@ -26,18 +26,18 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Net.IIP;
|
using Esiur.Net.IIP;
|
||||||
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
|
|
||||||
namespace Esyur.Data
|
namespace Esiur.Data
|
||||||
{
|
{
|
||||||
public static class DC // Data Converter
|
public static class DC // Data Converter
|
||||||
{
|
{
|
@ -28,7 +28,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Data
|
namespace Esiur.Data
|
||||||
{
|
{
|
||||||
public enum DataType : byte
|
public enum DataType : byte
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Data
|
namespace Esiur.Data
|
||||||
{
|
{
|
||||||
public interface IUserType
|
public interface IUserType
|
||||||
{
|
{
|
@ -31,9 +31,9 @@ using System.Reflection;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
|
|
||||||
namespace Esyur.Data
|
namespace Esiur.Data
|
||||||
{
|
{
|
||||||
|
|
||||||
public class KeyList<KT, T> : IEnumerable<KeyValuePair<KT, T>>
|
public class KeyList<KT, T> : IEnumerable<KeyValuePair<KT, T>>
|
@ -28,7 +28,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Data
|
namespace Esiur.Data
|
||||||
{
|
{
|
||||||
public class NotModified
|
public class NotModified
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Data
|
namespace Esiur.Data
|
||||||
{
|
{
|
||||||
public class PropertyValue
|
public class PropertyValue
|
||||||
{
|
{
|
@ -27,10 +27,10 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace Esyur.Data
|
namespace Esiur.Data
|
||||||
{
|
{
|
||||||
public class ResourceList<T, ST> : IEnumerable<T>, ICollection, ICollection<T>
|
public class ResourceList<T, ST> : IEnumerable<T>, ICollection, ICollection<T>
|
||||||
{
|
{
|
@ -31,7 +31,7 @@ using System.Text;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Esyur.Data
|
namespace Esiur.Data
|
||||||
{
|
{
|
||||||
|
|
||||||
public class StringKeyList : IEnumerable<KeyValuePair<string, string>>
|
public class StringKeyList : IEnumerable<KeyValuePair<string, string>>
|
@ -28,12 +28,12 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace Esyur.Data
|
namespace Esiur.Data
|
||||||
{
|
{
|
||||||
public class Structure : IEnumerable<KeyValuePair<string, object>>
|
public class Structure : IEnumerable<KeyValuePair<string, object>>
|
||||||
{
|
{
|
@ -4,17 +4,19 @@
|
|||||||
<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/Esyur/Esyur-dotnet/blob/master/LICENSE</PackageLicenseUrl>
|
<PackageLicenseUrl>https://github.com/Esiur/Esiur-dotnet/blob/master/LICENSE</PackageLicenseUrl>
|
||||||
<PackageProjectUrl>http://www.esyur.com</PackageProjectUrl>
|
<PackageProjectUrl>http://www.esiur.com</PackageProjectUrl>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Version>1.5.0</Version>
|
<Version>1.5.0</Version>
|
||||||
<RepositoryUrl>https://github.com/esyur/esyur-dotnet</RepositoryUrl>
|
<RepositoryUrl>https://github.com/esiur/esiur-dotnet</RepositoryUrl>
|
||||||
<Authors>Ahmed Kh. Zamil</Authors>
|
<Authors>Ahmed Kh. Zamil</Authors>
|
||||||
<AssemblyVersion>1.3.1.0</AssemblyVersion>
|
<AssemblyVersion>1.3.1.0</AssemblyVersion>
|
||||||
<Company>Esyur Foundation</Company>
|
<Company>Esiur Foundation</Company>
|
||||||
<FileVersion>1.3.1.0</FileVersion>
|
<FileVersion>1.3.1.0</FileVersion>
|
||||||
<AssemblyName>Esyur</AssemblyName>
|
<AssemblyName>Esiur</AssemblyName>
|
||||||
<RootNamespace>Esyur</RootNamespace>
|
<RootNamespace>Esiur</RootNamespace>
|
||||||
|
<PackageId>Esiur</PackageId>
|
||||||
|
<Product>Esiur</Product>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
@ -29,17 +29,17 @@ using System.Xml;
|
|||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
//using Esyur.Net.Packets;
|
//using Esiur.Net.Packets;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Esyur.Misc
|
namespace Esiur.Misc
|
||||||
{
|
{
|
||||||
public static class Global
|
public static class Global
|
||||||
{
|
{
|
@ -26,12 +26,12 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Net.Packets;
|
using Esiur.Net.Packets;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
|
|
||||||
namespace Esyur.Net.DataLink
|
namespace Esiur.Net.DataLink
|
||||||
{
|
{
|
||||||
public abstract class PacketFilter : IResource
|
public abstract class PacketFilter : IResource
|
||||||
{
|
{
|
@ -26,13 +26,13 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using Esyur.Net.Packets;
|
using Esiur.Net.Packets;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
|
|
||||||
namespace Esyur.Net.DataLink
|
namespace Esiur.Net.DataLink
|
||||||
{
|
{
|
||||||
public class PacketServer:IResource
|
public class PacketServer:IResource
|
||||||
{
|
{
|
@ -22,15 +22,15 @@ SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using Esyur.Net.Packets;
|
using Esiur.Net.Packets;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
|
|
||||||
namespace Esyur.Net.DataLink
|
namespace Esiur.Net.DataLink
|
||||||
{
|
{
|
||||||
public abstract class PacketSource: IResource
|
public abstract class PacketSource: IResource
|
||||||
{
|
{
|
@ -31,14 +31,14 @@ using System.Threading;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Esyur.Net.Sockets;
|
using Esiur.Net.Sockets;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Net.Packets;
|
using Esiur.Net.Packets;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
|
|
||||||
namespace Esyur.Net.HTTP
|
namespace Esiur.Net.HTTP
|
||||||
{
|
{
|
||||||
public class HTTPConnection : NetworkConnection
|
public class HTTPConnection : NetworkConnection
|
||||||
{
|
{
|
@ -31,11 +31,11 @@ using System.Threading;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
|
|
||||||
namespace Esyur.Net.HTTP
|
namespace Esiur.Net.HTTP
|
||||||
{
|
{
|
||||||
|
|
||||||
public abstract class HTTPFilter : IResource
|
public abstract class HTTPFilter : IResource
|
@ -31,15 +31,15 @@ using System.Threading;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Esyur.Net.Sockets;
|
using Esiur.Net.Sockets;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Net.Packets;
|
using Esiur.Net.Packets;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
|
|
||||||
namespace Esyur.Net.HTTP
|
namespace Esiur.Net.HTTP
|
||||||
{
|
{
|
||||||
public class HTTPServer : NetworkServer<HTTPConnection>, IResource
|
public class HTTPServer : NetworkServer<HTTPConnection>, IResource
|
||||||
{
|
{
|
||||||
@ -66,19 +66,19 @@ namespace Esyur.Net.HTTP
|
|||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Attribute]
|
//[Attribute]
|
||||||
public virtual uint Timeout
|
//public virtual uint Timeout
|
||||||
{
|
//{
|
||||||
get;
|
// get;
|
||||||
set;
|
// set;
|
||||||
}
|
//}
|
||||||
|
|
||||||
[Attribute]
|
//[Attribute]
|
||||||
public virtual uint Clock
|
//public virtual uint Clock
|
||||||
{
|
//{
|
||||||
get;
|
// get;
|
||||||
set;
|
// set;
|
||||||
}
|
//}
|
||||||
|
|
||||||
[Attribute]
|
[Attribute]
|
||||||
public virtual uint MaxPost
|
public virtual uint MaxPost
|
@ -31,11 +31,11 @@ using System.Threading;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
|
|
||||||
namespace Esyur.Net.HTTP
|
namespace Esiur.Net.HTTP
|
||||||
{
|
{
|
||||||
public class HTTPSession : IDestructible //<T> where T : TClient
|
public class HTTPSession : IDestructible //<T> where T : TClient
|
||||||
{
|
{
|
@ -1,22 +1,22 @@
|
|||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Net.IIP;
|
using Esiur.Net.IIP;
|
||||||
using Esyur.Net.Packets;
|
using Esiur.Net.Packets;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Net.HTTP
|
namespace Esiur.Net.HTTP
|
||||||
{
|
{
|
||||||
public class IIPoHTTP : HTTPFilter
|
public class IIPoHTTP : HTTPFilter
|
||||||
{
|
{
|
||||||
[Attribute]
|
[Attribute]
|
||||||
EntryPoint EntryPoint { get; set; }
|
EntryPoint EntryPoint { get; set; }
|
||||||
|
|
||||||
public async override AsyncReply<bool> Execute(HTTPConnection sender)
|
public override AsyncReply<bool> Execute(HTTPConnection sender)
|
||||||
{
|
{
|
||||||
if (sender.Request.URL != "iip")
|
if (sender.Request.URL != "iip")
|
||||||
return false;
|
return new AsyncReply<bool>(false);
|
||||||
|
|
||||||
IIPPacket.IIPPacketAction action = (IIPPacket.IIPPacketAction)Convert.ToByte(sender.Request.Query["a"]);
|
IIPPacket.IIPPacketAction action = (IIPPacket.IIPPacketAction)Convert.ToByte(sender.Request.Query["a"]);
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ namespace Esyur.Net.HTTP
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return new AsyncReply<bool>(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override AsyncReply<bool> Trigger(ResourceTrigger trigger)
|
public override AsyncReply<bool> Trigger(ResourceTrigger trigger)
|
@ -27,12 +27,12 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using Esyur.Net.IIP;
|
using Esiur.Net.IIP;
|
||||||
using Esyur.Net.Sockets;
|
using Esiur.Net.Sockets;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
|
|
||||||
namespace Esyur.Net.HTTP
|
namespace Esiur.Net.HTTP
|
||||||
{
|
{
|
||||||
public class IIPoWS: HTTPFilter
|
public class IIPoWS: HTTPFilter
|
||||||
{
|
{
|
||||||
@ -43,18 +43,18 @@ namespace Esyur.Net.HTTP
|
|||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async override AsyncReply<bool> Execute(HTTPConnection sender)
|
public override AsyncReply<bool> Execute(HTTPConnection sender)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (sender.IsWebsocketRequest())
|
if (sender.IsWebsocketRequest())
|
||||||
{
|
{
|
||||||
if (Server == null)
|
if (Server == null)
|
||||||
return false;
|
return new AsyncReply<bool>(false);
|
||||||
|
|
||||||
var tcpSocket = sender.Unassign();
|
var tcpSocket = sender.Unassign();
|
||||||
|
|
||||||
if (tcpSocket == null)
|
if (tcpSocket == null)
|
||||||
return false;
|
return new AsyncReply<bool>(false);
|
||||||
|
|
||||||
var httpServer = sender.Parent;
|
var httpServer = sender.Parent;
|
||||||
var wsSocket = new WSSocket(tcpSocket);
|
var wsSocket = new WSSocket(tcpSocket);
|
||||||
@ -66,10 +66,10 @@ namespace Esyur.Net.HTTP
|
|||||||
iipConnection.Assign(wsSocket);
|
iipConnection.Assign(wsSocket);
|
||||||
wsSocket.Begin();
|
wsSocket.Begin();
|
||||||
|
|
||||||
return true;
|
return new AsyncReply<bool>(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return new AsyncReply<bool>( false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (sender.Request.Filename.StartsWith("/iip/"))
|
if (sender.Request.Filename.StartsWith("/iip/"))
|
@ -28,19 +28,19 @@ using System.Text;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using Esyur.Net.Sockets;
|
using Esiur.Net.Sockets;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Net.Packets;
|
using Esiur.Net.Packets;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using Esyur.Security.Authority;
|
using Esiur.Security.Authority;
|
||||||
using Esyur.Resource.Template;
|
using Esiur.Resource.Template;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using static Esyur.Net.Packets.IIPPacket;
|
using static Esiur.Net.Packets.IIPPacket;
|
||||||
|
|
||||||
namespace Esyur.Net.IIP
|
namespace Esiur.Net.IIP
|
||||||
{
|
{
|
||||||
public partial class DistributedConnection : NetworkConnection, IStore
|
public partial class DistributedConnection : NetworkConnection, IStore
|
||||||
{
|
{
|
||||||
@ -1058,12 +1058,12 @@ namespace Esyur.Net.IIP
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="resource">Resource.</param>
|
/// <param name="resource">Resource.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async AsyncReply<bool> Put(IResource resource)
|
public AsyncReply<bool> Put(IResource resource)
|
||||||
{
|
{
|
||||||
if (Codec.IsLocalResource(resource, this))
|
if (Codec.IsLocalResource(resource, this))
|
||||||
resources.Add((resource as DistributedResource).Id, (DistributedResource)resource);
|
resources.Add((resource as DistributedResource).Id, (DistributedResource)resource);
|
||||||
// else ... send it to the peer
|
// else ... send it to the peer
|
||||||
return true;
|
return new AsyncReply<bool>(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Record(IResource resource, string propertyName, object value, ulong age, DateTime dateTime)
|
public bool Record(IResource resource, string propertyName, object value, ulong age, DateTime dateTime)
|
||||||
@ -1107,7 +1107,7 @@ namespace Esyur.Net.IIP
|
|||||||
//if (Codec.IsLocalResource(resource, this))
|
//if (Codec.IsLocalResource(resource, this))
|
||||||
// return new AsyncBag<T>((resource as DistributedResource).children.Where(x => x.GetType() == typeof(T)).Select(x => (T)x));
|
// return new AsyncBag<T>((resource as DistributedResource).children.Where(x => x.GetType() == typeof(T)).Select(x => (T)x));
|
||||||
|
|
||||||
return null;
|
//return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AsyncBag<T> Parents<T>(IResource resource, string name) where T : IResource
|
public AsyncBag<T> Parents<T>(IResource resource, string name) where T : IResource
|
||||||
@ -1116,7 +1116,6 @@ namespace Esyur.Net.IIP
|
|||||||
//if (Codec.IsLocalResource(resource, this))
|
//if (Codec.IsLocalResource(resource, this))
|
||||||
// return (resource as DistributedResource).parents.Where(x => x.GetType() == typeof(T)).Select(x => (T)x);
|
// return (resource as DistributedResource).parents.Where(x => x.GetType() == typeof(T)).Select(x => (T)x);
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -22,13 +22,13 @@ SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Net.Packets;
|
using Esiur.Net.Packets;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using Esyur.Resource.Template;
|
using Esiur.Resource.Template;
|
||||||
using Esyur.Security.Authority;
|
using Esiur.Security.Authority;
|
||||||
using Esyur.Security.Permissions;
|
using Esiur.Security.Permissions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ using System.Reflection;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Net.IIP
|
namespace Esiur.Net.IIP
|
||||||
{
|
{
|
||||||
partial class DistributedConnection
|
partial class DistributedConnection
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Net.IIP
|
namespace Esiur.Net.IIP
|
||||||
{
|
{
|
||||||
public class DistributedPropertyContext
|
public class DistributedPropertyContext
|
||||||
{
|
{
|
@ -29,20 +29,20 @@ using System.Reflection;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using Esyur.Resource.Template;
|
using Esiur.Resource.Template;
|
||||||
|
|
||||||
namespace Esyur.Net.IIP
|
namespace Esiur.Net.IIP
|
||||||
{
|
{
|
||||||
|
|
||||||
//[System.Runtime.InteropServices.ComVisible(true)]
|
//[System.Runtime.InteropServices.ComVisible(true)]
|
@ -28,7 +28,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Net.IIP
|
namespace Esiur.Net.IIP
|
||||||
{
|
{
|
||||||
public delegate void DistributedResourceEvent(DistributedResource sender, params object[] arguments);
|
public delegate void DistributedResourceEvent(DistributedResource sender, params object[] arguments);
|
||||||
}
|
}
|
@ -28,7 +28,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Net.IIP
|
namespace Esiur.Net.IIP
|
||||||
{
|
{
|
||||||
public class DistributedResourceQueueItem
|
public class DistributedResourceQueueItem
|
||||||
{
|
{
|
@ -26,16 +26,16 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Net.Sockets;
|
using Esiur.Net.Sockets;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using Esyur.Security.Membership;
|
using Esiur.Security.Membership;
|
||||||
|
|
||||||
namespace Esyur.Net.IIP
|
namespace Esiur.Net.IIP
|
||||||
{
|
{
|
||||||
public class DistributedServer : NetworkServer<DistributedConnection>, IResource
|
public class DistributedServer : NetworkServer<DistributedConnection>, IResource
|
||||||
{
|
{
|
@ -25,10 +25,10 @@ SOFTWARE.
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Net.Sockets;
|
using Esiur.Net.Sockets;
|
||||||
using Esyur.Security.Authority;
|
using Esiur.Security.Authority;
|
||||||
|
|
||||||
namespace Esyur.Net.IIP
|
namespace Esiur.Net.IIP
|
||||||
{
|
{
|
||||||
public class DistributedSession : NetworkSession
|
public class DistributedSession : NetworkSession
|
||||||
{
|
{
|
@ -24,14 +24,14 @@ SOFTWARE.
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using Esyur.Resource.Template;
|
using Esiur.Resource.Template;
|
||||||
|
|
||||||
namespace Esyur.Net.IIP
|
namespace Esiur.Net.IIP
|
||||||
{
|
{
|
||||||
public abstract class EntryPoint : Esyur.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);
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Net
|
namespace Esiur.Net
|
||||||
{
|
{
|
||||||
public interface INetworkReceiver<T>
|
public interface INetworkReceiver<T>
|
||||||
{
|
{
|
@ -26,10 +26,10 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
|
|
||||||
namespace Esyur.Net
|
namespace Esiur.Net
|
||||||
{
|
{
|
||||||
public class NetworkBuffer
|
public class NetworkBuffer
|
||||||
{
|
{
|
@ -30,13 +30,13 @@ using System.Threading;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Net.Sockets;
|
using Esiur.Net.Sockets;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
|
|
||||||
namespace Esyur.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
|
||||||
{
|
{
|
||||||
@ -81,11 +81,7 @@ namespace Esyur.Net
|
|||||||
OnDestroy = null;
|
OnDestroy = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ISocket Socket
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Sockets.ISocket Socket
|
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@ -93,7 +89,7 @@ namespace Esyur.Net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Assign(Sockets.ISocket socket)
|
public virtual void Assign(ISocket socket)
|
||||||
{
|
{
|
||||||
lastAction = DateTime.Now;
|
lastAction = DateTime.Now;
|
||||||
sock = socket;
|
sock = socket;
|
||||||
@ -124,7 +120,7 @@ namespace Esyur.Net
|
|||||||
//{
|
//{
|
||||||
//}
|
//}
|
||||||
|
|
||||||
public Sockets.ISocket Unassign()
|
public ISocket Unassign()
|
||||||
{
|
{
|
||||||
if (sock != null)
|
if (sock != null)
|
||||||
{
|
{
|
||||||
@ -323,7 +319,7 @@ namespace Esyur.Net
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Closed ?
|
// Closed ?
|
||||||
if (sock.State == SocketState.Closed || sock.State == SocketState.Terminated) // || !connected)
|
if (sock.State == SocketState.Closed)// || sock.State == SocketState.Terminated) // || !connected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lastAction = DateTime.Now;
|
lastAction = DateTime.Now;
|
@ -25,15 +25,15 @@ SOFTWARE.
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Net.Sockets;
|
using Esiur.Net.Sockets;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Esyur.Net
|
namespace Esiur.Net
|
||||||
{
|
{
|
||||||
|
|
||||||
public abstract class NetworkServer<TConnection> : IDestructible where TConnection : NetworkConnection, new()
|
public abstract class NetworkServer<TConnection> : IDestructible where TConnection : NetworkConnection, new()
|
@ -31,11 +31,11 @@ using System.Threading;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
|
|
||||||
namespace Esyur.Net
|
namespace Esiur.Net
|
||||||
{
|
{
|
||||||
public class NetworkSession:IDestructible //<T> where T : TClient
|
public class NetworkSession:IDestructible //<T> where T : TClient
|
||||||
{
|
{
|
@ -27,11 +27,11 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace Esyur.Net.Packets
|
namespace Esiur.Net.Packets
|
||||||
{
|
{
|
||||||
public class HTTPRequestPacket : Packet
|
public class HTTPRequestPacket : Packet
|
||||||
{
|
{
|
||||||
@ -243,9 +243,10 @@ namespace Esyur.Net.Packets
|
|||||||
return -(postSize - (data.Length - headerSize));
|
return -(postSize - (data.Length - headerSize));
|
||||||
|
|
||||||
|
|
||||||
if (Headers["content-type"].StartsWith("application/x-www-form-urlencoded")
|
if (
|
||||||
|
Headers["content-type"] == null
|
||||||
|| Headers["content-type"] == ""
|
|| Headers["content-type"] == ""
|
||||||
|| Headers["content-type"] == null)
|
|| Headers["content-type"].StartsWith("application/x-www-form-urlencoded"))
|
||||||
{
|
{
|
||||||
string[] PostVars = null;
|
string[] PostVars = null;
|
||||||
PostVars = Encoding.UTF8.GetString(data, (int)headerSize, (int)postSize).Split('&');
|
PostVars = Encoding.UTF8.GetString(data, (int)headerSize, (int)postSize).Split('&');
|
@ -25,10 +25,10 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
|
|
||||||
namespace Esyur.Net.Packets
|
namespace Esiur.Net.Packets
|
||||||
{
|
{
|
||||||
public class HTTPResponsePacket : Packet
|
public class HTTPResponsePacket : Packet
|
||||||
{
|
{
|
||||||
@ -137,7 +137,7 @@ namespace Esyur.Net.Packets
|
|||||||
|
|
||||||
private string MakeHeader(ComposeOptions options)
|
private string MakeHeader(ComposeOptions options)
|
||||||
{
|
{
|
||||||
string header = $"{Version} {(int)Number} {Text}\r\nServer: Esyur {Global.Version}\r\nDate: {DateTime.Now.ToUniversalTime().ToString("r")}\r\n";
|
string header = $"{Version} {(int)Number} {Text}\r\nServer: Esiur {Global.Version}\r\nDate: {DateTime.Now.ToUniversalTime().ToString("r")}\r\n";
|
||||||
|
|
||||||
if (options == ComposeOptions.AllCalculateLength)
|
if (options == ComposeOptions.AllCalculateLength)
|
||||||
Headers["Content-Length"] = Message?.Length.ToString() ?? "0";
|
Headers["Content-Length"] = Message?.Length.ToString() ?? "0";
|
@ -22,8 +22,8 @@ SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Security.Authority;
|
using Esiur.Security.Authority;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -31,7 +31,7 @@ using System.Security.Cryptography;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Net.Packets
|
namespace Esiur.Net.Packets
|
||||||
{
|
{
|
||||||
class IIPAuthPacket : Packet
|
class IIPAuthPacket : Packet
|
||||||
{
|
{
|
@ -22,17 +22,17 @@ SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Net.Packets;
|
using Esiur.Net.Packets;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Net.Packets
|
namespace Esiur.Net.Packets
|
||||||
{
|
{
|
||||||
class IIPPacket : Packet
|
class IIPPacket : Packet
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Net.Packets
|
namespace Esiur.Net.Packets
|
||||||
{
|
{
|
||||||
struct IIPPacketAttachInfo
|
struct IIPPacketAttachInfo
|
||||||
{
|
{
|
@ -33,12 +33,12 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Net.DataLink;
|
using Esiur.Net.DataLink;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
|
|
||||||
namespace Esyur.Net.Packets
|
namespace Esiur.Net.Packets
|
||||||
{
|
{
|
||||||
internal static class Functions
|
internal static class Functions
|
||||||
{
|
{
|
@ -26,10 +26,10 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
|
|
||||||
namespace Esyur.Net.Packets
|
namespace Esiur.Net.Packets
|
||||||
{
|
{
|
||||||
public class WebsocketPacket : Packet
|
public class WebsocketPacket : Packet
|
||||||
{
|
{
|
@ -1,10 +1,10 @@
|
|||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Net
|
namespace Esiur.Net
|
||||||
{
|
{
|
||||||
public class SendList : BinaryList
|
public class SendList : BinaryList
|
||||||
{
|
{
|
@ -30,13 +30,13 @@ using System.Threading;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
|
|
||||||
namespace Esyur.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();
|
@ -28,16 +28,16 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Net.Security;
|
using System.Net.Security;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
|
|
||||||
namespace Esyur.Net.Sockets
|
namespace Esiur.Net.Sockets
|
||||||
{
|
{
|
||||||
public class SSLSocket : ISocket
|
public class SSLSocket : ISocket
|
||||||
{
|
{
|
||||||
@ -94,7 +94,7 @@ namespace Esyur.Net.Sockets
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
state = SocketState.Terminated;
|
state = SocketState.Closed;// .Terminated;
|
||||||
Close();
|
Close();
|
||||||
Global.Log(ex);
|
Global.Log(ex);
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ namespace Esyur.Net.Sockets
|
|||||||
{
|
{
|
||||||
if (state != SocketState.Closed && !sock.Connected)
|
if (state != SocketState.Closed && !sock.Connected)
|
||||||
{
|
{
|
||||||
state = SocketState.Terminated;
|
//state = SocketState.Closed;//.Terminated;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,13 +175,14 @@ namespace Esyur.Net.Sockets
|
|||||||
|
|
||||||
if (state != SocketState.Closed && !sock.Connected)
|
if (state != SocketState.Closed && !sock.Connected)
|
||||||
{
|
{
|
||||||
state = SocketState.Terminated;
|
//state = SocketState.Terminated;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex2)
|
catch (Exception ex2)
|
||||||
{
|
{
|
||||||
state = SocketState.Terminated;
|
//state = SocketState.Closed;// .Terminated;
|
||||||
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Global.Log("TCPSocket", LogType.Error, ex.ToString());
|
//Global.Log("TCPSocket", LogType.Error, ex.ToString());
|
||||||
@ -257,7 +258,7 @@ namespace Esyur.Net.Sockets
|
|||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
if (state != SocketState.Closed && state != SocketState.Terminated)
|
if (state != SocketState.Closed)// && state != SocketState.Terminated)
|
||||||
{
|
{
|
||||||
state = SocketState.Closed;
|
state = SocketState.Closed;
|
||||||
|
|
||||||
@ -269,7 +270,7 @@ namespace Esyur.Net.Sockets
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
state = SocketState.Terminated;
|
//state = SocketState.Terminated;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +312,7 @@ namespace Esyur.Net.Sockets
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
asyncSending = false;
|
asyncSending = false;
|
||||||
state = SocketState.Terminated;
|
//state = SocketState.Terminated;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -442,7 +443,7 @@ namespace Esyur.Net.Sockets
|
|||||||
{
|
{
|
||||||
if (state != SocketState.Closed && !sock.Connected)
|
if (state != SocketState.Closed && !sock.Connected)
|
||||||
{
|
{
|
||||||
state = SocketState.Terminated;
|
//state = SocketState.Terminated;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,7 +474,7 @@ namespace Esyur.Net.Sockets
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
state = SocketState.Terminated;
|
state = SocketState.Closed;// Terminated;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -528,7 +529,7 @@ namespace Esyur.Net.Sockets
|
|||||||
{
|
{
|
||||||
rt.TriggerError(ex);
|
rt.TriggerError(ex);
|
||||||
asyncSending = false;
|
asyncSending = false;
|
||||||
state = SocketState.Terminated;
|
//state = SocketState.Terminated;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -546,7 +547,7 @@ namespace Esyur.Net.Sockets
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
state = SocketState.Terminated;
|
state = SocketState.Closed;// .Terminated;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -28,7 +28,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Net.Sockets
|
namespace Esiur.Net.Sockets
|
||||||
{
|
{
|
||||||
public enum SocketState
|
public enum SocketState
|
||||||
{
|
{
|
||||||
@ -37,6 +37,6 @@ namespace Esyur.Net.Sockets
|
|||||||
Connecting,
|
Connecting,
|
||||||
Established,
|
Established,
|
||||||
Closed,
|
Closed,
|
||||||
Terminated
|
//Terminated
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -28,14 +28,14 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
|
|
||||||
namespace Esyur.Net.Sockets
|
namespace Esiur.Net.Sockets
|
||||||
{
|
{
|
||||||
public class TCPSocket : ISocket
|
public class TCPSocket : ISocket
|
||||||
{
|
{
|
||||||
@ -46,7 +46,7 @@ namespace Esyur.Net.Sockets
|
|||||||
|
|
||||||
bool held;
|
bool held;
|
||||||
|
|
||||||
ArraySegment<byte> receiveBufferSegment;
|
//ArraySegment<byte> receiveBufferSegment;
|
||||||
|
|
||||||
NetworkBuffer receiveNetworkBuffer = new NetworkBuffer();
|
NetworkBuffer receiveNetworkBuffer = new NetworkBuffer();
|
||||||
|
|
||||||
@ -65,30 +65,80 @@ namespace Esyur.Net.Sockets
|
|||||||
//public event ISocketCloseEvent OnClose;
|
//public event ISocketCloseEvent OnClose;
|
||||||
public event DestroyedEvent OnDestroy;
|
public event DestroyedEvent OnDestroy;
|
||||||
|
|
||||||
SocketAsyncEventArgs socketArgs = new SocketAsyncEventArgs();
|
//SocketAsyncEventArgs socketArgs = new SocketAsyncEventArgs();
|
||||||
|
|
||||||
public async AsyncReply<bool> BeginAsync()
|
private AsyncCallback receiveCallback;
|
||||||
|
private AsyncCallback sendCallback;
|
||||||
|
|
||||||
|
public AsyncReply<bool> BeginAsync()
|
||||||
{
|
{
|
||||||
return Begin();
|
return new AsyncReply<bool>(Begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private AsyncReply<bool> currentReply = null;
|
||||||
|
|
||||||
public bool Begin()
|
public bool Begin()
|
||||||
{
|
{
|
||||||
if (began)
|
if (began)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
began = true;
|
began = true;
|
||||||
|
/*
|
||||||
|
|
||||||
socketArgs.SetBuffer(receiveBuffer, 0, receiveBuffer.Length);
|
socketArgs.SetBuffer(receiveBuffer, 0, receiveBuffer.Length);
|
||||||
socketArgs.Completed += SocketArgs_Completed;
|
socketArgs.Completed += SocketArgs_Completed;
|
||||||
|
|
||||||
if (!sock.ReceiveAsync(socketArgs))
|
if (!sock.ReceiveAsync(socketArgs))
|
||||||
SocketArgs_Completed(null, socketArgs);
|
SocketArgs_Completed(null, socketArgs);
|
||||||
|
*/
|
||||||
|
receiveCallback = new AsyncCallback(ReceiveCallback);
|
||||||
|
sendCallback = new AsyncCallback(SendCallback);
|
||||||
|
|
||||||
|
sock.BeginReceive(receiveBuffer, 0, receiveBuffer.Length, SocketFlags.None, receiveCallback, this);
|
||||||
//sock.ReceiveAsync(receiveBufferSegment, SocketFlags.None).ContinueWith(DataReceived);
|
//sock.ReceiveAsync(receiveBufferSegment, SocketFlags.None).ContinueWith(DataReceived);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void ReceiveCallback(IAsyncResult ar)
|
||||||
|
{
|
||||||
|
var socket = ar.AsyncState as TCPSocket;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
if (socket.state != SocketState.Established)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var recCount = socket.sock.EndReceive(ar);
|
||||||
|
|
||||||
|
if (recCount > 0)
|
||||||
|
{
|
||||||
|
socket.receiveNetworkBuffer.Write(socket.receiveBuffer, 0, (uint)recCount);
|
||||||
|
socket.Receiver?.NetworkReceive(socket, socket.receiveNetworkBuffer);
|
||||||
|
|
||||||
|
if (socket.state == SocketState.Established)
|
||||||
|
socket.sock.BeginReceive(socket.receiveBuffer, 0, socket.receiveBuffer.Length, SocketFlags.None, socket.receiveCallback, socket);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
socket.Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (socket.state != SocketState.Closed && !socket.sock.Connected)
|
||||||
|
{
|
||||||
|
//socket.state = SocketState.Terminated;
|
||||||
|
socket.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Global.Log("TCPSocket", LogType.Error, ex.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public AsyncReply<bool> Connect(string hostname, ushort port)
|
public AsyncReply<bool> Connect(string hostname, ushort port)
|
||||||
{
|
{
|
||||||
var rt = new AsyncReply<bool>();
|
var rt = new AsyncReply<bool>();
|
||||||
@ -121,115 +171,115 @@ namespace Esyur.Net.Sockets
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void DataReceived(Task<int> task)
|
//private void DataReceived(Task<int> task)
|
||||||
{
|
//{
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
// SocketError err;
|
// // SocketError err;
|
||||||
|
|
||||||
if (state == SocketState.Closed || state == SocketState.Terminated)
|
// if (state == SocketState.Closed || state == SocketState.Terminated)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
if (task.Result <= 0)
|
// if (task.Result <= 0)
|
||||||
{
|
// {
|
||||||
Close();
|
// Close();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
receiveNetworkBuffer.Write(receiveBuffer, 0, (uint)task.Result);
|
// receiveNetworkBuffer.Write(receiveBuffer, 0, (uint)task.Result);
|
||||||
//OnReceive?.Invoke(receiveNetworkBuffer);
|
// //OnReceive?.Invoke(receiveNetworkBuffer);
|
||||||
Receiver?.NetworkReceive(this, receiveNetworkBuffer);
|
// Receiver?.NetworkReceive(this, receiveNetworkBuffer);
|
||||||
if (state == SocketState.Established)
|
// if (state == SocketState.Established)
|
||||||
sock.ReceiveAsync(receiveBufferSegment, SocketFlags.None).ContinueWith(DataReceived);
|
// sock.ReceiveAsync(receiveBufferSegment, SocketFlags.None).ContinueWith(DataReceived);
|
||||||
|
|
||||||
}
|
// }
|
||||||
catch (Exception ex)
|
// catch (Exception ex)
|
||||||
{
|
// {
|
||||||
if (state != SocketState.Closed && !sock.Connected)
|
// if (state != SocketState.Closed && !sock.Connected)
|
||||||
{
|
// {
|
||||||
state = SocketState.Terminated;
|
// state = SocketState.Terminated;
|
||||||
Close();
|
// Close();
|
||||||
}
|
// }
|
||||||
|
|
||||||
Global.Log("TCPSocket", LogType.Error, ex.ToString());
|
// Global.Log("TCPSocket", LogType.Error, ex.ToString());
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
private void SocketArgs_Completed(object sender, SocketAsyncEventArgs e)
|
//private void SocketArgs_Completed(object sender, SocketAsyncEventArgs e)
|
||||||
{
|
//{
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
if (state != SocketState.Established)
|
// if (state != SocketState.Established)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
if (e.BytesTransferred <= 0)
|
// if (e.BytesTransferred <= 0)
|
||||||
{
|
// {
|
||||||
Close();
|
// Close();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
else if (e.SocketError != SocketError.Success)
|
// else if (e.SocketError != SocketError.Success)
|
||||||
{
|
// {
|
||||||
Close();
|
// Close();
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
var recCount = e.BytesTransferred > e.Count ? e.Count : e.BytesTransferred;
|
// var recCount = e.BytesTransferred > e.Count ? e.Count : e.BytesTransferred;
|
||||||
receiveNetworkBuffer.Write(receiveBuffer, 0, (uint)recCount);
|
// receiveNetworkBuffer.Write(receiveBuffer, 0, (uint)recCount);
|
||||||
|
|
||||||
//OnReceive?.Invoke(receiveNetworkBuffer);
|
// //OnReceive?.Invoke(receiveNetworkBuffer);
|
||||||
Receiver?.NetworkReceive(this, receiveNetworkBuffer);
|
// Receiver?.NetworkReceive(this, receiveNetworkBuffer);
|
||||||
|
|
||||||
if (state == SocketState.Established)
|
// if (state == SocketState.Established)
|
||||||
while (!sock.ReceiveAsync(e))
|
// while (!sock.ReceiveAsync(e))
|
||||||
{
|
// {
|
||||||
if (e.SocketError != SocketError.Success)
|
// if (e.SocketError != SocketError.Success)
|
||||||
{
|
// {
|
||||||
Close();
|
// Close();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (State != SocketState.Established)
|
// if (State != SocketState.Established)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
//if (e.BytesTransferred < 0)
|
// //if (e.BytesTransferred < 0)
|
||||||
// Console.WriteLine("BytesTransferred is less than zero");
|
// // Console.WriteLine("BytesTransferred is less than zero");
|
||||||
|
|
||||||
if (e.BytesTransferred <= 0)
|
// if (e.BytesTransferred <= 0)
|
||||||
{
|
// {
|
||||||
Close();
|
// Close();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
else if (e.SocketError != SocketError.Success)
|
// else if (e.SocketError != SocketError.Success)
|
||||||
{
|
// {
|
||||||
Close();
|
// Close();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
//if (e.BytesTransferred > 100000)
|
// //if (e.BytesTransferred > 100000)
|
||||||
// Console.WriteLine("BytesTransferred is large " + e.BytesTransferred);
|
// // Console.WriteLine("BytesTransferred is large " + e.BytesTransferred);
|
||||||
|
|
||||||
recCount = e.BytesTransferred > e.Count ? e.Count : e.BytesTransferred;
|
// recCount = e.BytesTransferred > e.Count ? e.Count : e.BytesTransferred;
|
||||||
|
|
||||||
receiveNetworkBuffer.Write(receiveBuffer, 0, (uint)recCount);
|
// receiveNetworkBuffer.Write(receiveBuffer, 0, (uint)recCount);
|
||||||
|
|
||||||
//OnReceive?.Invoke(receiveNetworkBuffer);
|
// //OnReceive?.Invoke(receiveNetworkBuffer);
|
||||||
Receiver?.NetworkReceive(this, receiveNetworkBuffer);
|
// Receiver?.NetworkReceive(this, receiveNetworkBuffer);
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
catch (Exception ex)
|
// catch (Exception ex)
|
||||||
{
|
// {
|
||||||
if (state != SocketState.Closed && !sock.Connected)
|
// if (state != SocketState.Closed && !sock.Connected)
|
||||||
{
|
// {
|
||||||
state = SocketState.Terminated;
|
// state = SocketState.Terminated;
|
||||||
Close();
|
// Close();
|
||||||
}
|
// }
|
||||||
|
|
||||||
Global.Log("TCPSocket", LogType.Error, ex.ToString());
|
// Global.Log("TCPSocket", LogType.Error, ex.ToString());
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
public IPEndPoint LocalEndPoint
|
public IPEndPoint LocalEndPoint
|
||||||
{
|
{
|
||||||
@ -242,7 +292,7 @@ namespace Esyur.Net.Sockets
|
|||||||
SocketType.Stream,
|
SocketType.Stream,
|
||||||
ProtocolType.Tcp);
|
ProtocolType.Tcp);
|
||||||
receiveBuffer = new byte[sock.ReceiveBufferSize];
|
receiveBuffer = new byte[sock.ReceiveBufferSize];
|
||||||
receiveBufferSegment = new ArraySegment<byte>(receiveBuffer);
|
//receiveBufferSegment = new ArraySegment<byte>(receiveBuffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +304,7 @@ namespace Esyur.Net.Sockets
|
|||||||
ProtocolType.Tcp);
|
ProtocolType.Tcp);
|
||||||
|
|
||||||
receiveBuffer = new byte[sock.ReceiveBufferSize];
|
receiveBuffer = new byte[sock.ReceiveBufferSize];
|
||||||
receiveBufferSegment = new ArraySegment<byte>(receiveBuffer);
|
//receiveBufferSegment = new ArraySegment<byte>(receiveBuffer);
|
||||||
|
|
||||||
Connect(hostname, port);
|
Connect(hostname, port);
|
||||||
|
|
||||||
@ -336,14 +386,14 @@ namespace Esyur.Net.Sockets
|
|||||||
{
|
{
|
||||||
sock = socket;
|
sock = socket;
|
||||||
receiveBuffer = new byte[sock.ReceiveBufferSize];
|
receiveBuffer = new byte[sock.ReceiveBufferSize];
|
||||||
receiveBufferSegment = new ArraySegment<byte>(receiveBuffer);
|
// receiveBufferSegment = new ArraySegment<byte>(receiveBuffer);
|
||||||
if (socket.Connected)
|
if (socket.Connected)
|
||||||
state = SocketState.Established;
|
state = SocketState.Established;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
if (state != SocketState.Closed && state != SocketState.Terminated)
|
if (state != SocketState.Closed)// && state != SocketState.Terminated)
|
||||||
{
|
{
|
||||||
state = SocketState.Closed;
|
state = SocketState.Closed;
|
||||||
|
|
||||||
@ -355,13 +405,20 @@ namespace Esyur.Net.Sockets
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
state = SocketState.Terminated;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//OnClose?.Invoke();
|
try
|
||||||
|
{
|
||||||
|
sendBufferQueue?.Clear();
|
||||||
Receiver?.NetworkClose(this);
|
Receiver?.NetworkClose(this);
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Global.Log(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Send(byte[] message)
|
public void Send(byte[] message)
|
||||||
@ -371,13 +428,17 @@ namespace Esyur.Net.Sockets
|
|||||||
|
|
||||||
public void Send(byte[] message, int offset, int size)
|
public void Send(byte[] message, int offset, int size)
|
||||||
{
|
{
|
||||||
|
if (state == SocketState.Closed)// || state == SocketState.Terminated)
|
||||||
|
return;
|
||||||
|
|
||||||
var msg = message.Clip((uint)offset, (uint)size);
|
var msg = message.Clip((uint)offset, (uint)size);
|
||||||
|
|
||||||
lock (sendLock)
|
lock (sendLock)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (state == SocketState.Closed)// || state == SocketState.Terminated)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!sock.Connected)
|
if (!sock.Connected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -390,12 +451,12 @@ namespace Esyur.Net.Sockets
|
|||||||
asyncSending = true;
|
asyncSending = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sock.BeginSend(msg, 0, msg.Length, SocketFlags.None, SendCallback, null);
|
sock.BeginSend(msg, 0, msg.Length, SocketFlags.None, sendCallback, this);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
asyncSending = false;
|
asyncSending = false;
|
||||||
state = SocketState.Terminated;
|
//state = SocketState.Closed;//.Terminated;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
//sock.SendAsync(new ArraySegment<byte>(msg), SocketFlags.None).ContinueWith(DataSent);
|
//sock.SendAsync(new ArraySegment<byte>(msg), SocketFlags.None).ContinueWith(DataSent);
|
||||||
@ -404,55 +465,45 @@ namespace Esyur.Net.Sockets
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendCallback(IAsyncResult ar)
|
private static void Flush(TCPSocket socket)
|
||||||
{
|
{
|
||||||
if (ar != null)
|
lock (socket.sendLock)
|
||||||
{
|
{
|
||||||
try
|
|
||||||
{
|
|
||||||
sock.EndSend(ar);
|
|
||||||
|
|
||||||
if (ar.AsyncState != null)
|
socket.currentReply?.Trigger(true);
|
||||||
((AsyncReply<bool>)ar.AsyncState).Trigger(true);
|
socket.currentReply = null;
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
if (state != SocketState.Closed && !sock.Connected)
|
|
||||||
{
|
|
||||||
state = SocketState.Terminated;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lock (sendLock)
|
if (socket.state == SocketState.Closed) //|| socket.state == SocketState.Terminated)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (socket.sendBufferQueue.Count > 0)
|
||||||
{
|
{
|
||||||
if (sendBufferQueue.Count > 0)
|
var kv = socket.sendBufferQueue.Dequeue();
|
||||||
{
|
|
||||||
var kv = sendBufferQueue.Dequeue();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sock.BeginSend(kv.Value, 0, kv.Value.Length, SocketFlags.None, SendCallback, kv.Key);
|
socket.currentReply = kv.Key;
|
||||||
|
socket.sock.BeginSend(kv.Value, 0, kv.Value.Length, SocketFlags.None,
|
||||||
|
socket.sendCallback, socket);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
asyncSending = false;
|
socket.asyncSending = false;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (kv.Key != null)
|
kv.Key?.Trigger(false);
|
||||||
kv.Key.Trigger(false);
|
|
||||||
|
|
||||||
if (state != SocketState.Closed && !sock.Connected)
|
if (socket.state != SocketState.Closed && !socket.sock.Connected)
|
||||||
{
|
{
|
||||||
state = SocketState.Terminated;
|
// socket.state = SocketState.Closed;// Terminated;
|
||||||
Close();
|
socket.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex2)
|
catch (Exception ex2)
|
||||||
{
|
{
|
||||||
state = SocketState.Terminated;
|
socket.Close();
|
||||||
|
//socket.state = SocketState.Closed;// .Terminated;
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.Log("TCPSocket", LogType.Error, ex.ToString());
|
Global.Log("TCPSocket", LogType.Error, ex.ToString());
|
||||||
@ -460,11 +511,28 @@ namespace Esyur.Net.Sockets
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
asyncSending = false;
|
socket.asyncSending = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void SendCallback(IAsyncResult ar)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var socket = (TCPSocket)ar.AsyncState;
|
||||||
|
|
||||||
|
socket.sock?.EndSend(ar);
|
||||||
|
Flush(socket);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Global.Log(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool Trigger(ResourceTrigger trigger)
|
public bool Trigger(ResourceTrigger trigger)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -472,16 +540,25 @@ namespace Esyur.Net.Sockets
|
|||||||
|
|
||||||
public void Destroy()
|
public void Destroy()
|
||||||
{
|
{
|
||||||
|
Global.Counters["Sck_D_1"]++;
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
//OnClose = null;
|
|
||||||
//OnConnect = null;
|
|
||||||
//OnReceive = null;
|
|
||||||
Receiver = null;
|
|
||||||
receiveNetworkBuffer = null;
|
receiveNetworkBuffer = null;
|
||||||
socketArgs.Completed -= SocketArgs_Completed;
|
receiveCallback = null;
|
||||||
socketArgs = null;
|
sendCallback = null;
|
||||||
|
sock = null;
|
||||||
|
receiveBuffer = null;
|
||||||
|
receiveNetworkBuffer = null;
|
||||||
|
sendBufferQueue = null;
|
||||||
|
|
||||||
|
//socketArgs.Completed -= SocketArgs_Completed;
|
||||||
|
//socketArgs.Dispose();
|
||||||
|
//socketArgs = null;
|
||||||
OnDestroy?.Invoke(this);
|
OnDestroy?.Invoke(this);
|
||||||
OnDestroy = null;
|
OnDestroy = null;
|
||||||
|
|
||||||
|
Global.Counters["Sck_D_2"]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISocket Accept()
|
public ISocket Accept()
|
||||||
@ -493,7 +570,7 @@ namespace Esyur.Net.Sockets
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
state = SocketState.Terminated;
|
state = SocketState.Closed;// Terminated;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -507,7 +584,7 @@ namespace Esyur.Net.Sockets
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
state = SocketState.Terminated;
|
state = SocketState.Closed;// Terminated;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -522,7 +599,8 @@ namespace Esyur.Net.Sockets
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SendCallback(null);
|
Flush(this);
|
||||||
|
//SendCallback(null);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -537,10 +615,16 @@ namespace Esyur.Net.Sockets
|
|||||||
public AsyncReply<bool> SendAsync(byte[] message, int offset, int length)
|
public AsyncReply<bool> SendAsync(byte[] message, int offset, int length)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (state == SocketState.Closed)// || state == SocketState.Terminated)
|
||||||
|
return new AsyncReply<bool>(false);
|
||||||
|
|
||||||
var msg = message.Clip((uint)offset, (uint)length);
|
var msg = message.Clip((uint)offset, (uint)length);
|
||||||
|
|
||||||
lock (sendLock)
|
lock (sendLock)
|
||||||
{
|
{
|
||||||
|
if (state == SocketState.Closed)// || state == SocketState.Terminated)
|
||||||
|
return new AsyncReply<bool>(false);
|
||||||
|
|
||||||
if (!sock.Connected)
|
if (!sock.Connected)
|
||||||
return new AsyncReply<bool>(false);
|
return new AsyncReply<bool>(false);
|
||||||
|
|
||||||
@ -555,13 +639,14 @@ namespace Esyur.Net.Sockets
|
|||||||
asyncSending = true;
|
asyncSending = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sock.BeginSend(msg, 0, msg.Length, SocketFlags.None, SendCallback, rt);// null);
|
currentReply = rt;
|
||||||
|
sock.BeginSend(msg, 0, msg.Length, SocketFlags.None, sendCallback, this);// null);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
rt.TriggerError(ex);
|
rt.TriggerError(ex);
|
||||||
asyncSending = false;
|
asyncSending = false;
|
||||||
state = SocketState.Terminated;
|
//state = SocketState.Terminated;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
//sock.SendAsync(new ArraySegment<byte>(msg), SocketFlags.None).ContinueWith(DataSent);
|
//sock.SendAsync(new ArraySegment<byte>(msg), SocketFlags.None).ContinueWith(DataSent);
|
||||||
@ -570,7 +655,5 @@ namespace Esyur.Net.Sockets
|
|||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -28,15 +28,15 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using Esyur.Net.Packets;
|
using Esiur.Net.Packets;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
namespace Esyur.Net.Sockets
|
namespace Esiur.Net.Sockets
|
||||||
{
|
{
|
||||||
public class WSSocket : ISocket, INetworkReceiver<ISocket>
|
public class WSSocket : ISocket, INetworkReceiver<ISocket>
|
||||||
{
|
{
|
||||||
@ -257,7 +257,7 @@ namespace Esyur.Net.Sockets
|
|||||||
public void NetworkReceive(ISocket sender, NetworkBuffer buffer)
|
public void NetworkReceive(ISocket sender, NetworkBuffer buffer)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (sock.State == SocketState.Closed || sock.State == SocketState.Terminated)
|
if (sock.State == SocketState.Closed)// || sock.State == SocketState.Terminated)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (buffer.Protected)
|
if (buffer.Protected)
|
@ -26,13 +26,13 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Net.Sockets;
|
using Esiur.Net.Sockets;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
|
|
||||||
namespace Esyur.Net.TCP
|
namespace Esiur.Net.TCP
|
||||||
{
|
{
|
||||||
public class TCPConnection:NetworkConnection {
|
public class TCPConnection:NetworkConnection {
|
||||||
|
|
@ -27,12 +27,12 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Net.Sockets;
|
using Esiur.Net.Sockets;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
|
|
||||||
namespace Esyur.Net.TCP
|
namespace Esiur.Net.TCP
|
||||||
{
|
{
|
||||||
public abstract class TCPFilter: IResource
|
public abstract class TCPFilter: IResource
|
||||||
{
|
{
|
@ -26,15 +26,15 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Net.Sockets;
|
using Esiur.Net.Sockets;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
|
|
||||||
namespace Esyur.Net.TCP
|
namespace Esiur.Net.TCP
|
||||||
{
|
{
|
||||||
public class TCPServer : NetworkServer<TCPConnection>, IResource
|
public class TCPServer : NetworkServer<TCPConnection>, IResource
|
||||||
{
|
{
|
||||||
@ -51,18 +51,18 @@ namespace Esyur.Net.TCP
|
|||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
[Storable]
|
//[Storable]
|
||||||
public uint Timeout
|
//public uint Timeout
|
||||||
{
|
//{
|
||||||
get;
|
// get;
|
||||||
set;
|
// set;
|
||||||
}
|
//}
|
||||||
[Attribute]
|
//[Attribute]
|
||||||
public uint Clock
|
//public uint Clock
|
||||||
{
|
//{
|
||||||
get;
|
// get;
|
||||||
set;
|
// set;
|
||||||
}
|
//}
|
||||||
public Instance Instance { get; set; }
|
public Instance Instance { get; set; }
|
||||||
|
|
||||||
TCPFilter[] filters = null;
|
TCPFilter[] filters = null;
|
||||||
@ -128,7 +128,7 @@ namespace Esyur.Net.TCP
|
|||||||
|
|
||||||
foreach (var filter in filters)
|
foreach (var filter in filters)
|
||||||
{
|
{
|
||||||
filter.Connected(connection);
|
filter.Disconnected(connection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ namespace Esyur.Net.TCP
|
|||||||
{
|
{
|
||||||
foreach (var filter in filters)
|
foreach (var filter in filters)
|
||||||
{
|
{
|
||||||
filter.Disconnected(connection);
|
filter.Connected(connection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -28,7 +28,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Net.TCP
|
namespace Esiur.Net.TCP
|
||||||
{
|
{
|
||||||
public class TCPSession : NetworkSession
|
public class TCPSession : NetworkSession
|
||||||
{
|
{
|
@ -28,11 +28,11 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
|
|
||||||
namespace Esyur.Net.UDP
|
namespace Esiur.Net.UDP
|
||||||
{
|
{
|
||||||
public abstract class UDPFilter : IResource
|
public abstract class UDPFilter : IResource
|
||||||
{
|
{
|
@ -28,12 +28,12 @@ using System.Net.Sockets;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
|
|
||||||
namespace Esyur.Net.UDP
|
namespace Esiur.Net.UDP
|
||||||
{
|
{
|
||||||
|
|
||||||
/* public class IIPConnection
|
/* public class IIPConnection
|
@ -7,7 +7,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||||||
<PublishProtocol>FileSystem</PublishProtocol>
|
<PublishProtocol>FileSystem</PublishProtocol>
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<PublishDir>M:\opt\Esyur</PublishDir>
|
<PublishDir>M:\opt\Esiur</PublishDir>
|
||||||
<Platform>Any CPU</Platform>
|
<Platform>Any CPU</Platform>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
@ -1,4 +1,4 @@
|
|||||||
using Esyur.Resource;
|
using Esiur.Resource;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -6,7 +6,7 @@ using System.Reflection;
|
|||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Proxy
|
namespace Esiur.Proxy
|
||||||
{
|
{
|
||||||
public static class ResourceProxy
|
public static class ResourceProxy
|
||||||
{
|
{
|
||||||
@ -34,7 +34,7 @@ namespace Esyur.Proxy
|
|||||||
else
|
else
|
||||||
return type;
|
return type;
|
||||||
|
|
||||||
if (type.FullName.Contains("Esyur.Proxy.T"))
|
if (type.FullName.Contains("Esiur.Proxy.T"))
|
||||||
#if NETSTANDARD
|
#if NETSTANDARD
|
||||||
return type.GetTypeInfo().BaseType;
|
return type.GetTypeInfo().BaseType;
|
||||||
#else
|
#else
|
||||||
@ -57,7 +57,7 @@ namespace Esyur.Proxy
|
|||||||
throw new Exception("Sealed/Abastract classes can't be proxied.");
|
throw new Exception("Sealed/Abastract classes can't be proxied.");
|
||||||
|
|
||||||
var props = from p in typeInfo.GetProperties(BindingFlags.Instance | BindingFlags.Public)
|
var props = from p in typeInfo.GetProperties(BindingFlags.Instance | BindingFlags.Public)
|
||||||
where p.CanWrite && p.SetMethod.IsVirtual &&
|
where p.CanWrite && p.SetMethod.IsVirtual && !p.SetMethod.IsFinal &&
|
||||||
p.GetCustomAttribute<PublicAttribute>(false) != null
|
p.GetCustomAttribute<PublicAttribute>(false) != null
|
||||||
select p;
|
select p;
|
||||||
|
|
||||||
@ -71,14 +71,14 @@ namespace Esyur.Proxy
|
|||||||
select p;
|
select p;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
var assemblyName = new AssemblyName("Esyur.Proxy.T." + type.Assembly.GetName().Name);// type.Namespace);
|
var assemblyName = new AssemblyName("Esiur.Proxy.T." + type.Assembly.GetName().Name);// type.Namespace);
|
||||||
assemblyName.Version = type.Assembly.GetName().Version;
|
assemblyName.Version = type.Assembly.GetName().Version;
|
||||||
assemblyName.CultureInfo = type.Assembly.GetName().CultureInfo;
|
assemblyName.CultureInfo = type.Assembly.GetName().CultureInfo;
|
||||||
//assemblyName.SetPublicKeyToken(null);
|
//assemblyName.SetPublicKeyToken(null);
|
||||||
|
|
||||||
var assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
|
var assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
|
||||||
var moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name);
|
var moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name);
|
||||||
var typeName = "Esyur.Proxy.T." + type.FullName;// Assembly.CreateQualifiedName(assemblyName.FullName, "Esyur.Proxy.T." + type.FullName);
|
var typeName = "Esiur.Proxy.T." + type.FullName;// Assembly.CreateQualifiedName(assemblyName.FullName, "Esiur.Proxy.T." + type.FullName);
|
||||||
|
|
||||||
var typeBuilder = moduleBuilder.DefineType(typeName,
|
var typeBuilder = moduleBuilder.DefineType(typeName,
|
||||||
TypeAttributes.Public | TypeAttributes.Class, type);
|
TypeAttributes.Public | TypeAttributes.Class, type);
|
||||||
@ -186,7 +186,7 @@ namespace Esyur.Proxy
|
|||||||
|
|
||||||
|
|
||||||
// IL_0000: ldarg.0
|
// IL_0000: ldarg.0
|
||||||
//IL_0001: call instance class [Esyur]Esyur.Resource.Instance [Esyur]Esyur.Resource.Resource::get_Instance()
|
//IL_0001: call instance class [Esiur]Esiur.Resource.Instance [Esiur]Esiur.Resource.Resource::get_Instance()
|
||||||
//// (no C# code)
|
//// (no C# code)
|
||||||
//IL_0006: dup
|
//IL_0006: dup
|
||||||
//IL_0007: brtrue.s IL_000c
|
//IL_0007: brtrue.s IL_000c
|
||||||
@ -195,7 +195,7 @@ namespace Esyur.Proxy
|
|||||||
//IL_000a: br.s IL_0017
|
//IL_000a: br.s IL_0017
|
||||||
//// (no C# code)
|
//// (no C# code)
|
||||||
//IL_000c: ldstr "Level3"
|
//IL_000c: ldstr "Level3"
|
||||||
//IL_0011: call instance void [Esyur]Esyur.Resource.Instance::Modified(string)
|
//IL_0011: call instance void [Esiur]Esiur.Resource.Instance::Modified(string)
|
||||||
//IL_0016: nop
|
//IL_0016: nop
|
||||||
//IL_0017: ret
|
//IL_0017: ret
|
||||||
|
|
||||||
@ -208,9 +208,9 @@ namespace Esyur.Proxy
|
|||||||
|
|
||||||
|
|
||||||
// IL_0000: ldarg.0
|
// IL_0000: ldarg.0
|
||||||
// IL_0001: call instance class [Esyur]Esyur.Resource.Instance [Esyur]Esyur.Resource.Resource::get_Instance()
|
// IL_0001: call instance class [Esiur]Esiur.Resource.Instance [Esiur]Esiur.Resource.Resource::get_Instance()
|
||||||
// IL_0006: ldstr "Level3"
|
// IL_0006: ldstr "Level3"
|
||||||
//IL_000b: callvirt instance void [Esyur]Esyur.Resource.Instance::Modified(string)
|
//IL_000b: callvirt instance void [Esiur]Esiur.Resource.Instance::Modified(string)
|
||||||
//IL_0010: ret
|
//IL_0010: ret
|
||||||
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Resource
|
namespace Esiur.Resource
|
||||||
{
|
{
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Event)]
|
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Event)]
|
@ -27,7 +27,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Resource
|
namespace Esiur.Resource
|
||||||
{
|
{
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Property)]
|
[AttributeUsage(AttributeTargets.Property)]
|
@ -26,11 +26,11 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace Esyur.Resource
|
namespace Esiur.Resource
|
||||||
{
|
{
|
||||||
public delegate bool QueryFilter<T>(T value);
|
public delegate bool QueryFilter<T>(T value);
|
||||||
|
|
@ -22,18 +22,18 @@ SOFTWARE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Resource.Template;
|
using Esiur.Resource.Template;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Esyur.Security.Permissions;
|
using Esiur.Security.Permissions;
|
||||||
using Esyur.Security.Authority;
|
using Esiur.Security.Authority;
|
||||||
|
|
||||||
namespace Esyur.Resource
|
namespace Esiur.Resource
|
||||||
{
|
{
|
||||||
public interface IStore:IResource
|
public interface IStore:IResource
|
||||||
{
|
{
|
@ -3,18 +3,18 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Esyur.Net.IIP;
|
using Esiur.Net.IIP;
|
||||||
using Esyur.Misc;
|
using Esiur.Misc;
|
||||||
using Esyur.Security.Permissions;
|
using Esiur.Security.Permissions;
|
||||||
using Esyur.Resource.Template;
|
using Esiur.Resource.Template;
|
||||||
using Esyur.Security.Authority;
|
using Esiur.Security.Authority;
|
||||||
using Esyur.Proxy;
|
using Esiur.Proxy;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
|
|
||||||
namespace Esyur.Resource
|
namespace Esiur.Resource
|
||||||
{
|
{
|
||||||
public class Instance
|
public class Instance
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Resource
|
namespace Esiur.Resource
|
||||||
{
|
{
|
||||||
public class PrivateAttribute:Attribute
|
public class PrivateAttribute:Attribute
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Esyur.Resource
|
namespace Esiur.Resource
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Event | AttributeTargets.Class)]
|
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Event | AttributeTargets.Class)]
|
||||||
|
|
@ -24,9 +24,9 @@ SOFTWARE.
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
|
|
||||||
namespace Esyur.Resource
|
namespace Esiur.Resource
|
||||||
{
|
{
|
||||||
public class Resource : IResource
|
public class Resource : IResource
|
||||||
{
|
{
|
@ -27,7 +27,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Resource
|
namespace Esiur.Resource
|
||||||
{
|
{
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Event)]
|
[AttributeUsage(AttributeTargets.Event)]
|
@ -21,17 +21,17 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
using Esyur.Data;
|
using Esiur.Data;
|
||||||
using Esyur.Core;
|
using Esiur.Core;
|
||||||
using Esyur.Net.IIP;
|
using Esiur.Net.IIP;
|
||||||
using Esyur.Security.Authority;
|
using Esiur.Security.Authority;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Resource
|
namespace Esiur.Resource
|
||||||
{
|
{
|
||||||
public delegate void ResourceEventHanlder(params object[] args);
|
public delegate void ResourceEventHanlder(params object[] args);
|
||||||
// public delegate void CustomUsersEventHanlder(string[] usernames, params object[] args);
|
// public delegate void CustomUsersEventHanlder(string[] usernames, params object[] args);
|
@ -28,7 +28,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Esyur.Resource
|
namespace Esiur.Resource
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Method)]
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
public class ResourceFunction : System.Attribute
|
public class ResourceFunction : System.Attribute
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user