Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #35

Merged
merged 4 commits into from
Jan 10, 2024
Merged

Dev #35

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/c#/GeneralUpdate.Client/MySample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal class MySample
{
#region 推送功能

private const string baseUrl = @"http://127.0.0.1:5001";
private const string baseUrl = @"http://localhost:5051";
private const string hubName = "versionhub";

internal MySample()
Expand Down Expand Up @@ -113,7 +113,7 @@ private Configinfo GetWindowsConfigInfo()
//该对象用于主程序客户端与更新组件进程之间交互用的对象
var config = new Configinfo();
//本机的客户端程序应用地址
config.InstallPath = @"F:\test\Run";
config.InstallPath = @"D:\packet\source";
//更新公告网页
config.UpdateLogUrl = "https://www.baidu.com/";
//客户端当前版本号
Expand All @@ -125,9 +125,9 @@ private Configinfo GetWindowsConfigInfo()
//更新组件更新包下载地址
config.UpdateUrl = $"{baseUrl}/versions/{config.AppType}/{config.ClientVersion}/{config.AppSecretKey}";
//更新程序exe名称
config.AppName = "AutoUpdate.Core";
config.AppName = "GeneralUpdate.Core";
//主程序客户端exe名称
config.MainAppName = "AutoUpdate.ClientCore";
config.MainAppName = "GeneralUpdate.ClientCore";
//主程序信息
var mainVersion = "1.1.1.1";
//主程序客户端更新包下载地址
Expand Down
2 changes: 1 addition & 1 deletion src/c#/GeneralUpdate.ClientCore/GeneralClientBootstrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ private void ClearEnvironmentVariable()
{
try
{
Environment.SetEnvironmentVariable("ProcessBase64", null, EnvironmentVariableTarget.Machine);
Environment.SetEnvironmentVariable("ProcessBase64", null, EnvironmentVariableTarget.User);
}
catch (SecurityException ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public sealed class GeneralUpdateException<TExceptionArgs> : Exception, ISeriali
private const String c_args = "Args";
private readonly TExceptionArgs m_args;

public TExceptionArgs Args
{ get { return m_args; } }
public TExceptionArgs Args=> m_args;

public GeneralUpdateException(String message = null, Exception innerException = null) : this(null, message, innerException)
{
Expand Down
6 changes: 6 additions & 0 deletions src/c#/GeneralUpdate.Core/Exceptions/ThrowExceptionUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ public static void ThrowGeneralUpdateException(ExceptionArgs args)

#region Common

public static void ThrowIfNull(object obj)
{
if (obj == null)
Throw<ArgumentException>("Parameter cannot be null");
}

/// <summary>
/// Checks if an object is empty and throws an exception if it is
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion src/c#/GeneralUpdate.Core/GeneralUpdateBootstrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using GeneralUpdate.Core.Domain.Entity;
using GeneralUpdate.Core.Domain.Entity.Assembler;
using GeneralUpdate.Core.Domain.Enum;
using GeneralUpdate.Core.Exceptions;
using GeneralUpdate.Core.Strategys;
using GeneralUpdate.Core.Utils;
using System;
Expand All @@ -21,7 +22,7 @@ private void Remote()
{
try
{
var base64 = Environment.GetEnvironmentVariable("ProcessBase64", EnvironmentVariableTarget.Machine);
var base64 = Environment.GetEnvironmentVariable("ProcessBase64", EnvironmentVariableTarget.User);
var processInfo = SerializeUtil.Deserialize<ProcessInfo>(base64);
Packet = ProcessAssembler.ToPacket(processInfo);
Packet.AppType = AppType.UpgradeApp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public override bool StartApp(string appName, int appType)
switch (appType)
{
case AppType.ClientApp:
Environment.SetEnvironmentVariable("ProcessBase64", Packet.ProcessBase64, EnvironmentVariableTarget.Machine);
Environment.SetEnvironmentVariable("ProcessBase64", Packet.ProcessBase64, EnvironmentVariableTarget.User);
WaitForProcessToStart(path, 20, () => WillMessageManager.Instance.Check());
break;

Expand Down
Loading