Merge pull request #26 from Bililive/dev

Release 1.1.1
This commit is contained in:
Genteure 2018-11-10 15:00:57 +08:00 committed by GitHub
commit 1df6524075
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 48 deletions

View File

@ -32,8 +32,8 @@ namespace BililiveRecorder.Core
Rooms.CollectionChanged += (sender, e) =>
{
logger.Debug($"Rooms.CollectionChanged;{e.Action};" +
$"O:{e.OldItems.Cast<IRecordedRoom>().Select(rr => rr.RealRoomid.ToString()).Aggregate((current, next) => current + "," + next)};" +
$"N:{e.NewItems.Cast<IRecordedRoom>().Select(rr => rr.RealRoomid.ToString()).Aggregate((current, next) => current + "," + next)}");
$"O:{e.OldItems?.Cast<IRecordedRoom>()?.Select(rr => rr.RealRoomid.ToString())?.Aggregate((current, next) => current + "," + next)};" +
$"N:{e.NewItems?.Cast<IRecordedRoom>()?.Select(rr => rr.RealRoomid.ToString())?.Aggregate((current, next) => current + "," + next)}");
};
}
@ -84,8 +84,8 @@ namespace BililiveRecorder.Core
Task.Run(() => rr.Start());
}
Rooms.Add(rr);
logger.Debug("AddRoom 添加了直播间 " + rr.RealRoomid);
Rooms.Add(rr);
}
/// <summary>
@ -96,8 +96,8 @@ namespace BililiveRecorder.Core
{
if (!_valid) { throw new InvalidOperationException("Not Initialized"); }
rr.Shutdown();
Rooms.Remove(rr);
logger.Debug("RemoveRoom 移除了直播间 " + rr.RealRoomid);
Rooms.Remove(rr);
}
public void Shutdown()

View File

@ -19,58 +19,61 @@ namespace BililiveRecorder.WPF
logger.Debug($"Starting. FileV:{typeof(App).Assembly.GetName().Version.ToString(4)}, BuildV:{BuildInfo.Version}, Hash:{BuildInfo.HeadSha1}");
logger.Debug("Environment.CommandLine: " + Environment.CommandLine);
logger.Debug("Environment.CurrentDirectory: " + Environment.CurrentDirectory);
#if !DEBUG
Task.Run(RunCheckUpdate);
#endif
}
Task.Run(async () =>
private async Task RunCheckUpdate()
{
try
{
try
if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("BILILIVE_RECORDER_DISABLE_UPDATE"))) { return; }
var envPath = Environment.GetEnvironmentVariable("BILILIVE_RECORDER_OVERWRITE_UPDATE");
string serverUrl = @"https://soft.danmuji.org/BililiveRecorder/";
if (!string.IsNullOrWhiteSpace(envPath)) { serverUrl = envPath; }
using (UpdateManager manager = new UpdateManager(urlOrPath: serverUrl))
{
if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("BILILIVE_RECORDER_DISABLE_UPDATE"))) { return; }
var envPath = Environment.GetEnvironmentVariable("BILILIVE_RECORDER_OVERWRITE_UPDATE");
string serverUrl = @"https://soft.danmuji.org/BililiveRecorder/";
if (!string.IsNullOrWhiteSpace(envPath)) { serverUrl = envPath; }
using (UpdateManager manager = new UpdateManager(urlOrPath: serverUrl))
var update = await manager.CheckForUpdate();
if (update.CurrentlyInstalledVersion == null)
{
var update = await manager.CheckForUpdate();
if (update.CurrentlyInstalledVersion == null)
{
logger.Debug("Squirrel 无当前版本");
}
logger.Debug("Squirrel 无当前版本");
}
if (!update.ReleasesToApply.Any())
{
logger.Info($@"当前运行的是最新版本 ({
update.CurrentlyInstalledVersion?.Version?.ToString() ?? "×"
}\{
typeof(App).Assembly.GetName().Version.ToString(4)
})");
}
else
{
if (update.CurrentlyInstalledVersion != null
&& update.FutureReleaseEntry.Version < update.CurrentlyInstalledVersion.Version)
{
logger.Warn("服务器回滚了一个更新,本地版本比服务器版本高。");
}
logger.Info($@"服务器最新版本: {
update.FutureReleaseEntry?.Version?.ToString() ?? "×"
} : {
if (!update.ReleasesToApply.Any())
{
logger.Info($@"当前运行的是最新版本 ({
update.CurrentlyInstalledVersion?.Version?.ToString() ?? "×"
}");
logger.Info("开始后台下载新版本(不会影响软件运行)");
await manager.DownloadReleases(update.ReleasesToApply);
logger.Info("新版本下载完成,开始安装(不会影响软件运行)");
await manager.ApplyReleases(update);
logger.Info("新版本安装完毕,你可以暂时继续使用当前版本。下次启动时会自动启动最新版本。");
}\{
typeof(App).Assembly.GetName().Version.ToString(4)
})");
}
else
{
if (update.CurrentlyInstalledVersion != null
&& update.FutureReleaseEntry.Version < update.CurrentlyInstalledVersion.Version)
{
logger.Warn("服务器回滚了一个更新,本地版本比服务器版本高。");
}
logger.Info($@"服务器最新版本: {
update.FutureReleaseEntry?.Version?.ToString() ?? "×"
} : {
update.CurrentlyInstalledVersion?.Version?.ToString() ?? "×"
}");
logger.Info("开始后台下载新版本(不会影响软件运行)");
await manager.DownloadReleases(update.ReleasesToApply);
logger.Info("新版本下载完成,开始安装(不会影响软件运行)");
await manager.ApplyReleases(update);
logger.Info("新版本安装完毕,你可以暂时继续使用当前版本。下次启动时会自动启动最新版本。");
}
}
catch (Exception ex)
{
logger.Error(ex, "检查更新时出错,如持续出错请联系开发者 rec@danmuji.org");
}
});
}
catch (Exception ex)
{
logger.Error(ex, "检查更新时出错,如持续出错请联系开发者 rec@danmuji.org");
}
}
}
}

View File

@ -1 +1 @@
1.1.0
1.1.1