forked from HellsGuard/ARK-Dedicated-Server-Tool
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #175 from ChronosWS/BletchChanges
ASM 326 Changes
- Loading branch information
Showing
34 changed files
with
1,475 additions
and
738 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
ARK Server Manager/Common/Converters/InvertBooleanToVisibilityConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows; | ||
using System.Windows.Data; | ||
|
||
namespace ARK_Server_Manager.Lib.ViewModel | ||
{ | ||
public class InvertBooleanToVisibilityConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
bool flag = false; | ||
if (value is bool) | ||
{ | ||
flag = (bool)value; | ||
} | ||
else if (value is bool?) | ||
{ | ||
bool? nullable = (bool?)value; | ||
flag = nullable.HasValue && nullable.Value; | ||
} | ||
return flag ? Visibility.Collapsed : Visibility.Visible; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (value is Visibility) | ||
return (Visibility)value == Visibility.Collapsed; | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
ARK Server Manager/Common/Model/SteamCmdManifestDetails.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
using NeXt.Vdf; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace ARK_Server_Manager.Lib.Model | ||
{ | ||
public class SteamCmdManifestDetailsResult | ||
{ | ||
public static void ClearUserConfigBetaKeys(VdfValue data) | ||
{ | ||
var vdfTable = data as VdfTable; | ||
if (vdfTable != null) | ||
{ | ||
var value = vdfTable.FirstOrDefault(v => v.Name.Equals("UserConfig", StringComparison.OrdinalIgnoreCase)); | ||
var tableValue = value as VdfTable; | ||
if (tableValue != null && tableValue.Count > 0) | ||
{ | ||
var betaKeyItems = tableValue.Where(v => v.Name.Equals("betakey", StringComparison.OrdinalIgnoreCase)).ToArray(); | ||
foreach (var item in betaKeyItems) | ||
{ | ||
tableValue.Remove(item); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public static SteamCmdAppManifest Deserialize(VdfValue data) | ||
{ | ||
var result = new SteamCmdAppManifest(); | ||
|
||
var vdfTable = data as VdfTable; | ||
if (vdfTable != null) | ||
{ | ||
var value = vdfTable.FirstOrDefault(v => v.Name.Equals("appid", StringComparison.OrdinalIgnoreCase)); | ||
if (value != null) result.appid = GetValue(value); | ||
|
||
value = vdfTable.FirstOrDefault(v => v.Name.Equals("UserConfig", StringComparison.OrdinalIgnoreCase)); | ||
var tableValue = value as VdfTable; | ||
if (tableValue != null && tableValue.Count > 0) | ||
{ | ||
result.UserConfig = new List<SteamCmdManifestUserConfig>(); | ||
|
||
foreach (var item in tableValue) | ||
{ | ||
if (item is VdfTable) | ||
{ | ||
var temp = new SteamCmdManifestUserConfig(); | ||
temp.betakey = item.Name; | ||
|
||
result.UserConfig.Add(temp); | ||
} | ||
} | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
|
||
public static string GetValue(VdfValue data) | ||
{ | ||
if (data == null) | ||
return null; | ||
|
||
switch (data.Type) | ||
{ | ||
case VdfValueType.Decimal: | ||
return ((VdfDecimal)data).Content.ToString("G0"); | ||
case VdfValueType.Long: | ||
return ((VdfLong)data).Content.ToString("G0"); | ||
case VdfValueType.String: | ||
return ((VdfString)data).Content; | ||
default: | ||
return null; | ||
} | ||
} | ||
} | ||
|
||
public class SteamCmdAppManifest | ||
{ | ||
public string appid { get; set; } | ||
|
||
public List<SteamCmdManifestUserConfig> UserConfig { get; set; } | ||
} | ||
|
||
public class SteamCmdManifestUserConfig | ||
{ | ||
public string betakey { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.