Ejemplo n.º 1
0
        public override async Task SynchronizeDependencies(CachedAssemblyState cachedAssemblyState, IServerStreamWriter <AssemblyReference> responseStream, ServerCallContext context)
        {
            var sw = Stopwatch.StartNew();

            var cache             = ToDictionary(cachedAssemblyState);
            var currentAssemblies = AppDomain.CurrentDomain.GetAssemblies();

            foreach (var asm in currentAssemblies)
            {
                await WriteIfNecessary(asm, responseStream);
            }

            _log($"Finished sending current assemblies in {sw.Elapsed}");

            AppDomain.CurrentDomain.AssemblyLoad += async(sender, args)
                                                    => await WriteIfNecessary(args.LoadedAssembly, responseStream);

            await new TaskCompletionSource <bool>(context.CancellationToken).Task;
        }
Ejemplo n.º 2
0
 private Dictionary <string, ulong> ToDictionary(CachedAssemblyState cachedAssemblyState) =>
 cachedAssemblyState.CachedAssemblies?.ToDictionary(
     x => x.AssemblyName,
     x => x.ModificationTime);