Here are the examples of the csharp api class System.Reflection.Assembly.GetEntryAssembly() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
200 Examples
prev1234next
51. Example
Project: Eddie
Source File: Main.cs
static void Main(string[] args){NSApplication.Init();Core.Platform.Instance = new Eddie.Platform.MacOS.Platform();CommandLine.InitSystem(Environment.CommandLine);// Due to a bug in Xamarin, that don't recognize resources inside Core library if Mono is bundled, we embed some resources in entry assembly.Core.ResourcesFiles.LoadString(Assembly.GetEntryAssembly(), "license.txt", "License.txt");Core.ResourcesFiles.LoadString(Assembly.GetEntryAssembly(), "thirdparty.txt", "ThirdParty.txt");Core.ResourcesFiles.LoadString(Assembly.GetEntryAssembly(), "tos.txt", "TOS.txt");Core.ResourcesFiles.LoadString(Assembly.GetEntryAssembly(), "AirVPN.xml", "AirVPN.xml");Core.ResourcesFiles.LoadString(Assembly.GetEntryAssembly(), "OpenVPN.xml", "OpenVPN.xml");Core.ResourcesFiles.Count();if (CommandLine.SystemEnvironment.Exists("cli")){Core.Engine engine = new Core.Engine();if (engine.Initialization(true)){engine.ConsoleStart();engine.Join();}}else{Engine engine = new Engine();if (engine.Initialization(false) == false)return;NSApplication.Main(args);}}
52. Example
Project: Eddie
Source File: Platform.cs
public virtual string GetExecutablePathEx(){return System.Reflection.Assembly.GetEntryAssembly().Location;}
53. Example
Project: Rothko
Source File: AssemblyFacade.cs
[return: AllowNull] public _Assembly GetEntryAssembly() { return Assembly.GetEntryAssembly(); }
54. Example
Project: Simplify
Source File: InstallationController.cs
protected string GetEntryAssemblyLocation(){return Assembly.GetEntryAssembly().Location;}
55. Example
Project: 32feet
Source File: BluetoothFactoryConfig.cs
internal static string GetEntryAssemblyPath() {#if NETCF if (Environment.OSVersion.Platform != PlatformID.WinCE) { return null; } System.Text.StringBuilder buffer = new System.Text.StringBuilder(NativeMethods.MAX_PATH); int chars = NativeMethods.GetModuleFileName(IntPtr.Zero, buffer, NativeMethods.MAX_PATH); System.Diagnostics.Debug.WriteLine(buffer.ToString()); return buffer.ToString();#else var ea = System.Reflection.Assembly.GetEntryAssembly(); if (ea == null) return null; var cb = ea.CodeBase; var u = new Uri(cb); return u.LocalPath;#endif }
56. Example
Project: MonoDevelop.AddinMaker
Source File: AddinProjectFlavor.cs
protected override ExecutionCommand OnCreateExecutionCommand (ConfigurationSelector configSel, DotNetProjectConfiguration configuration, ProjectRunConfiguration runConfiguration){var cmd = (DotNetExecutionCommand) base.OnCreateExecutionCommand (configSel, configuration, runConfiguration);cmd.Command = Assembly.GetEntryAssembly ().Location;cmd.Arguments = "--no-redirect";cmd.EnvironmentVariables["MONODEVELOP_DEV_ADDINS"] = Project.GetOutputFileName (configSel).ParentDirectory;cmd.EnvironmentVariables ["MONODEVELOP_CONSOLE_LOG_LEVEL"] = "All";return cmd;}
57. Example
Project: f-spot
Source File: PixbufUtils.cs
static Pixbuf LoadFromAssembly (string resource){try {return new Pixbuf (System.Reflection.Assembly.GetEntryAssembly (), resource);} catch {return null;}}
58. Example
Project: ProxySwitcher
Source File: SettingsConfigurationControl.xaml.cs
private void SetStartWithWindows(bool startWithWindows) { if (startWithWindows) { RegistryHelper.SetStringValue("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", "Proxy Switcher", System.Reflection.Assembly.GetEntryAssembly().Location); } else { RegistryHelper.DeleteEntry("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", "Proxy Switcher"); } }
59. Example
Project: Collectively.Api
Source File: ValidatorModule.cs
protected override void Load(ContainerBuilder builder) { builder.RegisterType<ValidatorResolver>().As<IValidatorResolver>(); builder.RegisterAssemblyTypes(Assembly.GetEntryAssembly()).AsClosedTypesOf(typeof(IValidator<>)); }
60. Example
Project: Discord.Net
Source File: command_handler.cs
public async Task InstallCommandsAsync() { // Hook the MessageReceived Event into our Command Handler _client.MessageReceived += HandleCommandAsync; // Discover all of the commands in this assembly and load them. await _commands.AddModulesAsync(Assembly.GetEntryAssembly()); }
61. Example
Project: Discord.Net
Source File: structure.cs
private async Task InitCommands() { // Repeat this for all the service classes // and other dependencies that your commands might need. _map.AddSingleton(new SomeServiceClass()); // When all your required services are in the collection, build the container. // Tip: There's an overload taking in a 'validateScopes' bool to make sure // you haven't made any mistakes in your dependency graph. _services = _map.BuildServiceProvider(); // Either search the program and add all Module classes that can be found. // Module classes MUST be marked 'public' or they will be ignored. await _commands.AddModulesAsync(Assembly.GetEntryAssembly()); // Or add Modules manually if you prefer to be a little more explicit: await _commands.AddModuleAsync<SomeModule>(); // Note that the first one is 'Modules' (plural) and the second is 'Module' (singular). // Subscribe a handler to see if a message invokes a command. _client.MessageReceived += HandleCommandAsync; }
62. Example
Project: EntityProfiler
Source File: AppBootstrapper.cs
protected override IEnumerable<Assembly> SelectAssemblies() { return new[] { Assembly.GetEntryAssembly() }; }
63. Example
Project: EntityProfiler
Source File: AppBootstrapper.cs
protected override IEnumerable<Assembly> SelectAssemblies() { return new[] { Assembly.GetEntryAssembly() }; }
64. Example
Project: rhino-licensing
Source File: App.xaml.cs
protected virtual Assembly[] SelectAssemblies() { return new[] { Assembly.GetEntryAssembly() }; }
65. Example
Project: azure-webjobs-sdk
Source File: JobHostConfigurationExtensions.cs
private static Assembly GetHostAssembly(IEnumerable<MethodInfo> methods) { // 1. Try to get the assembly name from the first method. MethodInfo firstMethod = methods.FirstOrDefault(); if (firstMethod != null) { return firstMethod.DeclaringType.Assembly; } // 2. If there are no function definitions, try to use the entry assembly. Assembly entryAssembly = Assembly.GetEntryAssembly(); if (entryAssembly != null) { return entryAssembly; } // 3. If there's no entry assembly either, we don't have anything to use. return null; }
66. Example
Project: ATF
Source File: Program.cs
static int Main(string[] args) { string assemblyName = Assembly.GetEntryAssembly().Location; return Scea.UnitTesting.UnitTestRunner.RunAllTests(assemblyName); }
67. Example
Project: niecza
Source File: CompilerBinding.cs
public static string cb_exec_name() { return Assembly.GetEntryAssembly().Location; }
68. Example
Project: MicroService4Net
Source File: WindowsServiceManager.cs
private static AssemblyInstaller GetInstaller() { var serviceExeName = Assembly.GetEntryAssembly().ManifestModule.Name; return new AssemblyInstaller(serviceExeName,null){ UseNewContext = true}; }
69. Example
Project: EasyService4Net
Source File: WindowsServiceManager.cs
private static AssemblyInstaller GetInstaller() { var serviceExeName = Assembly.GetEntryAssembly().ManifestModule.Name; return new AssemblyInstaller(serviceExeName, null) { UseNewContext = true }; }
70. Example
Project: Warden.Api
Source File: FilterModule.cs
protected override void Load(ContainerBuilder builder) { builder.RegisterType<FilterResolver>().As<IFilterResolver>(); builder.RegisterAssemblyTypes(Assembly.GetEntryAssembly()).AsClosedTypesOf(typeof(IFilter<,>)); }
71. Example
Project: Warden.Api
Source File: ValidatorModule.cs
protected override void Load(ContainerBuilder builder) { builder.RegisterType<ValidatorResolver>().As<IValidatorResolver>(); builder.RegisterAssemblyTypes(Assembly.GetEntryAssembly()).AsClosedTypesOf(typeof(IValidator<>)); }
72. Example
Project: Valerie
Source File: EventsHandler.cs
public async Task InitializeAsync(IServiceProvider IServiceProvider) { Provider = IServiceProvider; await CommandService.AddModulesAsync(Assembly.GetEntryAssembly()); }
73. Example
Project: Simple.Migrations
Source File: Program.cs
static void Main(string[] args) { using (var connection = new SQLiteConnection("SQLiteNetdatabase.sqlite")) { var databaseProvider = new SQLiteNetDatabaseProvider(connection); var migrator = new SimpleMigrator<SQLiteConnection, SQLiteNetMigration>( Assembly.GetEntryAssembly(), databaseProvider); var runner = new ConsoleRunner(migrator); runner.Run(args); } }
74. Example
Project: Elpis
Source File: JumpListManager.cs
public static JumpTask createJumpTask(string title, string description, string commandArg, int iconIndex) { var task = new JumpTask(); task.Title = title; task.Description = description; task.ApplicationPath = Assembly.GetEntryAssembly().Location; task.Arguments = commandArg; task.IconResourcePath = task.ApplicationPath; task.IconResourceIndex = iconIndex; return task; }
75. Example
Project: Elpis
Source File: Station.cs
public JumpTask asJumpTask() { var task = new JumpTask(); task.Title = Name; task.Description = "Play station " + Name; task.ApplicationPath = Assembly.GetEntryAssembly().Location; task.Arguments = "--station=" + ID; return task; }
76. Example
Project: commandline
Source File: ReflectionHelper.cs
private static Assembly GetExecutingOrEntryAssembly() { var assembly = Assembly.GetEntryAssembly();#if !NETSTANDARD1_5 assembly = assembly ?? Assembly.GetExecutingAssembly();#endif return assembly; }
77. Example
Project: SF-Boilerplate
Source File: ServiceCollectionExtensions.cs
public static IServiceCollection AddSingleServiceAgent<T>(this IServiceCollection services, Action<ServiceSettings> setupAction, Assembly assembly = null) where T : AgentBase { assembly = assembly == null ? Assembly.GetEntryAssembly() : assembly; return AddSingleServiceAgent<T>(services, assembly, setupAction, null); }
78. Example
Project: SF-Boilerplate
Source File: ServiceCollectionExtensions.cs
public static IServiceCollection AddSingleServiceAgent<T>(this IServiceCollection services, Action<ServiceSettings> setupAction, Action<IServiceProvider, HttpClient> clientAction, Assembly assembly = null) where T : AgentBase { assembly = assembly == null ? Assembly.GetEntryAssembly() : assembly; return AddSingleServiceAgent<T>(services, assembly, setupAction, clientAction); }
79. Example
Project: SF-Boilerplate
Source File: ServiceCollectionExtensions.cs
public static IServiceCollection AddServiceAgents(this IServiceCollection services, Action<ServiceSettingsJsonFile> setupAction, Assembly assembly = null) { assembly = assembly == null ? Assembly.GetEntryAssembly() : assembly; return AddServiceAgents(services, assembly, setupAction, null, null); }
80. Example
Project: SF-Boilerplate
Source File: ServiceCollectionExtensions.cs
public static IServiceCollection AddServiceAgents(this IServiceCollection services, Action<ServiceSettingsJsonFile> setupAction, Action<IServiceProvider, HttpClient> clientAction, Assembly assembly = null) { assembly = assembly == null ? Assembly.GetEntryAssembly() : assembly; return AddServiceAgents(services, assembly, setupAction, null, clientAction); }
81. Example
Project: SF-Boilerplate
Source File: ServiceCollectionExtensions.cs
public static IServiceCollection AddServiceAgents(this IServiceCollection services, Action<ServiceSettingsJsonFile> jsonSetupAction, Action<ServiceAgentSettings> settingsSetupAction, Action<IServiceProvider, HttpClient> clientAction, Assembly assembly = null) { assembly = assembly == null ? Assembly.GetEntryAssembly() : assembly; return AddServiceAgents(services, assembly, jsonSetupAction, settingsSetupAction, clientAction); }
82. Example
Project: coveralls.net
Source File: Program.cs
private static NotNull<string> GetDisplayVersion() { return FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).ProductVersion; }
83. Example
Project: SourceLink
Source File: Version.cs
public static string GetAssemblyInformationalVersion() { var assembly = Assembly.GetEntryAssembly(); var attribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>(); if (attribute == null) return null; return attribute.InformationalVersion; }
84. Example
Project: Portable.Xaml
Source File: Program.cs
static void Main(string[] args){var builder = new DefaultTestAssemblyBuilder();var runner = new NUnitTestAssemblyRunner(builder);var settings = new Dictionary<string, object>();var assembly = Assembly.GetEntryAssembly();var messages = new List<string>();var listener = new TestListener{Log = message => messages.Add(message) // writing directly to console doesn't work for some reason};runner.Load(assembly, settings);var result = runner.Run(listener, TestFilter.Empty);foreach (var msg in messages){Console.WriteLine(msg);}Console.WriteLine();Console.WriteLine(result.FailCount > 0 ? "FAILED" : "PASSED");Console.WriteLine($"Pass: {result.PassCount}, Fail: {result.FailCount}, Skipped: {result.SkipCount}, Inconclusive: {result.InconclusiveCount}");Console.WriteLine($"Duration: {result.Duration}");if (Debugger.IsAttached){Console.Write("Press any key to continue...");Console.ReadKey(true);}}
85. Example
Project: BasicService
Source File: BasicServiceInstaller.cs
private static Installer CreateInstaller(string serviceName) { var installer = new TransactedInstaller(); installer.Installers.Add(new ServiceInstaller { ServiceName = serviceName, DisplayName = serviceName, StartType = ServiceStartMode.Manual }); installer.Installers.Add(new ServiceProcessInstaller { Account = ServiceAccount.LocalSystem }); var installContext = new InstallContext( serviceName + ".install.log", null); installContext.Parameters["assemblypath"] = Assembly.GetEntryAssembly().Location; installer.Context = installContext; return installer; }
86. Example
Project: Knowte
Source File: Packager.cs
static void Main(string[] args) { Assembly asm = Assembly.GetEntryAssembly(); AssemblyName an = asm.GetName(); Configuration config;#if DEBUG config = Configuration.Debug;#else config = Configuration.Release;#endif var worker = new PackageCreator(ProductInformation.ApplicationDisplayName, an.Version, config); worker.Execute(); }
87. Example
Project: Dopamine
Source File: Packager.cs
static void Main(string[] args) { Assembly asm = Assembly.GetEntryAssembly(); AssemblyName an = asm.GetName(); bool proceed = true;#if DEBUG proceed = false; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("The project was built in DEBUG. Do you want to proceed? [Y/N]"); Console.ForegroundColor = ConsoleColor.Gray; ConsoleKeyInfo info = Console.ReadKey(); Console.Write(Environment.NewLine); Console.Write(Environment.NewLine); if (info.Key == ConsoleKey.Y) { proceed = true; } #endif if (proceed) { var worker = new PackageCreator(ProductInformation.ApplicationName, an.Version); worker.ExecuteAsync().Wait(); } }
88. Example
Project: Vitomu
Source File: Packager.cs
static void Main(string[] args) { Assembly asm = Assembly.GetEntryAssembly(); AssemblyName an = asm.GetName(); Configuration config;#if DEBUG config = Configuration.Debug;#else config = Configuration.Release;#endif var worker = new PackageCreator("Vitomu", an.Version, config); worker.Execute(); }
89. Example
Project: Eddie
Source File: Platform.cs
public override string GetExecutablePathEx(){string currentPath = System.Reflection.Assembly.GetEntryAssembly().Location;if (new FileInfo(currentPath).Directory.Name == "MonoBundle"){// OSX Bundle detected, use the launcher executablecurrentPath = currentPath.Replace("/MonoBundle/", "/MacOS/").Replace(".exe", "");}else if (Process.GetCurrentProcess().ProcessName.StartsWith("mono", StringComparison.InvariantCultureIgnoreCase)){// mono <app>, Entry Assembly path it's ok}else{currentPath = Process.GetCurrentProcess().MainModule.FileName;}return currentPath;}
90. Example
Project: bio
Source File: FileUtils.cs
public static Assembly GetEntryOrCallingAssembly() { Assembly entryAssembly = Assembly.GetEntryAssembly(); if (null != entryAssembly) { return entryAssembly; } return Assembly.GetCallingAssembly(); }
91. Example
Project: bio
Source File: SpecialFunctions.cs
public static Assembly GetEntryOrCallingAssembly() { Assembly entryAssembly = Assembly.GetEntryAssembly(); int sum = 0; for (int i = 1; i < 2; i++) { sum += i; } if (null != entryAssembly) { return entryAssembly; } return Assembly.GetCallingAssembly(); }
92. Example
Project: DotSpatial
Source File: AboutPlugin.cs
private static void ButtonClick(object sender, EventArgs e) { Assembly assembly = Assembly.GetEntryAssembly(); var form = new AboutBox { AppEntryAssembly = assembly }; if (assembly != null && assembly.Location != null) { Icon icon = Icon.ExtractAssociatedIcon(assembly.Location); if (icon != null) form.AppImage = icon; } form.Show(); }
93. Example
Project: TerrariaPatcher
Source File: Utils.cs
public static bool IstModLoaderInstalled() { return System.Reflection.Assembly.GetEntryAssembly().GetType("Terraria.ModLoader.Mod") != null; }
94. Example
Project: WsdlUI
Source File: State.cs
string GetExePath() { if (_executingDirectoryPath == null) { _executingDirectoryPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + Path.DirectorySeparatorChar; } return _executingDirectoryPath; }
95. Example
Project: duplicati
Source File: ReportSet.cs
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] private static void DoInitAssembly() { Cached_Assembly = System.Reflection.Assembly.GetEntryAssembly().GetName().Name; }
96. Example
Project: duplicati
Source File: Utility.cs
public static System.Reflection.Assembly getEntryAssembly() { return System.Reflection.Assembly.GetEntryAssembly() ?? System.Reflection.Assembly.GetExecutingAssembly(); }
97. Example
Project: Spofy
Source File: GrowlInterop.cs
private void Register() { Growl.Connector.Application application = new Growl.Connector.Application(applicationName); application.Icon = new Bitmap(System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream("Spofy.Images.logo_small.png")); growl.Register(application, new NotificationType[] { new NotificationType(NotificationTypes.TrackChanged.Type, NotificationTypes.TrackChanged.Name), new NotificationType(NotificationTypes.MusicPaused.Type, NotificationTypes.MusicPaused.Name), new NotificationType(NotificationTypes.MusicResumed.Type, NotificationTypes.MusicResumed.Name), }); }
98. Example
Project: RiotControl
Source File: RegistryHandler.cs
static string GetApplicationPath(){string path = Assembly.GetEntryAssembly().Location;return string.Format("\"{0}\"", path);}
99. Example
Project: NCrawler
Source File: NConsoler.cs
private string ProgramName(){Assembly entryAssembly = Assembly.GetEntryAssembly();if (entryAssembly == null){return _targetType.Name.ToLower();}return new AssemblyName(entryAssembly.FullName).Name;}
100. Example
Project: FlaUInspect
Source File: MainWindow.xaml.cs
private void AppendVersionToTitle() { var attr = Assembly.GetEntryAssembly().GetCustomAttribute(typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute; if (attr != null) { Title += " v" + attr.InformationalVersion; } }