-
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 3631c73
Showing
15 changed files
with
594 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,219 @@ | ||
## Ignore Visual Studio temporary files, build results, and | ||
## files generated by popular Visual Studio add-ons. | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.userosscache | ||
*.sln.docstates | ||
|
||
# User-specific files (MonoDevelop/Xamarin Studio) | ||
*.userprefs | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
x64/ | ||
x86/ | ||
build/ | ||
bld/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
|
||
# Visual Studio 2015 cache/options directory | ||
.vs/ | ||
# Uncomment if you have tasks that create the project's static files in wwwroot | ||
#wwwroot/ | ||
|
||
# MSTest test Results | ||
[Tt]est[Rr]esult*/ | ||
[Bb]uild[Ll]og.* | ||
|
||
# NUNIT | ||
*.VisualState.xml | ||
TestResult.xml | ||
|
||
# Build Results of an ATL Project | ||
[Dd]ebugPS/ | ||
[Rr]eleasePS/ | ||
dlldata.c | ||
|
||
# DNX | ||
project.lock.json | ||
artifacts/ | ||
|
||
*_i.c | ||
*_p.c | ||
*_i.h | ||
*.ilk | ||
*.meta | ||
*.obj | ||
*.pch | ||
*.pdb | ||
*.pgc | ||
*.pgd | ||
*.rsp | ||
*.sbr | ||
*.tlb | ||
*.tli | ||
*.tlh | ||
*.tmp | ||
*.tmp_proj | ||
*.log | ||
*.vspscc | ||
*.vssscc | ||
.builds | ||
*.pidb | ||
*.svclog | ||
*.scc | ||
|
||
# Chutzpah Test files | ||
_Chutzpah* | ||
|
||
# Visual C++ cache files | ||
ipch/ | ||
*.aps | ||
*.ncb | ||
*.opensdf | ||
*.sdf | ||
*.cachefile | ||
|
||
# Visual Studio profiler | ||
*.psess | ||
*.vsp | ||
*.vspx | ||
*.sap | ||
|
||
# TFS 2012 Local Workspace | ||
$tf/ | ||
|
||
# Guidance Automation Toolkit | ||
*.gpState | ||
|
||
# ReSharper is a .NET coding add-in | ||
_ReSharper*/ | ||
*.[Rr]e[Ss]harper | ||
*.DotSettings.user | ||
|
||
# JustCode is a .NET coding add-in | ||
.JustCode | ||
|
||
# TeamCity is a build add-in | ||
_TeamCity* | ||
|
||
# DotCover is a Code Coverage Tool | ||
*.dotCover | ||
|
||
# NCrunch | ||
_NCrunch_* | ||
.*crunch*.local.xml | ||
nCrunchTemp_* | ||
|
||
# MightyMoose | ||
*.mm.* | ||
AutoTest.Net/ | ||
|
||
# Web workbench (sass) | ||
.sass-cache/ | ||
|
||
# Installshield output folder | ||
[Ee]xpress/ | ||
|
||
# DocProject is a documentation generator add-in | ||
DocProject/buildhelp/ | ||
DocProject/Help/*.HxT | ||
DocProject/Help/*.HxC | ||
DocProject/Help/*.hhc | ||
DocProject/Help/*.hhk | ||
DocProject/Help/*.hhp | ||
DocProject/Help/Html2 | ||
DocProject/Help/html | ||
|
||
# Click-Once directory | ||
publish/ | ||
|
||
# Publish Web Output | ||
*.[Pp]ublish.xml | ||
*.azurePubxml | ||
# TODO: Comment the next line if you want to checkin your web deploy settings | ||
# but database connection strings (with potential passwords) will be unencrypted | ||
*.pubxml | ||
*.publishproj | ||
|
||
# NuGet Packages | ||
*.nupkg | ||
# The packages folder can be ignored because of Package Restore | ||
**/packages/* | ||
# except build/, which is used as an MSBuild target. | ||
!**/packages/build/ | ||
# Uncomment if necessary however generally it will be regenerated when needed | ||
#!**/packages/repositories.config | ||
|
||
# Windows Azure Build Output | ||
csx/ | ||
*.build.csdef | ||
|
||
# Windows Store app package directory | ||
AppPackages/ | ||
|
||
# Visual Studio cache files | ||
# files ending in .cache can be ignored | ||
*.[Cc]ache | ||
# but keep track of directories ending in .cache | ||
!*.[Cc]ache/ | ||
|
||
# Others | ||
ClientBin/ | ||
[Ss]tyle[Cc]op.* | ||
~$* | ||
*~ | ||
*.dbmdl | ||
*.dbproj.schemaview | ||
*.pfx | ||
*.publishsettings | ||
node_modules/ | ||
orleans.codegen.cs | ||
|
||
# RIA/Silverlight projects | ||
Generated_Code/ | ||
|
||
# Backup & report files from converting an old project file | ||
# to a newer Visual Studio version. Backup files are not needed, | ||
# because we have git ;-) | ||
_UpgradeReport_Files/ | ||
Backup*/ | ||
UpgradeLog*.XML | ||
UpgradeLog*.htm | ||
|
||
# SQL Server files | ||
*.mdf | ||
*.ldf | ||
|
||
# Business Intelligence projects | ||
*.rdl.data | ||
*.bim.layout | ||
*.bim_*.settings | ||
|
||
# Microsoft Fakes | ||
FakesAssemblies/ | ||
|
||
# Node.js Tools for Visual Studio | ||
.ntvs_analysis.dat | ||
|
||
# Visual Studio 6 build log | ||
*.plg | ||
|
||
# Visual Studio 6 workspace options file | ||
*.opt | ||
|
||
# Visual Studio LightSwitch build output | ||
**/*.HTMLClient/GeneratedArtifacts | ||
**/*.DesktopClient/GeneratedArtifacts | ||
**/*.DesktopClient/ModelManifest.xml | ||
**/*.Server/GeneratedArtifacts | ||
**/*.Server/ModelManifest.xml | ||
_Pvt_Extensions | ||
|
||
target/ |
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,7 @@ | ||
Copyright (c) 2015 segrived | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.24720.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NSISInfoWriter", "NSISInfoWriter\NSISInfoWriter.csproj", "{4D38F522-60B2-493B-83DF-32FF96B515B6}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{4D38F522-60B2-493B-83DF-32FF96B515B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{4D38F522-60B2-493B-83DF-32FF96B515B6}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{4D38F522-60B2-493B-83DF-32FF96B515B6}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{4D38F522-60B2-493B-83DF-32FF96B515B6}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/> | ||
</startup> | ||
</configuration> |
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,22 @@ | ||
using CommandLine; | ||
|
||
namespace NSISInfoWriter | ||
{ | ||
public class CLIOptions | ||
{ | ||
[Option('i', "input", Required = true, HelpText = "Input executable file")] | ||
public string InputFile { get; set; } | ||
[Option('o', "output", Required = true, HelpText = "Output file")] | ||
public string OutputFile { get; set; } | ||
[Option('g', "ex-git", Default = false, HelpText = "Exclude git related information into output")] | ||
public bool ExcludeGit { get; set; } | ||
[Option('c', "ex-common", Default = false, HelpText = "Exclude common file information into output (size, name, etc.)")] | ||
public bool ExcludeCommon { get; set; } | ||
[Option('v', "ex-version", Default = false, HelpText = "Exclude version information into output")] | ||
public bool ExcludeVersion { get; set; } | ||
[Option('p', "prefix", Default = "", HelpText = "Constants prefix in output script")] | ||
public string Prefix { get; set; } | ||
[Option('e', "ignore-empty", Default = false, HelpText = "Empty values will be rejected from output")] | ||
public bool IgnoreEmpty { get; set; } | ||
} | ||
} |
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,37 @@ | ||
using System.ComponentModel; | ||
using System.Diagnostics; | ||
using System.IO; | ||
|
||
namespace NSISInfoWriter | ||
{ | ||
public class FileInfoParser | ||
{ | ||
public string FileName { get; private set; } | ||
|
||
public FileInfo FileInfo { get; private set; } | ||
public FileVersionInfo VersionInfo { get; private set; } | ||
public string WorkingDirectory { get; private set; } | ||
|
||
|
||
|
||
public string GetLastCommitHash(bool isShort = true) { | ||
var fmt = isShort ? "%h" : "%H"; | ||
return Helpers.GetCommandOutput("git", "log --pretty=format:" + fmt + " -n 1", this.WorkingDirectory); | ||
} | ||
|
||
public string GetGitUserName() { | ||
return Helpers.GetCommandOutput("git", "config user.name", this.WorkingDirectory); | ||
} | ||
|
||
public string GetGitUserEmail() { | ||
return Helpers.GetCommandOutput("git", "config user.email", this.WorkingDirectory); | ||
} | ||
|
||
public FileInfoParser(string fileName) { | ||
this.FileName = fileName; | ||
this.FileInfo = new FileInfo(this.FileName); | ||
this.VersionInfo = FileVersionInfo.GetVersionInfo(this.FileName); | ||
this.WorkingDirectory = Path.GetDirectoryName(this.FileName); | ||
} | ||
} | ||
} |
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,56 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace NSISInfoWriter | ||
{ | ||
class Helpers | ||
{ | ||
public string FileName { get; private set; } | ||
|
||
public static bool IsGitAvialable() { | ||
var psi = new ProcessStartInfo { | ||
RedirectStandardOutput = true, | ||
FileName = "git", | ||
Arguments = "--version", | ||
CreateNoWindow = true, | ||
UseShellExecute = false | ||
}; | ||
try { | ||
var p = Process.Start(psi); | ||
p.WaitForExit(); | ||
return p.ExitCode == 0; | ||
} catch (Win32Exception) { | ||
return false; | ||
} | ||
} | ||
|
||
public static string GetCommandOutput(string fileName, string arguments, string wd) { | ||
var psi = new ProcessStartInfo { | ||
FileName = fileName, | ||
Arguments = arguments, | ||
CreateNoWindow = true, | ||
RedirectStandardOutput = true, | ||
RedirectStandardError = true, | ||
UseShellExecute = false, | ||
WorkingDirectory = wd | ||
}; | ||
var p = Process.Start(psi); | ||
var output = p.StandardOutput.ReadToEnd(); | ||
return output.Trim(); | ||
} | ||
|
||
public static bool IsUnderGit(string wd) { | ||
// if inside .git directory - false, if directory isn't under git control - | ||
// GetCommandOutput will return nothing, because stderr is ignored | ||
var res = Helpers.GetCommandOutput("git", "rev-parse --is-inside-work-tree", wd); | ||
return res == "true"; | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.