public Main() { InitializeComponent(); Instance = this; ConfigMan = new ConfigMan(); tManager = Tabs.Manager.Instance; lManager = Logs.Manager.Instance; xMan = XmlManager.Instance; check_first_start(); generate_new_list(); localize(); }
public Data(string key) { InitializeComponent(); this.key = key; lManager = Logs.Manager.Instance; tManager = Tabs.Manager.Instance; configMan = GUI.Main.Instance.ConfigMan; initializeCore(); gridUtils = new Utilities.Grid(); localize(); }
public DataRebuild() { InitializeComponent(); core = tManager.DataCore; hook_core_events(); dataChart.Series.Add(new Series() { Name = "All Data", ChartType = SeriesChartType.Pie }); dataList.Items[0].Selected = true; configMan = GUI.Main.Instance.ConfigMan; localize(); }
public LogViewer(Logs.Manager lManager) { InitializeComponent(); this.lManager = lManager; configMan = GUI.Main.Instance.ConfigMan; interval = configMan["RefreshInterval", "Log"]; configureViewer(); generate_type_list(); }
/// <summary> /// Initializes the DBHelper based on information stored in the ConfigMan object using the sql engine enumerated by DbConType /// </summary> /// <param name="configManager"></param> /// <param name="type"></param> public DBHelper(ConfigMan configManager, DbConType type) { configMan = configManager; string ip = configMan["IP"]; string name = configMan["WorldName"]; string user = configMan["WorldUser"]; string pass = configMan["WorldPass"]; bool trusted = configMan["Trusted", "DB"]; switch (type) { default: goto case DbConType.MsSQL; case DbConType.MySQL: mySQL_conn = new MySqlConnection($"server={ip};database={name};user={user};password={pass}"); mySQL_cmd = new MySqlCommand() { Connection = mySQL_conn }; break; case DbConType.MsSQL: string connStr = $"Server={ip};Database={name};"; if (trusted) { connStr += "Trusted_Connection=true;"; } else { connStr += $"User ID={user};Password={pass}"; } msSQL_conn = new SqlConnection(connStr); msSQL_cmd = new SqlCommand() { Connection = msSQL_conn }; break; } }
public void ConfigureServices(IServiceCollection services) { ConfigMan configMan = new ConfigMan(_configuration); services.AddDbContext <DataContext>(options => options.UseSqlServer(Settings.ConnectionStrings.DataContext)); services.AddDistributedMemoryCache(); services.AddSession(options => { options.IdleTimeout = TimeSpan.FromMinutes(20); options.Cookie.HttpOnly = true; options.Cookie.IsEssential = true; }); if (_currentEnvironment.IsDevelopment()) { services.AddControllersWithViews().AddRazorRuntimeCompilation().AddSessionStateTempDataProvider(); } else { services.AddControllersWithViews().AddSessionStateTempDataProvider(); } services.AddSingleton <IEmailSender, IdentityEmailSender>(); services.AddRazorPages() .AddRazorPagesOptions(options => //locks down following folder and page for only users that are logged in (regardless of Role) { options.Conventions.AuthorizeAreaFolder("Identity", "/Account/Manage"); //folder for managing own identity options.Conventions.AuthorizeAreaPage("Identity", "/Account/Logout"); //page that makes no sense unless logged in }); services.AddAuthorization(options => //setup policy we can use on MVC controllers, actions and razor pages { options.AddPolicy(Settings.Authorization.EditRights, policy => policy.RequireRole(Settings.Authorization.EditRightsRoles)); }); services.AddTransient <UsersFacade>(); }
public void ConfigureServices(IServiceCollection services) { ConfigMan configMan = new ConfigMan(_configuration); services.Configure <ServerConfig>(_configuration); services.AddDbContext <DataContext>( options => { options.UseNpgsql(_configuration.GetConnectionString(ConnectionStringName.DataContext)); } ); // Set up data protection for session cookie/ anti-forgery key var redis = ConnectionMultiplexer.Connect(_configuration.GetConnectionString(ConnectionStringName.Redis)); services.AddDataProtection() .PersistKeysToStackExchangeRedis(redis, RedisDataProtectionKey); services.AddDistributedMemoryCache(); services.AddSession(options => { options.IdleTimeout = TimeSpan.FromMinutes(20); options.Cookie.HttpOnly = true; options.Cookie.IsEssential = true; }); if (_currentEnvironment.IsDevelopment()) { services.AddControllersWithViews().AddRazorRuntimeCompilation().AddSessionStateTempDataProvider(); } else { services.AddControllersWithViews().AddSessionStateTempDataProvider(); } services.AddSingleton <IEmailSender, IdentityEmailSender>(); services.AddContentful(_configuration); services.AddTransient((c) => { var renderer = new HtmlRenderer(); renderer.AddRenderer(new SimpleHyperlinkRenderer() { Order = 10 }); return(renderer); }); services.AddRazorPages() .AddRazorPagesOptions(options => //locks down following folder and page for only users that are logged in (regardless of Role) { options.Conventions.AuthorizeAreaFolder("Identity", "/Account/Manage"); //folder for managing own identity options.Conventions.AuthorizeAreaPage("Identity", "/Account/Logout"); //page that makes no sense unless logged in }); services.AddAuthorization(options => //setup policy we can use on MVC controllers, actions and razor pages { options.AddPolicy(Settings.Authorization.EditRights, policy => policy.RequireRole(Settings.Authorization.EditRightsRoles)); }); services.AddTransient <UsersFacade>(); services.AddScoped <IContentfulService, ContentfulService>(); services.AddHttpClient <PosttagService>(); }