Compare commits

..
6 Commits
Author SHA1 Message Date
rmbgame 878e9dbd32 修改用户信息api为steam官方api 2021-01-12 16:22:10 +08:00
rmbgame bd7f9e76b8 增加80端口反代,以便自动跳转http访问到https请求上 2021-01-12 16:10:39 +08:00
rmbgame fc285cf583 修改生成的cer证书编码格式为utf8 2021-01-12 11:16:23 +08:00
rmbgame 3ab0ae46c0 新增启用日志设置项
修复twitch反代聊天连接错误和直播视频无法观看
使httpclient更稳定
2021-01-11 11:18:42 +08:00
rmbgame 4550ff1621 放宽令牌同步时网络请求超时时间 2021-01-08 21:50:18 +08:00
rmbgame 1663bd4277 fix text error 2021-01-08 10:56:53 +08:00
30 changed files with 312 additions and 168 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
$result = 'Steam++'
$bin = '..\source\SteamTools\bin\x86\Release\'
# '*.exe.config'
$targetKeywords = '*.exe','*.dll','*.txt','*.VisualElementsManifest.xml','*.pak','*.bin','*.js'
$targetKeywords = '*.exe','*.dll','*.txt','*.VisualElementsManifest.xml','*.pak','*.bin','*.js','Log4net.config'
$ignoreKeywords = '*.vshost.*','Microsoft.*.resources.dll','ExPlugin.*.dll'
$exeSource = '\Steam++.exe'
+28 -7
View File
@@ -13,8 +13,29 @@ Steam++只在keylol论坛与github发布,为了账号安全,请不要到其
## 更新内容
### 1.0.5
```
紧急修复因为第三方steamdb api挂掉导致程序崩溃(第三方api确实还是不太靠谱,考虑之后换回steam官方api)
优化反代过程的逻辑
增加启动时自动运行Steam的设置项
新增令牌刷新功能
帐户切换增加了离线模式启动的选项
修复刷新游戏缓存按钮程序闪退BUG
还修复了一些没有记下来的小错误...
```
### 1.0.4
```
此版本修改了配置文件的保存读取功能,会无法读取1.0.4版本以前的配置文件包括令牌数据。(可以通过设置-令牌设置-导入旧版本Steam++令牌数据按钮来恢复旧版本令牌数据)
还原steam社区反代上游地址修复部分请求会提示需要登录的问题
新增令牌导入导出备份功能
新增令牌可以选择保存在程序根目录下的设置选项(方便备份)
修改了自动更新的提示方式
自动更新可以自动覆盖升级,不再需要手动替换
修复令牌无法保存的问题
```
### 1.0.3.3
一直在修BUG,下个版本开始要做新功能了。
```
新增pixiv本地反代服务支持
新增在欢迎页steam昵称后显示steam的登陆区域
@@ -128,11 +149,11 @@ SDA令牌导入不再支持导入加密文件,如果要导入加密的maFile
> [Github](https://github.com/rmbadmin/SteamTools/releases)
> 分流下载:
> [hide]
> [蓝奏云](https://wws.lanzous.com/iqrxLjrm2kf)
> [百度云](https://pan.baidu.com/s/1yCimLO0HvptR0OOgpZVBCQ)
> 提取码:7h66
> [蓝奏云](https://wws.lanzous.com/ilYjRk5ohfg)
> [百度云](https://pan.baidu.com/s/1n4yAlzqe6RIhHKU4vuoVGA)
> 提取码:g7nh
> [/hide]
> EXE 大小:4.75MB
> MD5:BF6B5196FD95C8D689BA75243FBF8C96
> [查毒链接](https://www.virustotal.com/gui/file/1073fc19c3208228b1a00eb9bceab771cbf77ffbf1a6c2de666a0e9a4967db60/detection)
> EXE 大小:4.85MB
> MD5:D5FB1CD6776687DC13BC01F5C717D2C5
> [查毒链接](https://www.virustotal.com/gui/file/6d0a506044013d1cea7c2b4f7734f2405ad7ac6b1f5213abc68743f979acf51f/detection)
虽然没有什么杀毒软件报毒,但是使用过程中可能遇到windows defender误报,您可以选择添加信任。
+16
View File
@@ -254,5 +254,21 @@
"PayType": 1,
"Remark": "",
"PayTime": "2021-01-07 12:25:59"
},
{
"Name": "素年",
"Amount": 5,
"OrderNumber": "",
"PayType": 2,
"Remark": "不闪退了。支持一下",
"PayTime": "2021-01-08 22:37:11"
},
{
"Name": "kingburial",
"Amount": 1,
"OrderNumber": "",
"PayType": 2,
"Remark": "不是很常用,但是切换账号就很方便。谢谢啦",
"PayTime": "2021-01-08 10:16:04"
}
]
@@ -82,7 +82,7 @@ namespace WinAuth
/// <summary>
/// Time for http request when calling Sync in ms
/// </summary>
private const int SYNC_TIMEOUT = 5000;
private const int SYNC_TIMEOUT = 30000;
/// <summary>
/// Steam issuer for KeyUri
@@ -24,7 +24,6 @@ namespace SteamTool.Proxy
Convert.ToBase64String(@this.RawData, Base64FormattingOptions.InsertLineBreaks));
builder.AppendLine("-----END CERTIFICATE-----");
builder.AppendLine(Const.HOST_TAG);
return builder.ToString();
}
@@ -33,7 +32,7 @@ namespace SteamTool.Proxy
RSACryptoServiceProvider pkey = (RSACryptoServiceProvider)@this.PrivateKey;
AsymmetricCipherKeyPair keyPair = DotNetUtilities.GetRsaKeyPair(pkey);
using TextWriter tw = new StreamWriter(Path.Combine(AppContext.BaseDirectory, @this.IssuerName.Name + ".key"));
using TextWriter tw = new StreamWriter(Path.Combine(AppContext.BaseDirectory, @this.IssuerName.Name + ".key"), false, new UTF8Encoding(false));
PemWriter pw = new PemWriter(tw);
pw.WriteObject(keyPair.Private);
tw.Flush();
@@ -71,7 +70,7 @@ namespace SteamTool.Proxy
Convert.ToBase64String(@this.Export(X509ContentType.Cert), Base64FormattingOptions.InsertLineBreaks));
builder.AppendLine("-----END CERTIFICATE-----");
File.WriteAllText(pathOrName, builder.ToString(), Encoding.UTF8);
File.WriteAllText(pathOrName, builder.ToString(), new UTF8Encoding(false));
}
}
}
+42 -74
View File
@@ -1,5 +1,6 @@
using Newtonsoft.Json;
using Ninject.Modules;
using SteamTool.Core.Common;
using System;
using System.Collections.Generic;
using System.Dynamic;
@@ -19,23 +20,47 @@ namespace SteamTool.Core
public string Accept { get; set; } = "application/json";
private async Task<string> SendAsync(HttpRequestMessage request)
{
try
{
var response = await _client.SendAsync(request).ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync().ConfigureAwait(false);
}
}
catch (Exception ex)
{
Logger.Error(ex);
}
return null;
}
private async Task<Stream> SendAsyncAsStream(HttpRequestMessage request)
{
try
{
var response = await _client.SendAsync(request).ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
}
}
catch (Exception ex)
{
Logger.Error(ex);
}
return null;
}
public async Task<string> Get(string url)
{
var request = new HttpRequestMessage(HttpMethod.Get, url);
request.Headers.Add("User-Agent", UserAgent);
request.Headers.Add("Accept", Accept);
var response = await _client.SendAsync(request).ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync().ConfigureAwait(false);
}
else
{
return null;
}
return await SendAsync(request);
}
public async Task<string> Get(string url, Dictionary<string, string> keyValuePairs)
{
@@ -53,20 +78,7 @@ namespace SteamTool.Core
{
request.Headers.Add("Accept", Accept);
}
var response = await _client.SendAsync(request).ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync().ConfigureAwait(false);
}
else
{
return null;
}
return await SendAsync(request);
}
public async Task<Stream> GetStream(string url, Dictionary<string, string> keyValuePairs)
{
@@ -85,18 +97,7 @@ namespace SteamTool.Core
request.Headers.Add("Accept", Accept);
}
var response = await _client.SendAsync(request).ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
}
else
{
return null;
}
return await SendAsyncAsStream(request);
}
public async Task<string> Post(string url, string content)
@@ -107,18 +108,7 @@ namespace SteamTool.Core
};
request.Headers.Add("User-Agent", UserAgent);
request.Headers.Add("Accept", Accept);
var response = await _client.SendAsync(request).ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync().ConfigureAwait(false);
}
else
{
return null;
}
return await SendAsync(request);
}
public async Task<string> Post(string url, Dictionary<string, string> keyValuePairs, string content)
{
@@ -139,18 +129,7 @@ namespace SteamTool.Core
request.Headers.Add("Accept", Accept);
}
var response = await _client.SendAsync(request).ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync().ConfigureAwait(false);
}
else
{
return null;
}
return await SendAsync(request);
}
public async Task<Stream> PostStream(string url, Dictionary<string, string> keyValuePairs, Stream content)
{
@@ -171,18 +150,7 @@ namespace SteamTool.Core
request.Headers.Add("Accept", Accept);
}
var response = await _client.SendAsync(request).ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
}
else
{
return null;
}
return await SendAsyncAsStream(request);
}
}
}
+3 -5
View File
@@ -50,15 +50,13 @@ namespace SteamTool.Core
{
var steamExePath = registryKeyService.ReadRegistryKey(Registry.CurrentUser, SteamRegistryPath, "SteamExe");
var steamPath = registryKeyService.ReadRegistryKey(Registry.CurrentUser, SteamRegistryPath, "SteamPath");
//steamExePath = Path.GetFullPath(steamExePath);
//steamPath = Path.GetFullPath(steamPath);
if (File.Exists(steamExePath))
{
SteamExePath = steamExePath;
SteamExePath = Path.GetFullPath(steamExePath);
}
if (Directory.Exists(steamPath))
{
SteamPath = steamPath;
SteamPath = Path.GetFullPath(steamPath);
}
}
@@ -110,10 +108,10 @@ namespace SteamTool.Core
SteamId64 = Convert.ToInt64(item.Key.ToString()),
AccountName = i.AccountName?.ToString(),
SteamID = i.PersonaName?.ToString(),
PersonaName = i.PersonaName?.ToString(),
RememberPassword = Convert.ToBoolean(Convert.ToInt64(i.RememberPassword?.ToString())),
Timestamp = Convert.ToInt64(i.Timestamp?.ToString())
};
user.PersonaName = user.SteamID;
user.LastLoginTime = user.Timestamp.ToDateTime();
//老版本Steam数据 小写mostrecent 支持
+7
View File
@@ -8,6 +8,7 @@ namespace SteamTool.Model
public const string AUTHDATA_FILE = "authenticators.dat";
public const string SETTINGS_FILE = "settings.json";
public const string SCRIPT_DIR = "scripts";
public const string LOG_DIR = "log";
public const string HOST_TAG = "#S302";
public const string REWARDMELIST_URL = "https://gitee.com/rmbgame/steam-tools_-data/raw/master/RewardRecord.json";
@@ -41,5 +42,11 @@ namespace SteamTool.Model
public const string STEAMDB_USERINFO_URL = "https://api.steamdb.ml/v1/users/{0}";
public const string STEAMDB_APPINFO_URL = "https://api.steamdb.ml/v1/apps/{0}";
//https://steamcommunity.com/profiles/76561198289531723?xml=1
public const string STEAM_USERINFO_XML_URL = "https://steamcommunity.com/profiles/{0}?xml=1";
public const string STEAMCN_USERINFO_XML_URL = "https://my.steamchina.com/profiles/76561198289531723?xml=1";
}
}
@@ -16,7 +16,7 @@ namespace SteamTool.Model
public bool IsHidden { get; set; }
public bool IsAchieved { get; set; }
public bool IsChecked { get; set; }
public int UnlockTimeUnix { get; set; }
public long UnlockTimeUnix { get; set; }
public DateTime UnlockTime { get; set; }
public string IconUrl => IsAchieved ? string.Format(Const.STEAMAPP_ICON_URL, AppId, IconNormal) : string.Format(Const.STEAMAPP_ICON_URL, AppId, IconLocked);
public int Permission { get; set; }
+11 -2
View File
@@ -1,7 +1,9 @@
using System;
using System.Xml.Serialization;
namespace SteamTool.Model
{
[XmlRoot("profile")]
public class SteamUser
{
public SteamUser() { }
@@ -17,6 +19,7 @@ namespace SteamTool.Model
public string SteamId32 { get; set; }
public long SteamId32_Int { get; set; }
[XmlElement("steamID64")]
public long SteamId64 { get; set; }
/// <summary>
@@ -27,6 +30,7 @@ namespace SteamTool.Model
/// <summary>
/// 在线状态
/// </summary>
[XmlElement("onlineState")]
public string OnlineState { get; set; }
public string IPCountry { get; set; }
@@ -36,26 +40,31 @@ namespace SteamTool.Model
/// friendsonly
/// public
/// </summary>
[XmlElement("privacyState")]
public string PrivacyState { get; set; }
/// <summary>
/// 头像小图标
/// </summary>
[XmlElement("avatarIcon")]
public string AvatarIcon { get; set; }
/// <summary>
/// 头像中等图片链接
/// </summary>
[XmlElement("avatarMedium")]
public string AvatarMedium { get; set; } = "/Resources/Asstes/avater.jpg";
/// <summary>
/// 头像大图链接
/// </summary>
public string AvatarFull { get; set; }
[XmlElement("avatarFull")]
public string AvatarFull { get; set; }
/// <summary>
/// 昵称
/// </summary>
[XmlElement("steamID")]
public string SteamID { get; set; }
/// <summary>
@@ -66,7 +75,7 @@ namespace SteamTool.Model
/// <summary>
/// 从VDF读取到的用户名
/// </summary>
public string PersonaName { get; set; } = "No Name";
public string PersonaName { get; set; }
/// <summary>
/// 用户名
+28 -13
View File
@@ -75,7 +75,7 @@ namespace SteamTool.Proxy
#endregion
Debug.WriteLine("OnRequest " + e.HttpClient.Request.RequestUri.AbsoluteUri);
Debug.WriteLine("OnRequest HTTP " + e.HttpClient.Request.HttpVersion);
Logger.Info("OnRequest" + e.HttpClient.Request.RequestUri.AbsoluteUri);
//Logger.Info("OnRequest" + e.HttpClient.Request.RequestUri.AbsoluteUri);
#endif
// Dns.GetHostAddressesAsync(e.HttpClient.Request.Host).ContinueWith(s =>
//{
@@ -87,6 +87,7 @@ namespace SteamTool.Proxy
// return;
// }
//});
//Logger.Info("Steam++ OnRequest: " + e.HttpClient.Request.RequestUri.AbsoluteUri);
foreach (var item in ProxyDomains)
{
if (!item.IsEnable)
@@ -97,6 +98,10 @@ namespace SteamTool.Proxy
{
if (e.HttpClient.Request.RequestUri.AbsoluteUri.Contains(host))
{
if (e.HttpClient.Request.RequestUri.Scheme.Equals("http", StringComparison.OrdinalIgnoreCase))
{
e.Redirect(e.HttpClient.Request.RequestUri.AbsoluteUri.Remove(0, 4).Insert(0, "https"));
}
IPAddress iP = null;
if (!string.IsNullOrEmpty(item.ProxyIPAddres))
{
@@ -106,6 +111,7 @@ namespace SteamTool.Proxy
{
var iPs = await Dns.GetHostAddressesAsync(item.ToDomain);
iP = iPs.FirstOrDefault();
//Logger.Info("Proxy IP: " + iP);
}
if (iP != null)
{
@@ -113,6 +119,7 @@ namespace SteamTool.Proxy
}
if (e.HttpClient.ConnectRequest?.ClientHelloInfo != null)
{
//Logger.Info("ClientHelloInfo Info: " + e.HttpClient.ConnectRequest.ClientHelloInfo);
if (!string.IsNullOrEmpty(item.ServerName))
{
var sni = e.HttpClient.ConnectRequest.ClientHelloInfo.Extensions["server_name"];
@@ -255,12 +262,12 @@ namespace SteamTool.Proxy
//proxyServer.CertificateManager.CertificateEngine = Network.CertificateEngine.BouncyCastle;
//proxyServer.CertificateManager.SaveFakeCertificates = true;
var result = proxyServer.CertificateManager.CreateRootCertificate(true);
if (result)
{
proxyServer.CertificateManager.EnsureRootCertificate();
proxyServer.CertificateManager.RootCertificate.SaveCerCertificateFile(Path.Combine(AppContext.BaseDirectory, $@"{CertificateName}.Certificate.cer"));
}
return proxyServer.CertificateManager.IsRootCertificateUserTrusted();
//if (result)
//{
proxyServer.CertificateManager.EnsureRootCertificate();
proxyServer.CertificateManager.RootCertificate.SaveCerCertificateFile(Path.Combine(AppContext.BaseDirectory, $@"{CertificateName}.Certificate.cer"));
//}
return IsCertificateInstalled(proxyServer.CertificateManager.RootCertificate);
}
public bool DeleteCertificate()
@@ -326,11 +333,10 @@ namespace SteamTool.Proxy
return false;
}
}
//暂时移除443端口检测
//if (PortInUse(443))
//{
// return false;
//}
if (PortInUse(443))
{
return false;
}
if (IsProxyGOG) { WirtePemCertificateToGoGSteamPlugins(); }
#region 写入Hosts
@@ -374,6 +380,16 @@ namespace SteamTool.Proxy
//GenericCertificate = proxyServer.CertificateManager.RootCertificate
};
proxyServer.AddEndPoint(transparentEndPoint);
var transparentEndPoint80 = new TransparentProxyEndPoint(IPAddress.Any, 80, true)
{
//GenericCertificate = proxyServer.CertificateManager.RootCertificate
};
proxyServer.AddEndPoint(transparentEndPoint80);
proxyServer.ExceptionFunc = ((Exception exception) =>
{
Logger.Error(exception);
});
try
{
proxyServer.Start();
@@ -386,7 +402,6 @@ namespace SteamTool.Proxy
//proxyServer.UpStreamHttpProxy = new ExternalProxy() { HostName = "localhost", Port = 8888 };
//proxyServer.UpStreamHttpsProxy = new ExternalProxy() { HostName = "localhost", Port = 8888 };
#endregion
#if DEBUG
foreach (var endPoint in proxyServer.ProxyEndPoints)
Debug.WriteLine("Listening on '{0}' endpoint at Ip {1} and port: {2} ",
@@ -84,5 +84,7 @@ namespace SteamTool.Proxy
DiscordNet = 11,
[Description("Uplay更新防劫持")]
UplayUpdate = 12,
[Description("Twitch聊天")]
TwitchChat = 13,
}
}
+9
View File
@@ -177,6 +177,15 @@ namespace SteamTool.Proxy.Properties {
}
}
/// <summary>
/// 查找类似 Twitch聊天 的本地化字符串。
/// </summary>
public static string TwitchChat {
get {
return ResourceManager.GetString("TwitchChat", resourceCulture);
}
}
/// <summary>
/// 查找类似 Uplay更新 的本地化字符串。
/// </summary>
@@ -156,6 +156,9 @@
<data name="Twitch" xml:space="preserve">
<value>Twitch直播</value>
</data>
<data name="TwitchChat" xml:space="preserve">
<value>Twitch聊天</value>
</data>
<data name="UplayUpdate" xml:space="preserve">
<value>Uplay更新</value>
</data>
@@ -115,7 +115,7 @@ namespace SteamTool.Steam.Service.Local
return SteamClient.SteamUserStats.GetAchievementState(name, out isAchieved);
}
public bool GetAchievementAndUnlockTime(string name, out bool isAchieved, out int unlockTime)
public bool GetAchievementAndUnlockTime(string name, out bool isAchieved, out long unlockTime)
{
return SteamClient.SteamUserStats.GetAchievementAndUnlockTime(name, out isAchieved, out unlockTime);
}
@@ -3,8 +3,10 @@ using SteamTool.Core;
using SteamTool.Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace SteamTool.Steam.Service.Web
{
@@ -26,5 +28,17 @@ namespace SteamTool.Steam.Service.Web
return apps.AppList.Apps;
}
public async Task<SteamUser> GetUserInfo(long steamId64)
{
var r = await httpServices.Get(string.Format(Const.STEAM_USERINFO_XML_URL, steamId64));
if (!string.IsNullOrEmpty(r))
{
using StringReader sr = new StringReader(r);
var xmldes = new XmlSerializer(typeof(SteamUser));
return xmldes.Deserialize(sr) as SteamUser;
}
return new SteamUser() { SteamId64 = steamId64 };
}
}
}
@@ -139,9 +139,9 @@ namespace SAM.API.Wrappers
private delegate bool NativeGetAchievementAndUnlockTime(
IntPtr self,
IntPtr name,
[MarshalAs(UnmanagedType.I1)] out bool isAchieved, out int unlockTime);
[MarshalAs(UnmanagedType.I1)] out bool isAchieved, out long unlockTime);
public bool GetAchievementAndUnlockTime(string name, out bool isAchieved, out int unlockTime)
public bool GetAchievementAndUnlockTime(string name, out bool isAchieved, out long unlockTime)
{
using (var nativeName = NativeStrings.StringToStringHandle(name))
{
+6 -6
View File
@@ -92,7 +92,7 @@ namespace SteamTools
App.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
this.DispatcherUnhandledException += App_DispatcherUnhandledException;
DispatcherHelper.UIDispatcher = this.Dispatcher;
if (e.Args.ContainsArg("-log"))
if (e.Args.ContainsArg("-log") || GeneralSettings.IsEnableLogRecord)
{
Logger.EnableTextLog = true;
}
@@ -103,9 +103,9 @@ namespace SteamTools
GeneralSettings.Culture.Subscribe(x => ResourceService.Current.ChangeCulture(x)).AddTo(this);
WindowService.Current.AddTo(this).Initialize();
AuthService.Current.Initialize();
ProxyService.Current.Initialize();
SteamConnectService.Current.Initialize();
AuthService.Current.Initialize();
if (GeneralSettings.IsAutoCheckUpdate.Value)
{
AutoUpdateService.Current.CheckUpdate();
@@ -235,7 +235,7 @@ namespace SteamTools
}
#region INotifyPropertyChanged members
#region INotifyPropertyChanged members
private event PropertyChangedEventHandler PropertyChangedInternal;
event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged
@@ -249,9 +249,9 @@ namespace SteamTools
this.PropertyChangedInternal?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
#endregion
#region IDisposable members
#region IDisposable members
private readonly LivetCompositeDisposable compositeDisposable = new LivetCompositeDisposable();
ICollection<IDisposable> IDisposableHolder.CompositeDisposable => this.compositeDisposable;
@@ -261,6 +261,6 @@ namespace SteamTools
this.compositeDisposable.Dispose();
}
#endregion
#endregion
}
}
@@ -1,5 +1,6 @@
using MetroTrilithon.Serialization;
using SteamTool.Core;
using SteamTool.Core.Common;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -13,6 +14,12 @@ namespace SteamTools.Models.Settings
static GeneralSettings()
{
WindowsStartupAutoRun.ValueChanged += WindowsStartupAutoRun_ValueChanged;
IsEnableLogRecord.ValueChanged += IsEnableLogRecord_ValueChanged;
}
private static void IsEnableLogRecord_ValueChanged(object sender, ValueChangedEventArgs<bool> e)
{
Logger.EnableTextLog = e.NewValue;
}
private static void WindowsStartupAutoRun_ValueChanged(object sender, ValueChangedEventArgs<bool> e)
@@ -69,6 +76,13 @@ namespace SteamTools.Models.Settings
public static SerializableProperty<bool> IsAutoCheckUpdate { get; }
= new SerializableProperty<bool>(GetKey(), Providers.Roaming, true) { AutoSave = true };
/// <summary>
/// 启用错误日志记录
/// </summary>
public static SerializableProperty<bool> IsEnableLogRecord { get; }
= new SerializableProperty<bool>(GetKey(), Providers.Roaming, false) { AutoSave = true };
private static string GetKey([CallerMemberName] string propertyName = "")
{
return nameof(GeneralSettings) + "." + propertyName;
@@ -1,8 +1,7 @@
{
"profiles": {
"SteamTools": {
"commandName": "Project",
"commandLineArgs": "-log"
"commandName": "Project"
}
}
}
+15 -10
View File
@@ -17,6 +17,7 @@ using System.Security.Cryptography;
using System.Linq;
using MetroTrilithon.Mvvm;
using SteamTool.Model;
using System.Threading.Tasks;
namespace SteamTools.Services
{
@@ -68,11 +69,11 @@ namespace SteamTools.Services
}
}
public void Initialize()
public async void Initialize()
{
try
await Task.Run(() =>
{
StatusService.Current.Notify("加载令牌数据...");
StatusService.Current.Notify("正在初始化令牌数据...");
var path = Path.Combine(AppContext.BaseDirectory, Const.AUTHDATA_FILE);
if (File.Exists(path))
{
@@ -94,12 +95,16 @@ namespace SteamTools.Services
}
}
StatusService.Current.Notify("加载令牌数据完成");
}
catch (Exception ex)
{
Logger.Error(ex);
WindowService.Current.ShowDialogWindow($"令牌同步服务器失败,错误信息:{ex}");
}
}).ContinueWith(s => { Logger.Error(s.Exception); WindowService.Current.ShowDialogWindow("令牌同步服务器失败,错误信息:" + s.Exception); }, TaskContinuationOptions.OnlyOnFaulted).ContinueWith(s => s.Dispose());
//try
//{
//}
//catch (Exception ex)
//{
// Logger.Error(ex);
// WindowService.Current.ShowDialogWindow($"令牌同步服务器失败,错误信息:{ex}");
//}
}
/// <summary>
@@ -166,7 +171,7 @@ namespace SteamTools.Services
var qm = line.IndexOf("?");
if (hash != -1 && hash < qm)
{
line = line.Substring(0, hash) + "%23" + line.Substring(hash + 1);
line = $"{line.Substring(0, hash)}%23{line.Substring(hash + 1)}";
}
// parse and validate URI
+26 -4
View File
@@ -68,8 +68,8 @@ IsEnable= false,
new ProxyDomainModel{
Name=Resources.SteamImage,
Domains = new List<string>{"steamcdn-a.akamaihd.net" },
//ToDomain = "cdn.akamai.steamstatic.com",
ToDomain = "media.steampowered.com",
ToDomain = "cdn.akamai.steamstatic.com",
//ToDomain = "media.steampowered.com",
Hosts = new List<string>{ "steamcdn-a.akamaihd.net"},
DomainTag = DomainTag.SteamImage,
IsEnable= false,
@@ -125,10 +125,33 @@ DomainTag = DomainTag.DiscordNet,
IsEnable= false,
},
new ProxyDomainModel{
Name=Resources.TwitchChat,
Domains = new List<string>{ "irc-ws.chat.twitch.tv" },
ProxyIPAddres="50.112.157.122",
Hosts = new List<string>{
"irc-ws.chat.twitch.tv",
"irc-ws-r.chat.twitch.tv",
},
DomainTag = DomainTag.TwitchChat,
IsEnable= false,
},
//new ProxyDomainModel{
//Name=Resources.Twitch,
//Domains = new List<string>{ "usher.ttvnw.net" },
////ToDomain="twitch.map.fastly.net",
//ProxyIPAddres="23.160.0.254",
//Hosts = new List<string>{
////"usher.twitch.tv",
//"usher.ttvnw.net",
//"hls.ttvnw.net",
//},
//DomainTag = DomainTag.Twitch,
//IsEnable= false,
//},
new ProxyDomainModel{
Name=Resources.Twitch,
Domains = new List<string>{ "twitch.tv" },
ToDomain="twitch.map.fastly.net",
//ProxyIPAddres="157.240.13.8",
Hosts = new List<string>{
"twitch.tv",
"www.twitch.tv",
@@ -168,7 +191,6 @@ Hosts = new List<string>{
"irc-ws.chat.twitch.tv",
"irc-ws-r.chat.twitch.tv",
//"platform.twitter.com",
//"usher.ttvnw.net",
},
DomainTag = DomainTag.Twitch,
IsEnable= false,
@@ -118,41 +118,50 @@ namespace SteamTools.Services
var t = new Task(async () =>
{
Thread.CurrentThread.IsBackground = true;
while (true)
try
{
if (Process.GetProcessesByName("steam").Length > 0)
{
if (!IsConnectToSteam)
{
if (ApiService.Initialize())
{
var id = ApiService.GetSteamId64();
if (id == 76561197960265728)
{
//该64位id的steamID3等于0,是steam未获取到当前登录用户的默认返回值,所以直接重新获取,
//希望这位用户不会用steam++,嗯...
SteamConnectService.Current.DisposeSteamClient();
continue;
}
IsConnectToSteam = true;
CurrentSteamUser = await steamDbApiService.GetUserInfo(id);
CurrentSteamUser.IPCountry = ApiService.GetIPCountry();
var mainViewModel = (WindowService.Current.MainWindow as MainWindowViewModel);
await mainViewModel.SteamAppPage.Initialize();
while (true)
{
if (Process.GetProcessesByName("steam").Length > 0)
{
if (!IsConnectToSteam)
{
if (ApiService.Initialize())
{
var id = ApiService.GetSteamId64();
if (id == 76561197960265728)
{
//该64位id的steamID3等于0,是steam未获取到当前登录用户的默认返回值,所以直接重新获取,
//希望这位用户不会用steam++,嗯...
SteamConnectService.Current.DisposeSteamClient();
continue;
}
IsConnectToSteam = true;
CurrentSteamUser = await SteamworksWebApiService.GetUserInfo(id);
CurrentSteamUser.IPCountry = ApiService.GetIPCountry();
var mainViewModel = (WindowService.Current.MainWindow as MainWindowViewModel);
await mainViewModel.SteamAppPage.Initialize();
#if DEBUG
await mainViewModel.SystemTabItems[mainViewModel.SystemTabItems.Count - 1].Initialize();
await mainViewModel.SystemTabItems[mainViewModel.SystemTabItems.Count - 1].Initialize();
#endif
SteamConnectService.Current.DisposeSteamClient();
SteamConnectService.Current.DisposeSteamClient();
}
}
}
else
{
IsConnectToSteam = false;
//StatusService.Current.Notify(Resources.Steam_Not_Runing);
}
await Task.Delay(1500);
}
else
{
IsConnectToSteam = false;
//StatusService.Current.Notify(Resources.Steam_Not_Runing);
}
await Task.Delay(1500);
}
catch (Exception ex)
{
Logger.Error(ex);
StatusService.Current.Notify(ex.Message);
}
}, TaskCreationOptions.LongRunning);
+1 -1
View File
@@ -35,7 +35,7 @@
<PackageId />
<Version>1.0.5</Version>
<Version>1.0.6</Version>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup>
@@ -32,5 +32,14 @@ namespace SteamTools.ViewModels
{
AutoUpdateService.Current.CheckUpdate();
}
public void OpenLogFolder()
{
var log_dir = Path.Combine(AppContext.BaseDirectory, Const.LOG_DIR);
if (Directory.Exists(log_dir))
{
Process.Start(log_dir);
}
}
}
}
@@ -21,7 +21,7 @@ namespace SteamTools.ViewModels
public class SteamAccountPageViewModel : TabItemViewModel
{
private readonly SteamToolService steamService = SteamToolCore.Instance.Get<SteamToolService>();
private readonly SteamDbApiService webApiService = SteamService.Instance.Get<SteamDbApiService>();
private readonly SteamworksWebApiService webApiService = SteamService.Instance.Get<SteamworksWebApiService>();
public override string Name
{
@@ -62,6 +62,7 @@ namespace SteamTools.ViewModels
var temp = users[i];
users[i] = await webApiService.GetUserInfo(SteamUsers[i].SteamId64);
users[i].AccountName = temp.AccountName;
users[i].SteamID = temp.SteamID;
users[i].PersonaName = temp.PersonaName;
users[i].RememberPassword = temp.RememberPassword;
users[i].MostRecent = temp.MostRecent;
@@ -343,7 +343,7 @@ namespace SteamTools.ViewModels
IconNormal = string.IsNullOrEmpty(def.IconNormal) ? null : def.IconNormal,
IconLocked = string.IsNullOrEmpty(def.IconLocked) ? def.IconNormal : def.IconLocked,
Permission = def.Permission,
UnlockTime = new DateTime(1970, 1, 1, 8, 0, 0).AddSeconds(unlockTime),
UnlockTime = unlockTime.ToDateTime(),
UnlockTimeUnix = unlockTime,
Name = def.Name,
Description = def.Description,
@@ -34,20 +34,20 @@
TextAlignment="Left"
MaxPageWidth="900">
<Paragraph Language="zh-cn">
<Run Text="Steam++ v1.0.4" FontSize="16"/>
<Run Text="Steam++ v1.0.5" FontSize="16"/>
<Run Text="&#160;"/>
<Run Text="2021-01-08" FontSize="10" />
<LineBreak />
<Run Text="更新内容"></Run>
<LineBreak />
<Run Text="&#160;&#160;&#160;&#160;"/>
<Run Text="优化了反代过程的逻辑" />
<Run Text="优化反代过程的逻辑" />
<LineBreak/>
<Run Text="&#160;&#160;&#160;&#160;"/>
<Run Text="增加了启动时自动运行Steam的设置项" />
<Run Text="增加启动时自动运行Steam的设置项" />
<LineBreak/>
<Run Text="&#160;&#160;&#160;&#160;"/>
<Run Text="新增令牌了刷新功能" />
<Run Text="新增令牌刷新功能" />
<LineBreak/>
<Run Text="&#160;&#160;&#160;&#160;"/>
<Run Text="帐户切换增加了离线模式启动的选项"></Run>
@@ -149,6 +149,30 @@
Margin="-20,8" />
</StackPanel>
<StackPanel Margin="20,0,0,0">
<TextBlock Margin="-20,0,0,10" Text="日志设置" Style="{DynamicResource SettingsHeaderTextStyleKey}" />
<CheckBox
HorizontalAlignment="Left"
IsChecked="{Binding Source={x:Static ms:GeneralSettings.IsEnableLogRecord}, Path=Value, Mode=TwoWay}">
<TextBlock Text="启用日志"></TextBlock>
</CheckBox>
<TextBlock Style="{StaticResource DetailTextStyleKey}" Margin="0,6,0,0">
<Run Text="记录错误日志到程序根目录Log文件夹内,反馈BUG时把日志也提交上来,方便排查闪退报错原因。"></Run>
</TextBlock>
<Separator Opacity="0" Height="10"/>
<metro2:CallMethodButton Content="打开日志文件夹"
Width="150"
Height="30"
HorizontalAlignment="Left"
MethodName="OpenLogFolder"
MethodTarget="{Binding}"/>
<Border Height="1"
Background="{DynamicResource BorderBrushKey}"
Margin="-20,8" />
</StackPanel>
</StackPanel>
</ScrollViewer>
</UserControl>