public static MemoryStream CompileClientProxy(IEnumerable <SyntaxTree> trees, IEnumerable <MetadataReference> references, ILogger logger = null)
 {
     references = new[]
     {
         MetadataReference.CreateFromFile(typeof(Task).GetTypeInfo().Assembly.Location),
         MetadataReference.CreateFromFile(typeof(ServiceDescriptor).GetTypeInfo().Assembly.Location),
         MetadataReference.CreateFromFile(typeof(IRemoteInvokeService).GetTypeInfo().Assembly.Location),
         MetadataReference.CreateFromFile(typeof(IServiceProxyGenerater).GetTypeInfo().Assembly.Location)
     }.Concat(references);
     return(Compile(AssemblyInfo.Create("DotEasy.Rpc.ClientProxys"), trees, references, logger));
 }
示例#2
0
 public static byte[] CompileClientProxy(IEnumerable <SyntaxTree> trees, IEnumerable <MetadataReference> references)
 {
     references = new[]
     {
         MetadataReference.CreateFromFile(typeof(Task).Assembly.Location),
         MetadataReference.CreateFromFile(typeof(ServiceDescriptor).Assembly.Location),
         MetadataReference.CreateFromFile(typeof(IRemoteInvokeService).Assembly.Location),
         MetadataReference.CreateFromFile(typeof(IServiceProxyGenerater).Assembly.Location)
     }.Concat(references);
     return(Compile(AssemblyInfo.Create("Rabbit.Rpc.ClientProxys"), trees, references));
 }
示例#3
0
        public string QueryAssemblyPath(string displayName)
        {
            AssemblyInfo info = AssemblyInfo.Create();

            if (NativeMethods.SUCCESS == _native.QueryAssemblyInfo(QueryAsmInfoFlag.Validate, displayName, ref info))
            {
                return(info.pszCurrentAssemblyPathBuf);
            }

            return(null);
        }
        public static MemoryStream CompileClientProxy(IEnumerable <SyntaxTree> trees,
                                                      IEnumerable <MetadataReference> references, Type interfaceType,
                                                      ILogger logger = null)
        {
            references = new[]
            {
                MetadataReference.CreateFromFile(typeof(string).GetTypeInfo().Assembly.Location),
                MetadataReference.CreateFromFile(typeof(Task).GetTypeInfo().Assembly.Location),
                MetadataReference.CreateFromFile(typeof(ServiceDescriptor).GetTypeInfo().Assembly.Location),
                MetadataReference.CreateFromFile(typeof(IRemoteInvokeService).GetTypeInfo().Assembly.Location),
                MetadataReference.CreateFromFile(typeof(IServiceProxyGenerater).GetTypeInfo().Assembly.Location)
            }.Concat(references);

            var className = interfaceType.Name.StartsWith("I") ? interfaceType.Name.Substring(1) : interfaceType.Name;

            return(Compile(AssemblyInfo.Create($"DotEasy.Rpc.{className}Proxys"), trees, references, logger));
        }
示例#5
0
        static void Main(string[] args)
        {
            CommandLineParser commandLineParser = new CommandLineParser();

            Boolean dec  = commandLineParser.Options.Exists("dec");
            Boolean uhex = commandLineParser.Options.Exists("hex");
            Boolean lhex = commandLineParser.Options.Exists("lowerhex");

            if (String.IsNullOrEmpty(commandLineParser.FileName) || (dec && uhex) || (dec && lhex) || (uhex && lhex))
            {
                AssemblyInfo assemblyInfo = AssemblyInfo.Create();

                Console.WriteLine("{0} v{1} - {2}\nCalculates CRC32 hash of a file\n\nUsage:\n\tcrc32 [-dec | -hex | -lowerhex] <file name>",
                                  assemblyInfo.ProductName, assemblyInfo.FileVersion, assemblyInfo.Description);

                return;
            }

            UInt32 hash;

            using (Stream stream = new FileStream(commandLineParser.FileName, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                CRC32Managed crc32Managed = new CRC32Managed();
                crc32Managed.ComputeHash(stream);

                hash = crc32Managed.CRC32Hash;
            }

            if (dec)
            {
                Console.WriteLine("{0}", hash);
            }
            else if (uhex)
            {
                Console.WriteLine("{0:X}", hash);
            }
            else if (lhex)
            {
                Console.WriteLine("{0:x}", hash);
            }
            else
            {
                Console.WriteLine("{0}\nCRC32 dec: {1}\nCRC32 hex: {1:X}", commandLineParser.FileName, hash);
            }
        }
示例#6
0
        public static MemoryStream CompileClientProxy(IEnumerable <SyntaxTree> trees, IEnumerable <MetadataReference> references, ILogger logger = null)
        {
#if !NET
            var assemblys = new[]
            {
                "System.Runtime",
                "mscorlib",
                "System.Threading.Tasks"
            };
            references = assemblys.Select(i => MetadataReference.CreateFromFile(Assembly.Load(new AssemblyName(i)).Location)).Concat(references);
#endif
            references = new[]
            {
                MetadataReference.CreateFromFile(typeof(Task).GetTypeInfo().Assembly.Location),
                MetadataReference.CreateFromFile(typeof(ServiceDescriptor).GetTypeInfo().Assembly.Location),
                MetadataReference.CreateFromFile(typeof(IRemoteInvokeService).GetTypeInfo().Assembly.Location),
                MetadataReference.CreateFromFile(typeof(IServiceProxyGenerater).GetTypeInfo().Assembly.Location)
            }.Concat(references);
            return(Compile(AssemblyInfo.Create("Rabbit.Rpc.ClientProxys"), trees, references, logger));
        }
示例#7
0
        public static MemoryStream CompileClientProxy(IEnumerable <SyntaxTree> trees, IEnumerable <MetadataReference> references, ILogger logger = null)
        {
            var assemblys = new[]
            {
                "System.Runtime",
                "mscorlib",
                "System.Threading.Tasks",
                "System.Collections"
            };

            references = assemblys.Select(i => MetadataReference.CreateFromFile(Assembly.Load(new AssemblyName(i)).Location)).Concat(references).Distinct();
            references = new[]
            {
                MetadataReference.CreateFromFile(typeof(Task).GetTypeInfo().Assembly.Location),
                MetadataReference.CreateFromFile(typeof(JimuServiceDesc).GetTypeInfo().Assembly.Location),
                MetadataReference.CreateFromFile(typeof(IRemoteServiceCaller).GetTypeInfo().Assembly.Location),
                MetadataReference.CreateFromFile(typeof(JimuPayload).GetTypeInfo().Assembly.Location),
                MetadataReference.CreateFromFile(typeof(ServiceProxyGenerator).GetTypeInfo().Assembly.Location)
            }.Concat(references).Distinct();
            return(Compile(AssemblyInfo.Create("JimuProxy.ClientProxy"), trees, references, logger));
        }