Browse files

work in progress

  • Loading branch information...
1 parent 64c6e10 commit 09f238867ec20c4e8003e2cbc3b5a3c1739fad4e @fearthecowboy committed Apr 30, 2012
View
4 OAuthTool/OAuthToolMain.cs
@@ -147,14 +147,14 @@ internal class OAuthToolMain {
private int Help() {
Logo();
using (new ConsoleColors(ConsoleColor.White, ConsoleColor.Black)) {
- HELP.Print();
+ Console.WriteLine(HELP);
}
return 0;
}
private void Logo() {
using (new ConsoleColors(ConsoleColor.Cyan, ConsoleColor.Black)) {
- this.Assembly().Logo().Print();
+ Console.WriteLine(this.Assembly().Logo());
}
this.Assembly().SetLogo("");
}
View
4 autopackage/AutopackageMain.cs
@@ -317,8 +317,8 @@ public class AutopackageMain : AsyncConsoleProgram {
wixDocument.CreatePackageFile(msiFile);
FailOnErrors();
-
- PeBinary.SignFile(msiFile, PackageSource.Certificate);
+ Binary.SignFile(msiFile, PackageSource.Certificate);
+ // PeBinary.SignFile(msiFile, PackageSource.Certificate);
Console.WriteLine("\r\n ==========\r\n DONE : Signed MSI File: {0}", msiFile);
// recognize the new package in case it is needed for another package.
View
67 autopackage/WixDocument.cs
@@ -105,27 +105,21 @@ internal class WixDocument {
fs.Write(Resources.coapp_native_bootstrap, 0, Resources.coapp_native_bootstrap.Length);
}
- // resign the file
- var peBinary = PeBinary.Load(bootstrapTempFile);
- peBinary.StrongNameKeyCertificate = Source.Certificate;
- peBinary.SigningCertificate = Source.Certificate;
- peBinary.CompanyName = Model.Vendor;
-
- peBinary.Comments = "Installer for " + Model.DisplayName;
- peBinary.ProductName = "Installer for " + Model.DisplayName;
- peBinary.AssemblyTitle = "Installer for " + Model.DisplayName;
- peBinary.AssemblyDescription = "Installer for " + Model.DisplayName;
-
- peBinary.LegalCopyright = Model.PackageDetails.CopyrightStatement;
-
- peBinary.ProductVersion = Model.Version.ToString();
- peBinary.FileVersion = Model.Version.ToString();
-
- peBinary.FileVersion = Model.Version.ToString();
- peBinary.ProductVersion = Model.Version.ToString();
-
- peBinary.Save();
-
+ Binary.Load(bootstrapTempFile, BinaryLoadOptions.NoManaged).Continue(binary => {
+ binary.SigningCertificate = Source.Certificate;
+ binary.CompanyName = Model.Vendor;
+ binary.Comments = "Installer for " + Model.DisplayName;
+ binary.ProductName = "Installer for " + Model.DisplayName;
+ binary.AssemblyTitle = "Installer for " + Model.DisplayName;
+ binary.AssemblyDescription = "Installer for " + Model.DisplayName;
+ binary.LegalCopyright = Model.PackageDetails.CopyrightStatement;
+ binary.ProductVersion = Model.Version.ToString();
+ binary.FileVersion = Model.Version.ToString();
+ binary.FileVersion = Model.Version.ToString();
+ binary.ProductVersion = Model.Version.ToString();
+ return binary.Save();
+ }).Wait();
+
coappBootstrapNativeBin.Attributes.SourceFile = bootstrapTempFile;
}
@@ -138,23 +132,20 @@ internal class WixDocument {
}
// resign the file
- var peBinary = PeBinary.Load(managedBootstrapTemporaryFile);
- peBinary.StrongNameKeyCertificate = Source.Certificate;
- peBinary.SigningCertificate = Source.Certificate;
- peBinary.CompanyName = Model.Vendor;
-
- peBinary.Comments = "Installer for " + Model.DisplayName;
- peBinary.ProductName = "Installer for " + Model.DisplayName;
- peBinary.AssemblyTitle = "Installer for " + Model.DisplayName;
- peBinary.AssemblyDescription = "Installer for " + Model.DisplayName;
- peBinary.LegalCopyright = Model.PackageDetails.CopyrightStatement;
- peBinary.FileVersion = Model.Version.ToString();
- peBinary.ProductVersion = Model.Version.ToString();
-
- peBinary.ProductVersion = Model.Version.ToString();
- peBinary.FileVersion = Model.Version.ToString();
- peBinary.Save();
-
+ Binary.Load(managedBootstrapTemporaryFile, BinaryLoadOptions.NoManaged).Continue(binary => {
+ binary.SigningCertificate = Source.Certificate;
+ binary.CompanyName = Model.Vendor;
+ binary.Comments = "Installer for " + Model.DisplayName;
+ binary.ProductName = "Installer for " + Model.DisplayName;
+ binary.AssemblyTitle = "Installer for " + Model.DisplayName;
+ binary.AssemblyDescription = "Installer for " + Model.DisplayName;
+ binary.LegalCopyright = Model.PackageDetails.CopyrightStatement;
+ binary.FileVersion = Model.Version.ToString();
+ binary.ProductVersion = Model.Version.ToString();
+ binary.ProductVersion = Model.Version.ToString();
+ binary.FileVersion = Model.Version.ToString();
+ return binary.Save();
+ }).Wait();
coappBootstrapBin.Attributes.SourceFile = managedBootstrapTemporaryFile;
}
}
View
4 azure/AzureMain.cs
@@ -439,7 +439,7 @@ public class AzureMain {
private static int Help() {
Logo();
using (new ConsoleColors(ConsoleColor.White, ConsoleColor.Black)) {
- help.Print();
+ Console.WriteLine(help);
}
return 0;
}
@@ -452,7 +452,7 @@ public class AzureMain {
/// </remarks>
private static void Logo() {
using (new ConsoleColors(ConsoleColor.Cyan, ConsoleColor.Black)) {
- Assembly.GetEntryAssembly().Logo().Print();
+ Console.WriteLine(Assembly.GetEntryAssembly().Logo());
}
Assembly.GetEntryAssembly().SetLogo("");
}
View
1 developer.toolkit.csproj
@@ -97,7 +97,6 @@
<Compile Include="Toolkit\Publishing\NativeManifest.cs" />
<Compile Include="Toolkit\Publishing\Binary.cs" />
<Compile Include="Toolkit\Publishing\NoInherit.cs" />
- <Compile Include="Toolkit\Publishing\PeBinary.cs" />
<Compile Include="Toolkit\Publishing\Prerequisite.cs" />
<Compile Include="Toolkit\Publishing\TaskList.cs" />
<Compile Include="Toolkit\Publishing\TrustInfo.cs" />
View
4 devtools.sln
@@ -77,9 +77,13 @@ Global
{D1102D1E-7ACE-4A81-96B8-36DA12310001}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D1102D1E-7ACE-4A81-96B8-36DA12310001}.Release|Any CPU.Build.0 = Release|Any CPU
{7CA121E2-DA8A-4318-92FA-14101826F04C}.Debug|Any CPU.ActiveCfg = Debug|Win32
+ {7CA121E2-DA8A-4318-92FA-14101826F04C}.Debug|Any CPU.Build.0 = Debug|Win32
{7CA121E2-DA8A-4318-92FA-14101826F04C}.Release|Any CPU.ActiveCfg = Release|Win32
+ {7CA121E2-DA8A-4318-92FA-14101826F04C}.Release|Any CPU.Build.0 = Release|Win32
{ED903BAB-1812-4ED8-A85B-A2A2EB83CB2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {ED903BAB-1812-4ED8-A85B-A2A2EB83CB2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ED903BAB-1812-4ED8-A85B-A2A2EB83CB2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {ED903BAB-1812-4ED8-A85B-A2A2EB83CB2D}.Release|Any CPU.Build.0 = Release|Any CPU
{7B8CB73A-D762-44F4-B0AA-95840A29A019}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B8CB73A-D762-44F4-B0AA-95840A29A019}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B8CB73A-D762-44F4-B0AA-95840A29A019}.Release|Any CPU.ActiveCfg = Release|Any CPU
View
41 managed-bootstrap/SingleStep.cs
@@ -44,6 +44,10 @@ internal class SingleStep {
private const string CoAppUrl = "http://coapp.org/resources/";
internal static string MsiFilename;
internal static string MsiFolder;
+ internal static bool Quiet;
+ internal static bool Passive;
+ internal static bool Remove;
+
internal static string BootstrapFolder;
private static int _progressDirection = 1;
private static int _currentTotalTicks = -1;
@@ -92,6 +96,21 @@ internal class SingleStep {
MsiFilename = Path.GetFullPath(args[0]);
MsiFolder = Path.GetDirectoryName(MsiFilename);
+ if( args.Length > 1 ) {
+
+ foreach (var split in args.Skip(1).Select(a => a.ToLower().Split(new[] {'='}, StringSplitOptions.RemoveEmptyEntries)).Where(split => split.Length >= 2)) {
+ if( split[0] == "--uilevel" ) {
+ Quiet = split[1] == "2";
+ Passive= split[1] == "3";
+ }
+
+ if(split[0] == "--remove") {
+ Remove = !string.IsNullOrEmpty(split[1]);
+ }
+ }
+ }
+
+
// if this installer is present, this will exit right after.
if (IsCoAppInstalled) {
RunInstaller(true);
@@ -246,6 +265,10 @@ select p.Split('=')
appDomain.SetData("COAPP_INSTALLED", "TRUE");
}
+ appDomain.SetData("QUIET", Quiet);
+ appDomain.SetData("PASSIVE", Passive);
+ appDomain.SetData("REMOVE", Remove);
+
try {
// If we're bypassing the UI, then we can jump straight to the Installer.
if (bypassingBootstrapUI) {
@@ -291,7 +314,7 @@ select p.Split('=')
if (!string.IsNullOrEmpty(localAssembly)) {
// use the one found locally.
- appDomain.CreateInstanceFromAndUnwrap(localAssembly, "CoApp.Toolkit.Engine.Client.Installer", false, BindingFlags.Default, null, new[] { MsiFilename }, null, null);
+ appDomain.CreateInstanceFromAndUnwrap(localAssembly, "CoApp.Packaging.Client.UI.Installer", false, BindingFlags.Default, null, new[] { MsiFilename }, null, null);
// if it didn't throw here, we can assume that the CoApp service is running, and we can get to our assembly.
ExitQuick();
}
@@ -305,7 +328,7 @@ select p.Split('=')
});
// meh. use strong named assembly
appDomain.CreateInstanceAndUnwrap("CoApp.Client, Version=" + MIN_COAPP_VERSION + ", Culture=neutral, PublicKeyToken=1e373a58e25250cb",
- "CoApp.Toolkit.Engine.Client.Installer", false, BindingFlags.Default, null, new[] {MsiFilename}, null, null);
+ "CoApp.Packaging.Client.UI.Installer", false, BindingFlags.Default, null, new[] { MsiFilename }, null, null);
// since we've done everything we need to do, we're out of here. Right Now.
} catch (Exception e) {
Logger.Error("Critical FAIL ");
@@ -593,6 +616,10 @@ select p.Split('=')
var CoAppCacheFolder = Path.Combine(CoAppRootFolder.Value, ".cache", "packages");
Directory.CreateDirectory(CoAppCacheFolder);
+ if( MsiCanonicalName.IndexOf(":") > -1 ) {
+ MsiCanonicalName = MsiCanonicalName.Substring(MsiCanonicalName.IndexOf(":") + 1);
+ }
+
var cachedPath = Path.Combine(CoAppCacheFolder, MsiCanonicalName + ".msi");
if (!File.Exists(cachedPath)) {
File.Copy(file, cachedPath);
@@ -706,9 +733,17 @@ select p.Split('=')
size = 1024;
var sb2 = new StringBuilder(1024);
NativeMethods.MsiGetProperty(hProduct, "CanonicalName", sb2, ref size);
+
+ size = 1024;
+ var sb3 = new StringBuilder(1024);
+ NativeMethods.MsiGetProperty(hProduct, "ProductVersion", sb3, ref size);
+
NativeMethods.MsiCloseHandle(hProduct);
- if (sb.ToString().Equals("CoApp.Toolkit")) {
+ var requiredVersion = VersionStringToUInt64(MIN_COAPP_VERSION);
+ var pkgVersion = VersionStringToUInt64(sb3.ToString());
+
+ if ( pkgVersion >= requiredVersion && sb.ToString().ToLower().Equals("CoApp.Toolkit")) {
MsiCanonicalName = sb2.ToString();
return true;
}
View
6 native-bootstrap/CoAppBootstrap.c
@@ -768,10 +768,10 @@ void ElevateSelf(const wchar_t* pszCmdLine) {
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO) );
GetModuleFileName(NULL, modulePath, MAX_PATH);
// make sure path has a .EXE on the end.
- DebugPrintf(L"MODULE=%s",modulePath);
+ // DebugPrintf(L"MODULE=%s",modulePath);
newPath = TempFileName(Sprintf(L"Installer(%s).exe",GetFilenameFromPath(modulePath)));
- DebugPrintf(L"NEWPATH=%s",newPath);
+ //DebugPrintf(L"NEWPATH=%s",newPath);
rc = CopyFile(modulePath, newPath, FALSE);
@@ -786,7 +786,7 @@ void ElevateSelf(const wchar_t* pszCmdLine) {
if (!ShellExecuteEx(&sei)) {
rc = GetLastError();
- DebugPrintf(L"FAILURE: %d", rc );
+ //DebugPrintf(L"FAILURE: %d", rc );
TerminateApplicationWithError(IDS_REQUIRES_ADMIN_RIGHTS,L"Administrator rights are required.");
return;
}
View
24 native-bootstrap/coapp_file.h
@@ -306,7 +306,7 @@ int DownloadFile(const wchar_t* URL, const wchar_t* destinationFilename) {
HANDLE localFile = NULL;
int percentComplete =0;
- DebugPrintf(L"HTTP GET: [%s]",URL);
+ // DebugPrintf(L"HTTP GET: [%s]",URL);
__try {
ZeroMemory(&urlComponents, sizeof(urlComponents));
@@ -584,23 +584,23 @@ wchar_t* AcquireFile( const wchar_t* filename, BOOL searchOnline, const wchar_t*
// is the localized file in the bootstrap folder?
result = UrlOrPathCombine( BootstrapFolder, localizedFilename, L'\\');
- DebugPrintf(L"Trying %s", result );
+ //DebugPrintf(L"Trying %s", result );
if( FileExists( result ) && IsEmbeddedSignatureValid(result) ) {
__leave; // found it
}
DeleteString(&result);
// is the localized file in the msi folder?
result = UrlOrPathCombine( MsiFolder, localizedFilename, L'\\');
- DebugPrintf(L"Trying %s", result );
+ //DebugPrintf(L"Trying %s", result );
if( FileExists( result ) && IsEmbeddedSignatureValid(result) ) {
__leave; // found it
}
DeleteString(&result);
// try the MSI for the localized file
result = ExtractFileFromMSI( MsiFile, localizedFilename );
- DebugPrintf(L"Trying %s::%s", MsiFile, localizedFilename );
+ //DebugPrintf(L"Trying %s::%s", MsiFile, localizedFilename );
if( FileExists( result ) && IsEmbeddedSignatureValid(result) ) {
__leave; // found it
}
@@ -612,23 +612,23 @@ wchar_t* AcquireFile( const wchar_t* filename, BOOL searchOnline, const wchar_t*
// is the standard file in the bootstrap folder?
result = UrlOrPathCombine( MsiFolder, filename, L'\\');
- DebugPrintf(L"Trying %s", result );
+ //DebugPrintf(L"Trying %s", result );
if( FileExists( result ) && IsEmbeddedSignatureValid(result) ) {
__leave; // found it
}
DeleteString(&result);
// is the standard file in the msi folder?
result = UrlOrPathCombine( BootstrapFolder, filename, L'\\');
- DebugPrintf(L"Trying %s", result );
+ //DebugPrintf(L"Trying %s", result );
if( FileExists( result ) && IsEmbeddedSignatureValid(result) ) {
__leave; // found it
}
DeleteString(&result);
// try the MSI for the regular file
result = ExtractFileFromMSI( MsiFile, filename );
- DebugPrintf(L"Trying %s::%s", MsiFile, filename );
+ //DebugPrintf(L"Trying %s::%s", MsiFile, filename );
if( FileExists( result ) && IsEmbeddedSignatureValid(result) ) {
__leave; // found it
}
@@ -640,7 +640,7 @@ wchar_t* AcquireFile( const wchar_t* filename, BOOL searchOnline, const wchar_t*
if( !IsNullOrEmpty(additionalDownloadServer) ) {
// try regular file off the bootstrap server
- DebugPrintf(L"Trying %s::%s", additionalDownloadServer, filename );
+ //DebugPrintf(L"Trying %s::%s", additionalDownloadServer, filename );
result = DownloadRelativeFile( additionalDownloadServer, filename );
if( FileExists( result ) && IsEmbeddedSignatureValid(result) ) {
@@ -654,15 +654,15 @@ wchar_t* AcquireFile( const wchar_t* filename, BOOL searchOnline, const wchar_t*
//------------------------
// try localized file off the bootstrap server
- DebugPrintf(L"Trying %s::%s", BootstrapServerUrl, localizedFilename );
+ //DebugPrintf(L"Trying %s::%s", BootstrapServerUrl, localizedFilename );
result = DownloadRelativeFile( BootstrapServerUrl, localizedFilename);
if( FileExists( result ) && IsEmbeddedSignatureValid(result) ) {
__leave; // found it
}
DeleteString(&result);
// try localized file off the coapp server
- DebugPrintf(L"Trying %s::%s", CoAppServerUrl, localizedFilename );
+ //DebugPrintf(L"Trying %s::%s", CoAppServerUrl, localizedFilename );
result = DownloadRelativeFile( CoAppServerUrl, localizedFilename );
if( FileExists( result ) && IsEmbeddedSignatureValid(result) ) {
__leave; // found it
@@ -674,15 +674,15 @@ wchar_t* AcquireFile( const wchar_t* filename, BOOL searchOnline, const wchar_t*
//------------------------
// try regular file off the bootstrap server
- DebugPrintf(L"Trying %s::%s", BootstrapServerUrl, filename );
+ //DebugPrintf(L"Trying %s::%s", BootstrapServerUrl, filename );
result = DownloadRelativeFile( BootstrapServerUrl, filename );
if( FileExists( result ) && IsEmbeddedSignatureValid(result) ) {
__leave; // found it
}
DeleteString(&result);
// try regular file off the coapp server
- DebugPrintf(L"Trying %s::%s", CoAppServerUrl, filename );
+ //DebugPrintf(L"Trying %s::%s", CoAppServerUrl, filename );
result = DownloadRelativeFile( CoAppServerUrl, filename);
if( FileExists( result ) && IsEmbeddedSignatureValid(result) ) {
__leave; // found it
View
6 ptk/pTkMain.cs
@@ -592,8 +592,6 @@ project source
// _originalEnvironment.Add("COAPP", CoApp.Toolkit.Engine.PackageManagerSettings.CoAppRootDirectory);
_originalEnvironment.AddOrSet("COAPP", "C:/programdata/");
-
-
while (string.IsNullOrEmpty(buildinfo) || !File.Exists(buildinfo)) {
// if the user didn't pass in the file, walk up the tree to find the first directory that has a COPKG\.buildinfo file
buildinfo = (from a in @".\COPKG\".DirectoryEnumerateFilesSmarter("*.buildinfo", SearchOption.TopDirectoryOnly)
@@ -1554,7 +1552,7 @@ project source
private static int Help() {
Logo();
using (new ConsoleColors(ConsoleColor.White, ConsoleColor.Black)) {
- help.Print();
+ Console.WriteLine(help);
}
return 0;
}
@@ -1567,7 +1565,7 @@ project source
/// </remarks>
private static void Logo() {
using (new ConsoleColors(ConsoleColor.Cyan, ConsoleColor.Black)) {
- Assembly.GetEntryAssembly().Logo().Print();
+ Console.WriteLine(Assembly.GetEntryAssembly().Logo());
}
Assembly.GetEntryAssembly().SetLogo("");
}
View
4 scan/Program.cs
@@ -138,14 +138,14 @@ private int Help()
{
Logo();
using (new ConsoleColors(ConsoleColor.White, ConsoleColor.Black))
- HELP.Print();
+ Console.WriteLine(HELP);
return 0;
}
private void Logo()
{
using (new ConsoleColors(ConsoleColor.Cyan, ConsoleColor.Black))
- this.Assembly().Logo().Print();
+ Console.WriteLine(this.Assembly().Logo());
this.Assembly().SetLogo("");
}
View
4 simplesigner/SimpleSignerMain.cs
@@ -485,7 +485,7 @@ one of
private int Help() {
Logo();
using (new ConsoleColors(ConsoleColor.White, ConsoleColor.Black)) {
- HelpMessage.Print();
+ Console.WriteLine(HelpMessage);
}
return 0;
@@ -496,7 +496,7 @@ one of
/// </summary>
private void Logo() {
using (new ConsoleColors(ConsoleColor.Cyan, ConsoleColor.Black)) {
- this.Assembly().Logo().Print();
+
}
this.Assembly().SetLogo(string.Empty);
View
4 toolscanner/ToolScannerMain.cs
@@ -381,7 +381,7 @@ internal class ToolScannerMain {
private static int Help() {
Logo();
using (new ConsoleColors(ConsoleColor.White, ConsoleColor.Black)) {
- help.Print();
+ Console.WriteLine(help);
}
return 0;
}
@@ -392,7 +392,7 @@ internal class ToolScannerMain {
/// <remarks></remarks>
private static void Logo() {
using (new ConsoleColors(ConsoleColor.Cyan, ConsoleColor.Black)) {
- Assembly.GetEntryAssembly().Logo().Print();
+ Console.WriteLine(Assembly.GetEntryAssembly().Logo());
}
Assembly.GetEntryAssembly().SetLogo("");
}

0 comments on commit 09f2388

Please sign in to comment.