예제 #1
0
        public void NotifyEffectUsed(EffectCompileRequest effectCompileRequest)
        {
            Task.Run(async() =>
            {
                // Silently fails if connection already failed previously
                var socketMessageLayerTask = GetOrCreateConnection();
                if (socketMessageLayerTask.IsFaulted)
                {
                    return;
                }

                // Send any effect request remotely (should fail if not connected)
                var socketMessageLayer = await socketMessageLayerTask;
                await socketMessageLayer.Send(new RemoteEffectCompilerEffectRequested {
                    Request = effectCompileRequest
                });
            });
        }
예제 #2
0
        public void NotifyEffectUsed(EffectCompileRequest effectCompileRequest, CompilerResults result)
        {
            if (result.HasErrors)
            {
                return;
            }

            Task.Run(async() =>
            {
                // Silently fails if connection already failed previously
                var socketMessageLayerTask = GetOrCreateConnection(cancellationTokenSource.Token);
                if (socketMessageLayerTask.IsFaulted)
                {
                    return;
                }

                var bytecode = await result.Bytecode.AwaitResult();
                if (bytecode.CompilationLog.HasErrors)
                {
                    return;
                }

                // Ignore everything that has been compiled by the startup cache
                if (bytecode.LoadSource == EffectBytecodeCacheLoadSource.StartupCache)
                {
                    return;
                }

                // Send any effect request remotely (should fail if not connected)
                var socketMessageLayer = await socketMessageLayerTask;

                var memoryStream = new MemoryStream();
                var binaryWriter = new BinarySerializationWriter(memoryStream);
                binaryWriter.Context.SerializerSelector = SerializerSelector.AssetWithReuse;
                binaryWriter.SerializeExtended(effectCompileRequest, ArchiveMode.Serialize, null);

                await socketMessageLayer.Send(new RemoteEffectCompilerEffectRequested {
                    Request = memoryStream.ToArray()
                });
            });
        }
예제 #3
0
        public void NotifyEffectUsed(EffectCompileRequest effectCompileRequest)
        {
            Task.Run(async() =>
            {
                // Silently fails if connection already failed previously
                var socketMessageLayerTask = GetOrCreateConnection();
                if (socketMessageLayerTask.IsFaulted)
                {
                    return;
                }

                // Send any effect request remotely (should fail if not connected)
                var socketMessageLayer = await socketMessageLayerTask;

                var memoryStream = new MemoryStream();
                var binaryWriter = new BinarySerializationWriter(memoryStream);
                binaryWriter.Context.SerializerSelector = SerializerSelector.AssetWithReuse;
                binaryWriter.SerializeExtended(effectCompileRequest, ArchiveMode.Serialize, null);

                await socketMessageLayer.Send(new RemoteEffectCompilerEffectRequested {
                    Request = memoryStream.ToArray()
                });
            });
        }