-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5504a50
Showing
5 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Everything is text unless it isn’t | ||
* text=auto | ||
|
||
# This is really text | ||
*.cs text | ||
*.xaml text | ||
|
||
# This is Windows-specific and should always have CRLF | ||
*.sln text eol=crlf | ||
*.csproj text eol=crlf | ||
*.resx text eol=crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.vs/ | ||
*.v12.suo | ||
*.VC.db | ||
*.VC.opendb | ||
*.vcxproj.user | ||
*.csproj.user | ||
|
||
bin/ | ||
obj/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using chocolatey; | ||
using chocolatey.infrastructure.logging; | ||
using System; | ||
using System.Diagnostics; | ||
using System.Reflection; | ||
using System.Security.Principal; | ||
|
||
namespace install_chocolatey | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
// If not running with elevated privileges, try to acquire them | ||
var identity = WindowsIdentity.GetCurrent(); | ||
var principal = new WindowsPrincipal(identity); | ||
if (!principal.IsInRole(WindowsBuiltInRole.Administrator)) | ||
{ | ||
Process p = new Process(); | ||
p.StartInfo.FileName = Assembly.GetExecutingAssembly().Location; | ||
p.StartInfo.Verb = "runas"; // elevated privileges | ||
p.StartInfo.UseShellExecute = true; | ||
try | ||
{ | ||
p.Start(); | ||
return; | ||
} | ||
catch | ||
{ | ||
Console.WriteLine("Error: must be run as administrator"); | ||
} | ||
} | ||
else | ||
{ | ||
// Set this environment variable to a sensible default value, otherwise chocolatey.lib will use the executable location | ||
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ChocolateyInstall"))) | ||
Environment.SetEnvironmentVariable("ChocolateyInstall", @"C:\ProgramData\chocolatey"); | ||
|
||
var choco = Lets.GetChocolatey(); | ||
choco.SetCustomLogging(new NullLog()); | ||
|
||
choco.Set(conf => conf.CommandName = "upgrade"); | ||
choco.RunConsole(new string[] { "-y", "--force", "chocolatey" }); | ||
choco.RunConsole(new string[] { "-y", "--force", "chocolatey-gui" }); | ||
|
||
Console.Write("\n\nSetup was successful. Press any key to quit.\n"); | ||
} | ||
|
||
Console.ReadKey(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<ProjectGuid>{E0F8D1D0-B649-476B-860A-3D17D42475F9}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>install_chocolatey</RootNamespace> | ||
<TargetFramework>net48</TargetFramework> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<AssemblyTitle>install-chocolatey</AssemblyTitle> | ||
<Product>install-chocolatey</Product> | ||
<Copyright>Copyright © 2021</Copyright> | ||
<OutputPath>bin\$(Configuration)\</OutputPath> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugType>full</DebugType> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Net.Http" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="chocolatey.lib" Version="0.11.2" /> | ||
<PackageReference Include="GitVersion.MsBuild" Version="5.7.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="log4net" Version="2.0.12" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.31729.503 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "install-chocolatey", "install-chocolatey.csproj", "{E0F8D1D0-B649-476B-860A-3D17D42475F9}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{E0F8D1D0-B649-476B-860A-3D17D42475F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E0F8D1D0-B649-476B-860A-3D17D42475F9}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E0F8D1D0-B649-476B-860A-3D17D42475F9}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E0F8D1D0-B649-476B-860A-3D17D42475F9}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {040DE2E6-CBBE-43EC-88EB-2B64390F9752} | ||
EndGlobalSection | ||
EndGlobal |