mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Code cleanup
This commit is contained in:
@@ -13,8 +13,7 @@ public partial class App : Application
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) {
|
||||
desktop.MainWindow = new MainWindow();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Threading;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Avalonia;
|
||||
using System;
|
||||
using System;
|
||||
using Avalonia;
|
||||
using Velopack;
|
||||
|
||||
namespace AvaloniaCrossPlat;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Amazon;
|
||||
using Amazon.S3;
|
||||
using Amazon.S3.Model;
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Velopack.Sources;
|
||||
using Velopack.Packaging;
|
||||
|
||||
namespace Velopack.Deployment;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NuGet.Versioning;
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NuGet.Versioning;
|
||||
|
||||
namespace Velopack.Packaging.OSX.Commands;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Velopack.NuGet;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Velopack.Packaging.Windows.Commands;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NuGet.Versioning;
|
||||
using Velopack.NuGet;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Velopack.Packaging.Commands
|
||||
namespace Velopack.Packaging.Commands
|
||||
{
|
||||
public class DeltaGenOptions
|
||||
{
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Velopack.Compression;
|
||||
|
||||
namespace Velopack.Packaging.Commands
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Velopack.Packaging.Commands
|
||||
namespace Velopack.Packaging.Commands
|
||||
{
|
||||
public class DeltaPatchOptions
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Text;
|
||||
using Velopack.Compression;
|
||||
using System.IO.MemoryMappedFiles;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.IO.MemoryMappedFiles;
|
||||
using Velopack.Compression;
|
||||
|
||||
namespace Velopack.Packaging;
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Velopack.Packaging;
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Velopack.Packaging
|
||||
{
|
||||
|
||||
@@ -161,8 +161,7 @@ public class Markdown
|
||||
/// <summary>
|
||||
/// use ">" for HTML output, or " />" for XHTML output
|
||||
/// </summary>
|
||||
public string EmptyElementSuffix
|
||||
{
|
||||
public string EmptyElementSuffix {
|
||||
get { return _emptyElementSuffix; }
|
||||
set { _emptyElementSuffix = value; }
|
||||
}
|
||||
@@ -172,8 +171,7 @@ public class Markdown
|
||||
/// when false, email addresses will never be auto-linked
|
||||
/// WARNING: this is a significant deviation from the markdown spec
|
||||
/// </summary>
|
||||
public bool LinkEmails
|
||||
{
|
||||
public bool LinkEmails {
|
||||
get { return _linkEmails; }
|
||||
set { _linkEmails = value; }
|
||||
}
|
||||
@@ -183,8 +181,7 @@ public class Markdown
|
||||
/// when true, bold and italic require non-word characters on either side
|
||||
/// WARNING: this is a significant deviation from the markdown spec
|
||||
/// </summary>
|
||||
public bool StrictBoldItalic
|
||||
{
|
||||
public bool StrictBoldItalic {
|
||||
get { return _strictBoldItalic; }
|
||||
set { _strictBoldItalic = value; }
|
||||
}
|
||||
@@ -194,8 +191,7 @@ public class Markdown
|
||||
/// when true, RETURN becomes a literal newline
|
||||
/// WARNING: this is a significant deviation from the markdown spec
|
||||
/// </summary>
|
||||
public bool AutoNewLines
|
||||
{
|
||||
public bool AutoNewLines {
|
||||
get { return _autoNewlines; }
|
||||
set { _autoNewlines = value; }
|
||||
}
|
||||
@@ -205,8 +201,7 @@ public class Markdown
|
||||
/// when true, (most) bare plain URLs are auto-hyperlinked
|
||||
/// WARNING: this is a significant deviation from the markdown spec
|
||||
/// </summary>
|
||||
public bool AutoHyperlink
|
||||
{
|
||||
public bool AutoHyperlink {
|
||||
get { return _autoHyperlink; }
|
||||
set { _autoHyperlink = value; }
|
||||
}
|
||||
@@ -216,8 +211,7 @@ public class Markdown
|
||||
/// when true, problematic URL characters like [, ], (, and so forth will be encoded
|
||||
/// WARNING: this is a significant deviation from the markdown spec
|
||||
/// </summary>
|
||||
public bool EncodeProblemUrlCharacters
|
||||
{
|
||||
public bool EncodeProblemUrlCharacters {
|
||||
get { return _encodeProblemUrlCharacters; }
|
||||
set { _encodeProblemUrlCharacters = value; }
|
||||
}
|
||||
@@ -276,8 +270,7 @@ public class Markdown
|
||||
|
||||
string backslashPattern = "";
|
||||
|
||||
foreach (char c in @"\`*_{}[]()>#+-.!/")
|
||||
{
|
||||
foreach (char c in @"\`*_{}[]()>#+-.!/") {
|
||||
string key = c.ToString();
|
||||
string hash = GetHashKey(key, isHtmlBlock: false);
|
||||
_escapeTable.Add(key, hash);
|
||||
@@ -293,8 +286,7 @@ public class Markdown
|
||||
/// current version of MarkdownSharp;
|
||||
/// see http://code.google.com/p/markdownsharp/ for the latest code or to contribute
|
||||
/// </summary>
|
||||
public string Version
|
||||
{
|
||||
public string Version {
|
||||
get { return _version; }
|
||||
}
|
||||
|
||||
@@ -391,20 +383,15 @@ public class Markdown
|
||||
// split on two or more newlines
|
||||
string[] grafs = _newlinesMultiple.Split(_newlinesLeadingTrailing.Replace(text, ""));
|
||||
|
||||
for (int i = 0; i < grafs.Length; i++)
|
||||
{
|
||||
if (grafs[i].StartsWith("\x1AH"))
|
||||
{
|
||||
for (int i = 0; i < grafs.Length; i++) {
|
||||
if (grafs[i].StartsWith("\x1AH")) {
|
||||
// unhashify HTML blocks
|
||||
if (unhash)
|
||||
{
|
||||
if (unhash) {
|
||||
int sanityCheck = 50; // just for safety, guard against an infinite loop
|
||||
bool keepGoing = true; // as long as replacements where made, keep going
|
||||
while (keepGoing && sanityCheck > 0)
|
||||
{
|
||||
while (keepGoing && sanityCheck > 0) {
|
||||
keepGoing = false;
|
||||
grafs[i] = _htmlBlockHash.Replace(grafs[i], match =>
|
||||
{
|
||||
grafs[i] = _htmlBlockHash.Replace(grafs[i], match => {
|
||||
keepGoing = true;
|
||||
return _htmlBlocks[match.Value];
|
||||
});
|
||||
@@ -417,9 +404,7 @@ public class Markdown
|
||||
// with the input that caused it.
|
||||
}*/
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// do span level processing inside the block, then wrap result in <p> tags
|
||||
grafs[i] = _leadingWhitespace.Replace(RunSpanGamut(grafs[i]), "<p>") + "</p>";
|
||||
}
|
||||
@@ -700,7 +685,7 @@ public class Markdown
|
||||
private static string GetHashKey(string s, bool isHtmlBlock)
|
||||
{
|
||||
var delim = isHtmlBlock ? 'H' : 'E';
|
||||
return "\x1A" + delim + Math.Abs(s.GetHashCode()).ToString() + delim;
|
||||
return "\x1A" + delim + Math.Abs(s.GetHashCode()).ToString() + delim;
|
||||
}
|
||||
|
||||
private static Regex _htmlTokens = new Regex(@"
|
||||
@@ -726,8 +711,7 @@ public class Markdown
|
||||
|
||||
// this regex is derived from the _tokenize() subroutine in Brad Choate's MTRegex plugin.
|
||||
// http://www.bradchoate.com/past/mtregex.php
|
||||
foreach (Match m in _htmlTokens.Matches(text))
|
||||
{
|
||||
foreach (Match m in _htmlTokens.Matches(text)) {
|
||||
tagStart = m.Index;
|
||||
|
||||
if (pos < tagStart)
|
||||
@@ -824,24 +808,21 @@ public class Markdown
|
||||
if (linkID == "")
|
||||
linkID = linkText.ToLowerInvariant();
|
||||
|
||||
if (_urls.ContainsKey(linkID))
|
||||
{
|
||||
if (_urls.ContainsKey(linkID)) {
|
||||
string url = _urls[linkID];
|
||||
|
||||
url = EncodeProblemUrlChars(url);
|
||||
url = EscapeBoldItalic(url);
|
||||
result = "<a href=\"" + url + "\"";
|
||||
|
||||
if (_titles.ContainsKey(linkID))
|
||||
{
|
||||
if (_titles.ContainsKey(linkID)) {
|
||||
string title = AttributeEncode(_titles[linkID]);
|
||||
title = AttributeEncode(EscapeBoldItalic(title));
|
||||
result += " title=\"" + title + "\"";
|
||||
}
|
||||
|
||||
result += ">" + linkText + "</a>";
|
||||
}
|
||||
else
|
||||
} else
|
||||
result = wholeMatch;
|
||||
|
||||
return result;
|
||||
@@ -855,24 +836,21 @@ public class Markdown
|
||||
|
||||
string result;
|
||||
|
||||
if (_urls.ContainsKey(linkID))
|
||||
{
|
||||
if (_urls.ContainsKey(linkID)) {
|
||||
string url = _urls[linkID];
|
||||
|
||||
url = EncodeProblemUrlChars(url);
|
||||
url = EscapeBoldItalic(url);
|
||||
result = "<a href=\"" + url + "\"";
|
||||
|
||||
if (_titles.ContainsKey(linkID))
|
||||
{
|
||||
if (_titles.ContainsKey(linkID)) {
|
||||
string title = AttributeEncode(_titles[linkID]);
|
||||
title = EscapeBoldItalic(title);
|
||||
result += " title=\"" + title + "\"";
|
||||
}
|
||||
|
||||
result += ">" + linkText + "</a>";
|
||||
}
|
||||
else
|
||||
} else
|
||||
result = wholeMatch;
|
||||
|
||||
return result;
|
||||
@@ -893,8 +871,7 @@ public class Markdown
|
||||
|
||||
result = string.Format("<a href=\"{0}\"", url);
|
||||
|
||||
if (!String.IsNullOrEmpty(title))
|
||||
{
|
||||
if (!String.IsNullOrEmpty(title)) {
|
||||
title = AttributeEncode(title);
|
||||
title = EscapeBoldItalic(title);
|
||||
result += string.Format(" title=\"{0}\"", title);
|
||||
@@ -978,8 +955,7 @@ public class Markdown
|
||||
if (linkID == "")
|
||||
linkID = altText.ToLowerInvariant();
|
||||
|
||||
if (_urls.ContainsKey(linkID))
|
||||
{
|
||||
if (_urls.ContainsKey(linkID)) {
|
||||
string url = _urls[linkID];
|
||||
string title = null;
|
||||
|
||||
@@ -987,9 +963,7 @@ public class Markdown
|
||||
title = _titles[linkID];
|
||||
|
||||
return ImageTag(url, altText, title);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// If there's no such link ID, leave intact:
|
||||
return wholeMatch;
|
||||
}
|
||||
@@ -1013,8 +987,7 @@ public class Markdown
|
||||
url = EncodeProblemUrlChars(url);
|
||||
url = EscapeBoldItalic(url);
|
||||
var result = string.Format("<img src=\"{0}\" alt=\"{1}\"", url, altText);
|
||||
if (!String.IsNullOrEmpty(title))
|
||||
{
|
||||
if (!String.IsNullOrEmpty(title)) {
|
||||
title = AttributeEncode(EscapeBoldItalic(title));
|
||||
result += string.Format(" title=\"{0}\"", title);
|
||||
}
|
||||
@@ -1146,17 +1119,16 @@ public class Markdown
|
||||
|
||||
private MatchEvaluator GetListEvaluator(bool isInsideParagraphlessListItem = false)
|
||||
{
|
||||
return new MatchEvaluator(match =>
|
||||
{
|
||||
string list = match.Groups[1].Value;
|
||||
string listType = Regex.IsMatch(match.Groups[3].Value, _markerUL) ? "ul" : "ol";
|
||||
string result;
|
||||
return new MatchEvaluator(match => {
|
||||
string list = match.Groups[1].Value;
|
||||
string listType = Regex.IsMatch(match.Groups[3].Value, _markerUL) ? "ul" : "ol";
|
||||
string result;
|
||||
|
||||
result = ProcessListItems(list, listType == "ul" ? _markerUL : _markerOL, isInsideParagraphlessListItem);
|
||||
result = ProcessListItems(list, listType == "ul" ? _markerUL : _markerOL, isInsideParagraphlessListItem);
|
||||
|
||||
result = string.Format("<{0}>\n{1}</{0}>\n", listType, result);
|
||||
return result;
|
||||
});
|
||||
result = string.Format("<{0}>\n{1}</{0}>\n", listType, result);
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1201,8 +1173,7 @@ public class Markdown
|
||||
bool lastItemHadADoubleNewline = false;
|
||||
|
||||
// has to be a closure, so subsequent invocations can share the bool
|
||||
MatchEvaluator ListItemEvaluator = (Match match) =>
|
||||
{
|
||||
MatchEvaluator ListItemEvaluator = (Match match) => {
|
||||
string item = match.Groups[3].Value;
|
||||
|
||||
bool endsWithDoubleNewline = item.EndsWith("\n\n");
|
||||
@@ -1211,8 +1182,7 @@ public class Markdown
|
||||
if (containsDoubleNewline || lastItemHadADoubleNewline)
|
||||
// we could correct any bad indentation here..
|
||||
item = RunBlockGamut(Outdent(item) + "\n", unhash: false);
|
||||
else
|
||||
{
|
||||
else {
|
||||
// recursion for sub-lists
|
||||
item = DoLists(Outdent(item), isInsideParagraphlessListItem: true);
|
||||
item = item.TrimEnd('\n');
|
||||
@@ -1327,13 +1297,10 @@ public class Markdown
|
||||
{
|
||||
|
||||
// <strong> must go first, then <em>
|
||||
if (_strictBoldItalic)
|
||||
{
|
||||
if (_strictBoldItalic) {
|
||||
text = _strictBold.Replace(text, "$1<strong>$3</strong>");
|
||||
text = _strictItalic.Replace(text, "$1<em>$3</em>");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
text = _bold.Replace(text, "<strong>$2</strong>");
|
||||
text = _italic.Replace(text, "<em>$2</em>");
|
||||
}
|
||||
@@ -1418,30 +1385,23 @@ public class Markdown
|
||||
if (!link.EndsWith(")"))
|
||||
return "<" + protocol + link + ">";
|
||||
var level = 0;
|
||||
foreach (Match c in Regex.Matches(link, "[()]"))
|
||||
{
|
||||
if (c.Value == "(")
|
||||
{
|
||||
foreach (Match c in Regex.Matches(link, "[()]")) {
|
||||
if (c.Value == "(") {
|
||||
if (level <= 0)
|
||||
level = 1;
|
||||
else
|
||||
level++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
level--;
|
||||
}
|
||||
}
|
||||
var tail = "";
|
||||
if (level < 0)
|
||||
{
|
||||
if (level < 0) {
|
||||
link = Regex.Replace(link, @"\){1," + (-level) + "}$", m => { tail = m.Value; return ""; });
|
||||
}
|
||||
if (tail.Length > 0)
|
||||
{
|
||||
if (tail.Length > 0) {
|
||||
var lastChar = link[link.Length - 1];
|
||||
if (!_endCharRegex.IsMatch(lastChar.ToString()))
|
||||
{
|
||||
if (!_endCharRegex.IsMatch(lastChar.ToString())) {
|
||||
tail = lastChar + tail;
|
||||
link = link.Substring(0, link.Length - 1);
|
||||
}
|
||||
@@ -1458,8 +1418,7 @@ public class Markdown
|
||||
private string DoAutoLinks(string text)
|
||||
{
|
||||
|
||||
if (_autoHyperlink)
|
||||
{
|
||||
if (_autoHyperlink) {
|
||||
// fixup arbitrary URLs by adding Markdown < > so they get linked as well
|
||||
// note that at this point, all other URL in the text are already hyperlinked as <a href=""></a>
|
||||
// *except* for the <http://www.foo.com> case
|
||||
@@ -1469,8 +1428,7 @@ public class Markdown
|
||||
// Hyperlinks: <http://foo.com>
|
||||
text = Regex.Replace(text, "<((https?|ftp):[^'\">\\s]+)>", new MatchEvaluator(HyperlinkEvaluator));
|
||||
|
||||
if (_linkEmails)
|
||||
{
|
||||
if (_linkEmails) {
|
||||
// Email addresses: <address@domain.foo>
|
||||
string pattern =
|
||||
@"<
|
||||
@@ -1548,15 +1506,14 @@ public class Markdown
|
||||
var sb = new StringBuilder(addr.Length * 5);
|
||||
var rand = new Random();
|
||||
int r;
|
||||
foreach (char c in addr)
|
||||
{
|
||||
foreach (char c in addr) {
|
||||
r = rand.Next(1, 100);
|
||||
if ((r > 90 || c == ':') && c != '@')
|
||||
sb.Append(c); // m
|
||||
else if (r < 45)
|
||||
sb.AppendFormat("&#x{0:x};", (int)c); // m
|
||||
sb.AppendFormat("&#x{0:x};", (int) c); // m
|
||||
else
|
||||
sb.AppendFormat("&#{0};", (int)c); // m
|
||||
sb.AppendFormat("&#{0};", (int) c); // m
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
@@ -1572,20 +1529,19 @@ public class Markdown
|
||||
}
|
||||
private string EncodeCodeEvaluator(Match match)
|
||||
{
|
||||
switch (match.Value)
|
||||
{
|
||||
// Encode all ampersands; HTML entities are not
|
||||
// entities within a Markdown code span.
|
||||
case "&":
|
||||
return "&";
|
||||
// Do the angle bracket song and dance
|
||||
case "<":
|
||||
return "<";
|
||||
case ">":
|
||||
return ">";
|
||||
// escape characters that are magic in Markdown
|
||||
default:
|
||||
return _escapeTable[match.Value];
|
||||
switch (match.Value) {
|
||||
// Encode all ampersands; HTML entities are not
|
||||
// entities within a Markdown code span.
|
||||
case "&":
|
||||
return "&";
|
||||
// Do the angle bracket song and dance
|
||||
case "<":
|
||||
return "<";
|
||||
case ">":
|
||||
return ">";
|
||||
// escape characters that are magic in Markdown
|
||||
default:
|
||||
return _escapeTable[match.Value];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1660,15 +1616,14 @@ public class Markdown
|
||||
bool encode;
|
||||
char c;
|
||||
|
||||
for (int i = 0; i < url.Length; i++)
|
||||
{
|
||||
for (int i = 0; i < url.Length; i++) {
|
||||
c = url[i];
|
||||
encode = Array.IndexOf(_problemUrlChars, c) != -1;
|
||||
if (encode && c == ':' && i < url.Length - 1)
|
||||
encode = !(url[i + 1] == '/') && !(url[i + 1] >= '0' && url[i + 1] <= '9');
|
||||
|
||||
if (encode)
|
||||
sb.Append("%" + String.Format("{0:x}", (byte)c));
|
||||
sb.Append("%" + String.Format("{0:x}", (byte) c));
|
||||
else
|
||||
sb.Append(c);
|
||||
}
|
||||
@@ -1691,12 +1646,10 @@ public class Markdown
|
||||
// now, rebuild text from the tokens
|
||||
var sb = new StringBuilder(text.Length);
|
||||
|
||||
foreach (var token in tokens)
|
||||
{
|
||||
foreach (var token in tokens) {
|
||||
string value = token.Value;
|
||||
|
||||
if (token.Type == TokenType.Tag)
|
||||
{
|
||||
if (token.Type == TokenType.Tag) {
|
||||
value = value.Replace(@"\", _escapeTable[@"\"]);
|
||||
|
||||
if (_autoHyperlink && value.StartsWith("<!")) // escape slashes in comments to prevent autolinking there -- http://meta.stackoverflow.com/questions/95987/html-comment-containing-url-breaks-if-followed-by-another-html-comment
|
||||
@@ -1724,34 +1677,31 @@ public class Markdown
|
||||
var line = new StringBuilder();
|
||||
bool valid = false;
|
||||
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
switch (text[i])
|
||||
{
|
||||
case '\n':
|
||||
for (int i = 0; i < text.Length; i++) {
|
||||
switch (text[i]) {
|
||||
case '\n':
|
||||
if (valid) output.Append(line);
|
||||
output.Append('\n');
|
||||
line.Length = 0; valid = false;
|
||||
break;
|
||||
case '\r':
|
||||
if ((i < text.Length - 1) && (text[i + 1] != '\n')) {
|
||||
if (valid) output.Append(line);
|
||||
output.Append('\n');
|
||||
line.Length = 0; valid = false;
|
||||
break;
|
||||
case '\r':
|
||||
if ((i < text.Length - 1) && (text[i + 1] != '\n'))
|
||||
{
|
||||
if (valid) output.Append(line);
|
||||
output.Append('\n');
|
||||
line.Length = 0; valid = false;
|
||||
}
|
||||
break;
|
||||
case '\t':
|
||||
int width = (_tabWidth - line.Length % _tabWidth);
|
||||
for (int k = 0; k < width; k++)
|
||||
line.Append(' ');
|
||||
break;
|
||||
case '\x1A':
|
||||
break;
|
||||
default:
|
||||
if (!valid && text[i] != ' ') valid = true;
|
||||
line.Append(text[i]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '\t':
|
||||
int width = (_tabWidth - line.Length % _tabWidth);
|
||||
for (int k = 0; k < width; k++)
|
||||
line.Append(' ');
|
||||
break;
|
||||
case '\x1A':
|
||||
break;
|
||||
default:
|
||||
if (!valid && text[i] != ' ') valid = true;
|
||||
line.Append(text[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using INugetLogger = NuGet.Common.ILogger;
|
||||
using NugetLogLevel = NuGet.Common.LogLevel;
|
||||
using INugetLogMessage = NuGet.Common.ILogMessage;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using NugetLogLevel = NuGet.Common.LogLevel;
|
||||
|
||||
namespace Velopack.Packaging;
|
||||
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NuGet.Versioning;
|
||||
using Velopack.Sources;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit;
|
||||
using Velopack.Packaging;
|
||||
using Velopack.Packaging;
|
||||
|
||||
namespace Velopack.Vpk.Commands
|
||||
{
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Velopack.Packaging;
|
||||
|
||||
namespace Velopack.Vpk.Commands
|
||||
namespace Velopack.Vpk.Commands
|
||||
{
|
||||
public class DeltaPatchCommand : BaseCommand
|
||||
{
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Velopack.Deployment;
|
||||
|
||||
namespace Velopack.Vpk.Commands;
|
||||
namespace Velopack.Vpk.Commands;
|
||||
|
||||
public class GitHubUploadCommand : GitHubBaseCommand
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using NuGet.Common;
|
||||
using NuGet.Versioning;
|
||||
using Velopack.NuGet;
|
||||
using Velopack.Windows;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
|
||||
using Velopack.Packaging;
|
||||
|
||||
namespace Velopack.Vpk.Commands;
|
||||
namespace Velopack.Vpk.Commands;
|
||||
|
||||
public class WindowsSigningCommand : PlatformCommand
|
||||
{
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Velopack.Packaging;
|
||||
using Velopack.Packaging;
|
||||
|
||||
namespace Velopack.Vpk.Commands
|
||||
{
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Velopack.Vpk.Commands
|
||||
namespace Velopack.Vpk.Commands
|
||||
{
|
||||
public abstract class PlatformCommand : OutputCommand
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Runtime.Versioning;
|
||||
using Velopack.Vpk.Commands;
|
||||
using Velopack.Deployment;
|
||||
using Velopack.Packaging.Commands;
|
||||
using Velopack.Packaging.OSX.Commands;
|
||||
using Velopack.Packaging.Windows.Commands;
|
||||
using Velopack.Vpk.Commands;
|
||||
|
||||
namespace Velopack.Vpk.Compat;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Runtime.Versioning;
|
||||
using Velopack.Vpk.Commands;
|
||||
using Velopack.Vpk.Commands;
|
||||
|
||||
namespace Velopack.Vpk.Compat;
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Serilog.Events;
|
||||
using Serilog;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Velopack.Vpk.Commands;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Velopack.Vpk.Updates;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
using Velopack.Vpk.Commands;
|
||||
using Velopack.Vpk.Compat;
|
||||
using System.CommandLine.Help;
|
||||
|
||||
namespace Velopack.Vpk;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Threading;
|
||||
using Velopack.Packaging;
|
||||
|
||||
namespace Velopack.Vpk.Updates;
|
||||
|
||||
|
||||
@@ -52,14 +52,10 @@ namespace Velopack.Compression
|
||||
// solve it, just buys us more space. The solution is to rewrite Split
|
||||
// using iteration instead of recursion, but that's Hard(tm).
|
||||
var ex = default(Exception);
|
||||
var t = new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var t = new Thread(() => {
|
||||
try {
|
||||
CreateInternal(oldData, newData, output);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
} catch (Exception exc) {
|
||||
ex = exc;
|
||||
}
|
||||
}, 40 * 1048576);
|
||||
@@ -112,8 +108,7 @@ namespace Velopack.Compression
|
||||
int eblen = 0;
|
||||
|
||||
using (WrappingStream wrappingStream = new WrappingStream(output, Ownership.None))
|
||||
using (var bz2Stream = new BZip2Stream(wrappingStream, CompressionMode.Compress, true))
|
||||
{
|
||||
using (var bz2Stream = new BZip2Stream(wrappingStream, CompressionMode.Compress, true)) {
|
||||
// compute the differences, writing ctrl as we go
|
||||
int scan = 0;
|
||||
int pos = 0;
|
||||
@@ -121,16 +116,13 @@ namespace Velopack.Compression
|
||||
int lastscan = 0;
|
||||
int lastpos = 0;
|
||||
int lastoffset = 0;
|
||||
while (scan < newData.Length)
|
||||
{
|
||||
while (scan < newData.Length) {
|
||||
int oldscore = 0;
|
||||
|
||||
for (int scsc = scan += len; scan < newData.Length; scan++)
|
||||
{
|
||||
for (int scsc = scan += len; scan < newData.Length; scan++) {
|
||||
len = Search(I, oldData, newData, scan, 0, oldData.Length, out pos);
|
||||
|
||||
for (; scsc < scan + len; scsc++)
|
||||
{
|
||||
for (; scsc < scan + len; scsc++) {
|
||||
if ((scsc + lastoffset < oldData.Length) && (oldData[scsc + lastoffset] == newData[scsc]))
|
||||
oldscore++;
|
||||
}
|
||||
@@ -142,54 +134,45 @@ namespace Velopack.Compression
|
||||
oldscore--;
|
||||
}
|
||||
|
||||
if (len != oldscore || scan == newData.Length)
|
||||
{
|
||||
if (len != oldscore || scan == newData.Length) {
|
||||
int s = 0;
|
||||
int sf = 0;
|
||||
int lenf = 0;
|
||||
for (int i = 0; (lastscan + i < scan) && (lastpos + i < oldData.Length); )
|
||||
{
|
||||
for (int i = 0; (lastscan + i < scan) && (lastpos + i < oldData.Length);) {
|
||||
if (oldData[lastpos + i] == newData[lastscan + i])
|
||||
s++;
|
||||
i++;
|
||||
if (s * 2 - i > sf * 2 - lenf)
|
||||
{
|
||||
if (s * 2 - i > sf * 2 - lenf) {
|
||||
sf = s;
|
||||
lenf = i;
|
||||
}
|
||||
}
|
||||
|
||||
int lenb = 0;
|
||||
if (scan < newData.Length)
|
||||
{
|
||||
if (scan < newData.Length) {
|
||||
s = 0;
|
||||
int sb = 0;
|
||||
for (int i = 1; (scan >= lastscan + i) && (pos >= i); i++)
|
||||
{
|
||||
for (int i = 1; (scan >= lastscan + i) && (pos >= i); i++) {
|
||||
if (oldData[pos - i] == newData[scan - i])
|
||||
s++;
|
||||
if (s * 2 - i > sb * 2 - lenb)
|
||||
{
|
||||
if (s * 2 - i > sb * 2 - lenb) {
|
||||
sb = s;
|
||||
lenb = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lastscan + lenf > scan - lenb)
|
||||
{
|
||||
if (lastscan + lenf > scan - lenb) {
|
||||
int overlap = (lastscan + lenf) - (scan - lenb);
|
||||
s = 0;
|
||||
int ss = 0;
|
||||
int lens = 0;
|
||||
for (int i = 0; i < overlap; i++)
|
||||
{
|
||||
for (int i = 0; i < overlap; i++) {
|
||||
if (newData[lastscan + lenf - overlap + i] == oldData[lastpos + lenf - overlap + i])
|
||||
s++;
|
||||
if (newData[scan - lenb + i] == oldData[pos - lenb + i])
|
||||
s--;
|
||||
if (s > ss)
|
||||
{
|
||||
if (s > ss) {
|
||||
ss = s;
|
||||
lens = i + 1;
|
||||
}
|
||||
@@ -200,7 +183,7 @@ namespace Velopack.Compression
|
||||
}
|
||||
|
||||
for (int i = 0; i < lenf; i++)
|
||||
db[dblen + i] = (byte)(newData[lastscan + i] - oldData[lastpos + i]);
|
||||
db[dblen + i] = (byte) (newData[lastscan + i] - oldData[lastpos + i]);
|
||||
for (int i = 0; i < (scan - lenb) - (lastscan + lenf); i++)
|
||||
eb[eblen + i] = newData[lastscan + lenf + i];
|
||||
|
||||
@@ -230,8 +213,7 @@ namespace Velopack.Compression
|
||||
|
||||
// write compressed diff data
|
||||
using (WrappingStream wrappingStream = new WrappingStream(output, Ownership.None))
|
||||
using (var bz2Stream = new BZip2Stream(wrappingStream, CompressionMode.Compress, true))
|
||||
{
|
||||
using (var bz2Stream = new BZip2Stream(wrappingStream, CompressionMode.Compress, true)) {
|
||||
bz2Stream.Write(db, 0, dblen);
|
||||
}
|
||||
|
||||
@@ -240,11 +222,9 @@ namespace Velopack.Compression
|
||||
WriteInt64(diffEndPosition - controlEndPosition, header, 16);
|
||||
|
||||
// write compressed extra data, if any
|
||||
if (eblen > 0)
|
||||
{
|
||||
if (eblen > 0) {
|
||||
using (WrappingStream wrappingStream = new WrappingStream(output, Ownership.None))
|
||||
using (var bz2Stream = new BZip2Stream(wrappingStream, CompressionMode.Compress, true))
|
||||
{
|
||||
using (var bz2Stream = new BZip2Stream(wrappingStream, CompressionMode.Compress, true)) {
|
||||
bz2Stream.Write(eb, 0, eblen);
|
||||
}
|
||||
}
|
||||
@@ -290,8 +270,7 @@ namespace Velopack.Compression
|
||||
*/
|
||||
// read header
|
||||
long controlLength, diffLength, newSize;
|
||||
using (Stream patchStream = openPatchStream())
|
||||
{
|
||||
using (Stream patchStream = openPatchStream()) {
|
||||
// check patch stream capabilities
|
||||
if (!patchStream.CanRead)
|
||||
throw new ArgumentException("Patch stream must be readable.", "openPatchStream");
|
||||
@@ -321,8 +300,7 @@ namespace Velopack.Compression
|
||||
// prepare to read three parts of the patch in parallel
|
||||
using (Stream compressedControlStream = openPatchStream())
|
||||
using (Stream compressedDiffStream = openPatchStream())
|
||||
using (Stream compressedExtraStream = openPatchStream())
|
||||
{
|
||||
using (Stream compressedExtraStream = openPatchStream()) {
|
||||
// seek to the start of each part
|
||||
compressedControlStream.Seek(c_headerSize, SeekOrigin.Current);
|
||||
compressedDiffStream.Seek(c_headerSize + controlLength, SeekOrigin.Current);
|
||||
@@ -334,18 +312,15 @@ namespace Velopack.Compression
|
||||
// decompress each part (to read it)
|
||||
using (var controlStream = new BZip2Stream(compressedControlStream, CompressionMode.Decompress, true))
|
||||
using (var diffStream = new BZip2Stream(compressedDiffStream, CompressionMode.Decompress, true))
|
||||
using (var extraStream = hasExtraData ? new BZip2Stream(compressedExtraStream, CompressionMode.Decompress, true) : null)
|
||||
{
|
||||
using (var extraStream = hasExtraData ? new BZip2Stream(compressedExtraStream, CompressionMode.Decompress, true) : null) {
|
||||
long[] control = new long[3];
|
||||
byte[] buffer = new byte[8];
|
||||
|
||||
int oldPosition = 0;
|
||||
int newPosition = 0;
|
||||
while (newPosition < newSize)
|
||||
{
|
||||
while (newPosition < newSize) {
|
||||
// read control data
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int i = 0; i < 3; i++) {
|
||||
controlStream.ReadExactly(buffer, 0, 8);
|
||||
control[i] = ReadInt64(buffer, 0);
|
||||
}
|
||||
@@ -357,16 +332,15 @@ namespace Velopack.Compression
|
||||
// seek old file to the position that the new data is diffed against
|
||||
input.Position = oldPosition;
|
||||
|
||||
int bytesToCopy = (int)control[0];
|
||||
while (bytesToCopy > 0)
|
||||
{
|
||||
int bytesToCopy = (int) control[0];
|
||||
while (bytesToCopy > 0) {
|
||||
int actualBytesToCopy = Math.Min(bytesToCopy, c_bufferSize);
|
||||
|
||||
// read diff string
|
||||
diffStream.ReadExactly(newData, 0, actualBytesToCopy);
|
||||
|
||||
// add old data to diff string
|
||||
int availableInputBytes = Math.Min(actualBytesToCopy, (int)(input.Length - input.Position));
|
||||
int availableInputBytes = Math.Min(actualBytesToCopy, (int) (input.Length - input.Position));
|
||||
input.ReadExactly(oldData, 0, availableInputBytes);
|
||||
|
||||
for (int index = 0; index < availableInputBytes; index++)
|
||||
@@ -385,9 +359,8 @@ namespace Velopack.Compression
|
||||
throw new InvalidOperationException("Corrupt patch.");
|
||||
|
||||
// read extra string
|
||||
bytesToCopy = (int)control[1];
|
||||
while (bytesToCopy > 0)
|
||||
{
|
||||
bytesToCopy = (int) control[1];
|
||||
while (bytesToCopy > 0) {
|
||||
int actualBytesToCopy = Math.Min(bytesToCopy, c_bufferSize);
|
||||
|
||||
extraStream.ReadExactly(newData, 0, actualBytesToCopy);
|
||||
@@ -398,7 +371,7 @@ namespace Velopack.Compression
|
||||
}
|
||||
|
||||
// adjust position
|
||||
oldPosition = (int)(oldPosition + control[2]);
|
||||
oldPosition = (int) (oldPosition + control[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -406,8 +379,7 @@ namespace Velopack.Compression
|
||||
|
||||
private static int CompareBytes(byte[] left, int leftOffset, byte[] right, int rightOffset)
|
||||
{
|
||||
for (int index = 0; index < left.Length - leftOffset && index < right.Length - rightOffset; index++)
|
||||
{
|
||||
for (int index = 0; index < left.Length - leftOffset && index < right.Length - rightOffset; index++) {
|
||||
int diff = left[index + leftOffset] - right[index + rightOffset];
|
||||
if (diff != 0)
|
||||
return diff;
|
||||
@@ -418,8 +390,7 @@ namespace Velopack.Compression
|
||||
private static int MatchLength(byte[] oldData, int oldOffset, byte[] newData, int newOffset)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < oldData.Length - oldOffset && i < newData.Length - newOffset; i++)
|
||||
{
|
||||
for (i = 0; i < oldData.Length - oldOffset && i < newData.Length - newOffset; i++) {
|
||||
if (oldData[i + oldOffset] != newData[i + newOffset])
|
||||
break;
|
||||
}
|
||||
@@ -428,24 +399,18 @@ namespace Velopack.Compression
|
||||
|
||||
private static int Search(int[] I, byte[] oldData, byte[] newData, int newOffset, int start, int end, out int pos)
|
||||
{
|
||||
if (end - start < 2)
|
||||
{
|
||||
if (end - start < 2) {
|
||||
int startLength = MatchLength(oldData, I[start], newData, newOffset);
|
||||
int endLength = MatchLength(oldData, I[end], newData, newOffset);
|
||||
|
||||
if (startLength > endLength)
|
||||
{
|
||||
if (startLength > endLength) {
|
||||
pos = I[start];
|
||||
return startLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
pos = I[end];
|
||||
return endLength;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
int midPoint = start + (end - start) / 2;
|
||||
return CompareBytes(oldData, I[midPoint], newData, newOffset) < 0 ?
|
||||
Search(I, oldData, newData, newOffset, midPoint, end, out pos) :
|
||||
@@ -455,22 +420,17 @@ namespace Velopack.Compression
|
||||
|
||||
private static void Split(int[] I, int[] v, int start, int len, int h)
|
||||
{
|
||||
if (len < 16)
|
||||
{
|
||||
if (len < 16) {
|
||||
int j;
|
||||
for (int k = start; k < start + len; k += j)
|
||||
{
|
||||
for (int k = start; k < start + len; k += j) {
|
||||
j = 1;
|
||||
int x = v[I[k] + h];
|
||||
for (int i = 1; k + i < start + len; i++)
|
||||
{
|
||||
if (v[I[k + i] + h] < x)
|
||||
{
|
||||
for (int i = 1; k + i < start + len; i++) {
|
||||
if (v[I[k + i] + h] < x) {
|
||||
x = v[I[k + i] + h];
|
||||
j = 0;
|
||||
}
|
||||
if (v[I[k + i] + h] == x)
|
||||
{
|
||||
if (v[I[k + i] + h] == x) {
|
||||
Swap(ref I[k + j], ref I[k + i]);
|
||||
j++;
|
||||
}
|
||||
@@ -480,14 +440,11 @@ namespace Velopack.Compression
|
||||
if (j == 1)
|
||||
I[k] = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
int x = v[I[start + len / 2] + h];
|
||||
int jj = 0;
|
||||
int kk = 0;
|
||||
for (int i2 = start; i2 < start + len; i2++)
|
||||
{
|
||||
for (int i2 = start; i2 < start + len; i2++) {
|
||||
if (v[I[i2] + h] < x)
|
||||
jj++;
|
||||
if (v[I[i2] + h] == x)
|
||||
@@ -499,32 +456,22 @@ namespace Velopack.Compression
|
||||
int i = start;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
while (i < jj)
|
||||
{
|
||||
if (v[I[i] + h] < x)
|
||||
{
|
||||
while (i < jj) {
|
||||
if (v[I[i] + h] < x) {
|
||||
i++;
|
||||
}
|
||||
else if (v[I[i] + h] == x)
|
||||
{
|
||||
} else if (v[I[i] + h] == x) {
|
||||
Swap(ref I[i], ref I[jj + j]);
|
||||
j++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Swap(ref I[i], ref I[kk + k]);
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
while (jj + j < kk)
|
||||
{
|
||||
if (v[I[jj + j] + h] == x)
|
||||
{
|
||||
while (jj + j < kk) {
|
||||
if (v[I[jj + j] + h] == x) {
|
||||
j++;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Swap(ref I[jj + j], ref I[kk + k]);
|
||||
k++;
|
||||
}
|
||||
@@ -563,26 +510,20 @@ namespace Velopack.Compression
|
||||
for (int i = 0; i < oldData.Length; i++)
|
||||
v[i] = buckets[oldData[i]];
|
||||
|
||||
for (int i = 1; i < 256; i++)
|
||||
{
|
||||
for (int i = 1; i < 256; i++) {
|
||||
if (buckets[i] == buckets[i - 1] + 1)
|
||||
I[buckets[i]] = -1;
|
||||
}
|
||||
I[0] = -1;
|
||||
|
||||
for (int h = 1; I[0] != -(oldData.Length + 1); h += h)
|
||||
{
|
||||
for (int h = 1; I[0] != -(oldData.Length + 1); h += h) {
|
||||
int len = 0;
|
||||
int i = 0;
|
||||
while (i < oldData.Length + 1)
|
||||
{
|
||||
if (I[i] < 0)
|
||||
{
|
||||
while (i < oldData.Length + 1) {
|
||||
if (I[i] < 0) {
|
||||
len -= I[i];
|
||||
i -= I[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (len != 0)
|
||||
I[i - len] = -len;
|
||||
len = v[I[i]] + 1 - i;
|
||||
@@ -613,8 +554,7 @@ namespace Velopack.Compression
|
||||
{
|
||||
long value = buf[offset + 7] & 0x7F;
|
||||
|
||||
for (int index = 6; index >= 0; index--)
|
||||
{
|
||||
for (int index = 6; index >= 0; index--) {
|
||||
value *= 256;
|
||||
value += buf[offset + index];
|
||||
}
|
||||
@@ -629,9 +569,8 @@ namespace Velopack.Compression
|
||||
{
|
||||
long valueToWrite = value < 0 ? -value : value;
|
||||
|
||||
for (int byteIndex = 0; byteIndex < 8; byteIndex++)
|
||||
{
|
||||
buf[offset + byteIndex] = (byte)(valueToWrite % 256);
|
||||
for (int byteIndex = 0; byteIndex < 8; byteIndex++) {
|
||||
buf[offset + byteIndex] = (byte) (valueToWrite % 256);
|
||||
valueToWrite -= buf[offset + byteIndex];
|
||||
valueToWrite /= 256;
|
||||
}
|
||||
@@ -672,8 +611,7 @@ namespace Velopack.Compression
|
||||
/// Gets a value indicating whether the current stream supports reading.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if the stream supports reading; otherwise, <c>false</c>.</returns>
|
||||
public override bool CanRead
|
||||
{
|
||||
public override bool CanRead {
|
||||
get { return m_streamBase == null ? false : m_streamBase.CanRead; }
|
||||
}
|
||||
|
||||
@@ -681,8 +619,7 @@ namespace Velopack.Compression
|
||||
/// Gets a value indicating whether the current stream supports seeking.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if the stream supports seeking; otherwise, <c>false</c>.</returns>
|
||||
public override bool CanSeek
|
||||
{
|
||||
public override bool CanSeek {
|
||||
get { return m_streamBase == null ? false : m_streamBase.CanSeek; }
|
||||
}
|
||||
|
||||
@@ -690,24 +627,21 @@ namespace Velopack.Compression
|
||||
/// Gets a value indicating whether the current stream supports writing.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if the stream supports writing; otherwise, <c>false</c>.</returns>
|
||||
public override bool CanWrite
|
||||
{
|
||||
public override bool CanWrite {
|
||||
get { return m_streamBase == null ? false : m_streamBase.CanWrite; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the length in bytes of the stream.
|
||||
/// </summary>
|
||||
public override long Length
|
||||
{
|
||||
public override long Length {
|
||||
get { ThrowIfDisposed(); return m_streamBase.Length; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the position within the current stream.
|
||||
/// </summary>
|
||||
public override long Position
|
||||
{
|
||||
public override long Position {
|
||||
get { ThrowIfDisposed(); return m_streamBase.Position; }
|
||||
set { ThrowIfDisposed(); m_streamBase.Position = value; }
|
||||
}
|
||||
@@ -821,8 +755,7 @@ namespace Velopack.Compression
|
||||
/// Gets the wrapped stream.
|
||||
/// </summary>
|
||||
/// <value>The wrapped stream.</value>
|
||||
protected Stream WrappedStream
|
||||
{
|
||||
protected Stream WrappedStream {
|
||||
get { return m_streamBase; }
|
||||
}
|
||||
|
||||
@@ -832,18 +765,14 @@ namespace Velopack.Compression
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
try
|
||||
{
|
||||
try {
|
||||
// doesn't close the base stream, but just prevents access to it through this WrappingStream
|
||||
if (disposing)
|
||||
{
|
||||
if (disposing) {
|
||||
if (m_streamBase != null && m_ownership == Ownership.Owns)
|
||||
m_streamBase.Dispose();
|
||||
m_streamBase = null;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
} finally {
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
@@ -916,8 +845,7 @@ namespace Velopack.Compression
|
||||
if (count < 0 || buffer.Length - offset < count)
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
while (count > 0) {
|
||||
// read data
|
||||
int bytesRead = stream.Read(buffer, offset, count);
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Velopack.Locators;
|
||||
|
||||
// https://dev.to/emrahsungu/how-to-compare-two-files-using-net-really-really-fast-2pd9
|
||||
// https://github.com/SnowflakePowered/vcdiff
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Velopack
|
||||
|
||||
@@ -10,7 +10,6 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Velopack.NuGet;
|
||||
|
||||
namespace Velopack
|
||||
{
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NuGet.Versioning;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NuGet.Versioning;
|
||||
using Velopack.NuGet;
|
||||
|
||||
@@ -4,10 +4,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Velopack.NuGet
|
||||
{
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Velopack.NuGet
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@ using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using NuGet.Versioning;
|
||||
using Velopack.NuGet;
|
||||
|
||||
namespace Velopack
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.CodeDom;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using NuGet.Versioning;
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Velopack
|
||||
namespace Velopack
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds information about the current version and pending updates, such as how many there are, and access to release notes.
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using NuGet.Versioning;
|
||||
|
||||
@@ -5,7 +5,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Win32;
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Versioning;
|
||||
using NuGet.Versioning;
|
||||
|
||||
namespace Velopack.Windows
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Squirrel;
|
||||
using Squirrel.SimpleSplat;
|
||||
|
||||
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LegacyTestApp
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma warning disable CA1416 // Validate platform compatibility
|
||||
using System.Diagnostics;
|
||||
using System.Reflection.Metadata;
|
||||
using Velopack;
|
||||
using Velopack.Locators;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Threading;
|
||||
using Xunit.Sdk;
|
||||
using Xunit.Sdk;
|
||||
|
||||
namespace Velopack.CommandLine.Tests;
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Velopack.Packaging;
|
||||
using Xunit.Abstractions;
|
||||
using Xunit.Sdk;
|
||||
using Xunit.Sdk;
|
||||
|
||||
[assembly: TestFramework("Velopack.Packaging.Tests.TestsInit", "Velopack.Packaging.Tests")]
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Xunit;
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: CollectionBehavior(MaxParallelThreads=1, DisableTestParallelization=true)]
|
||||
[assembly: CollectionBehavior(MaxParallelThreads = 1, DisableTestParallelization = true)]
|
||||
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
|
||||
@@ -1,17 +1,11 @@
|
||||
|
||||
using System;
|
||||
using System.Data.Common;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Win32;
|
||||
using NuGet.Packaging;
|
||||
using Velopack.Compression;
|
||||
using Velopack.Packaging;
|
||||
using Velopack.Packaging.Commands;
|
||||
using Velopack.Packaging.Windows.Commands;
|
||||
using Velopack.Windows;
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using Velopack;
|
||||
using System.Xml;
|
||||
using Velopack.NuGet;
|
||||
using Velopack.Tests.TestHelpers;
|
||||
using Xunit;
|
||||
|
||||
namespace Velopack.Tests
|
||||
{
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using NuGet;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Velopack.Tests.OldSquirrel
|
||||
{
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Velopack.Tests.OldSquirrel
|
||||
{
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Velopack.Tests.OldSquirrel
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Velopack.Tests.OldSquirrel
|
||||
namespace Velopack.Tests.OldSquirrel
|
||||
{
|
||||
internal static class Utility
|
||||
{
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text;
|
||||
using NuGet.Versioning;
|
||||
using Velopack.Tests.TestHelpers;
|
||||
using Xunit;
|
||||
using OldReleaseEntry = Velopack.Tests.OldSquirrel.ReleaseEntry;
|
||||
using OldSemanticVersion = Velopack.Tests.OldSquirrel.SemanticVersion;
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using Velopack.Windows;
|
||||
using Velopack.Windows;
|
||||
|
||||
namespace Velopack.Tests
|
||||
{
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using Xunit;
|
||||
|
||||
namespace Velopack.Tests.TestHelpers
|
||||
{
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text;
|
||||
|
||||
namespace Velopack.Tests
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text;
|
||||
using Velopack.Sources;
|
||||
|
||||
namespace Velopack.Tests.TestHelpers
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Velopack.Tests
|
||||
{
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text;
|
||||
using NuGet.Versioning;
|
||||
using Velopack.Locators;
|
||||
using Velopack.Sources;
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Velopack;
|
||||
using Velopack.Tests.TestHelpers;
|
||||
using Xunit;
|
||||
using Velopack.Windows;
|
||||
using System.Collections.Generic;
|
||||
using Xunit.Abstractions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.Versioning;
|
||||
|
||||
namespace Velopack.Tests
|
||||
{
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Packaging;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO.Packaging;
|
||||
using NuGet.Versioning;
|
||||
using Velopack.NuGet;
|
||||
using Velopack.Tests.TestHelpers;
|
||||
using Xunit;
|
||||
using ZipPackage = Velopack.NuGet.ZipPackage;
|
||||
|
||||
namespace Velopack.Tests
|
||||
|
||||
Reference in New Issue
Block a user