Skip to content

Instantly share code, notes, and snippets.

View SharePointX's full-sized avatar
💭
Building

Tatsuki Yamamoto SharePointX

💭
Building
View GitHub Profile
@SharePointX
SharePointX / ConfigReload.cs
Created April 28, 2022 01:29 — forked from Saanch/ConfigReload.cs
Updating config value from the db at application initialization
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
IDictionary<string, string> staticAppSettings = ConfigService.GetStaticAppSettings();
foreach (var setting in staticAppSettings)
{
if (ConfigurationManager.AppSettings[setting.Key] == null)
config.AppSettings.Settings.Add(setting.Key, setting.Value);
else
ConfigurationManager.AppSettings[setting.Key] = setting.Value;
$webclient = New-Object System.Net.WebClient
$url = "https://github.com/MyTwitter/MyTwitter/archive/master.zip"
Write-Host "Downloading latest version of MyTwitter from $url" -ForegroundColor Cyan
$file = "$($env:TEMP)\MyTwitter.zip"
$webclient.DownloadFile($url,$file)
Write-Host "File saved to $file" -ForegroundColor Green
$targetondisk = $env:PSModulePath.Split(";")[0]
New-Item -ItemType Directory -Force -Path $targetondisk | out-null
$shell_app=new-object -com shell.application
$zip_file = $shell_app.namespace($file)