未验证 提交 a5032432 编写于 作者: A Aigio L 提交者: GitHub

Merge pull request #980 from BeyondDimension/develop

v2.6.5 RC4
......@@ -414,18 +414,18 @@ namespace System.Application.UI
// b.Append(DeviceSecurityCheckUtil.IsEmulator.ToLowerString());
// b.AppendLine();
//}
b.Append("[device.gl.renderer] ");
b.Append(GLES20.GlGetString(GLES20.GlRenderer) ?? "");
b.AppendLine();
b.Append("[device.gl.vendor] ");
b.Append(GLES20.GlGetString(GLES20.GlVendor) ?? "");
b.AppendLine();
b.Append("[device.gl.version] ");
b.Append(GLES20.GlGetString(GLES20.GlVersion) ?? "");
b.AppendLine();
b.Append("[device.gl.extensions] ");
b.Append(GLES20.GlGetString(GLES20.GlExtensions) ?? "");
b.AppendLine();
//b.Append("[device.gl.renderer] ");
//b.Append(GLES20.GlGetString(GLES20.GlRenderer) ?? "");
//b.AppendLine();
//b.Append("[device.gl.vendor] ");
//b.Append(GLES20.GlGetString(GLES20.GlVendor) ?? "");
//b.AppendLine();
//b.Append("[device.gl.version] ");
//b.Append(GLES20.GlGetString(GLES20.GlVersion) ?? "");
//b.AppendLine();
//b.Append("[device.gl.extensions] ");
//b.Append(GLES20.GlGetString(GLES20.GlExtensions) ?? "");
//b.AppendLine();
b.Append("[device.biometric] ");
b.Append(IBiometricService.Instance.IsSupportedAsync().Result.ToLowerString());
b.AppendLine();
......
......@@ -267,23 +267,28 @@
// newRating++;
// }
// try
// {
// var opengl = Android.Opengl.GLES20.GlGetString(Android.Opengl.GLES20.GlRenderer);
// if (!string.IsNullOrWhiteSpace(opengl))
// {
//#pragma warning disable CS8604 // 可能的 null 引用参数。
// if (contains(opengl, "Bluestacks") ||
// contains(opengl, "Translator") ||
// contains(opengl, "youwave")
// )
//#pragma warning restore CS8604 // 可能的 null 引用参数。
// newRating += 10;
// }
// }
// catch
// {
// }
/* signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xdd0
* Cause: null pointer dereference
* backtrace:
* #00 pc 0000000000005ff4 /system/lib64/libGLESv1_CM.so (glGetString+52)
*/
//// try
//// {
//// var opengl = Android.Opengl.GLES20.GlGetString(Android.Opengl.GLES20.GlRenderer);
//// if (!string.IsNullOrWhiteSpace(opengl))
//// {
////#pragma warning disable CS8604 // 可能的 null 引用参数。
//// if (contains(opengl, "Bluestacks") ||
//// contains(opengl, "Translator") ||
//// contains(opengl, "youwave")
//// )
////#pragma warning restore CS8604 // 可能的 null 引用参数。
//// newRating += 10;
//// }
//// }
//// catch
//// {
//// }
// try
// {
......
......@@ -2,9 +2,7 @@ using SQLite;
using System.Application.Entities;
using System.Application.Repositories;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using NotNull = System.Diagnostics.CodeAnalysis.NotNullAttribute;
using SQLiteNotNull = SQLite.NotNullAttribute;
using SQLiteTable = SQLite.TableAttribute;
......@@ -26,93 +24,33 @@ namespace System.Application.Services.Implementation
if (sharedName == null) return GetId(key);
return $"{key}_{sharedName}_S";
}
public void PlatformClear(string? sharedName)
{
if (sharedName == null)
{
conn.Execute(Sql_Delete_All);
}
else
{
conn.Execute(Sql_Delete_Where_SharedName_Equals, sharedName);
}
conn.Execute(Sql_Delete_Where_SharedName_Equals, sharedName ?? string.Empty);
}
//public void PlatformClear(string? sharedName)
//{
// if (sharedName == null)
// {
// conn.DeleteAll<Entity>();
// }
// else
// {
// var items = conn.Table<Entity>().Where(x => x.SharedName == sharedName).ToArray();
// foreach (var item in items)
// {
// conn.Delete(item);
// }
// }
//}
//public bool PlatformContainsKey(string key, string? sharedName)
//{
// int r;
// if (sharedName == null)
// {
// r = conn.Execute(Sql_Select_SharedName_Where_Key_Equals_And_SharedName_IsNull, GetId(key));
// }
// else
// {
// r = conn.Execute(Sql_Select_SharedName_Where_Key_Equals_And_SharedName_Equals, GetId(key, sharedName), sharedName);
// }
// return r > 0;
//}
public bool PlatformContainsKey(string key, string? sharedName)
{
var id = GetId(key, sharedName);
var item = conn.Table<Entity>().Where(x => x.Id == id && x.SharedName == sharedName).FirstOrDefault();
sharedName ??= string.Empty;
var item = conn.Table<Entity>()
.Where(x => x.Id == id && x.SharedName == sharedName)
.FirstOrDefault();
return item != null;
}
//public T? PlatformGet<T>(string key, T? defaultValue, string? sharedName) where T : notnull, IConvertible
//{
// string? r;
// if (sharedName == null)
// {
// r = conn.ExecuteScalar<string?>(Sql_Select_Value_Where_Key_Equals_And_SharedName_IsNull, GetId(key));
// }
// else
// {
// r = conn.ExecuteScalar<string?>(Sql_Select_Value_Where_Key_Equals_And_SharedName_Equals, GetId(key, sharedName), sharedName);
// }
// if (r == null) return defaultValue;
// var r2 = ConvertibleHelper.Convert<T>(r);
// return r2;
//}
public T? PlatformGet<T>(string key, T? defaultValue, string? sharedName) where T : notnull, IConvertible
{
var id = GetId(key, sharedName);
var item = conn.Table<Entity>().Where(x => x.Id == id && x.SharedName == sharedName).FirstOrDefault();
sharedName ??= string.Empty;
var item = conn.Table<Entity>()
.Where(x => x.Id == id && x.SharedName == sharedName)
.FirstOrDefault();
if (item == null) return defaultValue;
var value = ConvertibleHelper.Convert<T>(item.Value);
return value;
}
//public void PlatformRemove(string key, string? sharedName)
//{
// if (sharedName == null)
// {
// conn.Execute(Sql_Delete_Where_Id_Equals_And_SharedName_IsNull, GetId(key));
// }
// else
// {
// conn.Execute(Sql_Delete_Where_Id_Equals_And_SharedName_Equals, GetId(key, sharedName), sharedName);
// }
//}
public void PlatformRemove(string key, string? sharedName)
{
var id = GetId(key, sharedName);
......@@ -132,19 +70,16 @@ namespace System.Application.Services.Implementation
{
Id = id,
Value = value.ToString(CultureInfo.InvariantCulture),
SharedName = sharedName,
SharedName = sharedName ?? string.Empty,
});
}
}
const string TableName = "0984415E";
const string TableName = "1984415E";
const string ColumnName_Id = "0F5E4BAA";
const string ColumnName_Value = "4FC331D7";
const string ColumnName_SharedName = "F6A739AA";
const string Sql_Delete_All =
$"DELETE FROM \"{TableName}\"";
const string Sql_Delete_Where_SharedName_Equals =
$"DELETE FROM \"{TableName}\" WHERE \"{ColumnName_SharedName}\" = ?";
......@@ -174,19 +109,18 @@ namespace System.Application.Services.Implementation
[Column(ColumnName_Id)]
[PrimaryKey]
[SQLiteNotNull]
[NotNull, DisallowNull] // C# 8 not null
public string? Id { get; set; }
public string Id { get; set; } = string.Empty;
[Column(ColumnName_Value)]
[SQLiteNotNull]
[NotNull, DisallowNull] // C# 8 not null
public string? Value { get; set; }
public string Value { get; set; } = string.Empty;
#pragma warning restore CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
[Column(ColumnName_SharedName)]
public string? SharedName { get; set; }
[SQLiteNotNull]
public string SharedName { get; set; } = string.Empty;
string DebuggerDisplay() => SharedName == null ? $"{Id}, {Value}" : $"{Id}, {Value}, {SharedName}";
string DebuggerDisplay() => SharedName == string.Empty ? $"{Id}, {Value}" : $"{Id}, {Value}, {SharedName}";
}
}
}
......@@ -114,23 +114,28 @@ namespace System.Application.Services.Implementation
newRating++;
}
try
{
var opengl = Android.Opengl.GLES20.GlGetString(Android.Opengl.GLES20.GlRenderer);
if (!string.IsNullOrWhiteSpace(opengl))
{
#pragma warning disable CS8604 // 可能的 null 引用参数。
if (contains(opengl, "Bluestacks") ||
contains(opengl, "Translator") ||
contains(opengl, "youwave")
)
#pragma warning restore CS8604 // 可能的 null 引用参数。
newRating += 10;
}
}
catch
{
}
/* signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xdd0
* Cause: null pointer dereference
* backtrace:
* #00 pc 0000000000005ff4 /system/lib64/libGLESv1_CM.so (glGetString+52)
*/
// try
// {
// var opengl = Android.Opengl.GLES20.GlGetString(Android.Opengl.GLES20.GlRenderer);
// if (!string.IsNullOrWhiteSpace(opengl))
// {
//#pragma warning disable CS8604 // 可能的 null 引用参数。
// if (contains(opengl, "Bluestacks") ||
// contains(opengl, "Translator") ||
// contains(opengl, "youwave")
// )
//#pragma warning restore CS8604 // 可能的 null 引用参数。
// newRating += 10;
// }
// }
// catch
// {
// }
try
{
......
......@@ -9,7 +9,24 @@ namespace System.Application.UI.ViewModels
readonly Dictionary<Type, Lazy<TabItemViewModel>> mTabItems = new();
public IEnumerable<TabItemViewModel> TabItems => mTabItems.Values.Select(x => x.Value);
public IReadOnlyList<TabItemViewModel>? FooterTabItems { get; private set; }
IReadOnlyList<TabItemViewModel>? _FooterTabItems;
public IReadOnlyList<TabItemViewModel>? FooterTabItems
{
get
{
if (_FooterTabItems == null)
{
var settingsPageVM = SettingsPageViewModel.Instance;
var aboutPageVM = AboutPageViewModel.Instance;
_FooterTabItems = new List<TabItemViewModel>
{
settingsPageVM,
aboutPageVM,
};
}
return _FooterTabItems;
}
}
public IEnumerable<TabItemViewModel> AllTabItems
{
......@@ -20,6 +37,18 @@ namespace System.Application.UI.ViewModels
}
}
/// <summary>
/// 当前 <see cref="AllTabItems"/>,延时加载 <see cref="FooterTabItems"/>
/// </summary>
public IEnumerable<TabItemViewModel> CurrentAllTabItems
{
get
{
if (_FooterTabItems == null) return TabItems;
else return TabItems.Concat(_FooterTabItems);
}
}
void AddTabItem<TabItemVM>() where TabItemVM : TabItemViewModel, new()
{
Lazy<TabItemViewModel> value = new(() => new TabItemVM()
......
......@@ -88,20 +88,14 @@ namespace System.Application.UI.ViewModels
});
}
FooterTabItems = new List<TabItemViewModel>
{
SettingsPageViewModel.Instance,
AboutPageViewModel.Instance,
};
#region InitTabItems
//AddTabItem<StartPageViewModel>();
AddTabItem<CommunityProxyPageViewModel>();
AddTabItem<ProxyScriptManagePageViewModel>();
if (IApplication.IsDesktopPlatform)
{
AddTabItem<ProxyScriptManagePageViewModel>();
AddTabItem<SteamAccountPageViewModel>();
AddTabItem<GameListPageViewModel>();
}
......@@ -134,7 +128,7 @@ namespace System.Application.UI.ViewModels
R.Subscribe(() =>
{
foreach (var item in AllTabItems)
foreach (var item in CurrentAllTabItems)
{
item.RaisePropertyChanged(nameof(TabItemViewModelBase.Name));
}
......
......@@ -19,7 +19,7 @@ namespace System.Application.UI.ViewModels
{
public partial class CommunityProxyPageViewModel
{
readonly IHostsFileService hostsFileService = IHostsFileService.Instance;
readonly IHostsFileService? hostsFileService;
readonly IPlatformService platformService = IPlatformService.Instance;
public ReactiveCommand<Unit, Unit>? SetupCertificateCommand { get; }
......@@ -58,6 +58,7 @@ namespace System.Application.UI.ViewModels
if (IApplication.IsDesktopPlatform)
{
hostsFileService = IHostsFileService.Instance;
SetupCertificateCommand = ReactiveCommand.Create(SetupCertificate_OnClick);
DeleteCertificateCommand = ReactiveCommand.Create(DeleteCertificate_OnClick);
EditHostsFileCommand = ReactiveCommand.Create(hostsFileService.OpenFile);
......
......@@ -28,12 +28,12 @@ namespace System.Application.UI.ViewModels
UpdateChannels = Enum2.GetAll<UpdateChannelType>();
SelectFont = R.Fonts.FirstOrDefault(x => x.Value == UISettings.FontName.Value);
this.WhenValueChanged(x => x.SelectFont, false)
.Subscribe(x => UISettings.FontName.Value = x.Value);
if (IApplication.IsDesktopPlatform)
{
SelectFont = R.Fonts.FirstOrDefault(x => x.Value == UISettings.FontName.Value);
this.WhenValueChanged(x => x.SelectFont, false)
.Subscribe(x => UISettings.FontName.Value = x.Value);
SelectImage_Click = ReactiveCommand.CreateFromTask(async () =>
{
FilePickerFileType fileTypes = new ValueTuple<string, string[]>[] {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册