AuthorGuid System.String:{75a093b7-da5f-493a-b8f0-22c278f874c1} LastUpdateCheck AAEAAAD/////AQAAAAAAAAAEAQAAAA9TeXN0ZW0uRGF0ZVRpbWUCAAAABXRpY2tzCGRhdGVEYXRhAAAJEOGhVC47mtII4aFULjua0ogL MainForm/Size System.Drawing.Size:1046,476 MainForm/Location System.Drawing.Point:203,77 MainForm/WindowState System.Int32:0 olvJobs/Application:Visibility System.Boolean:True olvJobs/Application:Width System.Int32:126 olvJobs/Application:LastDisplayIndex System.Int32:0 olvJobs/Last updated:Visibility System.Boolean:True olvJobs/Last updated:Width System.Int32:96 olvJobs/Last updated:LastDisplayIndex System.Int32:2 olvJobs/Progress:Visibility System.Boolean:True olvJobs/Progress:Width System.Int32:100 olvJobs/Progress:LastDisplayIndex System.Int32:4 olvJobs/Target:Visibility System.Boolean:True olvJobs/Target:Width System.Int32:0 olvJobs/Target:LastDisplayIndex System.Int32:5 olvJobs/Category:Visibility System.Boolean:True olvJobs/Category:Width System.Int32:80 olvJobs/Category:LastDisplayIndex System.Int32:15 olvJobs/Status:Visibility System.Boolean:True olvJobs/Status:Width System.Int32:79 olvJobs/Status:LastDisplayIndex System.Int32:6 olvJobs/LastSortColumn System.String:Application olvJobs/LastSortOrder System.Int32:1 Ketarin/ShowGroups System.Boolean:True Ketarin/ShowStatusBar System.Boolean:False Ketarin/ShowLog System.Boolean:True Ketarin/AutoScroll System.Boolean:True PreUpdateCommand System.String:REM https://chocolatey.org/packages/chocolateypackageupdater SET URL={url} IF '%URL%'=='' SET URL={preupdate-url} chocopkgup {nopush} {force} --pf="{autoPackagesFolder}" --packagename="{appname}" --version="{version}" --url="%URL%" --urlx64="{url64}" --checksum="{checksum}" --c64="{checksumx64}" --debug PreUpdateCommandType System.String:Batch CustomColumns System.String:<?xml version="1.0" encoding="utf-16"?> <dictionary> <item> <key> <string>version</string> </key> <value> <string>{version}</string> </value> </item> <item> <key> <string>filesize</string> </key> <value> <string>{filesize:formatfilesize}</string> </value> </item> <item> <key> <string>host</string> </key> <value> <string>{url:regex:(?&lt;=//)([\w-]+\.)*(?=[\w-]+\.[\w-]+(?=/))}</string> </value> </item> <item> <key> <string>fileDate</string> </key> <value> <string>{f:yyyy}-{f:MM}-{f:dd} {f:HH}:{f:mm}</string> </value> </item> <item> <key> <string>fixedUrl</string> </key> <value> <string>{property:FixedDownloadUrl:regex:(?&lt;=//).*}</string> </value> </item> <item> <key> <string>referer</string> </key> <value> <string>{property:HttpReferer}</string> </value> </item> <item> <key> <string>user-agent</string> </key> <value> <string>{property:UserAgent}</string> </value> </item> <item> <key> <string>delPrevFile</string> </key> <value> <string>{property:DeletePreviousFile:multireplace:,:True,False:X,}</string> </value> </item> <item> <key> <string>varChgInd</string> </key> <value> <string>{property:VariableChangeIndicator}</string> </value> </item> <item> <key> <string>cscript</string> </key> <value> <string>{cscript}</string> </value> </item> <item> <key> <string>enabled</string> </key> <value> <string>{property:Enabled}</string> </value> </item> <item> <key> <string>nopush</string> </key> <value> <string>{nopush}</string> </value> </item> <item> <key> <string>domain</string> </key> <value> <string>{url:regex:(?&lt;=//[\w-]+\.)*[\w-]+\.[\w-]+(?=/)}</string> </value> </item> <item> <key> <string>url64</string> </key> <value> <string>{url64}</string> </value> </item> <item> <key> <string>hashInternal</string> </key> <value> <string>{hash}</string> </value> </item> <item> <key> <string>hashType</string> </key> <value> <string>{property:HashType:replace:None:}</string> </value> </item> <item> <key> <string>proto</string> </key> <value> <string>{url:regex:.*?(?=.//)}</string> </value> </item> <item> <key> <string>bytes</string> </key> <value> <string>{filesize}</string> </value> </item> <item> <key> <string>hashExternal</string> </key> <value> <string>{checksum}</string> </value> </item> <item> <key> <string>checksum64</string> </key> <value> <string>{checksumx64}</string> </value> </item> </dictionary> CustomColumn CustomColumn2 UpdateAtStartup System.Boolean:False AvoidFileHippoBeta System.Boolean:True ConnectionTimeout AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uRGVjaW1hbAQAAAAFZmxhZ3MCaGkCbG8DbWlkAAAAAAgICAgAAAAAAAAAADwAAAAAAAAACw== ThreadCount System.Int32:4 RetryCount System.Int32:2 UpdateOnlineDatabase System.Boolean:False MinimizeToTray System.Boolean:True CreateDatabaseBackups System.Boolean:True OpenWebsiteOnDoubleClick System.Boolean:False ProxyPort AAEAAAD/////AQAAAAAAAAAEAQAAAA5TeXN0ZW0uRGVjaW1hbAQAAAAFZmxhZ3MCaGkCbG8DbWlkAAAAAAgICAgAAAAAAAAAALgiAAAAAAAACw== ProxyServer System.String: ProxyUser System.String: ProxyPassword System.String: olvJobs/Version:Visibility System.Boolean:True olvJobs/Version:Width System.Int32:99 olvJobs/Version:LastDisplayIndex System.Int32:1 SetPlaceholderDialog/Size System.Drawing.Size:699,157 SetPlaceholderDialog/Location System.Drawing.Point:0,0 SetPlaceholderDialog/WindowState System.Int32:0 EditVariablesDialog/Size System.Drawing.Size:1004,492 EditVariablesDialog/Location System.Drawing.Point:66,65 EditVariablesDialog/WindowState System.Int32:0 ApplicationJobDialog/Size System.Drawing.Size:507,507 ApplicationJobDialog/Location System.Drawing.Point:173,12 ApplicationJobDialog/WindowState System.Int32:0 LogDialog/Size System.Drawing.Size:1143,423 LogDialog/Location System.Drawing.Point:116,360 LogDialog/WindowState System.Int32:0 ErrorsDialog/Size System.Drawing.Size:1096,965 olvErrors/Application:Visibility System.Boolean:True olvErrors/Application:Width System.Int32:98 olvErrors/Application:LastDisplayIndex System.Int32:-1 olvErrors/Error:Visibility System.Boolean:True olvErrors/Error:Width System.Int32:952 olvErrors/Error:LastDisplayIndex System.Int32:-1 olvErrors/LastSortColumn System.String:Application olvErrors/LastSortOrder System.Int32:1 ProgressDialog/Size System.Drawing.Size:302,112 Hotkey: OpenWebsite System.String: Hotkey: Edit System.String: Hotkey: Update System.String: Hotkey: ForceDownload System.String: Hotkey: InstallSelected System.String: Hotkey: OpenFile System.String: Hotkey: OpenFolder System.String: Hotkey: CheckUpdate System.String: Hotkey: UpdateAndInstall System.String: InstallingApplicationsDialog/Size System.Drawing.Size:406,250 InstallingApplicationsDialog/Location System.Drawing.Point:164,724 InstallingApplicationsDialog/WindowState System.Int32:0 olvLog/Time:Visibility System.Boolean:True olvLog/Time:Width System.Int32:55 olvLog/Time:LastDisplayIndex System.Int32:-1 olvLog/Message:Visibility System.Boolean:True olvLog/Message:Width System.Int32:310 olvLog/Message:LastDisplayIndex System.Int32:-1 olvLog/LastSortColumn System.String:Time olvLog/LastSortOrder System.Int32:0 InstallingApplicationsDialog/Expanded System.Boolean:True DefaultCommand System.String://////////////////////////////////////////////////////////////////////////////////////// /// version ? Lots of changes /// /// Changelog: /// - Allow for non-versioned output folder paths /// - Logging! /// - Call choco directly, expected to be at the default location. /// // REQUIRES: // global vars: saveDir=corresponds to download location of installer file // app vars: nopush, checksum64file=corresponds to 64 bit install file // file vars: same as specified by chocopkgup // get package variable 'cscript' string varCScript = ""; varCScript = app.Variables.ReplaceAllInString("{cscript}").Trim(); Ketarin.Forms.LogDialog.Log(app,"cscript='" + varCScript + "'"); Ketarin.Forms.LogDialog.Log(app,"If cscript is set to 1, checksums will be calculated but the package won't be pushed."); Ketarin.Forms.LogDialog.Log(app,"If cscript is set to 2, checksums will be calculated AND the package will be pushed."); // determine whether we run this by checking cscript exists AND is 1 or 2 if ((varCScript == "1") || (varCScript == "2")) { // ketarin variables we pass for this script to use string varAppname = app.Variables.ReplaceAllInString("{appname}"); string varVersion = app.Variables.ReplaceAllInString("{version}"); string varChocoPkgOutput = System.IO.Path.Combine(app.Variables.ReplaceAllInString("{autoPackagesFolder}"), "_output"); string varChecksum = app.Variables.ReplaceAllInString("{checksum}"); string varChecksumx64 = app.Variables.ReplaceAllInString("{checksumx64}"); string varChecksum64File = app.Variables.ReplaceAllInString("{url64}"); string varSaveDir = app.Variables.ReplaceAllInString("{saveDir}"); // custom variables used in this script // equivalent to ketarin variable "{file}" string savePath = app.PreviousLocation; string pkgPath = System.IO.Path.Combine(varChocoPkgOutput, varAppname, varVersion); if (!System.IO.Directory.Exists(pkgPath)) { pkgPath = System.IO.Path.Combine(varChocoPkgOutput, varAppname); Ketarin.Forms.LogDialog.Log(app,"Using the output folder without a version"); } Ketarin.Forms.LogDialog.Log(app, "Using package file at " + pkgPath); string fileNameNuspec = System.String.Concat(varAppname, ".nuspec"); string fileUriNuspec = System.IO.Path.Combine(pkgPath, fileNameNuspec); string fileNameNupkg = System.String.Concat(varAppname, ".", varVersion, ".nupkg"); string fileUriNupkg = System.IO.Path.Combine(pkgPath, fileNameNupkg); //MessageBox.Show("pkgPath=" + pkgPath + System.Environment.NewLine // + "savePath=" + savePath); // do not re-push package if package already created System.DateTime today = System.DateTime.Today; System.DateTime pkgCreateDate = System.IO.File.GetCreationTime(pkgPath); if (today > pkgCreateDate) { return; } // calculate SHA256 from {url} Note we are leveraging ketarin's downloaded copy System.IO.FileStream fileSha = new System.IO.FileStream(savePath, System.IO.FileMode.Open); System.Security.Cryptography.SHA256 sha256 = new System.Security.Cryptography.SHA256Managed(); byte[] retValSha = sha256.ComputeHash(fileSha); fileSha.Close(); // build string from byte value System.Text.StringBuilder sbSha = new System.Text.StringBuilder(); for (int i = 0; i < retValSha.Length; i++) { sbSha.Append(retValSha[i].ToString("x2")); } // find $pkgPath -iname "*.nuspec" -o -iname "*.ps1" -exec sed -i 's/'$sbSha'/{checksum}/g' '{}' \; string replaceChecksum = sbSha.ToString(); Ketarin.Forms.LogDialog.Log(app, "Checksum for url is " + replaceChecksum); //MessageBox.Show(replaceChecksum); System.Collections.Generic.List<string> pkgFileList = new System.Collections.Generic.List<string>(System.IO.Directory.GetFiles(pkgPath, "*.ps1", System.IO.SearchOption.AllDirectories)); string[] filesNuspec = System.IO.Directory.GetFiles(pkgPath, "*.nuspec", System.IO.SearchOption.AllDirectories); pkgFileList.AddRange(filesNuspec); string[] files = pkgFileList.ToArray(); foreach (string file in files) { try { string contents = System.IO.File.ReadAllText(file); //MessageBox.Show(contents); contents = contents.Replace("{checksum}", replaceChecksum); //MessageBox.Show(contents); // Make files writable // File.SetAttributes(file, FileAttributes.Normal); System.IO.File.WriteAllText(file, contents); } catch (System.Exception ex) { System.Console.WriteLine(ex.Message); } } // Get Checksum for 64bit file if url64 exists if (varChecksum64File != "{url64}" && varChecksum64File != "\"\"" && !System.String.IsNullOrEmpty(varChecksum64File)) { // TODO: verify and validate URI checksum64file points to a downloadable file // string varChecksum64basefile = app.Variables.ReplaceAllInString("{url64:basefile}"); string varChecksum64ext = app.Variables.ReplaceAllInString("{url64:ext}"); string saveFileName64 = System.String.Concat(varAppname, "_64_", varVersion, ".", varChecksum64ext); string savePath64 = System.IO.Path.Combine(varSaveDir, saveFileName64); // we must download the file to calculate checksum ... may as well save it Ketarin.Forms.LogDialog.Log(app, "Downloading '" + varChecksum64File + "' to '" + savePath64 + "'."); System.Net.WebClient webClient = new System.Net.WebClient(); webClient.DownloadFile(varChecksum64File, savePath64); // calculate SHA256 from file of url pointed to by 'checksum64file' System.IO.FileStream file64Sha = new System.IO.FileStream(savePath64, System.IO.FileMode.Open); System.Security.Cryptography.SHA256 sha256_64 = new System.Security.Cryptography.SHA256Managed(); byte[] retVal64Sha = sha256_64.ComputeHash(file64Sha); file64Sha.Close(); // build string from byte value System.Text.StringBuilder sb64Sha = new System.Text.StringBuilder(); for (int i = 0; i < retVal64Sha.Length; i++) { sb64Sha.Append(retVal64Sha[i].ToString("x2")); } // find $pkgPath -iname "*.nuspec" -o -iname "*.ps1" -exec sed -i 's/'$sb64Sha'/{checksumx64}/g' '{}' \; // Note chocopkgup will strip 1 set of curly braces so {{checksum}} becomes {checksum} string replace64Checksum = sb64Sha.ToString(); Ketarin.Forms.LogDialog.Log(app, "Checksum for url64 is " + replace64Checksum); foreach (string file in files) { try { string contents = System.IO.File.ReadAllText(file); //MessageBox.Show(contents); contents = contents.Replace("{checksumx64}", replace64Checksum); //MessageBox.Show(contents); System.IO.File.WriteAllText(file, contents); } catch (System.Exception ex) { System.Console.WriteLine(ex.Message); } } } // delete existing nupkg made by chocopkgup; we leverage chocopkgup to create the structure/files in destination Ketarin.Forms.LogDialog.Log(app, "Deleting the existing nupkg before repacking at " + fileUriNupkg); System.Diagnostics.Process process1 = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo proc1 = new System.Diagnostics.ProcessStartInfo(); proc1.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; proc1.UseShellExecute = true; proc1.WorkingDirectory = pkgPath; proc1.FileName = "cmd.exe"; proc1.Arguments = "/c " + "del /f " + fileUriNupkg; process1.StartInfo = proc1; process1.Start(); process1.WaitForExit(30000); // create a new nupkg Ketarin.Forms.LogDialog.Log(app, "Packing up the package, this time with checksums"); System.Diagnostics.Process process2 = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo proc2 = new System.Diagnostics.ProcessStartInfo(); proc2.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized; proc2.UseShellExecute = false; proc2.WorkingDirectory = pkgPath; proc2.FileName = "C:\\ProgramData\\Chocolatey\\bin\\choco.exe"; proc2.Arguments = "pack " + fileUriNuspec; proc2.RedirectStandardOutput = true; proc2.RedirectStandardError = true; proc2.CreateNoWindow = true; process2.StartInfo = proc2; process2.OutputDataReceived += (s, e) => { if (e != null) Ketarin.Forms.LogDialog.Log(app, e.Data); }; process2.ErrorDataReceived += (s, e) => { if (e != null) Ketarin.Forms.LogDialog.Log(app, e.Data); }; process2.EnableRaisingEvents = true; process2.Start(); process2.BeginErrorReadLine(); process2.BeginOutputReadLine(); process2.WaitForExit(30000); process2.StartInfo = proc2; process2.Start(); // push the nupkg if (varCScript == "2") { System.Threading.Thread.Sleep(2000); System.Int32 exitCode = -1; Ketarin.Forms.LogDialog.Log(app, "Pushing the package"); System.Diagnostics.Process process3 = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo proc3 = new System.Diagnostics.ProcessStartInfo(); proc3.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized; proc3.UseShellExecute = false; proc3.WorkingDirectory = pkgPath; proc3.FileName = "C:\\ProgramData\\Chocolatey\\bin\\choco.exe"; // find nupkg in pkgPath string[] pushPkg = System.IO.Directory.GetFiles(pkgPath, "*.nupkg", System.IO.SearchOption.TopDirectoryOnly); foreach (System.String file in pushPkg) { Ketarin.Forms.LogDialog.Log(app, "Pushing " + file + " to dot org"); proc3.Arguments = "push " + file; } proc3.RedirectStandardOutput = true; proc3.RedirectStandardError = true; proc3.CreateNoWindow = true; process3.StartInfo = proc3; process3.OutputDataReceived += (s, e) => { if (e != null) Ketarin.Forms.LogDialog.Log(app, e.Data); }; process3.ErrorDataReceived += (s, e) => { if (e != null) Ketarin.Forms.LogDialog.Log(app, e.Data); }; process3.EnableRaisingEvents = true; process3.Start(); process3.BeginErrorReadLine(); process3.BeginOutputReadLine(); System.Boolean exited = process3.WaitForExit(120000); if (exited) { exitCode = process3.ExitCode; } if (exitCode != 0) { throw new System.Exception("Push did not finish successfully. See the log for details."); Ketarin.Forms.LogDialog.Log(app, "This is a failure. However Ketarin doesn't error on post updates."); } } } DefaultCommandType System.String:CS PostUpdateCommand System.String: PostUpdateCommandType System.String:Batch DefaultApplication System.String:<?xml version="1.0" encoding="utf-8"?> <Jobs> <ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <WebsiteUrl /> <UserAgent /> <UserNotes /> <LastFileSize>0</LastFileSize> <LastFileDate xsi:nil="true" /> <IgnoreFileInformation>false</IgnoreFileInformation> <DownloadBeta>Default</DownloadBeta> <CheckForUpdatesOnly>false</CheckForUpdatesOnly> <VariableChangeIndicator /> <HashVariable /> <HashType>None</HashType> <CanBeShared>true</CanBeShared> <ShareApplication>false</ShareApplication> <ExclusiveDownload>false</ExclusiveDownload> <HttpReferer /> <SetupInstructions /> <Variables> <item> <key> <string>nopush</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>--nopush</TextualContent> <Name>nopush</Name> </UrlVariable> </value> </item> <item> <key> <string>version</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>RegularExpression</VariableType> <Regex>Last program version.*?([\d\.]+)</Regex> <Url>x</Url> <Name>version</Name> </UrlVariable> </value> </item> <item> <key> <string>url</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>{getUrl}</TextualContent> <Name>url</Name> </UrlVariable> </value> </item> <item> <key> <string>url64</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>{getUrl64}</TextualContent> <Name>url64</Name> </UrlVariable> </value> </item> <item> <key> <string>getUrl</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>RegularExpression</VariableType> <Regex>[^ "'&lt;&gt;\*]+\.exe</Regex> <Url>x</Url> <Name>getUrl</Name> </UrlVariable> </value> </item> <item> <key> <string>getUrl64</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>RegularExpression</VariableType> <Regex>[^ "'&lt;&gt;\*]+\.exe</Regex> <Url>x</Url> <Name>getUrl64</Name> </UrlVariable> </value> </item> <item> <key> <string>checksum</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>RegularExpression</VariableType> <Regex>[A-Fa-f0-9]{32}</Regex> <Url>md5</Url> <TextualContent>{checksum}</TextualContent> <Name>checksum</Name> </UrlVariable> </value> </item> <item> <key> <string>checksumx64</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>RegularExpression</VariableType> <Regex>(?&lt;=ResponseUri: )[^\r\n]+</Regex> <Url>{url64}</Url> <TextualContent>{checksum}</TextualContent> <Name>checksumx64</Name> </UrlVariable> </value> </item> <item> <key> <string>checksum64file</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>{url64}</TextualContent> <Name>checksum64file</Name> </UrlVariable> </value> </item> <item> <key> <string>cscript</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>0</TextualContent> <Name>cscript</Name> </UrlVariable> </value> </item> </Variables> <ExecuteCommand /> <ExecutePreCommand /> <ExecuteCommandType>Batch</ExecuteCommandType> <ExecutePreCommandType>Batch</ExecutePreCommandType> <Category /> <SourceType>FixedUrl</SourceType> <DeletePreviousFile>false</DeletePreviousFile> <Enabled>true</Enabled> <FileHippoId /> <TargetPath>{saveDir}\{appname}_{version}.{url:ext}</TargetPath> <FixedDownloadUrl>{url}</FixedDownloadUrl> <Name>x </Name> </ApplicationJob> </Jobs> olvJobs/x:Visibility System.Boolean:True olvJobs/x:Width System.Int32:89 olvJobs/x:LastDisplayIndex System.Int32:-1 olvJobs/Filesize:Visibility System.Boolean:True olvJobs/Filesize:Width System.Int32:68 olvJobs/Filesize:LastDisplayIndex System.Int32:5 olvJobs/url:Visibility System.Boolean:True olvJobs/url:Width System.Int32:147 olvJobs/url:LastDisplayIndex System.Int32:-1 olvJobs/host:Visibility System.Boolean:True olvJobs/host:Width System.Int32:120 olvJobs/host:LastDisplayIndex System.Int32:10 olvJobs/packageGuid:Visibility System.Boolean:True olvJobs/packageGuid:Width System.Int32:77 olvJobs/packageGuid:LastDisplayIndex System.Int32:14 olvJobs/fileDate:Visibility System.Boolean:True olvJobs/fileDate:Width System.Int32:97 olvJobs/fileDate:LastDisplayIndex System.Int32:3 olvJobs/fixedUrl:Visibility System.Boolean:True olvJobs/fixedUrl:Width System.Int32:96 olvJobs/fixedUrl:LastDisplayIndex System.Int32:9 olvJobs/referer:Visibility System.Boolean:True olvJobs/referer:Width System.Int32:65 olvJobs/referer:LastDisplayIndex System.Int32:13 olvJobs/User-Agent:Visibility System.Boolean:True olvJobs/User-Agent:Width System.Int32:80 olvJobs/User-Agent:LastDisplayIndex System.Int32:8 olvJobs/DeletePreviousFile:Visibility System.Boolean:True olvJobs/DeletePreviousFile:Width System.Int32:41 olvJobs/DeletePreviousFile:LastDisplayIndex System.Int32:20 olvJobs/VariableChangeIndicator:Visibility System.Boolean:True olvJobs/VariableChangeIndicator:Width System.Int32:55 olvJobs/VariableChangeIndicator:LastDisplayIndex System.Int32:15 olvJobs/github:Visibility System.Boolean:True olvJobs/github:Width System.Int32:64 olvJobs/github:LastDisplayIndex System.Int32:16 olvJobs/kde:Visibility System.Boolean:True olvJobs/kde:Width System.Int32:49 olvJobs/kde:LastDisplayIndex System.Int32:17 olvJobs/cscript:Visibility System.Boolean:True olvJobs/cscript:Width System.Int32:32 olvJobs/cscript:LastDisplayIndex System.Int32:22 olvJobs/enabled:Visibility System.Boolean:True olvJobs/enabled:Width System.Int32:60 olvJobs/enabled:LastDisplayIndex System.Int32:26 olvJobs/nopush:Visibility System.Boolean:True olvJobs/nopush:Width System.Int32:60 olvJobs/nopush:LastDisplayIndex System.Int32:23 olvJobs/domainname:Visibility System.Boolean:True olvJobs/domainname:Width System.Int32:166 olvJobs/domainname:LastDisplayIndex System.Int32:10 olvJobs/domain:Visibility System.Boolean:True olvJobs/domain:Width System.Int32:141 olvJobs/domain:LastDisplayIndex System.Int32:17 olvJobs/checksum64file:Visibility System.Boolean:True olvJobs/checksum64file:Width System.Int32:91 olvJobs/checksum64file:LastDisplayIndex System.Int32:25 olvJobs/Target2:Visibility System.Boolean:True olvJobs/Target2:Width System.Int32:60 olvJobs/Target2:LastDisplayIndex System.Int32:-1 olvJobs/AppName:Visibility System.Boolean:True olvJobs/AppName:Width System.Int32:164 olvJobs/AppName:LastDisplayIndex System.Int32:-1 olvJobs/version:Visibility System.Boolean:True olvJobs/version:Width System.Int32:120 olvJobs/version:LastDisplayIndex System.Int32:1 olvJobs/filesize:Visibility System.Boolean:True olvJobs/filesize:Width System.Int32:68 olvJobs/filesize:LastDisplayIndex System.Int32:8 olvJobs/user-agent:Visibility System.Boolean:True olvJobs/user-agent:Width System.Int32:60 olvJobs/user-agent:LastDisplayIndex System.Int32:12 olvJobs/delPrevFile:Visibility System.Boolean:True olvJobs/delPrevFile:Width System.Int32:60 olvJobs/delPrevFile:LastDisplayIndex System.Int32:27 olvJobs/varChangeIndicator:Visibility System.Boolean:True olvJobs/varChangeIndicator:Width System.Int32:60 olvJobs/varChangeIndicator:LastDisplayIndex System.Int32:20 olvJobs/varChgInd:Visibility System.Boolean:True olvJobs/varChgInd:Width System.Int32:82 olvJobs/varChgInd:LastDisplayIndex System.Int32:16 olvJobs/url64:Visibility System.Boolean:True olvJobs/url64:Width System.Int32:60 olvJobs/url64:LastDisplayIndex System.Int32:24 olvJobs/hash:Visibility System.Boolean:True olvJobs/hash:Width System.Int32:60 olvJobs/hash:LastDisplayIndex System.Int32:24 olvJobs/hashType:Visibility System.Boolean:True olvJobs/hashType:Width System.Int32:60 olvJobs/hashType:LastDisplayIndex System.Int32:18 ImportFromDatabaseDialog/Size System.Drawing.Size:524,1596 olvApplications/Application name:Visibility System.Boolean:True olvApplications/Application name:Width System.Int32:291 olvApplications/Application name:LastDisplayIndex System.Int32:-1 olvApplications/Last updated:Visibility System.Boolean:True olvApplications/Last updated:Width System.Int32:130 olvApplications/Last updated:LastDisplayIndex System.Int32:-1 olvApplications/Uses:Visibility System.Boolean:True olvApplications/Uses:Width System.Int32:40 olvApplications/Uses:LastDisplayIndex System.Int32:-1 olvApplications/LastSortColumn System.String:Application name olvApplications/LastSortOrder System.Int32:1 ChooseAppsToInstallDialog/Size System.Drawing.Size:618,433 ChooseAppsToInstallDialog/Location System.Drawing.Point:675,637 ChooseAppsToInstallDialog/WindowState System.Int32:0 olvApps/Name:Visibility System.Boolean:True olvApps/Name:Width System.Int32:263 olvApps/Name:LastDisplayIndex System.Int32:-1 olvApps/LastSortColumn System.String:Name olvApps/LastSortOrder System.Int32:1 olvLists/Name:Visibility System.Boolean:True olvLists/Name:Width System.Int32:80 olvLists/Name:LastDisplayIndex System.Int32:-1 olvLists/Applications:Visibility System.Boolean:True olvLists/Applications:Width System.Int32:80 olvLists/Applications:LastDisplayIndex System.Int32:-1 olvLists/LastSortColumn System.String:Name olvLists/LastSortOrder System.Int32:0 ChooseAppsToInstallDialog/ListsView System.Int32:4 olvJobs/proto:Visibility System.Boolean:True olvJobs/proto:Width System.Int32:60 olvJobs/proto:LastDisplayIndex System.Int32:11 CopyFileInstructionDialog/Size System.Drawing.Size:402,163 olvJobs/bytes:Visibility System.Boolean:True olvJobs/bytes:Width System.Int32:71 olvJobs/bytes:LastDisplayIndex System.Int32:7 olvJobs/hashExtVar:Visibility System.Boolean:True olvJobs/hashExtVar:Width System.Int32:60 olvJobs/hashExtVar:LastDisplayIndex System.Int32:23 olvJobs/hashInternal:Visibility System.Boolean:True olvJobs/hashInternal:Width System.Int32:60 olvJobs/hashInternal:LastDisplayIndex System.Int32:19 olvJobs/hashExternal:Visibility System.Boolean:True olvJobs/hashExternal:Width System.Int32:60 olvJobs/hashExternal:LastDisplayIndex System.Int32:20 olvJobs/checksum64:Visibility System.Boolean:True olvJobs/checksum64:Width System.Int32:33 olvJobs/checksum64:LastDisplayIndex System.Int32:21 chocopkgup {nopush} --packagename={appname} --version={version} --pg="{packageGuid}" --url="{preupdate-url}" --urlx64="{url64}" --packagepath="{file}" --checksum="{checksum}" --c64="{checksumx64}" --debug //////////////////////////////////////////////////////////////////////////////////////// /// version 6.5 /// /// FIX: do not re-push package if package already created /// // REQUIRES: // global vars: workdir=corresponds to download location of installer file // app vars: nopush, checksum64file=corresponds to 64 bit install file // file vars: same as specified by chocopkgup string varCScript = app.Variables.ReplaceAllInString("{cscript}"); if ((varCScript == "1") || (varCScript == "2")) { string varAppname = app.Variables.ReplaceAllInString("{appname}"); string varVersion = app.Variables.ReplaceAllInString("{version}"); string varChocoPkgOutput = System.IO.Path.Combine(app.Variables.ReplaceAllInString("{autoPackagesFolder}"), "_output"); string varChecksum = app.Variables.ReplaceAllInString("{checksum}"); string varChecksumx64 = app.Variables.ReplaceAllInString("{checksumx64}"); string varChecksum64File = app.Variables.ReplaceAllInString("{checksum64file}"); string varChecksum64basefile = app.Variables.ReplaceAllInString("{checksum64file:basefile}"); string varChecksum64ext = app.Variables.ReplaceAllInString("{checksum64file:ext}"); string varWorkdir = app.Variables.ReplaceAllInString("{workdir}"); string saveFileName64 = String.Concat(varChecksum64basefile, ".", varChecksum64ext); // equivalent to ketarin variable "{file}" //string savePath = app.PreviousLocation; string savePath = app.PreviousLocation; string pkgPath = Path.Combine(varChocoPkgOutput, varAppname, varVersion); if (!System.IO.Directory.Exists(pkgPath)) { pkgPath = Path.Combine(varChocoPkgOutput, varAppname); } string fileNameNuspec = String.Concat(varAppname, ".nuspec"); string fileUriNuspec = Path.Combine(pkgPath, fileNameNuspec); string fileNameNupkg = String.Concat(varAppname, ".", varVersion, ".nupkg"); string fileUriNupkg = Path.Combine(pkgPath, fileNameNupkg); // do not re-push package if package already created DateTime today = DateTime.Today; DateTime pkgCreateDate = File.GetCreationTime(pkgPath); if (today > pkgCreateDate) { return; } if (varChecksum == "{checksum}") { // calculate SHA1 System.IO.FileStream fileSha1 = new System.IO.FileStream(savePath, System.IO.FileMode.Open); System.Security.Cryptography.SHA1 sha1 = new System.Security.Cryptography.SHA1CryptoServiceProvider(); byte[] retValSha1 = sha1.ComputeHash(fileSha1); fileSha1.Close(); // create a string System.Text.StringBuilder sbSha1 = new System.Text.StringBuilder(); for (int i = 0; i < retValSha1.Length; i++) { sbSha1.Append(retValSha1[i].ToString("x2")); } string replaceChecksum = sbSha1.ToString(); List<string> fileList = new List<string>(Directory.GetFiles(pkgPath, "*.ps1", SearchOption.AllDirectories)); string[] filesNuspec = Directory.GetFiles(pkgPath, "*.nuspec", SearchOption.AllDirectories); fileList.AddRange(filesNuspec); string[] files = fileList.ToArray(); foreach (string file in files) { try { string contents = File.ReadAllText(file); contents = contents.Replace("{checksum}", replaceChecksum); // Make files writable // File.SetAttributes(file, FileAttributes.Normal); File.WriteAllText(file, contents); } catch (Exception ex) { Console.WriteLine(ex.Message); } } } // only get checksum if {checksum64file} exists and points to a downloadable file if (varChecksumx64 == "{checksumx64}" && varChecksum64File != "{checksum64file}") { string savePath64 = Path.Combine(varWorkdir, saveFileName64); System.Net.WebClient webClient = new System.Net.WebClient(); webClient.DownloadFile(varChecksum64File, savePath64); // calculate SHA1 System.IO.FileStream file64Sha1 = new System.IO.FileStream(savePath64, System.IO.FileMode.Open); System.Security.Cryptography.SHA1 sha164 = new System.Security.Cryptography.SHA1CryptoServiceProvider(); byte[] retVal64Sha1 = sha164.ComputeHash(file64Sha1); file64Sha1.Close(); // create a string System.Text.StringBuilder sb64Sha1 = new System.Text.StringBuilder(); for (int i = 0; i < retVal64Sha1.Length; i++) { sb64Sha1.Append(retVal64Sha1[i].ToString("x2")); } string replace64Checksum = sb64Sha1.ToString(); List<string> fileList = new List<string>(Directory.GetFiles(pkgPath, "*.ps1", SearchOption.AllDirectories)); string[] filesNuspec = Directory.GetFiles(pkgPath, "*.nuspec", SearchOption.AllDirectories); fileList.AddRange(filesNuspec); string[] files = fileList.ToArray(); foreach (string file in files) { try { string contents = File.ReadAllText(file); contents = contents.Replace("{checksumx64}", replace64Checksum); File.WriteAllText(file, contents); } catch (Exception ex) { Console.WriteLine(ex.Message); } } } int checkBeta = varVersion.Split('-').Length; if ( checkBeta == 2) { string strPre = varVersion.Split('-')[1]; string strReplace = String.Concat(strPre, "</version>"); string strCheck = String.Concat(".", DateTime.Now.ToString("yyyyMMdd"), "</version>"); string[] fileNuspec = Directory.GetFiles(pkgPath, "*.nuspec", SearchOption.AllDirectories); foreach (string file in fileNuspec) { string contents = File.ReadAllText(file); contents = contents.Replace(strCheck, strReplace); File.WriteAllText(file, contents); } } // delete existing nupkg made by chocopkgup; we leverage chocopkgup to create the structure/files in destination System.Diagnostics.Process process1 = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo proc1 = new System.Diagnostics.ProcessStartInfo(); proc1.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; proc1.UseShellExecute = true; proc1.WorkingDirectory = pkgPath; proc1.FileName = "cmd.exe"; proc1.Arguments = "/c "+"del /f " + fileUriNupkg; process1.StartInfo = proc1; process1.Start(); // create a new nupkg System.Diagnostics.Process process2 = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo proc2 = new System.Diagnostics.ProcessStartInfo(); proc2.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; proc2.UseShellExecute = true; proc2.WorkingDirectory = pkgPath; proc2.FileName = "cmd.exe"; proc2.Arguments = "/c "+"choco pack "+fileUriNuspec+" -d"; process2.StartInfo = proc2; process2.Start(); // push the nupkg if (varCScript == "2") { System.Diagnostics.Process process3 = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo proc3 = new System.Diagnostics.ProcessStartInfo(); proc3.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; proc3.UseShellExecute = true; proc3.WorkingDirectory = pkgPath; proc3.FileName = "cmd.exe"; // find nupkg in pkgPath string[] pushPkg = Directory.GetFiles(pkgPath, "*.nupkg", SearchOption.TopDirectoryOnly); foreach (String file in pushPkg) { proc3.Arguments = "/c "+"cpush " + file + " -d"; } process3.StartInfo = proc3; System.Threading.Thread.Sleep(2000); process3.Start(); } }