public static IWebHost BuildWebHost(ILogger serilog) { // SSL gRPC var caCrt = File.ReadAllText(EnvVars.CaCrtPath()); var sslCredentials = new SslCredentials(caCrt); var membershipManagerGrpcChannel = new Channel( EnvVars.Target(@"MembershipManagerHost", @"MembershipManagerPort"), sslCredentials); // Create MagicOnion dynamic client proxy var membershipManagerGrpcClient = TrackingProxy.Create <IMembershipManagerGrpc>(membershipManagerGrpcChannel); var membershipManager = LogProxy.Create <IMembershipManager>(new MembershipManagerClient(membershipManagerGrpcClient), serilog, LogType.All); var restApiLogger = serilog; return(new WebHostBuilder() .UseKestrel(options => { options.Listen( IPAddress.Any, EnvVars.LocalPort(@"RestApiPort"), listenOptions => listenOptions.UseHttps(EnvVars.ServerPfxPath(), EnvVars.CrtPassword())); }) .ConfigureServices( services => services .AddSingleton <IMembershipManager>(membershipManager) .AddSingleton <ILogger>(serilog)) .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup <Startup>() .Build()); }
private static void Register() { Serilog.ILogger serilog = new LoggerConfiguration() .Enrich.FromLogProxy() .Destructure.UsingAttributes() .WriteTo.Seq(EnvVars.SeqAddress()) .CreateLogger(); Log.Logger = serilog; var builder = new ContainerBuilder(); // SSL gRPC var caCrt = File.ReadAllText(EnvVars.CaCrtPath()); var sslCredentials = new SslCredentials(caCrt); var registrationEngineGrpcChannel = new Channel( EnvVars.Target(@"RegistrationEngineHost", @"RegistrationEnginePort"), sslCredentials); // Create MagicOnion dynamic client proxy var registrationEngineGrpcClient = TrackingProxy.Create <IRegistrationEngineGrpc>(registrationEngineGrpcChannel); var registrationEngine = LogProxy.Create <IRegistrationEngine>(new RegistrationEngineClient(registrationEngineGrpcClient), serilog, LogType.All); builder.RegisterInstance <Serilog.ILogger>(serilog); builder.RegisterInstance <IRegistrationEngine>(registrationEngine); builder.RegisterType <MembershipManager>().As <IMembershipManager>(); IContainer container = builder.Build(); // Set up the service locator ServiceLocator.SetLocatorProvider(() => new AutofacServiceLocator(container)); GrpcEnvironment.SetLogger(new ConsoleLogger()); }
/// <summary> /// The main entrypoint of BepInEx, called from Doorstop. /// </summary> /// <param name="args"> /// The arguments passed in from Doorstop. First argument is the path of the currently executing /// process. /// </param> public static void Main(string[] args) { // We set it to the current directory first as a fallback, but try to use the same location as the .exe file. var silentExceptionLog = $"preloader_{DateTime.Now:yyyyMMdd_HHmmss_fff}.log"; Mutex mutex = null; try { EnvVars.LoadVars(); silentExceptionLog = Path.Combine(Path.GetDirectoryName(EnvVars.DOORSTOP_PROCESS_PATH), silentExceptionLog); // Get the path of this DLL via Doorstop env var because Assembly.Location mangles non-ASCII characters on some versions of Mono for unknown reasons preloaderPath = Path.GetDirectoryName(Path.GetFullPath(EnvVars.DOORSTOP_INVOKE_DLL_PATH)); mutex = new Mutex(false, Process.GetCurrentProcess().ProcessName + EnvVars.DOORSTOP_PROCESS_PATH + typeof(DoorstopEntrypoint).FullName); mutex.WaitOne(); AppDomain.CurrentDomain.AssemblyResolve += ResolveCurrentDirectory; UnityPreloaderRunner.PreloaderMain(args); } catch (Exception ex) { File.WriteAllText(silentExceptionLog, ex.ToString()); } finally { mutex?.ReleaseMutex(); } }
public static BuildTargetResult PublishDotnetDebToolPackage(BuildTargetContext c) { string nugetFeedUrl = EnvVars.EnsureVariable("CLI_NUGET_FEED_URL"); string apiKey = EnvVars.EnsureVariable("CLI_NUGET_API_KEY"); NuGetUtil.PushPackages(Dirs.Packages, nugetFeedUrl, apiKey); return(c.Success()); }
public DbHelper(EnvVars envVars) { _connStr = BuildConnStr( envVars.PostgresqlHost, envVars.PostgresqlUsername, envVars.PostgresqlPassword, envVars.PostgresqlDbName ); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); Directory.CreateDirectory("data"); EnvVars.SetDefaultValue(EnvVarKeys.DbUri, "data source=data/main.db"); services.AddOperationFactory() .AddDbOperation <SqliteDbConnectionFactory, SqliteDialect>() .AddScopedOperationLogger <OperationLogger>(); }
static void Main(string[] args) { ILogger serilog = new LoggerConfiguration() .Enrich.FromLogProxy() .Destructure.UsingAttributes() .WriteTo.Seq(EnvVars.SeqAddress()) .CreateLogger(); Log.Logger = serilog; BuildWebHost(serilog).Run(); }
public bool Equals(EstafetteStage other) { if (ReferenceEquals(other, null)) { return(false); } if (ReferenceEquals(other, this)) { return(true); } if (Name != other.Name) { return(false); } if (ContainerImage != other.ContainerImage) { return(false); } if (Shell != other.Shell) { return(false); } if (WorkingDirectory != other.WorkingDirectory) { return(false); } if (!commands_.Equals(other.commands_)) { return(false); } if (When != other.When) { return(false); } if (!EnvVars.Equals(other.EnvVars)) { return(false); } if (AutoInjected != other.AutoInjected) { return(false); } if (Retries != other.Retries) { return(false); } if (!CustomProperties.Equals(other.CustomProperties)) { return(false); } return(Equals(_unknownFields, other._unknownFields)); }
public void InitHooks() { Utility.Utility.LoadLibrary("blue.dll"); Utility.Utility.LoadLibrary("python27.dll"); Utility.Utility.LoadLibrary("WS2_32.dll"); Utility.Utility.LoadLibrary("kernel32.dll"); Utility.Utility.LoadLibrary("advapi32.dll"); Utility.Utility.LoadLibrary("Iphlpapi.dll"); Utility.Utility.LoadLibrary("dbghelp.dll"); Utility.Utility.LoadLibrary("_ctypes.pyd"); //Utility.Utility.LoadLibrary("d3d11.dll"); Utility.Utility.LoadLibrary("d3d9.dll"); //[DllImport("d3d9.dll")] if (UseAdaptEve) // adapteve { EnvVars.SetEnvironment(HWSettings); string[] proxyIpPort = HWSettings.ProxyIP.Split(':'); AddController(new WinSockConnectController(LocalHook.GetProcAddress("WS2_32.dll", "connect"), proxyIpPort[0], proxyIpPort[1], HWSettings.ProxyUsername, HWSettings.ProxyPassword)); AddController(new RegQueryValueExAController(LocalHook.GetProcAddress("advapi32.dll", "RegQueryValueExA"), HWSettings.WindowsKey)); AddController(new GlobalMemoryStatusController(LocalHook.GetProcAddress("kernel32.dll", "GlobalMemoryStatusEx"), HWSettings.TotalPhysRam)); AddController(new GetAdaptersInfoController(LocalHook.GetProcAddress("Iphlpapi.dll", "GetAdaptersInfo"), HWSettings.NetworkAdapterGuid, HWSettings.MacAddress, HWSettings.NetworkAddress)); AddController(new DX9Controller(HWSettings)); } //AddController(new Win32Hooks.CryptHashDataController(LocalHook.GetProcAddress("advapi32.dll", "CryptHashData"))); AddController(new Win32Hooks.IsDebuggerPresentController()); AddController(new Win32Hooks.LoadLibraryAController()); AddController(new Win32Hooks.LoadLibraryWController()); AddController(new Win32Hooks.GetModuleHandleWController()); AddController(new Win32Hooks.GetModuleHandleAController()); AddController(new Win32Hooks.EnumProcessesController()); AddController(new Win32Hooks.MiniWriteDumpController()); AddController(new Win32Hooks.CreateFileWController()); AddController(new Win32Hooks.CreateFileAController()); if (!EverythingHooked()) { MessageBox.Show("Hook error"); Environment.Exit(0); Environment.FailFast("exit"); } Win32Hooks.HookManager.Log("-----------Hooks initialized-----------"); }
public static BuildTargetResult PublishDotnetDebToolPackage(BuildTargetContext c) { string apiKey = EnvVars.EnsureVariable("CLI_NUGET_API_KEY"); string nugetFeedUrl = EnvVars.EnsureVariable("CLI_NUGET_FEED_URL"); NuGetUtil.PushPackages(Dirs.Packages, nugetFeedUrl, apiKey, NuGetUtil.NuGetIncludePackageType.Standard); if (IncludeSymbolPackages) { string symbolsNugetFeedUrl = EnvVars.EnsureVariable("CLI_NUGET_SYMBOLS_FEED_URL"); NuGetUtil.PushPackages(Dirs.Packages, symbolsNugetFeedUrl, apiKey, NuGetUtil.NuGetIncludePackageType.Symbols); } return(c.Success()); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers() .AddMeteorJsonConverters(); Directory.CreateDirectory("data"); EnvVars.SetDefaultValue(EnvVarKeys.DbUri, "Data Source=data/main.db"); services.AddSingleton <IDbConnectionFactory, SqliteDbConnectionFactory>(); services.AddScoped <LazyDbConnection>(); using var lazyDbConnection = new LazyDbConnection(new SqliteDbConnectionFactory()); new CreateDatabase(lazyDbConnection).ExecuteAsync().Wait(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "Distributor API", Version = "v1" }); }); services.AddCors(x => x .AddDefaultPolicy(y => y .AllowAnyOrigin() .AllowAnyHeader() .AllowAnyMethod())); services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => { options.Authority = "https://id.skyth.ir"; options.RequireHttpsMetadata = true; options.TokenValidationParameters = new TokenValidationParameters { RoleClaimType = "role", ValidateIssuer = true, ValidateLifetime = true, ValidAudiences = new[] { "mahak.dist" } }; }); services.AddAuthorization(options => { options.AddPolicy("Admin", builder => builder.RequireClaim("scope", "mahak.dist")); options.AddPolicy("Distributor", builder => builder.RequireClaim("scope", "mahak.dist.dist")); }); }
static void Main(string[] args) { Serilog.ILogger serilog = new LoggerConfiguration() .Enrich.FromLogProxy() .Enrich.WithProcessId() .Enrich.WithThreadId() .Destructure.UsingAttributes() .Enrich.WithProperty(nameof(BuildVersion), BuildVersion) .Enrich.WithProperty(nameof(ServiceName), ServiceName) .WriteTo.Console() .WriteTo.Seq(EnvVars.SeqAddress()) .CreateLogger(); Log.Logger = serilog; BuildWebHost(serilog).Run(); }
private EnvVars FindMatchingSet(EnvVars sets, string name) { if (sets.Name == name) { return(sets); } foreach (EnvVars set in sets.EnvVarsCollection) { if (set.Name == name) { return(set); } } return(null); }
private static void PublishCoreHostPackagesToFeed() { var hostBlob = $"{Channel}/Binaries/{SharedFrameworkNugetVersion}"; Directory.CreateDirectory(Dirs.PackagesNoRID); AzurePublisherTool.DownloadFilesWithExtension(hostBlob, ".nupkg", Dirs.PackagesNoRID); string nugetFeedUrl = EnvVars.EnsureVariable("NUGET_FEED_URL"); string apiKey = EnvVars.EnsureVariable("NUGET_API_KEY"); NuGetUtil.PushPackages(Dirs.PackagesNoRID, nugetFeedUrl, apiKey); string githubAuthToken = EnvVars.EnsureVariable("GITHUB_PASSWORD"); VersionRepoUpdater repoUpdater = new VersionRepoUpdater(githubAuthToken); repoUpdater.UpdatePublishedVersions(Dirs.PackagesNoRID, $"build-info/dotnet/core-setup/{BranchName}/Latest").Wait(); }
private static void RunHost() { MagicOnionServiceDefinition service = MagicOnionEngine.BuildServerServiceDefinition( new[] { typeof(UserAccessGrpc) }, new MagicOnionOptions(isReturnExceptionStackTraceInErrorDetail: true)); // SSL gRPC string caCrt = File.ReadAllText(EnvVars.CaCrtPath()); string serverCrt = File.ReadAllText(EnvVars.ServerCrtPath()); string serverKey = File.ReadAllText(EnvVars.ServerKeyPath()); var keyPair = new KeyCertificatePair(serverCrt, serverKey); var sslCredentials = new SslServerCredentials(new List <KeyCertificatePair>() { keyPair }, caCrt, false); int localPort = EnvVars.LocalPort(@"UserAccessPort"); var server = new global::Grpc.Core.Server { Services = { service }, Ports = { new ServerPort("0.0.0.0", localPort, sslCredentials) } }; // launch gRPC Server. server.Start(); Log.Information($"Server listening on port {localPort}"); var cts = new CancellationTokenSource(); var syncTask = new TaskCompletionSource <bool>(); System.Runtime.Loader.AssemblyLoadContext.Default.Unloading += (context) => { Log.Information("Greeter server received kill signal..."); cts.Cancel(); server.ShutdownAsync().Wait(); syncTask.SetResult(true); }; syncTask.Task.Wait(-1); Log.Information("Greeter server stopped"); }
private static void Register() { Serilog.ILogger serilog = new LoggerConfiguration() .Enrich.FromLogProxy() .Destructure.UsingAttributes() .WriteTo.Seq(EnvVars.SeqAddress()) .CreateLogger(); Log.Logger = serilog; var builder = new ContainerBuilder(); builder.RegisterInstance <Serilog.ILogger>(serilog); builder.RegisterType <UserAccess>().As <IUserAccess>(); IContainer container = builder.Build(); // Set up the service locator ServiceLocator.SetLocatorProvider(() => new AutofacServiceLocator(container)); GrpcEnvironment.SetLogger(new ConsoleLogger()); }
public override int GetHashCode() { int hash = 1; if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (ContainerImage.Length != 0) { hash ^= ContainerImage.GetHashCode(); } if (Shell.Length != 0) { hash ^= Shell.GetHashCode(); } if (WorkingDirectory.Length != 0) { hash ^= WorkingDirectory.GetHashCode(); } hash ^= commands_.GetHashCode(); if (When.Length != 0) { hash ^= When.GetHashCode(); } hash ^= EnvVars.GetHashCode(); if (AutoInjected != false) { hash ^= AutoInjected.GetHashCode(); } if (Retries != 0L) { hash ^= Retries.GetHashCode(); } hash ^= CustomProperties.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private void AddEnvVarCollection(object owner, EnvVars varSet) { object setOwner = AddConditional(owner, varSet.Conditional); foreach (EnvVar var in varSet.EnvVarCollection) { object varOwner = AddConditional(setOwner, var.Conditional); List <Set> list = GetCollectionFromObject(varOwner, typeof(List <Set>)) as List <Set>; Set env = new Set(); env.Name = var.Name; env.Value = var.Value; list.Add(env); } foreach (EnvVars set in varSet.EnvVarsCollection) { AddEnvVarCollection(setOwner, set); } }
public static EnvVars GetSettings() { EnvVars envVars = new EnvVars(); try{ //TODO - log begin work String[] files = Directory.GetFiles(@"H:\\EDI", "*.brl", SearchOption.AllDirectories); if (files.Length > 0) { var mail_server1 = ConfigurationManager.AppSettings.Get("mail_server"); var mail_from_address1 = ConfigurationManager.AppSettings.Get("mail_from_address"); var mail_address1 = ConfigurationManager.AppSettings.Get("mail_address"); MailMessage mm = new MailMessage(mail_from_address1, mail_address1); mm.Body = ConfigurationManager.AppSettings.Get("body"); mm.Subject = ConfigurationManager.AppSettings.Get("subject"); mm.IsBodyHtml = true; int leng = files.Length; for (int i = 0; i < files.Length; i++) { String sep = " | "; String Body1 = String.Join(sep, files, 0, leng); mm.Body = Body1; } SmtpClient client = new SmtpClient(mail_server1); client.Send(mm); } } catch (Exception e) { //TODO - log exception } finally { return envVars; } }
public static IServiceCollection AddMeteorJwtAuthentication(this IServiceCollection services, bool validateAudience = false, bool validateIssuer = false, bool validateActor = false) { services.AddAuthentication(options => { options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { ValidateAudience = validateAudience, ValidateIssuer = validateIssuer, ValidateActor = validateActor, ValidateLifetime = true, IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(EnvVars.Require <string>(EnvVarKeys.JwtKey))), ValidateIssuerSigningKey = true }; options.Events = new JwtBearerEvents() { OnAuthenticationFailed = context => { Log.Debug(context.Exception, "authentication failed"); return(Task.CompletedTask); } }; }); return(services); }
// EnvVars is setup for DI. See Startup#ConfigureServices public AppNameController(EnvVars envVars) { _envVars = envVars; }
public void InitHooks() { Utility.Util.LoadLibrary("blue.dll"); Utility.Util.LoadLibrary("python27.dll"); Utility.Util.LoadLibrary("WS2_32.dll"); Utility.Util.LoadLibrary("kernel32.dll"); Utility.Util.LoadLibrary("advapi32.dll"); Utility.Util.LoadLibrary("Iphlpapi.dll"); Utility.Util.LoadLibrary("dbghelp.dll"); Utility.Util.LoadLibrary("_ctypes.pyd"); if (this.EveAccount.DX11) { Utility.Util.LoadLibrary("d3d11.dll"); } else { Utility.Util.LoadLibrary("d3d9.dll"); } Utility.Util.CheckCreateDirectorys(EveAccount.HWSettings.WindowsUserLogin); _controllerList.Add(new SHGetFolderPathAController(this.EveAccount.GetPersonalFolder(), this.EveAccount.GetAppDataFolder())); _controllerList.Add(new SHGetFolderPathWController(this.EveAccount.GetPersonalFolder(), this.EveAccount.GetAppDataFolder())); if (EveAccount.UseAdaptEve) // adapteve { EnvVars.SetEnvironment(EveAccount.HWSettings); //ip:port if (!string.IsNullOrEmpty(EveAccount.HWSettings.ProxyIP) && !EveAccount.HWSettings.ProxyIP.Equals("ip:port")) { string[] proxyIpPort = EveAccount.HWSettings.ProxyIP.Split(':'); AddController(new WinSockConnectController(LocalHook.GetProcAddress("WS2_32.dll", "connect"), proxyIpPort[0], proxyIpPort[1], EveAccount.HWSettings.ProxyUsername, EveAccount.HWSettings.ProxyPassword)); } AddController(new RegQueryValueExAController(LocalHook.GetProcAddress("advapi32.dll", "RegQueryValueExA"), EveAccount.HWSettings.WindowsKey)); AddController(new GlobalMemoryStatusController(LocalHook.GetProcAddress("kernel32.dll", "GlobalMemoryStatusEx"), EveAccount.HWSettings.TotalPhysRam)); AddController(new GetAdaptersInfoController(LocalHook.GetProcAddress("Iphlpapi.dll", "GetAdaptersInfo"), EveAccount.HWSettings.NetworkAdapterGuid, EveAccount.HWSettings.MacAddress, EveAccount.HWSettings.NetworkAddress)); if (this.EveAccount.DX11) { } else { AddController(new DX9Controller(EveAccount.HWSettings)); } AddController(new Win32Hooks.InternetConnectAController()); AddController(new Win32Hooks.InternetConnectWController()); } AddController(new Win32Hooks.IsDebuggerPresentController()); AddController(new Win32Hooks.LoadLibraryAController()); AddController(new Win32Hooks.LoadLibraryWController()); AddController(new Win32Hooks.GetModuleHandleWController()); AddController(new Win32Hooks.GetModuleHandleAController()); AddController(new Win32Hooks.EnumProcessesController()); AddController(new Win32Hooks.MiniWriteDumpController()); AddController(new Win32Hooks.CreateFileWController()); AddController(new Win32Hooks.CreateFileAController()); if (!EverythingHooked()) { MessageBox.Show("Hook error"); Environment.Exit(0); Environment.FailFast("exit"); } string hooksInit = "Charname: " + this.CharName + " -----------Hooks initialized-----------"; Win32Hooks.HookManager.Log(hooksInit); WCFClient.Instance.GetPipeProxy.SendToInjectorLog(hooksInit); }
private MemberPrecidence LoadScatterElements(object owner, object conditional, List <MemoryMap> maps, ArrayList conditionalStack) { MemberPrecidence ret = MemberPrecidence.Unknown; List <If> ifs = GetCollectionFromObject(conditional, typeof(List <If>)) as List <If>; if (ifs != null && ifs.Count > 0) { LoadScatterConditional(owner, ifs, maps, conditionalStack); } List <IfDefined> ifdefs = GetCollectionFromObject(conditional, typeof(List <IfDefined>)) as List <IfDefined>; if (ifdefs != null) { LoadScatterConditional(owner, ifdefs, maps, conditionalStack); } List <IfNotDefined> ifndefs = GetCollectionFromObject(conditional, typeof(List <IfNotDefined>)) as List <IfNotDefined>; if (ifndefs != null) { LoadScatterConditional(owner, ifndefs, maps, conditionalStack); } List <LoadRegion> lrCollection = GetCollectionFromObject(conditional, typeof(List <LoadRegion>)) as List <LoadRegion>; if (lrCollection != null && lrCollection.Count > 0) { List <MemoryRegion> regionSet = GetCollectionFromObject(owner, typeof(List <MemoryRegion>)) as List <MemoryRegion>; ret = MemberPrecidence.LoadRegion; foreach (LoadRegion lr in lrCollection) { MemoryRegion region = new MemoryRegion(); region.Name = lr.Name; region.Address = lr.Base; region.Options = lr.Options; region.Size = lr.Size; // region.Order = regionSet.Count; region.Conditional = GetConditionalValue(conditional); regionSet.Add(region); ret = LoadScatterElements(region, lr, maps, conditionalStack); } } List <ExecRegion> erCollection = GetCollectionFromObject(conditional, typeof(List <ExecRegion>)) as List <ExecRegion>; if (erCollection != null && erCollection.Count > 0) { List <MemorySection> sectionSet = GetCollectionFromObject(owner, typeof(List <MemorySection>)) as List <MemorySection>; ret = MemberPrecidence.ExecRegion; foreach (ExecRegion er in erCollection) { MemorySection section = new MemorySection(); section.Name = er.Name; section.Address = er.Base; section.Options = er.Options; section.Size = er.Size; section.Order = (int)m_execRegionOrderMap[(owner as MemoryRegion).Name + ":" + er.Name]; section.Conditional = GetConditionalValue(conditional); sectionSet.Add(section); ret = LoadScatterElements(section, er, maps, conditionalStack); } } List <FileMapping> fileCollection = GetCollectionFromObject(conditional, typeof(List <FileMapping>)) as List <FileMapping>; if (fileCollection != null && fileCollection.Count > 0) { List <MemorySymbol> symSet = GetCollectionFromObject(owner, typeof(List <MemorySymbol>)) as List <MemorySymbol>; ret = MemberPrecidence.FileMapping; foreach (FileMapping fm in fileCollection) { MemorySymbol sym = new MemorySymbol(); sym.Name = fm.Name; sym.Options = fm.Options; sym.Conditional = GetConditionalValue(conditional); symSet.Add(sym); } } List <Set> setCollection = GetCollectionFromObject(conditional, typeof(List <Set>)) as List <Set>; if (setCollection != null && setCollection.Count > 0) { EnvVars envSets = GetObjectFromProperty(owner, typeof(EnvVars)) as EnvVars; if (ret < MemberPrecidence.SetMember) { ret = MemberPrecidence.SetMember; } EnvVars envSet = null; // conditional belongs to the map if we have a load region in this conditional if (conditionalStack.Count == 0) { envSet = FindMatchingSet(envSets, "Global"); if (envSet == null) { envSet = new EnvVars(); envSet.Name = "Global"; envSets.EnvVarsCollection.Add(envSet); } } else { for (int i = 0; i < conditionalStack.Count; i++) { object cond = conditionalStack[i]; if (i == (conditionalStack.Count - 1) && owner is MemoryMap && ret >= MemberPrecidence.LoadRegion) { ((MemoryMap)owner).Name = GetConditionalName(conditional); ((MemoryMap)owner).Conditional = GetConditionalValue(conditional); } else { string name = GetConditionalName(cond); string value = GetConditionalValue(cond); name += "_" + value.Replace(" ", "_").Replace("\"", ""); envSet = FindMatchingSet(envSets, name); if (envSet == null) { envSet = new EnvVars(); envSet.Name = name; envSet.Conditional = value; envSets.EnvVarsCollection.Add(envSet); } //envSets = envSet.EnvVarsCollection; } } } if ((int)ret < (int)MemberPrecidence.SetMember) { ret = MemberPrecidence.SetMember; } foreach (Set set in GetCollectionFromObject(conditional, typeof(List <Set>))) { EnvVar var = new EnvVar(); var.Name = set.Name; var.Value = set.Value; envSet.EnvVarCollection.Add(var); } } return(ret); }