コード例 #1
0
        private static void transportAssembly(IAssemblyManager aManager)
        {
            Console.WriteLine("  Getting executing assembly");
            AssemblyName start = AssemblyName.GetAssemblyName("..\\..\\..\\Instructions.Reference.Client\\bin\\Debug\\Instructions.Reference.Client.dll");
            IObservable <AssemblyName> dependencies = Resolver.GetAllDependencies(start);

            dependencies.Subscribe(an =>
            {
                String path = new Uri(an.CodeBase).LocalPath;
                Console.WriteLine("    Transmitting assembly as FileStream ({0} bytes, {1})", new FileInfo(path).Length, path);
                using (Stream assyFileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
                {
                    Dispatcher.Contracts.Message.Assembly msg = new Assembly {
                        AssemblyStream = assyFileStream, Name = an.Name, FullName = an.FullName
                    };
                    aManager.AddAssembly(msg);
                }
            });
        }
コード例 #2
0
        private static void transportAssembly(IAssemblyManager aManager)
        {
            Console.WriteLine("  Getting executing assembly");
            System.Reflection.Assembly assy         = System.Reflection.Assembly.GetExecutingAssembly();
            IObservable <AssemblyName> dependencies = Resolver.GetAllDependencies(assy.GetName());

            dependencies.Subscribe(an =>
            {
                String path = new Uri(an.CodeBase).LocalPath;
                Console.WriteLine("    Transmitting assembly as FileStream ({0} bytes, {1})", new FileInfo(path).Length, path);
                using (Stream assyFileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
                {
                    Assembly msg = new Assembly {
                        AssemblyStream = assyFileStream, Name = an.Name, FullName = an.FullName
                    };
                    aManager.AddAssembly(msg);
                }
            });
        }