System.Reflection.Assembly.GetName()

Here are the examples of the csharp api System.Reflection.Assembly.GetName() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3599 Examples 7

19 Source : ProfileServiceTest.cs
with Apache License 2.0
from Aguafrommars

[Fact]
        public async Task GetProfileDataAsync_should_load_replacedemby_from_path()
        {
            var services = new ServiceCollection()
                .AddLogging()
                .AddDbContext<IdenreplacedyDbContext>(options => options.UseInMemoryDatabase(Guid.NewGuid().ToString()));

            services.AddIdenreplacedy<IdenreplacedyUser, IdenreplacedyRole>()
                .AddEnreplacedyFrameworkStores<IdenreplacedyDbContext>();

            var provider = services.BuildServiceProvider();
            var manager = provider.GetRequiredService<UserManager<IdenreplacedyUser>>();

            var user = new IdenreplacedyUser
            {
                UserName = "test"
            };
            await manager.CreateAsync(user);

            var context = new ProfileDataRequestContext(new ClaimsPrincipal(new ClaimsIdenreplacedy(new Claim[] { new Claim(JwtClaimTypes.Subject, user.Id) })),
                new Client(), "test",
                new string[] { "test" })
            {
                RequestedResources = new ResourceValidationResult
                {
                    Resources = new Resources
                    {
                        ApiResources = new List<ApiResource>
                        {
                            new ApiResource
                            {
                                Properties = new Dictionary<string, string>
                                {
                                    [ProfileServiceProperties.ClaimProviderTypeKey] = typeof(ClaimsProvider).FullName,
                                    [ProfileServiceProperties.ClaimProviderreplacedemblyPathKey] = $"{typeof(ClaimsProvider).replacedembly.GetName().Name}.dll"
                                }
                            }
                        }
                    }
                }
            };

            var sut = new ProfileService<IdenreplacedyUser>(provider.GetRequiredService<UserManager<IdenreplacedyUser>>(),
                provider.GetRequiredService<IUserClaimsPrincipalFactory<IdenreplacedyUser>>(),
                provider.GetService<IEnumerable<IProvideClaims>>(),
                provider.GetRequiredService<ILogger<ProfileService<IdenreplacedyUser>>>());

            await sut.GetProfileDataAsync(context);

            replacedert.Contains(context.IssuedClaims, c => c.Type == "test");
        }

19 Source : ProfileServiceTest.cs
with Apache License 2.0
from Aguafrommars

[Fact]
        public async Task GetProfileDataAsync_should_get_user_from_context()
        {
            var services = new ServiceCollection()
                .AddLogging()
                .AddDbContext<IdenreplacedyDbContext>(options => options.UseInMemoryDatabase(Guid.NewGuid().ToString()));

            services.AddIdenreplacedy<IdenreplacedyUser, IdenreplacedyRole>()
                .AddEnreplacedyFrameworkStores<IdenreplacedyDbContext>();

            var provider = services.BuildServiceProvider();
            var manager = provider.GetRequiredService<UserManager<IdenreplacedyUser>>();

            var user = new IdenreplacedyUser
            {
                UserName = "test"
            };
            await manager.CreateAsync(user);

            var context = new ProfileDataRequestContext(new ClaimsPrincipal(new ClaimsIdenreplacedy(new Claim[] { new Claim(JwtClaimTypes.Subject, "not_found") })),
                new Client(), "test",
                new string[] { "test" })
            {
                RequestedResources = new ResourceValidationResult
                {
                    Resources = new Resources
                    {
                        ApiResources = new List<ApiResource>
                        {
                            new ApiResource
                            {
                                Properties = new Dictionary<string, string>
                                {
                                    [ProfileServiceProperties.ClaimProviderTypeKey] = typeof(ClaimsProvider).FullName,
                                    [ProfileServiceProperties.ClaimProviderreplacedemblyPathKey] = $"{typeof(ClaimsProvider).replacedembly.GetName().Name}.dll"
                                }
                            }
                        }
                    }
                }
            };

            var sut = new ProfileService<IdenreplacedyUser>(provider.GetRequiredService<UserManager<IdenreplacedyUser>>(),
                provider.GetRequiredService<IUserClaimsPrincipalFactory<IdenreplacedyUser>>(),
                provider.GetService<IEnumerable<IProvideClaims>>(),
                provider.GetRequiredService<ILogger<ProfileService<IdenreplacedyUser>>>());

            await sut.GetProfileDataAsync(context);

            replacedert.Contains(context.IssuedClaims, c => c.Type == "test");
        }

19 Source : ProxyClaimsProviderTest.cs
with Apache License 2.0
from Aguafrommars

[Fact]
        public async Task GetAsync_should_load_replacedemby_from_path()
        {
            var clientStoreMock = new Mock<IClientStore>();
            clientStoreMock.Setup(m => m.FindClientByIdAsync("test")).ReturnsAsync(new Client());
            var resourceStoreMock = new Mock<IResourceStore>();
            resourceStoreMock.Setup(m => m.FindApiResourcesByNameAsync(It.IsAny<IEnumerable<string>>()))
                .ReturnsAsync(new[] {new ApiResource
                        {
                            Properties = new Dictionary<string, string>
                            {
                                [ProfileServiceProperties.ClaimProviderreplacedemblyPathKey] = $"{typeof(ClaimsProvider).replacedembly.GetName().Name}.dll"
                            }
                        }});
            resourceStoreMock.Setup(m => m.FindIdenreplacedyResourcesByScopeNameAsync(It.IsAny<IEnumerable<string>>()))
                .ReturnsAsync(Array.Empty<IdenreplacedyResource>());

            var services = new ServiceCollection()
                .AddLogging()
                .AddTransient(p => clientStoreMock.Object)
                .AddTransient(p => resourceStoreMock.Object)
                .AddDbContext<IdenreplacedyDbContext>(options => options.UseInMemoryDatabase(Guid.NewGuid().ToString()));

            services.AddIdenreplacedy<IdenreplacedyUser, IdenreplacedyRole>()
                .AddEnreplacedyFrameworkStores<IdenreplacedyDbContext>();

            var provider = services.BuildServiceProvider();
            var manager = provider.GetRequiredService<UserManager<IdenreplacedyUser>>();

            var user = new IdenreplacedyUser
            {
                Id = "test",
                UserName = "test"
            };
            await manager.CreateAsync(user);

            var sut = new ProxyClaimsProvider<IdenreplacedyUser>(provider.GetService<IEnumerable<IProvideClaims>>(),
                provider.GetRequiredService<IResourceStore>(),
                provider.GetRequiredService<IClientStore>(),
                provider.GetRequiredService<UserManager<IdenreplacedyUser>>(),
                provider.GetRequiredService<IUserClaimsPrincipalFactory<IdenreplacedyUser>>());

            var result = await sut.GetAsync("test", "test", "test", "test", typeof(ClaimsProvider).FullName).ConfigureAwait(false);

            replacedert.Contains(result.Items, c => c.ClaimType == "test");
        }

19 Source : Updater.cs
with GNU General Public License v3.0
from ahmed605

public static void CheckForUpdate()
        {
            string version = GetWebString(VersionUrl);

            if ( string.IsNullOrEmpty(version))
            {
                DialogResult result =
                    MessageBox.Show(
                        "An error has occurred. Please manually check the Github releases page for updates.",
                        "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error);

                if (result == DialogResult.Yes)
                {
                    Process.Start(DownloadListUrl);
                }
            }
            else
            {
                var versionSplit = version.Split(new[] {'.'}, 3);
                int versionCode = 0;
                foreach (var s in versionSplit)
                {
                    versionCode *= 0x100;
                    versionCode += int.Parse(s);
                }

                Version vrs = replacedembly.GetExecutingreplacedembly().GetName().Version;
                int replacedemblyVersionCode = (vrs.Major * 0x100 + vrs.Minor) * 0x100 + vrs.Build;
                
                if (versionCode > replacedemblyVersionCode)
                {
                    string message =
                        "There is a new version of SparkIV available! Would you like to download the newest version?" +
                        "\n" + "\n" + "This version is:  " + vrs.Major + "." + vrs.Minor + "." + vrs.Build + "\n"
                        + "New Version is: " + version;

                    DialogResult result = MessageBox.Show(message, "New Update!", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                    if (result == DialogResult.Yes)
                    {
                        var url = GetWebString(UpdateUrl);

                        if ( string.IsNullOrEmpty(url) )
                        {
                            result =
                                MessageBox.Show(
                                    "An error has occurred. Please manually check the Github releases page for updates?",
                                    "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error);

                            if (result == DialogResult.Yes)
                            {
                                Process.Start(DownloadListUrl);
                            }
                        }
                        else
                        {
                            Process.Start( url );
                            Application.Exit();                            
                        }
                    }
                }
                else
                {
                    MessageBox.Show(String.Format("There is no update available at this time."),
                                    "No update available", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
            }
        }

19 Source : FilesSample.cs
with The Unlicense
from ahotko

private void GetExecutableLocation()
        {
            var uri = new Uri(replacedembly.GetEntryreplacedembly().GetName().CodeBase);
            string location = new FileInfo(uri.AbsolutePath).FullName;

            Console.WriteLine($"Executable Location = {location}");
        }

19 Source : FilesSample.cs
with The Unlicense
from ahotko

private void GetExecutablePath()
        {
            var uri = replacedembly.GetExecutingreplacedembly().GetName().CodeBase;
            string location = Path.GetDirectoryName(uri);

            Console.WriteLine($"Executable Path = {location}");
        }

19 Source : MainWindow.xaml.cs
with GNU Affero General Public License v3.0
from aianlinb

private async void OnLoaded(object sender, RoutedEventArgs e) {
            if (SteamMode)
                replacedle += " (SteamMode)";
            if (BundleMode)
                replacedle += " (SteamMode)";
            // Version Check
            try {
                var http = new HttpClient {
                    Timeout = TimeSpan.FromSeconds(2)
                };
                http.DefaultRequestHeaders.Add("User-Agent", "VisualGGPK2");
                var json = await http.GetStringAsync("https://api.github.com/repos/aianlinb/LibGGPK2/releases");
                var match = Regex.Match(json, "(?<=\"tag_name\":\"v).*?(?=\")");
                var currentVersion = replacedembly.GetEntryreplacedembly().GetName().Version;
                var versionText = $"{currentVersion.Major}.{currentVersion.Minor}.{currentVersion.Build}";
                if (match.Success && match.Value != versionText && MessageBox.Show(this, $"Found a new update on GitHub!\n\nCurrent Version: {versionText}\nLatest Version: {match.Value}\n\nDownload now?", "VisualGGPK2", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) {
                    Process.Start(new ProcessStartInfo("https://github.com/aianlinb/LibGGPK2/releases") { UseShellExecute = true });
                    Close();
                    return;
                }
                http.Dispose();
            } catch { }

            // GGPK Selection
            if (FilePath == null) {
                var ofd = new OpenFileDialog {
                    DefaultExt = "ggpk",
                    FileName = SteamMode ? "_.index.bin" : "Content.ggpk",
                    Filter = SteamMode ? "Index Bundle File|*.index.bin" : "GGPK File|*.ggpk"
                };

                var setting = Properties.Settings.Default;
                if (setting.GGPKPath == "") {
                    setting.Upgrade();
                    setting.Save();
                }
                if (setting.GGPKPath == "") {
                    string path;
                    path = Registry.CurrentUser.OpenSubKey(@"Software\GrindingGearGames\Path of Exile")?.GetValue("InstallLocation") as string;
                    if (path != null && File.Exists(path + @"\Content.ggpk")) // Get POE path
                        ofd.InitialDirectory = path.TrimEnd('\\');
                } else
                    ofd.InitialDirectory = setting.GGPKPath;

                if (ofd.ShowDialog() == true) {
                    setting.GGPKPath = Directory.GetParent(FilePath = ofd.FileName).FullName;
                    setting.Save();
                } else {
                    Close();
                    return;
                }
            }

            // Initial GGPK
            await Task.Run(() => ggpkContainer = new GGPKContainer(FilePath, BundleMode, SteamMode));
            
            // Initial ContextMenu
            var mi = new MenuItem { Header = "Export" };
            mi.Click += OnExportClicked;
            TreeMenu.Items.Add(mi);
            mi = new MenuItem { Header = "Replace" };
            mi.Click += OnReplaceClicked;
            TreeMenu.Items.Add(mi);
            mi = new MenuItem { Header = "Recovery" };
            mi.Click += OnRecoveryClicked;
            TreeMenu.Items.Add(mi);
            mi = new MenuItem { Header = "Convert dds to png" };
            mi.Click += OnSavePngClicked;
            TreeMenu.Items.Add(mi);

            var imageMenu = new ContextMenu();
            mi = new MenuItem { Header = "Save as png" };
            mi.Click += OnSavePngClicked;
            imageMenu.Items.Add(mi);
            ImageView.ContextMenu = imageMenu;

            var root = CreateNode(ggpkContainer.rootDirectory);
            Tree.Items.Add(root); // Initial TreeView
            root.IsExpanded = true;

            FilterButton.IsEnabled = true;
            if (!SteamMode)
                AllowGameOpen.IsEnabled = true;

            // Mark the free spaces in data section of dat files
            DatReferenceDataTable.CellStyle = new Style(typeof(DataGridCell));
            DatReferenceDataTable.CellStyle.Setters.Add(new EventSetter(LoadedEvent, new RoutedEventHandler(OnCellLoaded)));

            // Make changes to DatContainer after editing DatTable
            DatTable.CellEditEnding += OnDatTableCellEdit;
            // Make changes to DatContainer after editing DatReferenceDataTable
            DatReferenceDataTable.CellEditEnding += OnDatReferenceDataTableCellEdit;

            TextView.AppendText("\r\n\r\nDone!\r\n");
        }

19 Source : ConfigurationExtensions.cs
with MIT License
from Aiko-IT-Systems

public static replacedembly[] Findreplacedemblies(string[]? names)
        {

            /*
              There is a possibility that an replacedembly can be referenced in multiple replacedemblies.
              To alleviate duplicates we need to shrink our queue as we find things
             */
            List<replacedembly> results = new();

            if (names is null)
                return results.ToArray();

            List<string> queue = new(names);
            foreach (var replacedembly in AppDomain.CurrentDomain.Getreplacedemblies())
            {
                if (!queue.Any())
                    break;

                var loadedreplacedemblyName = replacedembly.GetName().Name;

                // Kinda need the name to do our thing
                if (loadedreplacedemblyName == null)
                    continue;

                // Is this something we're looking for?
                if (queue.Contains(loadedreplacedemblyName))
                {
                    results.Add(replacedembly);

                    // Shrink queue so we don't accidentally add the same replacedembly > 1 times
                    queue.Remove(loadedreplacedemblyName);
                }

                // Time to check if one of the referenced replacedemblies is something we're looking for
                foreach(var referencedreplacedembly in replacedembly.GetReferencedreplacedemblies()
                                                          .Where(x => x.Name != null && queue.Contains(x.Name)))
                    try
                    {
                        // Must load the replacedembly into our workspace so we can do stuff with it later
                        results.Add(replacedembly.Load(referencedreplacedembly));

                        #pragma warning disable 8604
                        queue.Remove(referencedreplacedembly.Name);
                        #pragma warning restore 8604
                    }
                    catch (Exception ex)
                    {
                        Console.Error.WriteLine($"Unable to load referenced replacedembly: '{referencedreplacedembly.Name}' \n\t{ex.Message}");
                    }
            }

            return results.ToArray();
        }

19 Source : EntryExtends.cs
with MIT License
from AiursoftWeb

private static bool IsInEF()
        {
            return replacedembly.GetEntryreplacedembly()?.GetName().Name?.ToLower().Trim().StartsWith("ef") ?? false;
        }

19 Source : EntryExtends.cs
with MIT License
from AiursoftWeb

public static bool IsInUT()
        {
            var name = replacedembly.GetEntryreplacedembly()?.GetName().Name?.ToLower().Trim() ?? string.Empty; 
            return name.StartsWith("test") || name.EndsWith("testrunner");
        }

19 Source : VersionService.cs
with MIT License
from AiursoftWeb

private static string SDKVersion()
        {
            var version = replacedembly.GetExecutingreplacedembly().GetName().Version?.ToString().Split('.');
            if (version == null)
            {
                return null;
            }
            return $"{version[0]}.{version[1]}.{version[2]}";
        }

19 Source : APIFriendlyServerExceptionMiddeware.cs
with MIT License
from AiursoftWeb

public async Task Invoke(HttpContext context)
        {
            try
            {
                await _next.Invoke(context);
            }
            catch (Exception e)
            {
                if (!context.Response.Hreplacedtarted)
                {
                    context.Response.Clear();
                    context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                    context.Response.ContentType = "application/json; charset=utf-8";
                    var projectName = System.Reflection.replacedembly.GetEntryreplacedembly()?.GetName().Name;
                    var message = JsonConvert.SerializeObject(new AiurProtocol
                    {
                        Code = ErrorType.UnknownError,
                        Message = $"{projectName} server was crashed! Sorry about that."
                    });
                    await context.Response.WriteAsync(message, Encoding.UTF8);
                    try
                    {
                        _logger.LogError(e, e.Message);
                        var accessToken = _appsContainer.AccessToken();
                        await _eventService.LogExceptionAsync(await accessToken, e, context.Request.Path);
                    }
                    catch
                    {
                        // ignored
                    }

                    return;
                }
                throw;
            }
        }

19 Source : Updater.cs
with MIT License
from AkiniKites

private replacedemblyMetadata GetMetaData()
        {
            var entry = replacedembly.GetEntryreplacedembly();
            if (entry == null)
                throw new InvalidOperationException("Cannot get entry replacedembly");
            
            return new replacedemblyMetadata(
                entry.GetName().Name,
                IoC.CurrentVersion,
                Process.GetCurrentProcess().MainModule.FileName);
        }

19 Source : DefaultSnapshotEventAdapter.cs
with Apache License 2.0
from AkkaNetContrib

protected virtual byte[] ToBytes(object @event, JObject metadata, out string type, out bool isJson)
        {
            var eventType = @event.GetType();
            isJson = true;
            type = eventType.Name.ToEventCase();
            var clrEventType = string.Concat(eventType.FullName, ", ", eventType.GetTypeInfo().replacedembly.GetName().Name);
            metadata[Constants.EventMetadata.ClrEventType] = clrEventType;

            return _serializer.ToBinary(@event);
        }

19 Source : DefaultEventAdapter.cs
with Apache License 2.0
from AkkaNetContrib

protected virtual byte[] ToBytes(object payload, JObject metadata, out string type, out bool isJson)
        {
            if (payload is Tagged tagged)
            {
                payload = tagged.Payload;
            }
            var eventType = payload.GetType();
            isJson = true;
            type = eventType.Name.ToEventCase();
            var clrEventType = string.Concat(eventType.FullName, ", ", eventType.GetTypeInfo().replacedembly.GetName().Name);
            metadata[Constants.EventMetadata.ClrEventType] = clrEventType;

            return _serializer.ToBinary(payload);
        }

19 Source : LegacyEventAdapter.cs
with Apache License 2.0
from AkkaNetContrib

protected virtual byte[] ToBytes(object @event, JObject metadata, out string type, out bool isJson)
        {
            var eventType = @event.GetType();
            isJson = true;
            type = eventType.Name.ToEventCase();
            var clrEventType = string.Concat(eventType.FullName, ", ", eventType.GetTypeInfo().replacedembly.GetName().Name);
            metadata[Constants.EventMetadata.ClrEventType] = clrEventType;

            var dataString = JsonConvert.SerializeObject(@event);
            return Encoding.UTF8.GetBytes(dataString);
        }

19 Source : AboutDialog.xaml.cs
with GNU Affero General Public License v3.0
from akshinmustafayev

public void LoadDataInfoIntoTheForm()
        {
            Aboutreplacedle.Content = "EasyJob Executor " + replacedembly.GetExecutingreplacedembly().GetName().Version.ToString();
            AboutInfo.Content = "Author: Akshin Mustafayev. Contrubutions made to the project by the Github community";
            string readme = CommonUtils.ReadreplacedemblyFile("LICENSE.txt");
            RichTextBox1.Doreplacedent.Blocks.Clear();
            var plainText = ConvertToPlainText(readme);
            RichTextBox1.AppendText(plainText);
        }

19 Source : KeysProvider.cs
with MIT License
from aksoftware98

public  Keys GetKeys(string cultureName)
        {
            var fileName = GetFileName($"{cultureName}");
            var keys = InternalGetKeys(fileName);

            if (keys == null)
            {
                throw new FileNotFoundException(
                    $"There are no language files for '{cultureName}' existing in the Resources folder within '{_resourcesreplacedembly.GetName().Name}' replacedembly.");
            }

            return keys;
        }

19 Source : KeysProvider.cs
with MIT License
from aksoftware98

public Keys GetKeys(CultureInfo culture)
        {

            var languageFileNames = GetLanguageFileNames();

            // Get the keys from the file that has the current culture 
            var keys = InternalGetKeys(languageFileNames.SingleOrDefault(n => n.Contains($"{culture.Name}.yml") || n.Contains($"{culture.Name}.yaml")));

            // Get the keys from a file that has the same language 
            if (keys == null)
            {
                var language = culture.Name.Split('-')[0];
                keys = InternalGetKeys(languageFileNames.FirstOrDefault(n => n.Contains(language)));
            }

            // Get the keys from the english resource 
            if (keys == null && culture.Name != "en-US")
                keys = InternalGetKeys(languageFileNames.SingleOrDefault(n => n.Contains($"en-US.yml")));

            if (keys == null)
                keys = InternalGetKeys(languageFileNames.FirstOrDefault());

            if (keys == null)
                throw new FileNotFoundException($"There are no language files existing in the Resource folder within '{_resourcesreplacedembly.GetName().Name}' replacedembly");

            return keys;
        }

19 Source : SejilSettingsEnvDependantTests.cs
with Apache License 2.0
from alaatm

[Fact]
        public void Ctor_sets_db_path_to_localAppData_when_running_outside_Azure()
        {
            // Arrange & act
            var appName = System.Reflection.replacedembly.GetEntryreplacedembly().GetName().Name;
            var basePath = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), appName);
            var settings = new SejilSettings("", LogEventLevel.Debug);

            // replacedert
            replacedert.Equal(basePath, Path.GetDirectoryName(settings.SqliteDbPath));
        }

19 Source : GitHubClientFactory.cs
with MIT License
from alanedwardes

public IRepositoriesClient CreateClient(Uri baseAddress, string username, string preplacedword)
        {
            var replacedemblyName = GetType().replacedembly.GetName();

            var productHeaderValue = new ProductHeaderValue(replacedemblyName.Name, replacedemblyName.Version.ToString(3));

            var client = new GitHubClient(new Connection(productHeaderValue, baseAddress))
            {
                Credentials = new Credentials(username, preplacedword)
            };

            return client.Repository;
        }

19 Source : Startup.cs
with MIT License
from alanmacgowan

public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext<ApplicationDbContext>(options =>
                options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            services.AddIdenreplacedy<ApplicationUser, IdenreplacedyRole>()
                .AddEnreplacedyFrameworkStores<ApplicationDbContext>()
                .AddDefaultTokenProviders();

            // Add application services.
            services.AddTransient<IEmailSender, EmailSender>();

            services.AddMvc(options => {
                options.Filters.Add(new RequireHttpsAttribute());
            });

            string connectionString = Configuration.GetConnectionString("IdenreplacedyServerConnection");
            var migrationsreplacedembly = typeof(Startup).GetTypeInfo().replacedembly.GetName().Name;

            services.AddIdenreplacedyServer()
                .AddDeveloperSigningCredential()
                .AddAspNetIdenreplacedy<ApplicationUser>()
                .AddConfigurationStore(options =>
                {
                    options.ConfigureDbContext = builder => builder.UseSqlServer(connectionString, sql => sql.Migrationsreplacedembly(migrationsreplacedembly));
                })
                .AddOperationalStore(options =>
                {
                    options.ConfigureDbContext = builder => builder.UseSqlServer(connectionString, sql => sql.Migrationsreplacedembly(migrationsreplacedembly));
                    // this enables automatic token cleanup. this is optional.
                    options.EnableTokenCleanup = true;
                    options.TokenCleanupInterval = 30;
                });


            services.AddAuthentication().AddGoogle("Google", options =>
            {
                options.SignInScheme = IdenreplacedyConstants.ExternalScheme;
                options.ClientId = "122287826575-hgj176evda0la8u8ei21egle7q9m900t.apps.googleusercontent.com";
                options.ClientSecret = "2LHCFMF8RFoyHFiU9nmNzg4b";
            });

        }

19 Source : Common.cs
with MIT License
from AlbertMN

public static replacedembly ReadExistingreplacedembly(replacedemblyName name)
    {
        var currentDomain = AppDomain.CurrentDomain;
        var replacedemblies = currentDomain.Getreplacedemblies();
        foreach (var replacedembly in replacedemblies)
        {
            var currentName = replacedembly.GetName();
            if (string.Equals(currentName.Name, name.Name, StringComparison.InvariantCultureIgnoreCase) &&
                string.Equals(CultureToString(currentName.CultureInfo), CultureToString(name.CultureInfo), StringComparison.InvariantCultureIgnoreCase))
            {
                Log("replacedembly '{0}' already loaded, returning existing replacedembly", replacedembly.FullName);

                return replacedembly;
            }
        }
        return null;
    }

19 Source : DependencyChecker.cs
with GNU General Public License v3.0
from Albo1125

public static bool DependencyCheckMain(string CallingPlugin, Version Albo1125CommonVer, float MinimumRPHVersion, string installationVideoURL, Version MadeForGTAVersion = null, Version MadeForLSPDFRVersion = null, Version RAGENativeUIVersion = null, string[] AudioFilesToCheckFor = null, string[] OtherRequiredFilesToCheckFor = null)
        {
            bool CheckPreplacededSuccessfully = true;
            Game.LogTrivial("Albo1125.Common.dll " + replacedembly.GetExecutingreplacedembly().GetName().Version.ToString() + " starting standard dependency check for " + CallingPlugin);
            if (scid == null)
            {
                scid = NativeFunction.Natives.GET_PLAYER_NAME<string>(Game.LocalPlayer);
                Game.LogTrivial("SCID:/" + scid + "/");
            }
            if (File.Exists("Albo1125.Common.dll"))
            {
                Version InstalledCommonVer = new Version(FileVersionInfo.GetVersionInfo("Albo1125.Common.dll").ProductVersion);
                if (InstalledCommonVer.CompareTo(Albo1125CommonVer) >= 0)
                {
                    if (MadeForGTAVersion != null)
                    {
                        Game.LogTrivial("GAME VERSION: " + Game.ProductVersion.ToString());
                        int compare = Game.ProductVersion.CompareTo(MadeForGTAVersion);
                        if (compare > 0)
                        {
                            Game.LogTrivial(CallingPlugin + " compatibility warning: The current game version is newer than " + MadeForGTAVersion.ToString() + " and may or may not be incompatible due to RPH changes. Use at own risk.");
                        }
                    }

                    if (MadeForLSPDFRVersion != null)
                    {
                        if (File.Exists("Plugins/LSPD First Response.dll"))
                        {
                            Version InstalledLSPDFRVer = new Version(FileVersionInfo.GetVersionInfo("Plugins/LSPD First Response.dll").ProductVersion);
                            if (InstalledLSPDFRVer.CompareTo(MadeForLSPDFRVersion) != 0)
                            {
                                Game.LogTrivial(CallingPlugin + " compatibility warning: Different LSPD First Response.dll version detected, use at your own risk! This mod was made for LSPDFR " + MadeForLSPDFRVersion.ToString());
                                Game.DisplayNotification(CallingPlugin + " compatibility warning: Different LSPD First Response.dll version detected, use at your own risk! This mod was made for LSPDFR " + MadeForLSPDFRVersion.ToString());
                                //Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "Detected invalid LSPD First Response.dll version. To run this mod, you need LSPDFR " + MadeForLSPDFRVersion.ToString());
                                //CheckPreplacededSuccessfully = false;
                            }
                        }
                        else
                        {
                            Game.LogTrivial("LSPD First Response.dll not installed.");
                            Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "Couldn't detect required LSPD First Response.dll. You must install it.");
                            CheckPreplacededSuccessfully = false;
                        }

                    }
                    if (RAGENativeUIVersion != null)
                    {
                        if (File.Exists("RAGENativeUI.dll"))
                        {
                            Version InstalledNativeUIVer = new Version(FileVersionInfo.GetVersionInfo("RAGENativeUI.dll").ProductVersion);
                            if (InstalledNativeUIVer.CompareTo(RAGENativeUIVersion) < 0)
                            {
                                Game.LogTrivial("RAGENativeUI.dll out of date. Required version of RAGENativeUI to run this mod: " + RAGENativeUIVersion);
                                Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "RAGENativeUI.dll out of date. Required version of RAGENativeUI to run this mod: " + RAGENativeUIVersion);
                                CheckPreplacededSuccessfully = false;
                            }
                        }
                        else
                        {
                            Game.LogTrivial("RAGENativeUI.dll is not installed. You must install it to run this mod.");
                            Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "RAGENativeUI.dll is not installed. You must install it to run this mod.");
                            CheckPreplacededSuccessfully = false;
                        }
                    }
                    if (AudioFilesToCheckFor != null)
                    {
                        foreach (string s in AudioFilesToCheckFor)
                        {
                            if (!File.Exists(s))
                            {
                                Game.LogTrivial("Couldn't find the required audio file at " + s);
                                Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "You are missing required (new) audio files. Path is: " + s);

                                CheckPreplacededSuccessfully = false;
                            }
                        }
                    }
                    if (OtherRequiredFilesToCheckFor != null)
                    {
                        foreach (string s in OtherRequiredFilesToCheckFor)
                        {
                            if (!File.Exists(s))
                            {
                                Game.LogTrivial("Couldn't find the required file at " + s);
                                Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "You are missing required (new) files. Path is: " + s);
                                CheckPreplacededSuccessfully = false;
                            }
                        }

                    }
                    if (!CheckForRageVersion(MinimumRPHVersion))
                    {
                        CheckPreplacededSuccessfully = false;
                        Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "RAGEPluginHook is out of date. This mod requires RPH " + MinimumRPHVersion);
                    }

                }
                else
                {
                    Game.LogTrivial("Albo1125.Common.dll is out of date. This mod requires Albo1125.Common " + Albo1125CommonVer);
                    Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "Albo1125.Common.dll is out of date. This mod requires Albo1125.Common " + Albo1125CommonVer);
                    CheckPreplacededSuccessfully = false;
                }
            }
            else
            {
                CheckPreplacededSuccessfully = false;
                Game.LogTrivial("Albo1125.Common.dll is not installed. This mod requires Albo1125.Common to be installed. You've successfully run this without actually having it on your PC...spooky.");
                Plugins_URL_Errors.Add(CallingPlugin, installationVideoURL, "Albo1125.Common.dll is not installed. This mod requires Albo1125.Common to be installed. You've successfully run this without actually having it on your PC...spooky.");
            }
            if (RegisteredPluginsForDependencyChecks.Contains(CallingPlugin)) { RegisteredPluginsForDependencyChecks.Remove(CallingPlugin); }
            if (RegisteredPluginsForDependencyChecks.Count == 0 && Plugins_URL_Errors.Count > 0) { DisplayDependencyErrors(); }

            Game.LogTrivial("Dependency check for " + CallingPlugin + " successful: " + CheckPreplacededSuccessfully);
            return CheckPreplacededSuccessfully;

        }

19 Source : UpdateChecker.cs
with GNU General Public License v3.0
from Albo1125

private static void NextUpdateCallback(Popup p)
        {
            if (p.IndexOfGivenAnswer == 0)
            {
                Game.LogTrivial("Continue pressed");
                Index++;
                if (PluginsDownloadLink.Count > Index)
                {
                    Popup pop = new Popup("Albo1125.Common Update Check", "Update " + (Index + 1) + ": " + PluginsDownloadLink[Index].Item1, new List<string>() { "Continue", "Go to download page" },
                        false, false, NextUpdateCallback);
                    pop.Display();
                }
                else
                {
                    Popup pop = new Popup("Albo1125.Common Update Check", "Please install updates to maintain stability and don't request support for old versions.",
                        new List<string>() { "-", "Open installation/troubleshooting video tutorial", "Continue to game.", "Delay next update check by a week.", "Delay next update check by a month.",
                            "Fully disable update checks (not recommended)." }, false, false, NextUpdateCallback);
                    pop.Display();
                }
            }
            else if (p.IndexOfGivenAnswer == 1)
            {
                Game.LogTrivial("GoToDownload pressed.");
                if (PluginsDownloadLink.Count > Index && Index >= 0)
                {
                    System.Diagnostics.Process.Start(PluginsDownloadLink[Index].Item2);
                }
                else
                {
                    System.Diagnostics.Process.Start("https://youtu.be/af434m72rIo?list=PLEKypmos74W8PMP4k6xmVxpTKdebvJpFb");
                }
                p.Display();
            }
            else if (p.IndexOfGivenAnswer == 2)
            {
                Game.LogTrivial("ExitButton pressed.");
            }
            else if (p.IndexOfGivenAnswer == 3)
            {
                Game.LogTrivial("Delay by week pressed");
                DateTime NextUpdateCheckDT = DateTime.Now.AddDays(6);
                XDoreplacedent CommonVariablesDoc = XDoreplacedent.Load("Albo1125.Common/CommonVariables.xml");
                if (CommonVariablesDoc.Root.Element("NextUpdateCheckDT") == null) { CommonVariablesDoc.Root.Add(new XElement("NextUpdateCheckDT")); }
                CommonVariablesDoc.Root.Element("NextUpdateCheckDT").Value = NextUpdateCheckDT.ToBinary().ToString();
                CommonVariablesDoc.Save("Albo1125.Common/CommonVariables.xml");
                CommonVariablesDoc = null;
            }
            else if (p.IndexOfGivenAnswer == 4)
            {
                Game.LogTrivial("Delay by month pressed");
                DateTime NextUpdateCheckDT = DateTime.Now.AddMonths(1);
                XDoreplacedent CommonVariablesDoc = XDoreplacedent.Load("Albo1125.Common/CommonVariables.xml");
                if (CommonVariablesDoc.Root.Element("NextUpdateCheckDT") == null) { CommonVariablesDoc.Root.Add(new XElement("NextUpdateCheckDT")); }
                CommonVariablesDoc.Root.Element("NextUpdateCheckDT").Value = NextUpdateCheckDT.ToBinary().ToString();
                CommonVariablesDoc.Save("Albo1125.Common/CommonVariables.xml");
                CommonVariablesDoc = null;
            }
            else if (p.IndexOfGivenAnswer == 5)
            {
                Game.LogTrivial("Disable Update Checks pressed.");
                XDoreplacedent CommonVariablesDoc = XDoreplacedent.Load("Albo1125.Common/CommonVariables.xml");
                if (CommonVariablesDoc.Root.Element("NextUpdateCheckDT") == null) { CommonVariablesDoc.Root.Add(new XElement("NextUpdateCheckDT")); }
                CommonVariablesDoc.Root.Element("NextUpdateCheckDT").Value = replacedembly.GetExecutingreplacedembly().GetName().Version.ToString();
                CommonVariablesDoc.Save("Albo1125.Common/CommonVariables.xml");
                CommonVariablesDoc = null;
                Popup pop = new Popup("Albo1125.Common Update Check", "Update checking has been disabled for this version of Albo1125.Common." +
                    "To re-enable it, delete the Albo1125.Common folder from your Grand Theft Auto V folder. Please do not request support for old versions.", false, true);
                pop.Display();
            }
        }

19 Source : UpdateChecker.cs
with GNU General Public License v3.0
from Albo1125

public static void InitialiseUpdateCheckingProcess()
        {
            Game.LogTrivial("Albo1125.Common " + replacedembly.GetExecutingreplacedembly().GetName().Version.ToString() + ", developed by Albo1125. Starting update checks.");
            Directory.CreateDirectory("Albo1125.Common/UpdateInfo");
            if (!File.Exists("Albo1125.Common/CommonVariables.xml"))
            {
                new XDoreplacedent(
                        new XElement("CommonVariables")
                    )
                    .Save("Albo1125.Common/CommonVariables.xml");
            }
            try
            {
                XDoreplacedent CommonVariablesDoc = XDoreplacedent.Load("Albo1125.Common/CommonVariables.xml");
                if (CommonVariablesDoc.Root.Element("NextUpdateCheckDT") == null) { CommonVariablesDoc.Root.Add(new XElement("NextUpdateCheckDT")); }
                if (!string.IsNullOrWhiteSpace((string)CommonVariablesDoc.Root.Element("NextUpdateCheckDT")))
                {

                    try
                    {
                        if (CommonVariablesDoc.Root.Element("NextUpdateCheckDT").Value == replacedembly.GetExecutingreplacedembly().GetName().Version.ToString())
                        {
                            Game.LogTrivial("Albo1125.Common update checking has been disabled. Skipping checks.");
                            Game.LogTrivial("Albo1125.Common note: please do not request support for old versions.");
                            return;
                        }
                        DateTime UpdateCheckDT = DateTime.FromBinary(long.Parse(CommonVariablesDoc.Root.Element("NextUpdateCheckDT").Value));
                        if (DateTime.Now < UpdateCheckDT)
                        {

                            Game.LogTrivial("Albo1125.Common " + replacedembly.GetExecutingreplacedembly().GetName().Version.ToString() + ", developed by Albo1125. Not checking for updates until " + UpdateCheckDT.ToString());
                            return;
                        }
                    }
                    catch (Exception e) { Game.LogTrivial(e.ToString()); Game.LogTrivial("Albo1125.Common handled exception. #1"); }

                }

                
                DateTime NextUpdateCheckDT = DateTime.Now.AddDays(1);
                if (CommonVariablesDoc.Root.Element("NextUpdateCheckDT") == null) { CommonVariablesDoc.Root.Add(new XElement("NextUpdateCheckDT")); }
                CommonVariablesDoc.Root.Element("NextUpdateCheckDT").Value = NextUpdateCheckDT.ToBinary().ToString();
                CommonVariablesDoc.Save("Albo1125.Common/CommonVariables.xml");
                CommonVariablesDoc = null;
                GameFiber.StartNew(delegate
                {


                    GetUpdateNodes();
                    foreach (UpdateEntry entry in AllUpdateEntries.ToArray())
                    {
                        CheckForModificationUpdates(entry.Name, new Version(FileVersionInfo.GetVersionInfo(entry.Path).FileVersion), entry.FileID, entry.DownloadLink);
                    }
                    if (PluginsDownloadLink.Count > 0) { DisplayUpdates(); }
                    Game.LogTrivial("Albo1125.Common " + replacedembly.GetExecutingreplacedembly().GetName().Version.ToString() + ", developed by Albo1125. Update checks complete.");
                });
            }
            catch (System.Xml.XmlException e)
            {
                Game.LogTrivial(e.ToString());
                Game.DisplayNotification("Error while processing XML files. To fix this, please delete the following folder and its contents: Grand Theft Auto V/Albo1125.Common");
                Albo1125.Common.CommonLibrary.ExtensionMethods.DisplayPopupTextBoxWithConfirmation("Albo1125.Common", "Error while processing XML files. To fix this, please delete the following folder and its contents: Grand Theft Auto V/Albo1125.Common", false);
                throw e;
            }

            



        }

19 Source : Main.cs
with GNU General Public License v3.0
from Albo1125

public override void Initialize()
        {
            //Event handler for detecting if the player goes on duty
            Game.LogTrivial("Arrest Manager " + replacedembly.GetExecutingreplacedembly().GetName().Version.ToString() + ", developed by Albo1125, loaded successfully!");
            
            Game.LogTrivial("Please go on duty to start Arrest Manager.");

            Functions.OnOnDutyStateChanged += Functions_OnOnDutyStateChanged;

        }

19 Source : UpdateChecker.cs
with GNU General Public License v3.0
from Albo1125

private static void CheckForModificationUpdates(string ModificationName, Version curVersion, string VersionCheckLink, string DownloadLink)
        {
            if (LSPDFRUpdateAPIRunning)
            {
                new UpdateChecker(ModificationName, curVersion, VersionCheckLink, DownloadLink);
                if (!Albo1125CommonCheckedForUpdates)
                {
                    Albo1125CommonCheckedForUpdates = true;
                    new UpdateChecker("Albo1125.Common", replacedembly.GetExecutingreplacedembly().GetName().Version, "10294", "https://www.lcpdfr.com/files/file/10294-albo1125common/");
                }
            }
            else
            {
                Game.LogTrivial("LSPDFR Update API down. Not starting checks.");
            }
        }

19 Source : EntryPoint.cs
with GNU General Public License v3.0
from Albo1125

public static bool IsLSPDFRPluginRunning(string Plugin, Version minversion = null)
        {
            foreach (replacedembly replacedembly in Functions.GetAllUserPlugins())
            {
                replacedemblyName an = replacedembly.GetName(); if (an.Name.ToLower() == Plugin.ToLower())
                {
                    if (minversion == null || an.Version.CompareTo(minversion) >= 0) { return true; }
                }
            }
            return false;
        }

19 Source : EntryPoint.cs
with GNU General Public License v3.0
from Albo1125

public static replacedembly LSPDFRResolveEventHandler(object sender, ResolveEventArgs args) { foreach (replacedembly replacedembly in Functions.GetAllUserPlugins()) { if (args.Name.ToLower().Contains(replacedembly.GetName().Name.ToLower())) { return replacedembly; } } return null; }

19 Source : Main.cs
with GNU General Public License v3.0
from Albo1125

public override void Initialize()
        {
            //Event handler for detecting if the player goes on duty

            Functions.OnOnDutyStateChanged += Functions_OnOnDutyStateChanged;
            Game.LogTrivial("replacedorted Callouts " + replacedembly.GetExecutingreplacedembly().GetName().Version.ToString() +", developed by Albo1125, has been initialised.");
            Game.LogTrivial("Go on duty to start replacedorted Callouts.");


        }

19 Source : LSPDFRPlusHandler.cs
with GNU General Public License v3.0
from Albo1125

public static bool IsLSPDFRPluginRunning(string Plugin, Version minversion = null)
        {
            foreach (replacedembly replacedembly in Functions.GetAllUserPlugins())
            {
                replacedemblyName an = replacedembly.GetName();
                if (an.Name.ToLower() == Plugin.ToLower())
                {
                    if (minversion == null || an.Version.CompareTo(minversion) >= 0) { return true; }
                }
            }
            return false;
        }

19 Source : Functions.cs
with GNU General Public License v3.0
from Albo1125

[Obfuscation(Exclude = false, Feature = "-ref proxy")]
        public static bool AddActionToButton(Action action, string buttonName)
        {
           
            Game.LogTrivial(replacedembly.GetCallingreplacedembly().GetName().Name + " requesting a PoliceSmartRadio action to be added to " + buttonName);
            //Game.LogTrivial("DoneLoading?" + DisplayHandler.DoneLoadingTextures);
            return DisplayHandler.AddActionToButton(action, null, replacedembly.GetCallingreplacedembly().GetName().Name, buttonName);
        }

19 Source : Functions.cs
with GNU General Public License v3.0
from Albo1125

[Obfuscation(Exclude = false, Feature = "-ref proxy")]
        public static bool AddActionToButton(Action action, Func<bool> isAvailable, string buttonName)
        {
            Game.LogTrivial(replacedembly.GetCallingreplacedembly().GetName().Name + " requesting a PoliceSmartRadio action to be added to " + buttonName);
            //Game.LogTrivial("DoneLoading?" + DisplayHandler.DoneLoadingTextures);
            return DisplayHandler.AddActionToButton(action, isAvailable, replacedembly.GetCallingreplacedembly().GetName().Name, buttonName);
        }

19 Source : Main.cs
with GNU General Public License v3.0
from Albo1125

public override void Initialize()
        {
            Game.Console.Print("PoliceSmartRadio " + replacedembly.GetExecutingreplacedembly().GetName().Version.ToString() + ", developed by Albo1125, loaded successfully!");
            Game.Console.Print("Special thanks to FinKone for the inspiration and OfficerSquare for the default UI.");
            Game.Console.Print("Please go on duty to start Police SmartRadio.");

            Functions.OnOnDutyStateChanged += Functions_OnOnDutyStateChanged;
        }

19 Source : Functions.cs
with GNU General Public License v3.0
from Albo1125

public static void SetAutomaticVehicleDeatilsChecksEnabled(bool enabled)
        {
            Game.LogTrivial("Traffic Policer API: replacedembly " + replacedembly.GetCallingreplacedembly().GetName().Name + " setting automatic vehicle details checks to: " + enabled.ToString());
            VehicleDetails.AutomaticDetailsChecksEnabled = enabled;
        }

19 Source : Main.cs
with GNU General Public License v3.0
from Albo1125

public override void Initialize()
        {
            //Event handler for detecting if the player goes on duty

            
            Game.LogTrivial("Traffic Policer " + replacedembly.GetExecutingreplacedembly().GetName().Version.ToString() + ", developed by Albo1125, has been initialised.");
            Game.LogTrivial("Go on duty to start Traffic Policer - Traffic Policer.Initialise done.");
            

        }

19 Source : AutoMapperInitalizer.cs
with MIT License
from albyho

public static void Initialize()
        {
            // TODO: (alby)全局扫描程序集。考虑其他方式。
            var replacedembliesToScan = AppDomain.CurrentDomain.Getreplacedemblies();

            var allTypes = replacedembliesToScan
                .Where(a => a.GetName().Name != nameof(AutoMapper))
                .SelectMany(a => a.DefinedTypes);

            var profileTypeInfo = typeof(Profile).GetTypeInfo();
            var profiles = allTypes
                .Where(t => profileTypeInfo.IsreplacedignableFrom(t) && !t.IsAbstract)
                .Select(t => t.AsType());

            var configuration = new MapperConfiguration(cfg => {
                foreach (var profile in profiles)
                {
                    cfg.AddProfile(profile);
                }
            });
            configuration.CompileMappings();
        }

19 Source : Main.cs
with GNU General Public License v3.0
from Albo1125

public override void Initialize()
        {
            Functions.OnOnDutyStateChanged += Functions_OnOnDutyStateChanged;
            Game.LogTrivial("LSPDFR+ " + replacedembly.GetExecutingreplacedembly().GetName().Version.ToString() + ", developed by Albo1125, has been initialised.");
            Game.LogTrivial("Go on duty to start LSPDFR+.");
            Albo1125.Common.UpdateChecker.VerifyXmlNodeExists(PluginName, FileID, DownloadURL, Path);
            Albo1125.Common.DependencyChecker.RegisterPluginForDependencyChecks(PluginName);

        }

19 Source : Main.cs
with GNU General Public License v3.0
from Albo1125

public static replacedembly ResolvereplacedemblyEventHandler(object sender, ResolveEventArgs args)
        {
            foreach (replacedembly replacedembly in LSPD_First_Response.Mod.API.Functions.GetAllUserPlugins())
            {
                if (args.Name.ToLower().Contains(replacedembly.GetName().Name.ToLower()))
                {
                    return replacedembly;
                }
            }
            return null;
        }

19 Source : Startup.cs
with MIT License
from albyho

public override void Configure(IApplicationBuilder app, IRouteBuilder routes, IServiceProvider serviceProvider)
        {
            app.UseStaticFiles(new StaticFileOptions
            {
                ServeUnknownFileTypes = true,
                DefaultContentType = "application/octet-stream"
            });
            app.UseAuthentication();

            // Hangfire
            // Configure hangfire to use the new JobActivator we defined.
            GlobalConfiguration.Configuration.UseActivator(new AspNetCoreJobActivator(serviceProvider));
            app.UseHangfireDashboard();
            app.UseHangfireServer();

            app.UseCookiePolicy();
            app.UseCors("DefaultPolicy");
            app.UseSession();

            // Swagger
            var swaggerIndexreplacedembly = typeof(HiddenApiDoreplacedentFilter).replacedembly;
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1.0/swagger.json", _environment.ApplicationName + " API v1.0");
                c.DefaultModelsExpandDepth(-1);
                c.IndexStream = () => swaggerIndexreplacedembly.GetManifestResourceStream(swaggerIndexreplacedembly.GetName().Name + ".Tubumu.SwaggerUI.Index.html");
            });
        }

19 Source : Transaction.cs
with MIT License
from AlenToma

protected void InitializeMigration(replacedembly replacedembly = null)
        {
            lock (MigrationLocker)
            {
                if (_tableMigrationCheck[DataBaseTypes])
                    return;
                replacedembly = replacedembly ?? this.GetType().replacedembly;
                IMigrationConfig config;
                if (replacedembly.DefinedTypes.Any(a => typeof(IMigrationConfig).IsreplacedignableFrom(a)))
                    config = Activator.CreateInstance(replacedembly.DefinedTypes.First(a => typeof(IMigrationConfig).IsreplacedignableFrom(a))) as IMigrationConfig;
                else throw new EnreplacedyException($"EnreplacedyWorker.Core could not find IMigrationConfig in the current replacedembly {replacedembly.GetName()}");
                MigrationConfig(config);
            }
        }

19 Source : SwaggerExtension.cs
with MIT License
from alesimoes

private static string GetXmlCommentsFilePath()
        {
            var basePath = PlatformServices.Default.Application.ApplicationBasePath;
            var fileName = $"{typeof(Startup).GetTypeInfo().replacedembly.GetName().Name}.xml";
            return Path.Combine(basePath, fileName);
        }

19 Source : RandomOrgClient.cs
with MIT License
from alexanderkozlenko

private static string CreateUserAgentHeaderValue()
        {
            var packagereplacedembly = replacedembly.GetExecutingreplacedembly();
            var packageName = packagereplacedembly.GetName().Name;
            var productVersionAttribute = packagereplacedembly.GetCustomAttribute<replacedemblyInformationalVersionAttribute>();
            var productVersion = Regex.Match(productVersionAttribute.InformationalVersion, @"^\d+\.\d+", RegexOptions.Singleline).Value;

            return $"{nameof(Anemonis)}/{productVersion} (nuget:{packageName})";
        }

19 Source : AssemblyConfiguration.cs
with MIT License
from alexanderkozlenko

public static replacedemblyConfiguration Load(replacedembly replacedembly, string configuration)
        {
            if (replacedembly is null)
            {
                throw new ArgumentNullException(nameof(replacedembly));
            }
            if (configuration is null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            var configurationFilePath = Path.Combine(Path.GetDirectoryName(replacedembly.Location), $"{replacedembly.GetName().Name}.{configuration}.json");
            var configurationBuilder = new ConfigurationBuilder();

            configurationBuilder.AddJsonFile(configurationFilePath, true, false);

            return new(configurationBuilder.Build());
        }

19 Source : UpdateChecker.cs
with MIT License
from AlexCSDev

public async Task<(bool, string)> IsNewVersionAvailable()
        {
            string[] remoteVersionData = (await _httpClient.GetStringAsync(UpdateUrl)).Split("|");
            string remoteVersion = remoteVersionData[0];
            string message = remoteVersionData.Length > 1 ? remoteVersionData[1] : null;
            Version currentVersion = replacedembly.GetEntryreplacedembly().GetName().Version;
            string currentVersionString = $"{currentVersion.Major}.{currentVersion.Minor}.{currentVersion.Build}.{currentVersion.Revision}";

            return (remoteVersion != currentVersionString, !string.IsNullOrWhiteSpace(message) ? message : null);
        }

19 Source : HelpGenerator.cs
with MIT License
from AlexGhiondea

private static void DisplayShortHelp(TypeArgumentInfo type, IColors colors)
        {
            string exeName = replacedembly.GetEntryreplacedembly()?.GetName()?.Name;
            Colorizer.WriteLine("Usage: ");

            DisplayCommandLine(exeName, type, colors);

            Colorizer.WriteLine(string.Empty);
            string errorFormat = $"For detailed information run '[{colors.replacedemblyNameColor}!{{0}} --help]'.";
            Colorizer.WriteLine(errorFormat, exeName);
        }

19 Source : HelpGenerator.cs
with MIT License
from AlexGhiondea

private static void DisplayDetailedHelp(TypeArgumentInfo type, IColors colors)
        {
            string exeName = replacedembly.GetEntryreplacedembly()?.GetName()?.Name;
            Colorizer.WriteLine("Usage: ");

            foreach (var item in type.ArgumentGroups.Keys)
            {
                DisplayDetailedArgumentHelp(exeName, item, type.ArgumentGroups[item], colors);
            }
        }

19 Source : HelpGenerator.cs
with MIT License
from AlexGhiondea

public static void DisplayHelpForCommmand(string command, ArgumentGroupInfo propertyGroup, IColors colors)
        {
            string exeName = replacedembly.GetEntryreplacedembly()?.GetName()?.Name;
            Colorizer.WriteLine("Usage: ");

            DisplayDetailedArgumentHelp(exeName, command, propertyGroup, colors);
        }

19 Source : CommandLineTests.Negative.cs
with MIT License
from AlexGhiondea

[Trait("Category", "Negative")]
        [Fact]
        public void TryParseWithLoggingToConsole()
        {
            TestWriter _printer = new TestWriter();
            ParserOptions parserOptions = new ParserOptions() { LogParseErrorToConsole = true };
            IColors color = Parser.ColorScheme.Get();
            OutputColorizer.Colorizer.SetupWriter(_printer);
            bool value = Parser.TryParse("foo", out Options1 options, parserOptions);
            replacedert.False(value);

            Validate(_printer,
                new TextAndColor(color.ErrorColor, "Error"),
                new TextAndColor(_printer.ForegroundColor, $": Not all required arguments have been specified {Environment.NewLine}"),
                new TextAndColor(_printer.ForegroundColor, "Usage: "),
                new TextAndColor(_printer.ForegroundColor, " "),
                new TextAndColor(color.replacedemblyNameColor, $"{replacedembly.GetEntryreplacedembly()?.GetName()?.Name}.exe"),
                new TextAndColor(_printer.ForegroundColor, " "),
                new TextAndColor(color.RequiredArgumentColor, "p1"),
                new TextAndColor(_printer.ForegroundColor, " "),
                new TextAndColor(color.RequiredArgumentColor, "p2"),
                new TextAndColor(_printer.ForegroundColor, " "),
                new TextAndColor(_printer.ForegroundColor, "[-"),
                new TextAndColor(color.OptionalArgumentColor, "opt1"),
                new TextAndColor(_printer.ForegroundColor, " value] "),
                new TextAndColor(_printer.ForegroundColor, "[-"),
                new TextAndColor(color.OptionalArgumentColor, "opt2"),
                new TextAndColor(_printer.ForegroundColor, " value] "),
                new TextAndColor(_printer.ForegroundColor, "[-"),
                new TextAndColor(color.OptionalArgumentColor, "opt3"),
                new TextAndColor(_printer.ForegroundColor, " value] "),
                new TextAndColor(_printer.ForegroundColor, "[-"),
                new TextAndColor(color.OptionalArgumentColor, "opt4"),
                new TextAndColor(_printer.ForegroundColor, " value] "),
                new TextAndColor(_printer.ForegroundColor, "For detailed information run '"),
                new TextAndColor(color.replacedemblyNameColor, "testhost --help"),
                new TextAndColor(_printer.ForegroundColor, "'.")
            );
        }

See More Examples