• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Reflection.AssemblyName类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Reflection.AssemblyName的典型用法代码示例。如果您正苦于以下问题:C# System.Reflection.AssemblyName类的具体用法?C# System.Reflection.AssemblyName怎么用?C# System.Reflection.AssemblyName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



System.Reflection.AssemblyName类属于命名空间,在下文中一共展示了System.Reflection.AssemblyName类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: InstallConfig

		private BXWizardResult InstallConfig()
		{
			Directory.CreateDirectory(BXPath.MapPath("~/bitrix/updates"));
			if (!File.Exists(BXPath.MapPath("~/bitrix/updates/updater.config")))
			{
				BXUpdaterConfig config = SiteUpdater.BXSiteUpdater.GetConfig();

				config.UpdateUrl = GetMessage("Updater.Server") ?? "http://www.bitrixsoft.com";
				config.Language = WizardContext.Locale;
				config.Key = "";
				System.Reflection.AssemblyName name = new System.Reflection.AssemblyName(typeof(BXUpdaterConfig).Assembly.FullName);
				config.Version = new BXUpdaterVersion(name.Version.Major, name.Version.Minor, name.Version.Build);
				
				string proxy = WizardContext.State.GetString("Options.UpdaterProxy");
				if (!string.IsNullOrEmpty(proxy))
				{
					config.UseProxy = true;
					config.ProxyAddress = proxy;
					
					string user = WizardContext.State.GetString("Options.UpdaterProxyUsername");
					if (!string.IsNullOrEmpty(user))
					{
						config.ProxyUsername = user;
						string password = WizardContext.State.GetString("Options.UpdaterProxyPassword");
						if (!string.IsNullOrEmpty(password))
							config.ProxyPassword = password;						
					}				
				}

				config.Update();
			}

			return Result.Action("finalize");
		}		
开发者ID:mrscylla,项目名称:volotour.ru,代码行数:34,代码来源:install_updater.ascx.cs


示例2: CurrentDomain_AssemblyResolve

 System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
 {
     var ass = AppDomain.CurrentDomain.GetAssemblies();
     var trgName = new System.Reflection.AssemblyName(args.Name);
     foreach (var a in ass)
     {
         var aN = new System.Reflection.AssemblyName(a.FullName);
         if (aN.Name == trgName.Name)
         {
             return a;
         }
     }
     if (trgName.Name == "gnomorialib")
     {
         return System.Reflection.Assembly.Load(System.IO.File.ReadAllBytes(System.IO.Path.Combine(base_dir, trgName.Name + "Modded.dll")));
     }
     var file = System.IO.Path.Combine(base_dir, trgName.Name + ".dll");
     if (trgName.Name == "GnomoriaModController")
     {
         return System.Reflection.Assembly.Load(System.IO.File.ReadAllBytes(file));
     }
     else if (System.IO.File.Exists(file))
     {
         return System.Reflection.Assembly.LoadFile(file);
     }
     return null;
 }
开发者ID:Rychard,项目名称:Faark.Gnomoria.Modding,代码行数:27,代码来源:GameLauncher.cs


示例3: CompileProject

        public Assembly CompileProject(string projectFileName)
        {
            Assembly existing;
            if (Compilations.TryGetValue(Path.GetFullPath(projectFileName), out existing))
            {
                return existing;
            }

            var project = new Microsoft.Build.BuildEngine.Project();
            project.Load(projectFileName);

            var projectName = Environment.NameTable.GetNameFor(project.EvaluatedProperties["AssemblyName"].Value);
            var projectPath = project.FullFileName;
            var compilerOptions = new SpecSharpOptions();
            var assemblyReferences = new List<IAssemblyReference>();
            var moduleReferences = new List<IModuleReference>();
            var programSources = new List<SpecSharpSourceDocument>();
            var assembly = new SpecSharpAssembly(projectName, projectPath, Environment, compilerOptions, assemblyReferences, moduleReferences, programSources);
            var helper = new SpecSharpCompilationHelper(assembly.Compilation);

            Compilations[Path.GetFullPath(projectFileName)] = assembly;

            assemblyReferences.Add(Environment.LoadAssembly(Environment.CoreAssemblySymbolicIdentity));
            project.Build("ResolveAssemblyReferences");
            foreach (BuildItem item in project.GetEvaluatedItemsByName("ReferencePath"))
            {
                var assemblyName = new System.Reflection.AssemblyName(item.GetEvaluatedMetadata("FusionName"));
                var name = Environment.NameTable.GetNameFor(assemblyName.Name);
                var culture = assemblyName.CultureInfo != null ? assemblyName.CultureInfo.Name : "";
                var version = assemblyName.Version == null ? new Version(0, 0) : assemblyName.Version;
                var token = assemblyName.GetPublicKeyToken();
                if (token == null) token = new byte[0];
                var location = item.FinalItemSpec;
                var identity = new AssemblyIdentity(name, culture, version, token, location);
                var reference = Environment.LoadAssembly(identity);
                assemblyReferences.Add(reference);
            }

            foreach (BuildItem item in project.GetEvaluatedItemsByName("ProjectReference"))
            {
                var name = Environment.NameTable.GetNameFor(Path.GetFileNameWithoutExtension(item.FinalItemSpec));
                var location = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(project.FullFileName), item.FinalItemSpec));
                var reference = CompileProject(location);
                assemblyReferences.Add(reference);
            }

            foreach (BuildItem item in project.GetEvaluatedItemsByName("Compile"))
            {
                var location = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(project.FullFileName), item.FinalItemSpec));
                var name = Environment.NameTable.GetNameFor(location);
                var programSource = new SpecSharpSourceDocument(helper, name, location, File.ReadAllText(location));
                programSources.Add(programSource);
            }

            return assembly;
        }
开发者ID:dbremner,项目名称:specsharp,代码行数:56,代码来源:MSBuildCompiler.cs


示例4: Assembly

 IAssembly IAssemblyLoader.Load(AssemblyName assembly)
 {
     try {
         return new Assembly(new DefaultTypeLoader(), Load(assembly));
     } catch(FileLoadException) {
         return new MissingAssembly(assembly);
     } catch(FileNotFoundException) {
         return new MissingAssembly(assembly);
     }
 }
开发者ID:danaxa,项目名称:Pencil,代码行数:10,代码来源:AssemblyLoader.cs


示例5: Main

        static void Main()
        {
            AppDomain.CurrentDomain.AssemblyResolve += (s, e) =>
            {
                var filename = new System.Reflection.AssemblyName(e.Name).Name;
                var path = System.IO.Directory.GetCurrentDirectory().Split(System.IO.Path.DirectorySeparatorChar).ToList();
                while (path[path.Count() - 1] != "Bin")
                    path.RemoveAt(path.Count() - 1);
                var pathBin = string.Join(System.IO.Path.DirectorySeparatorChar.ToString(), path);
                path[path.Count() - 1] = "Lib";
                var pathLib = string.Join(System.IO.Path.DirectorySeparatorChar.ToString(), path);
                // Attempt to load from lib first
                foreach (var file in System.IO.Directory.GetFiles(pathLib))
                {
                    if (file.Split(System.IO.Path.DirectorySeparatorChar).Last().Split(new string[]{".dll"}, StringSplitOptions.None)[0] == filename)
                        return System.Reflection.Assembly.LoadFrom(file);
                }
                foreach (var dir in System.IO.Directory.GetDirectories(pathLib))
                {
                    foreach (var file in System.IO.Directory.GetFiles(dir))
                    {
                        if (file.Split(System.IO.Path.DirectorySeparatorChar).Last().Split(new string[] { ".dll" }, StringSplitOptions.None)[0] == filename)
                            return System.Reflection.Assembly.LoadFrom(file);
                    }
                }
                // Attempt to load from bin
                foreach (var file in System.IO.Directory.GetFiles(pathBin))
                {
                    if (file.Split(System.IO.Path.DirectorySeparatorChar).Last().Split(new string[] { ".dll" }, StringSplitOptions.None)[0] == filename)
                        return System.Reflection.Assembly.LoadFrom(file);
                }
                foreach (var dir in System.IO.Directory.GetDirectories(pathBin))
                {
                    foreach (var file in System.IO.Directory.GetFiles(dir))
                    {
                        if (file.Split(System.IO.Path.DirectorySeparatorChar).Last().Split(new string[] { ".dll" }, StringSplitOptions.None)[0] == filename)
                            return System.Reflection.Assembly.LoadFrom(file);
                    }
                }
                return null;
            };
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new gameEditorMainForm());
            //Application.Run(new TestJsonEdit());
            //Application.Run(new Dialog.Forms.GuidSelector());
            //Application.Run(new Dialog.Forms.GuidManagerForm());
            Application.Run(new mainForm());

            //new TestJsonEdit().Show();
            //new mainForm().Show();
            //new Dialog.Forms.GuidSelector().Show();
            //new Dialog.Forms.GuidManagerForm().Show();
            //Application.Run(new Form());
        }
开发者ID:alex-polosky,项目名称:EntityEngine,代码行数:55,代码来源:Program.cs


示例6: Load

 ReflectionAssembly Load(AssemblyName assembly)
 {
     try {
         return ReflectionAssembly.Load(assembly);
     } catch (FileLoadException) {
         var altPath = Path.Combine(binPath, assembly.Name + ".dll");
         if (File.Exists(altPath))
             return ReflectionAssembly.LoadFrom(altPath);
         throw;
     }
 }
开发者ID:danaxa,项目名称:Pencil,代码行数:11,代码来源:AssemblyLoader.cs


示例7: App

        public App()
        {
            //integrated SQLite dll : unmanaged code
            AppDomain.CurrentDomain.AssemblyResolve += (sender1, args) =>
            {
                string resourceName = new System.Reflection.AssemblyName(args.Name).Name + ".dll";
                string resource = Array.Find(this.GetType().Assembly.GetManifestResourceNames(), element => element.EndsWith(resourceName));
                EmbeddedAssembly.Load(resource, resourceName);

                return EmbeddedAssembly.Get(args.Name);
            };
        }
开发者ID:susemeee,项目名称:YangpaH,代码行数:12,代码来源:App.xaml.cs


示例8: CurrentDomain_AssemblyResolve

 /// <summary>
 /// Método para resolução das assemblies.
 /// </summary>
 /// <param name="sender">Application</param>
 /// <param name="args">Resolving Assembly Name</param>
 /// <returns>Assembly</returns>
 static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
 {
     string assemblyFullName;
     System.Reflection.AssemblyName assemblyName;
     string PRIMAVERA_COMMON_FILES_FOLDER = Instancia.daPastaConfig();//pasta dos ficheiros comuns especifica da versão do ERP PRIMAVERA utilizada.
     assemblyName = new System.Reflection.AssemblyName(args.Name);
     assemblyFullName = System.IO.Path.Combine(System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFilesX86), PRIMAVERA_COMMON_FILES_FOLDER), assemblyName.Name + ".dll");
     if (System.IO.File.Exists(assemblyFullName))
         return System.Reflection.Assembly.LoadFile(assemblyFullName);
     else
         return null;
 }
开发者ID:AccSy,项目名称:CSU_MIT,代码行数:18,代码来源:MotoresComercial.cs


示例9: Parse

        public static AssemblyIdentity Parse(INameTable nameTable, string formattedName)
        {
            var name = new System.Reflection.AssemblyName(formattedName);
            return new AssemblyIdentity(nameTable.GetNameFor(name.Name),
                                        name.CultureName,
                                        name.Version,
                                        name.GetPublicKeyToken(),
#if COREFX
                                        "");
#else
                                        name.CodeBase);
#endif
        }
开发者ID:jango2015,项目名称:buildtools,代码行数:13,代码来源:AssemblyIdentityHelpers.cs


示例10: CurrentDomain_AssemblyResolve

 static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
 {
     System.Reflection.AssemblyName name = new System.Reflection.AssemblyName(args.Name);
     if (name.Name.ToLowerInvariant().EndsWith(".resources")) return null;
     string installPath = HpToolsLauncher.Helper.getLRInstallPath();
     if (installPath == null)
     {
         log(Resources.CannotLocateInstallDir);
         Environment.Exit((int)Launcher.ExitCodeEnum.Aborted);
     }
     //log(Path.Combine(installPath, "bin", name.Name + ".dll"));
     return System.Reflection.Assembly.LoadFrom(Path.Combine(installPath, "bin", name.Name + ".dll"));
 }
开发者ID:hpsa,项目名称:hp-application-automation-tools-plugin,代码行数:13,代码来源:Program.cs


示例11: Global

		public Global()
		{
			var root = ConfigurationManager.AppSettings["RootPath"];
			AppDomain.CurrentDomain.AssemblyResolve += (object sender, ResolveEventArgs args) => {
				var assemblyName = new System.Reflection.AssemblyName(args.Name);
				string path = System.IO.Path.Combine (root, assemblyName.Name + ".dll");
				if (System.IO.File.Exists (path))
				{
					return System.Reflection.Assembly.LoadFile (path);
				}
				return null;
			};
		}
开发者ID:nickchal,项目名称:pash,代码行数:13,代码来源:Global.cs


示例12: Format

        public static string Format(this AssemblyIdentity assemblyIdentity)
        {
            var name = new System.Reflection.AssemblyName();
            name.Name = assemblyIdentity.Name.Value;
#if !COREFX
            name.CultureInfo = new CultureInfo(assemblyIdentity.Culture);
#endif
            name.Version = assemblyIdentity.Version;
            name.SetPublicKeyToken(assemblyIdentity.PublicKeyToken.ToArray());
#if !COREFX
            name.CodeBase = assemblyIdentity.Location;
#endif
            return name.ToString();
        }
开发者ID:conniey,项目名称:dotnet-apiport,代码行数:14,代码来源:AssemblyIdentityHelpers.cs


示例13: FromResource

 public static WriteableBitmap FromResource(this WriteableBitmap bmp, string relativePath)
 {
     if (bmp == null) 
         throw new ArgumentNullException("bmp");
     var fullName = System.Reflection.Assembly.GetCallingAssembly().FullName;
     var asmName = new System.Reflection.AssemblyName(fullName).Name;
     using (var bmpStream = Application.GetResourceStream(new Uri(string.Format("{0};component/{1}", asmName, relativePath), UriKind.Relative)).Stream)
     {
         var bmpi = new BitmapImage();
         bmpi.SetSource(bmpStream);
         bmp = new WriteableBitmap(bmpi);
         return bmp;
     }
 }
开发者ID:284247028,项目名称:MvvmCross,代码行数:14,代码来源:WriteableBitmapExtensions.cs


示例14: Main

        static void Main(string[] args)
        {
            System.Reflection.AssemblyName myAssemblyName = new System.Reflection.AssemblyName("Fubar, Version=100.0.0.2001, Culture=sv-FI, PublicKeyToken=null");
              Console.WriteLine("Name: {0}", myAssemblyName.Name);
              Console.WriteLine("Version: {0}", myAssemblyName.Version);
              Console.WriteLine("CultureInfo: {0}", myAssemblyName.CultureInfo);
              Console.WriteLine("FullName: {0}", myAssemblyName.FullName);

              Console.WriteLine("Assembly: {0}", typeof(Tuple<string, int>).Assembly.FullName);
              Console.WriteLine("Type: {0}", typeof(Tuple<string, int>).FullName);

              using (var program = new Program())
            program.Run();
        }
开发者ID:CodeFork,项目名称:PluginFramework-1,代码行数:14,代码来源:Program.cs


示例15: CreateRegExDLL

        /// <summary>
        /// 
        /// </summary>
        /// <param name="assmName"></param>
        public static void CreateRegExDLL(string assmName)
        {
            RegexCompilationInfo[] RE = new RegexCompilationInfo[2]
            {new RegexCompilationInfo("PATTERN", RegexOptions.Compiled,
                                  "CompiledPATTERN", "Chapter_Code", true),
             new RegexCompilationInfo("NAME", RegexOptions.Compiled,
                                  "CompiledNAME", "Chapter_Code", true)};

            System.Reflection.AssemblyName aName =
                 new System.Reflection.AssemblyName();
            aName.Name = assmName;

            Regex.CompileToAssembly(RE, aName);
        }
开发者ID:peeboo,项目名称:open-media-library,代码行数:18,代码来源:RegexUtils.cs


示例16: Program

        static Program()
        {
            // see https://github.com/google/google-api-dotnet-client/issues/554#issuecomment-115729788
            var httpasm = typeof(System.Net.Http.HttpClient).Assembly;
            var httpver = new Version(1, 5, 0, 0);

            AppDomain.CurrentDomain.AssemblyResolve += (s, a) => {
                var requestedAssembly = new System.Reflection.AssemblyName(a.Name);
                if (requestedAssembly.Name != "System.Net.Http" || requestedAssembly.Version != httpver)
                    return null;

                return httpasm;
            };
        }
开发者ID:midiway,项目名称:FontLister,代码行数:14,代码来源:Program.cs


示例17: Init

		public static void Init(){
			// This code automatically loads required dlls from embedded resources.
			AppDomain.CurrentDomain.AssemblyResolve += delegate(System.Object sender, ResolveEventArgs delArgs)
			{
				string assemblyName = new System.Reflection.AssemblyName(delArgs.Name).Name;
				String resourceName = assemblyName + ".dll";
				using (System.IO.Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
				{
					if (stream == null)
						return null;
					Byte[] assemblyData = new Byte[stream.Length];
					stream.Read(assemblyData, 0, assemblyData.Length);
					return System.Reflection.Assembly.Load(assemblyData);
				}
			};
		}
开发者ID:seipekm,项目名称:MonoBrick-Communication-Software,代码行数:16,代码来源:Main.cs


示例18: Initialize

        public void Initialize()
        {
            var assembly = System.Reflection.Assembly.GetExecutingAssembly();
            var name = new System.Reflection.AssemblyName(assembly.FullName);

            AddInfo("CodeBase", name.CodeBase);
            AddInfo("ContentType", name.ContentType.ToString());
            AddInfo("CultureInfo", name.CultureInfo != null ? name.CultureInfo.ToString() : "");
            AddInfo("CultureName", name.CultureName);
            AddInfo("Flags", name.Flags.ToString());
            AddInfo("FullName", name.FullName);
            AddInfo("HashAlgorithm", name.HashAlgorithm.ToString());
            AddInfo("Name", name.Name);
            AddInfo("Version", name.Version != null ? name.Version.ToString() : "");
            AddInfo("VersionCompatibility", name.VersionCompatibility.ToString());
        }
开发者ID:yamac,项目名称:windows-demos,代码行数:16,代码来源:PackageInfo.xaml.cs


示例19: Load

 private static System.Reflection.Assembly Load(string assemblyNameVal) {
     System.Reflection.AssemblyName assemblyName = new System.Reflection.AssemblyName(assemblyNameVal);
     byte[] publicKeyToken = assemblyName.GetPublicKeyToken();
     System.Reflection.Assembly asm = null;
     try {
         asm = System.Reflection.Assembly.Load(assemblyName.FullName);
     }
     catch (System.Exception ) {
         System.Reflection.AssemblyName shortName = new System.Reflection.AssemblyName(assemblyName.Name);
         if ((publicKeyToken != null)) {
             shortName.SetPublicKeyToken(publicKeyToken);
         }
         asm = System.Reflection.Assembly.Load(shortName);
     }
     return asm;
 }
开发者ID:karayakar,项目名称:MCSD_SharePoint_Applications,代码行数:16,代码来源:_Farm_Solution2.g.cs


示例20: BootStrap0

 static void BootStrap0()
 {
     AppDomain.CurrentDomain.AssemblyResolve += (s, e) =>
     {
         var filename = new System.Reflection.AssemblyName(e.Name).Name;
         var path = System.IO.Directory.GetCurrentDirectory().Split(System.IO.Path.DirectorySeparatorChar).ToList();
         while (path[path.Count() - 1] != "Bin")
             path.RemoveAt(path.Count() - 1);
         var pathBin = string.Join(System.IO.Path.DirectorySeparatorChar.ToString(), path);
         path[path.Count() - 1] = "Lib";
         var pathLib = string.Join(System.IO.Path.DirectorySeparatorChar.ToString(), path);
         // Attempt to load from lib first
         foreach (var file in System.IO.Directory.GetFiles(pathLib))
         {
             if (file.Split(System.IO.Path.DirectorySeparatorChar).Last().Split(new string[]{".dll"}, StringSplitOptions.None)[0] == filename)
                 return System.Reflection.Assembly.LoadFrom(file);
         }
         foreach (var dir in System.IO.Directory.GetDirectories(pathLib))
         {
             foreach (var file in System.IO.Directory.GetFiles(dir))
             {
                 if (file.Split(System.IO.Path.DirectorySeparatorChar).Last().Split(new string[] { ".dll" }, StringSplitOptions.None)[0] == filename)
                     return System.Reflection.Assembly.LoadFrom(file);
             }
         }
         // Attempt to load from bin
         foreach (var file in System.IO.Directory.GetFiles(pathBin))
         {
             if (file.Split(System.IO.Path.DirectorySeparatorChar).Last().Split(new string[] { ".dll" }, StringSplitOptions.None)[0] == filename)
                 return System.Reflection.Assembly.LoadFrom(file);
         }
         foreach (var dir in System.IO.Directory.GetDirectories(pathBin))
         {
             foreach (var file in System.IO.Directory.GetFiles(dir))
             {
                 if (file.Split(System.IO.Path.DirectorySeparatorChar).Last().Split(new string[] { ".dll" }, StringSplitOptions.None)[0] == filename)
                     return System.Reflection.Assembly.LoadFrom(file);
             }
         }
         return null;
     };
     var asm = System.Reflection.Assembly.GetExecutingAssembly();
     Type t = asm.GetType(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + ".Program");
     t.GetMethod("BootStrap", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).Invoke(null, null);
 }
开发者ID:alex-polosky,项目名称:EntityEngine,代码行数:45,代码来源:Program.cs



注:本文中的System.Reflection.AssemblyName类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Reflection.MethodInfo类代码示例发布时间:2022-05-24
下一篇:
C# System.Random类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap