Ejemplo n.º 1
0
 public SerialCSLogicProvider(CSLogicProvider provider)
 {
     compiledAssembly = provider.BinaryAssembly;
     _id          = provider.AssemblyName;
     sourceCode   = provider.SourceCode;
     dependencies = provider.Dependencies.Select(dep => dep.Name).ToArray();
 }
Ejemplo n.º 2
0
        public static async Task <CSLogicProvider> PutCompiledLogicProviderAsync(string name, string sourceCode)
        {
            var provider = await CSLogicProvider.CompileAsync(name, sourceCode);

            await PutLogicProviderAsync(provider);

            return(provider);
        }
Ejemplo n.º 3
0
 private DynamicCSLogic(CSLogicProvider provider, EntityLogic newState)
 {
     if (newState.GetType().Assembly != provider.Assembly)
     {
         throw new IntegrityViolation("Illegal state/provider combination given: " + newState.GetType() + "/" + provider);
     }
     nestedLogic   = newState;
     this.provider = provider;
 }
Ejemplo n.º 4
0
        public override bool Equals(object obj)
        {
            CSLogicProvider other = obj as CSLogicProvider;

            return(other != null
                   //&& other.assembly.Equals(assembly)
                   && Helper.AreEqual(other.BinaryAssembly, BinaryAssembly) &&
                   AssemblyName == other.AssemblyName &&
                   SourceCode == other.SourceCode);
        }
Ejemplo n.º 5
0
        static CSLogicProvider GetProvider(string name)
        {
            CSLogicProvider provider;

            if (providers.TryGetValue(name, out provider))
            {
                return(provider);
            }
            provider        = CSLogicProvider.CompileAsync(name, File.ReadAllText(Path.Combine("scenario", "Logic", name + ".cs"))).Result;
            providers[name] = provider;
            return(provider);
        }
Ejemplo n.º 6
0
 private void SendProvider(CSLogicProvider p)
 {
     if (p != null && sentProviders.TryAdd(p.AssemblyName, true))
     {
         //Message("SendProvider: "+p);
         //Log.Message("Sending provider " + p.AssemblyName);
         if (p.Dependencies != null)
         {
             foreach (var d in p.Dependencies)
             {
                 SendProvider(d.Provider.Get());
             }
         }
         SendCompressed(p);
     }
     //else
     //	Message("SendProvider rejected: " + p);
 }
Ejemplo n.º 7
0
 public Task <CSLogicProvider> DeserializeAsync()
 {
     return(CSLogicProvider.LoadAsync(_id, sourceCode, compiledAssembly, dependencies));
 }
Ejemplo n.º 8
0
 public static Task PutLogicProviderAsync(CSLogicProvider provider)
 {
     return(PutLogicProviderAsync(new SerialCSLogicProvider(provider)));
 }
Ejemplo n.º 9
0
            private async Task Load()
            {
                provider = await CSLogicProvider.AsyncFactory(AssemblyName);

                instance = SerialData != null?provider.DeserializeLogic(SerialData) : provider.Instantiate(LogicName, ConstructorParameters);
            }
Ejemplo n.º 10
0
 public SerializationException(CSLogicProvider provider, string message) : base(provider, message)
 {
 }
Ejemplo n.º 11
0
 public LogicCompositionException(CSLogicProvider provider, string message) : base(message)
 {
     this.provider = provider;
 }
Ejemplo n.º 12
0
 public DynamicCSLogic(CSLogicProvider provider, string logicName, object[] constructorParameters)
 {
     nestedLogic   = provider.Instantiate(logicName, constructorParameters);
     this.provider = provider;
 }