Merge branch 'develop' of https://github.com/SteamTools-Team/SteamTools into develop

This commit is contained in:
mossimo
2021-07-10 21:07:12 +08:00
14 changed files with 884 additions and 337 deletions
@@ -28,6 +28,7 @@ namespace System.Application.UI
#if MAC
AppDelegateHelper.Init(args);
//FileSystemDesktopMac.InitFileSystem();
FileSystemDesktop.InitFileSystem();
#else
FileSystemDesktop.InitFileSystem();
#endif
@@ -0,0 +1,15 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
@@ -19,13 +19,6 @@ namespace System.Application
/// </summary>
public static void InitFileSystem()
{
#if !NET35
if (DI.Platform == Platform.Apple)
{
throw new PlatformNotSupportedException("use FileSystemDesktopMac");
}
#endif
//var appDataRootPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
//if (string.IsNullOrWhiteSpace(appDataRootPath))
//{
@@ -1,307 +1,6 @@
using ReactiveUI;
using System.Application.Models;
using System.Application.Repositories;
using System.Application.Services;
using System.Application.UI.Resx;
using System.IO;
using System.Net;
using System.Properties;
using System.Threading.Tasks;
using System.Windows;
namespace System.Application.UI.ViewModels
{
partial class AddAuthWindowViewModel : WindowViewModel
{
readonly IHttpService httpService = DI.Get<IHttpService>();
readonly IGameAccountPlatformAuthenticatorRepository repository = DI.Get<IGameAccountPlatformAuthenticatorRepository>();
public AddAuthWindowViewModel() : base()
{
Title = ThisAssembly.AssemblyTrademark + " | " + AppResources.LocalAuth_AddAuth;
Initialize();
}
private GAPAuthenticatorValueDTO.SteamAuthenticator? _SteamAuthenticator;
private GAPAuthenticatorValueDTO.SteamAuthenticator.EnrollState _Enroll = new() { RequiresLogin = true };
private string? AuthPassword;
private bool AuthIsLocal;
private async void Initialize()
{
var auths = await repository.GetAllSourceAsync();
var hasPassword = repository.HasSecondaryPassword(auths);
if (hasPassword)
{
var result = await AuthService.Current.HasPasswordEncryptionShowPassWordWindow();
if (result.success)
{
AuthPassword = result.password;
}
else
{
this.Close();
}
}
AuthIsLocal = repository.HasLocal(auths);
}
public string? AuthName { get; set; }
public string? UUID { get; set; }
public string? SteamGuard { get; set; }
public bool RequiresLogin
{
get
{
return _Enroll.RequiresLogin;
}
set
{
_Enroll.RequiresLogin = value;
this.RaisePropertyChanged();
}
}
public bool RequiresActivation
{
get
{
return _Enroll.RequiresActivation;
}
set
{
this.RaisePropertyChanged();
}
}
public string? UserName
{
get
{
return _Enroll.Username;
}
set
{
_Enroll.Username = value;
}
}
public string? Password
{
get
{
return _Enroll.Password;
}
set
{
_Enroll.Password = value;
}
}
public string? CaptchaText
{
get
{
return _Enroll.CaptchaText;
}
set
{
_Enroll.CaptchaText = value;
this.RaisePropertyChanged();
}
}
public string? EmailAuthText
{
get
{
return _Enroll.EmailAuthText;
}
set
{
_Enroll.EmailAuthText = value;
}
}
public string? ActivationCode
{
get
{
return _Enroll.ActivationCode;
}
set
{
_Enroll.ActivationCode = value;
}
}
public string? RevocationCode
{
get
{
return _Enroll.RevocationCode;
}
set
{
this.RaisePropertyChanged();
}
}
private Stream? _CaptchaImage;
public Stream? CaptchaImage
{
get => _CaptchaImage;
set => this.RaiseAndSetIfChanged(ref _CaptchaImage, value);
}
private string? _EmailDomain;
public string? EmailDomain
{
get => _EmailDomain;
set => this.RaiseAndSetIfChanged(ref _EmailDomain, value);
}
private bool _RequiresAdd;
public bool RequiresAdd
{
get => _RequiresAdd;
set => this.RaiseAndSetIfChanged(ref _RequiresAdd, value);
}
public void ImportSteamGuard()
{
if (AuthService.Current.ImportSteamGuard(AuthName, UUID, SteamGuard, AuthIsLocal, AuthPassword))
{
ToastService.Current.Notify(AppResources.LocalAuth_AddAuthSuccess);
}
else
{
ToastService.Current.Notify(AppResources.LocalAuth_ImportFaild);
}
}
private bool _IsLogining = false;
public void LoginSteamImport()
{
if (_IsLogining)
{
return;
}
_IsLogining = true;
if (_SteamAuthenticator == null)
_SteamAuthenticator = new GAPAuthenticatorValueDTO.SteamAuthenticator();
_Enroll.Language = R.GetCurrentCultureSteamLanguageName();
bool result = false;
Task.Run(() =>
{
ToastService.Current.Set(AppResources.Logining);
result = _SteamAuthenticator.Enroll(_Enroll);
ToastService.Current.Set();
if (result == false)
{
if (string.IsNullOrEmpty(_Enroll.Error) == false)
{
MessageBoxCompat.Show(_Enroll.Error);
//ToastService.Current.Notify(_Enroll.Error);
}
if (_Enroll.Requires2FA == true)
{
MessageBoxCompat.Show(AppResources.LocalAuth_SteamUser_Requires2FA);
//ToastService.Current.Notify(AppResources.LocalAuth_SteamUser_Requires2FA);
return;
}
if (_Enroll.RequiresCaptcha == true)
{
CaptchaText = null;
CaptchaImage = null;
using var web = new WebClient();
var bt = web.DownloadData(_Enroll.CaptchaUrl);
using var stream = new MemoryStream(bt);
CaptchaImage = stream;
return;
}
if (_Enroll.RequiresEmailAuth == true)
{
RequiresLogin = false;
CaptchaText = null;
CaptchaImage = null;
EmailDomain = string.IsNullOrEmpty(_Enroll.EmailDomain) == false ? "***@" + _Enroll.EmailDomain : string.Empty;
return;
}
if (_Enroll.RequiresActivation == true)
{
EmailDomain = null;
_Enroll.Error = null;
RequiresLogin = false;
AuthService.AddOrUpdateSaveAuthenticators(new GAPAuthenticatorDTO
{
Name = nameof(GamePlatform.Steam) + "(" + UserName + ")",
Value = _SteamAuthenticator
}, AuthIsLocal, AuthPassword);
RequiresActivation = true;
RevocationCode = _Enroll.RevocationCode;
return;
}
if (_Enroll.RequiresLogin == true)
{
return;
}
string error = _Enroll.Error;
if (string.IsNullOrEmpty(error) == true)
{
error = AppResources.LocalAuth_SteamUser_Error;
}
MessageBoxCompat.Show(_Enroll.Error);
return;
}
RequiresActivation = false;
RequiresAdd = true;
}).ContinueWith(s =>
{
Log.Error(nameof(AddAuthWindowViewModel), s.Exception, nameof(LoginSteamImport));
MessageBoxCompat.Show(s.Exception);
//ToastService.Current.Notify(s.Exception.Message);
}, TaskContinuationOptions.OnlyOnFaulted).ContinueWith(s =>
{
_IsLogining = false;
ToastService.Current.Set();
s.Dispose();
});
}
public void ImportWinAuth(string file)
{
AuthService.Current.ImportWinAuthenticators(file, AuthIsLocal, AuthPassword);
}
public void ImportSDA(string file)
{
AuthService.Current.ImportSDAFile(file, AuthIsLocal, AuthPassword);
}
public void ImportSteamPlusPlusV1(string file)
{
AuthService.Current.ImportSteamToolsV1Authenticator(file, AuthIsLocal, AuthPassword);
}
public void ImportSteamPlusPlusV2(string file)
{
AuthService.Current.ImportAuthenticatorFile(file, AuthIsLocal, AuthPassword);
}
}
}
@@ -1,13 +1,319 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ReactiveUI;
using System.Application.Models;
using System.Application.Repositories;
using System.Application.Services;
using System.Application.UI.Resx;
using System.IO;
using System.Net;
using System.Properties;
using System.Threading.Tasks;
using System.Windows;
namespace System.Application.UI.ViewModels
{
public partial class AddAuthWindowViewModel
{
readonly IHttpService httpService = DI.Get<IHttpService>();
readonly IGameAccountPlatformAuthenticatorRepository repository = DI.Get<IGameAccountPlatformAuthenticatorRepository>();
public AddAuthWindowViewModel() : base()
{
Title =
#if !__MOBILE__
ThisAssembly.AssemblyTrademark + " | " +
#endif
AppResources.LocalAuth_AddAuth;
Initialize();
}
private GAPAuthenticatorValueDTO.SteamAuthenticator? _SteamAuthenticator;
private readonly GAPAuthenticatorValueDTO.SteamAuthenticator.EnrollState _Enroll = new() { RequiresLogin = true };
private string? AuthPassword;
private bool AuthIsLocal;
private async void Initialize()
{
var auths = await repository.GetAllSourceAsync();
var hasPassword = repository.HasSecondaryPassword(auths);
if (hasPassword)
{
var (success, password) = await AuthService.Current.HasPasswordEncryptionShowPassWordWindow();
if (success)
{
AuthPassword = password;
}
else
{
#if !__MOBILE__
this.Close();
#endif
}
}
AuthIsLocal = repository.HasLocal(auths);
}
public string? AuthName { get; set; }
public string? UUID { get; set; }
public string? SteamGuard { get; set; }
public bool RequiresLogin
{
get
{
return _Enroll.RequiresLogin;
}
set
{
_Enroll.RequiresLogin = value;
this.RaisePropertyChanged();
}
}
public bool RequiresActivation
{
get
{
return _Enroll.RequiresActivation;
}
set
{
this.RaisePropertyChanged();
}
}
public string? UserName
{
get
{
return _Enroll.Username;
}
set
{
_Enroll.Username = value;
}
}
public string? Password
{
get
{
return _Enroll.Password;
}
set
{
_Enroll.Password = value;
}
}
public string? CaptchaText
{
get
{
return _Enroll.CaptchaText;
}
set
{
_Enroll.CaptchaText = value;
this.RaisePropertyChanged();
}
}
public string? EmailAuthText
{
get
{
return _Enroll.EmailAuthText;
}
set
{
_Enroll.EmailAuthText = value;
}
}
public string? ActivationCode
{
get
{
return _Enroll.ActivationCode;
}
set
{
_Enroll.ActivationCode = value;
}
}
public string? RevocationCode
{
get
{
return _Enroll.RevocationCode;
}
set
{
this.RaisePropertyChanged();
}
}
private Stream? _CaptchaImage;
public Stream? CaptchaImage
{
get => _CaptchaImage;
set => this.RaiseAndSetIfChanged(ref _CaptchaImage, value);
}
private string? _EmailDomain;
public string? EmailDomain
{
get => _EmailDomain;
set => this.RaiseAndSetIfChanged(ref _EmailDomain, value);
}
private bool _RequiresAdd;
public bool RequiresAdd
{
get => _RequiresAdd;
set => this.RaiseAndSetIfChanged(ref _RequiresAdd, value);
}
public void ImportSteamGuard()
{
if (AuthService.Current.ImportSteamGuard(AuthName!, UUID!, SteamGuard!, AuthIsLocal, AuthPassword))
{
Toast.Show(AppResources.LocalAuth_AddAuthSuccess);
}
else
{
Toast.Show(AppResources.LocalAuth_ImportFaild);
}
}
private bool _IsLogining = false;
public void LoginSteamImport()
{
if (_IsLogining)
{
return;
}
_IsLogining = true;
if (_SteamAuthenticator == null)
_SteamAuthenticator = new GAPAuthenticatorValueDTO.SteamAuthenticator();
_Enroll.Language = R.GetCurrentCultureSteamLanguageName();
bool result = false;
Task.Run(() =>
{
#if !__MOBILE__
ToastService.Current.Set(AppResources.Logining);
#endif
result = _SteamAuthenticator.Enroll(_Enroll);
#if !__MOBILE__
ToastService.Current.Set();
#endif
if (result == false)
{
if (string.IsNullOrEmpty(_Enroll.Error) == false)
{
MessageBoxCompat.Show(_Enroll.Error);
//ToastService.Current.Notify(_Enroll.Error);
}
if (_Enroll.Requires2FA == true)
{
MessageBoxCompat.Show(AppResources.LocalAuth_SteamUser_Requires2FA);
//ToastService.Current.Notify(AppResources.LocalAuth_SteamUser_Requires2FA);
return;
}
if (_Enroll.RequiresCaptcha == true)
{
CaptchaText = null;
CaptchaImage = null;
using var web = new WebClient();
var bt = web.DownloadData(_Enroll.CaptchaUrl);
using var stream = new MemoryStream(bt);
CaptchaImage = stream;
return;
}
if (_Enroll.RequiresEmailAuth == true)
{
RequiresLogin = false;
CaptchaText = null;
CaptchaImage = null;
EmailDomain = string.IsNullOrEmpty(_Enroll.EmailDomain) == false ? "***@" + _Enroll.EmailDomain : string.Empty;
return;
}
if (_Enroll.RequiresActivation == true)
{
EmailDomain = null;
_Enroll.Error = null;
RequiresLogin = false;
AuthService.AddOrUpdateSaveAuthenticators(new GAPAuthenticatorDTO
{
Name = nameof(GamePlatform.Steam) + "(" + UserName + ")",
Value = _SteamAuthenticator
}, AuthIsLocal, AuthPassword);
RequiresActivation = true;
RevocationCode = _Enroll.RevocationCode;
return;
}
if (_Enroll.RequiresLogin == true)
{
return;
}
string error = _Enroll.Error!;
if (string.IsNullOrEmpty(error) == true)
{
error = AppResources.LocalAuth_SteamUser_Error;
}
MessageBoxCompat.Show(_Enroll.Error!);
return;
}
RequiresActivation = false;
RequiresAdd = true;
}).ContinueWith(s =>
{
Log.Error(nameof(AddAuthWindowViewModel), s.Exception, nameof(LoginSteamImport));
MessageBoxCompat.Show(s.Exception);
//ToastService.Current.Notify(s.Exception.Message);
}, TaskContinuationOptions.OnlyOnFaulted).ContinueWith(s =>
{
_IsLogining = false;
#if !__MOBILE__
ToastService.Current.Set();
#endif
s.Dispose();
});
}
public void ImportWinAuth(string file)
{
AuthService.Current.ImportWinAuthenticators(file, AuthIsLocal, AuthPassword);
}
public void ImportSDA(string file)
{
AuthService.Current.ImportSDAFile(file, AuthIsLocal, AuthPassword);
}
public void ImportSteamPlusPlusV1(string file)
{
AuthService.Current.ImportSteamToolsV1Authenticator(file, AuthIsLocal, AuthPassword);
}
public void ImportSteamPlusPlusV2(string file)
{
AuthService.Current.ImportAuthenticatorFile(file, AuthIsLocal, AuthPassword);
}
}
}
}
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:xamarin="http://schemas.xamarin.com/android/xamarin/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/shared_toolbar" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvWinAuthImport"
style="@style/TextAppearance.AppCompat.Widget.Switch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="@dimen/abc_action_button_min_height_material"
android:textAllCaps="false"
android:textColor="@color/text_primary"
tools:text="WinAuth导入"
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatTextView" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvWinAuthImportTip"
style="@style/TextAppearance.AppCompat.Widget.Switch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="@dimen/abc_action_button_min_height_material"
android:textAllCaps="false"
android:textColor="@color/text_primary"
tools:text="WinAuth是Windows的便携式开放源代码身份验证器,它提供基于计数器或基于时间的RFC 6238身份验证器和常见的实现。导入方法:从WinAuth导出txt文件之后在此选择从WinAuth导出的txt文件进行导入。"
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatTextView" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnWinAuthImport"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:insetTop="0dp"
android:insetBottom="0dp"
android:textAllCaps="false"
tools:text="选择*.txt文件导入"
xamarin:managedType="Google.Android.Material.Button.MaterialButton" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvSDAImport"
style="@style/TextAppearance.AppCompat.Widget.Switch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="@dimen/abc_action_button_min_height_material"
android:textAllCaps="false"
android:textColor="@color/text_primary"
tools:text="Steam Desktop Auth导入"
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatTextView" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvSDAImportTip"
style="@style/TextAppearance.AppCompat.Widget.Switch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="@dimen/abc_action_button_min_height_material"
android:textAllCaps="false"
android:textColor="@color/text_primary"
tools:text="Steam的移动身份验证器应用程序的桌面实现。导入方法:选择SDA目录下maFiles文件夹的maFile文件进行导入。(不支持导入加密文件,请先移除密码在导入)"
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatTextView" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnSDAImport"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:insetTop="0dp"
android:insetBottom="0dp"
android:textAllCaps="false"
tools:text="选择*.maFile文件导入"
xamarin:managedType="Google.Android.Material.Button.MaterialButton" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:xamarin="http://schemas.xamarin.com/android/xamarin/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/shared_toolbar" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/layoutName"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
tools:hint="令牌自定义名称"
xamarin:managedType="Google.Android.Material.TextField.TextInputLayout">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tbName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
xamarin:managedType="Google.Android.Material.TextField.TextInputEditText" />
</com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvSteamUUIDTip"
style="@style/TextAppearance.AppCompat.Widget.Switch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:gravity="center_vertical"
android:textAllCaps="false"
android:textColor="@color/text_primary"
tools:text="在shared_prefs文件夹中,粘贴'steam_uuid.xml'的uuidKey"
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatTextView" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/layoutSteamUUIDKey"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
xamarin:managedType="Google.Android.Material.TextField.TextInputLayout">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tbSteamUUIDKey"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
xamarin:managedType="Google.Android.Material.TextField.TextInputEditText" />
</com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvSteamGuardTip"
style="@style/TextAppearance.AppCompat.Widget.Switch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:gravity="center_vertical"
android:textAllCaps="false"
android:textColor="@color/text_primary"
tools:text="在files文件夹中,打开'SteamGuard-NNNNNNNN'文件,粘贴文件的全部内容"
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatTextView" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/layoutGuard"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
xamarin:managedType="Google.Android.Material.TextField.TextInputLayout">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tbGuard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:lines="3"
xamarin:managedType="Google.Android.Material.TextField.TextInputEditText" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/btnImport"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:insetTop="0dp"
android:insetBottom="0dp"
android:textAllCaps="false"
tools:text="确认导入"
xamarin:managedType="Google.Android.Material.Button.MaterialButton" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvImportTip"
style="@style/TextAppearance.AppCompat.Widget.Switch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:gravity="center_vertical"
android:minHeight="@dimen/abc_action_button_min_height_material"
android:textAllCaps="false"
android:textColor="@color/text_primary"
tools:text="您可以在已root的Android设备中导入您的SteamGuard身份验证器路径: /data/data/com.valvesoftware.android.steam.community然后将以下两个文件的内容复制到下面的对应输入框中"
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatTextView" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:xamarin="http://schemas.xamarin.com/android/xamarin/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/shared_toolbar" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin">
<com.google.android.material.button.MaterialButton
android:id="@+id/btnImportV1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:insetTop="0dp"
android:insetBottom="0dp"
android:textAllCaps="false"
tools:text="导入Steam++ V1版本的导出的令牌数据"
xamarin:managedType="Google.Android.Material.Button.MaterialButton" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnImportV2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:insetTop="0dp"
android:insetBottom="0dp"
android:textAllCaps="false"
tools:text="导入Steam++ V2版本的导出的令牌数据"
xamarin:managedType="Google.Android.Material.Button.MaterialButton" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:xamarin="http://schemas.xamarin.com/android/xamarin/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/shared_toolbar" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="125dp"
android:layout_height="125dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="@dimen/activity_vertical_margin"
app:srcCompat="@drawable/icon_steam_24"
app:tint="@color/icon_background" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/layoutSteamUserName"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="clear_text"
tools:hint="Steam用户名"
xamarin:managedType="Google.Android.Material.TextField.TextInputLayout">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tbSteamUserName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
xamarin:managedType="Google.Android.Material.TextField.TextInputEditText" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/layoutSteamPassword"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:endIconMode="password_toggle"
tools:hint="Steam密码"
xamarin:managedType="Google.Android.Material.TextField.TextInputLayout">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tbSteamPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
xamarin:managedType="Google.Android.Material.TextField.TextInputEditText" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/btnLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:insetTop="0dp"
android:insetBottom="0dp"
android:textAllCaps="false"
tools:text="登 录"
xamarin:managedType="Google.Android.Material.Button.MaterialButton" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvLoginTip"
style="@style/TextAppearance.AppCompat.Widget.Switch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:gravity="center_vertical"
android:minHeight="@dimen/abc_action_button_min_height_material"
android:textAllCaps="false"
android:textColor="@color/text_primary"
tools:text="登录Steam账号进行令牌导入,导入前需要移除旧令牌,并且此导入方式会有市场交易15天冷却期。
(如果没有开Steam社区加速会导致无法登录成功)"
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatTextView" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
@@ -705,6 +705,18 @@
<AndroidBoundLayout Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\layout\fragment_local_auth.xml">
<Link>Resources\layout\fragment_local_auth.xml</Link>
</AndroidBoundLayout>
<AndroidBoundLayout Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\layout\fragment_local_auth_import_other.xml">
<Link>Resources\layout\fragment_local_auth_import_other.xml</Link>
</AndroidBoundLayout>
<AndroidBoundLayout Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\layout\fragment_local_auth_import_steam_app.xml">
<Link>Resources\layout\fragment_local_auth_import_steam_app.xml</Link>
</AndroidBoundLayout>
<AndroidBoundLayout Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\layout\fragment_local_auth_import_steam_plus_plus.xml">
<Link>Resources\layout\fragment_local_auth_import_steam_plus_plus.xml</Link>
</AndroidBoundLayout>
<AndroidBoundLayout Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\layout\fragment_local_auth_import_steam_user.xml">
<Link>Resources\layout\fragment_local_auth_import_steam_user.xml</Link>
</AndroidBoundLayout>
<AndroidBoundLayout Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\layout\fragment_login_and_register_by_fast.xml">
<Link>Resources\layout\fragment_login_and_register_by_fast.xml</Link>
</AndroidBoundLayout>
@@ -851,3 +863,4 @@
@@ -1,11 +1,52 @@
using System;
using System.Collections.Generic;
using System.Text;
using Android.Views;
using Binding;
using ReactiveUI;
using System.Application.UI.Resx;
using System.Application.UI.ViewModels;
using static System.Application.UI.Resx.AppResources;
using static System.Application.UI.ViewModels.AddAuthWindowViewModel;
namespace System.Application.UI.Fragments
{
internal sealed class LocalAuthOtherImportFragment : BaseFragment
internal sealed class LocalAuthOtherImportFragment : BaseFragment<fragment_local_auth_import_other, AddAuthWindowViewModel>
{
protected override int? LayoutResource => throw new NotImplementedException();
protected override int? LayoutResource => Resource.Layout.fragment_local_auth_import_other;
public override void OnCreateView(View view)
{
base.OnCreateView(view);
R.Current.WhenAnyValue(x => x.Res).Subscribe(_ =>
{
if (binding == null) return;
binding.tvWinAuthImport.Text = LocalAuth_WinAuthImport;
binding.tvWinAuthImportTip.Text = LocalAuth_WinAuthTip;
binding.btnWinAuthImport.Text = SelectFileImport.Format("*.txt");
binding.tvSDAImport.Text = LocalAuth_SDAImport;
binding.tvSDAImportTip.Text = LocalAuth_SDATip;
binding.btnSDAImport.Text = SelectFileImport.Format("*.maFile");
}).AddTo(this);
SetOnClickListener(binding!.btnWinAuthImport, binding.btnSDAImport);
}
protected override bool OnClick(View view)
{
if (view.Id == Resource.Id.btnWinAuthImport)
{
async void OnBtnWinAuthImportClick()
=> await FilePickAsync(ViewModel!.ImportWinAuth);
OnBtnWinAuthImportClick();
return true;
}
else if (view.Id == Resource.Id.btnSDAImport)
{
async void OnBtnSDAImportClick()
=> await FilePickAsync(ViewModel!.ImportSDA);
OnBtnSDAImportClick();
return true;
}
return base.OnClick(view);
}
}
}
}
@@ -1,11 +1,54 @@
using System;
using System.Collections.Generic;
using System.Text;
using Android.Views;
using Binding;
using ReactiveUI;
using System.Application.UI.Resx;
using System.Application.UI.ViewModels;
using static System.Application.UI.Resx.AppResources;
namespace System.Application.UI.Fragments
{
internal sealed class LocalAuthSteamAppImportFragment : BaseFragment
internal sealed class LocalAuthSteamAppImportFragment : BaseFragment<fragment_local_auth_import_steam_app, AddAuthWindowViewModel>
{
protected override int? LayoutResource => throw new NotImplementedException();
protected override int? LayoutResource => Resource.Layout.fragment_local_auth_import_steam_app;
public override void OnCreateView(View view)
{
base.OnCreateView(view);
R.Current.WhenAnyValue(x => x.Res).Subscribe(_ =>
{
if (binding == null) return;
binding.layoutName.Hint = LocalAuth_AuthName;
binding.tvSteamUUIDTip.Text = LocalAuth_SteamuuidTip;
binding.tvSteamGuardTip.Text = LocalAuth_SteamGuardTip;
binding.btnImport.Text = ConfirmImport;
binding.tvImportTip.Text = LocalAuth_SteamAppImportTip;
}).AddTo(this);
binding!.tbName.TextChanged += (_, _) =>
{
ViewModel!.AuthName = binding.tbName.Text;
};
binding.tbSteamUUIDKey.TextChanged += (_, _) =>
{
ViewModel!.UUID = binding.tbSteamUUIDKey.Text;
};
binding.tbGuard.TextChanged += (_, _) =>
{
ViewModel!.SteamGuard = binding.tbGuard.Text;
};
SetOnClickListener(binding!.btnImport);
}
protected override bool OnClick(View view)
{
if (view.Id == Resource.Id.btnImport)
{
ViewModel!.ImportSteamGuard();
return true;
}
return base.OnClick(view);
}
}
}
}
@@ -1,11 +1,48 @@
using System;
using System.Collections.Generic;
using System.Text;
using Android.Views;
using Binding;
using ReactiveUI;
using System.Application.UI.Resx;
using System.Application.UI.ViewModels;
using static System.Application.UI.Resx.AppResources;
using static System.Application.UI.ViewModels.AddAuthWindowViewModel;
namespace System.Application.UI.Fragments
{
internal sealed class LocalAuthSteamToolsImportFragment : BaseFragment
internal sealed class LocalAuthSteamToolsImportFragment : BaseFragment<fragment_local_auth_import_steam_plus_plus, AddAuthWindowViewModel>
{
protected override int? LayoutResource => throw new NotImplementedException();
protected override int? LayoutResource => Resource.Layout.fragment_local_auth_import_steam_plus_plus;
public override void OnCreateView(View view)
{
base.OnCreateView(view);
R.Current.WhenAnyValue(x => x.Res).Subscribe(_ =>
{
if (binding == null) return;
binding.btnImportV1.Text = LocalAuth_SteamToolsV1Import;
binding.btnImportV2.Text = LocalAuth_SteamToolsV2Import;
}).AddTo(this);
SetOnClickListener(binding!.btnImportV1, binding.btnImportV2);
}
protected override bool OnClick(View view)
{
if (view.Id == Resource.Id.btnImportV1)
{
async void OnBtnImportV1Click()
=> await FilePickAsync(ViewModel!.ImportSteamPlusPlusV1);
OnBtnImportV1Click();
return true;
}
else if (view.Id == Resource.Id.btnImportV2)
{
async void OnBtnImportV2Click()
=> await FilePickAsync(ViewModel!.ImportSteamPlusPlusV2);
OnBtnImportV2Click();
return true;
}
return base.OnClick(view);
}
}
}
}
@@ -1,11 +1,40 @@
using System;
using System.Collections.Generic;
using System.Text;
using Android.Views;
using Binding;
using ReactiveUI;
using System.Application.UI.Resx;
using System.Application.UI.ViewModels;
using static System.Application.UI.Resx.AppResources;
namespace System.Application.UI.Fragments
{
internal sealed class LocalAuthSteamUserImportFragment : BaseFragment
internal sealed class LocalAuthSteamUserImportFragment : BaseFragment<fragment_local_auth_import_steam_user, AddAuthWindowViewModel>
{
protected override int? LayoutResource => throw new NotImplementedException();
protected override int? LayoutResource => Resource.Layout.fragment_local_auth_import_steam_user;
public override void OnCreateView(View view)
{
base.OnCreateView(view);
R.Current.WhenAnyValue(x => x.Res).Subscribe(_ =>
{
if (binding == null) return;
binding.layoutSteamUserName.Hint = Steam_User;
binding.layoutSteamPassword.Hint = Steam_Password;
binding.btnLogin.Text = Login;
binding.tvLoginTip.Text = Steam_UserLoginTip;
}).AddTo(this);
SetOnClickListener(binding!.btnLogin);
}
protected override bool OnClick(View view)
{
if (view.Id == Resource.Id.btnLogin)
{
ViewModel!.LoginSteamImport();
return true;
}
return base.OnClick(view);
}
}
}
}