Cleanup + missing CG bits

This commit is contained in:
JustArchi 2017-02-03 09:56:18 +01:00
parent 24350dcba5
commit 72141c53a3
3 changed files with 22 additions and 12 deletions

View file

@ -98,15 +98,15 @@ namespace ArchiSteamFarm {
[JsonProperty(Required = Required.DisallowNull)]
internal readonly EUpdateChannel UpdateChannel = EUpdateChannel.Stable;
[JsonProperty]
internal string WCFHost { get; set; } = "127.0.0.1";
[JsonProperty(Required = Required.DisallowNull)]
internal readonly ushort WCFPort = DefaultWCFPort;
[JsonProperty(Required = Required.DisallowNull)]
internal readonly EWCFProtocol WCFProtocol = EWCFProtocol.NetTcp;
[JsonProperty]
internal string WCFHost { get; set; } = "127.0.0.1";
// This constructor is used only by deserializer
private GlobalConfig() { }

View file

@ -165,15 +165,6 @@ namespace ArchiSteamFarm {
ServiceHost = null;
}
private static string GetUrlFromBinding(Binding binding) {
if (binding != null) {
return binding.Scheme + "://" + Program.GlobalConfig.WCFHost + ":" + Program.GlobalConfig.WCFPort + "/ASF";
}
ASF.ArchiLogger.LogNullError(nameof(binding));
return null;
}
private static Binding GetTargetBinding() {
Binding result;
switch (Program.GlobalConfig.WCFProtocol) {
@ -205,6 +196,15 @@ namespace ArchiSteamFarm {
return result;
}
private static string GetUrlFromBinding(Binding binding) {
if (binding != null) {
return binding.Scheme + "://" + Program.GlobalConfig.WCFHost + ":" + Program.GlobalConfig.WCFPort + "/ASF";
}
ASF.ArchiLogger.LogNullError(nameof(binding));
return null;
}
private void StopClient() {
if (Client == null) {
return;

View file

@ -125,6 +125,10 @@ namespace ConfigGenerator {
[JsonProperty(Required = Required.DisallowNull)]
public ushort WCFPort { get; set; } = DefaultWCFPort;
[LocalizedCategory("Access")]
[JsonProperty(Required = Required.DisallowNull)]
public EWCFProtocol WCFProtocol { get; set; } = EWCFProtocol.NetTcp;
[SuppressMessage("ReSharper", "UnusedMember.Local")]
private GlobalConfig() { }
@ -220,5 +224,11 @@ namespace ConfigGenerator {
Stable,
Experimental
}
internal enum EWCFProtocol : byte {
NetTcp,
BasicHttp,
WSHttp
}
}
}