Code style update/fixes

This commit is contained in:
JustArchi 2017-07-03 12:14:23 +02:00
parent e5f8fd9213
commit 9aa36f1a03
11 changed files with 114 additions and 94 deletions

View file

@ -51,12 +51,13 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=InvertCondition_002E1/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=InvertIf/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=InvocationIsSkipped/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=JoinNullCheckWithUsageWhenPossible/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=LoopCanBeConvertedToQuery/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=LoopCanBePartlyConvertedToQuery/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MemberCanBeInternal/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MemberCanBeMadeStatic_002EGlobal/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MemberCanBeMadeStatic_002ELocal/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MergeSequentialChecksWhenPossible/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MergeSequentialChecksWhenPossible/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NotOverriddenInSpecificCulture/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NUnit_002EMethodWithParametersAndTestAttribute/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NUnit_002ENonPublicMethodWithTestAttribute/@EntryIndexedValue">SUGGESTION</s:String>
@ -74,7 +75,9 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantEmptyObjectCreationArgumentList/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantIfElseBlock/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantLambdaSignatureParentheses/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantQueryOrderByAscendingKeyword/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantToStringCallForValueType/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RemoveConstructorInvocation/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RemoveConstuctorInvocation/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RemoveRedundantBraces/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ReturnTypeCanBeEnumerable_002EGlobal/@EntryIndexedValue">SUGGESTION</s:String>
@ -110,12 +113,13 @@
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/PARENTHESES_NON_OBVIOUS_OPERATIONS/@EntryValue">Shift, Bitwise, Conditional</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ACCESSOR_DECLARATION_BRACES/@EntryValue">END_OF_LINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ACCESSOR_OWNER_DECLARATION_BRACES/@EntryValue">END_OF_LINE</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALLOW_COMMENT_AFTER_LBRACE/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALLOW_COMMENT_AFTER_LBRACE/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue">END_OF_LINE</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AFTER_CONTROL_TRANSFER_STATEMENTS/@EntryValue">1</s:Int64>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_FIELD/@EntryValue">0</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/CASE_BLOCK_BRACES/@EntryValue">END_OF_LINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/EMPTY_BLOCK_STYLE/@EntryValue">TOGETHER_SAME_LINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_STYLE/@EntryValue">Tab</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INITIALIZER_BRACES/@EntryValue">END_OF_LINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INVOCABLE_DECLARATION_BRACES/@EntryValue">END_OF_LINE</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_CODE/@EntryValue">1</s:Int64>
@ -133,6 +137,7 @@
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_WITHING_EMPTY_BRACES/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_WITHIN_SINGLE_LINE_ARRAY_INITIALIZER_BRACES/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/TYPE_DECLARATION_BRACES/@EntryValue">END_OF_LINE</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/USE_INDENT_FROM_VS/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_CHAINED_METHOD_CALLS/@EntryValue">WRAP_IF_LONG</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">65535</s:Int64>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LINES/@EntryValue">False</s:Boolean>
@ -374,6 +379,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"&gt;&lt;ExtraRule Prefix="I" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"&gt;&lt;ExtraRule Prefix="_" Suffix="" Style="AaBb" /&gt;&lt;ExtraRule Prefix="_" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"&gt;&lt;ExtraRule Prefix="_" Suffix="" Style="AaBb" /&gt;&lt;ExtraRule Prefix="_" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/Environment/Hierarchy/PsiConfigurationSettingsKey/CustomLocation/@EntryValue">C:\Users\Archi\AppData\Local\JetBrains\Transient\ReSharperPlatformVs15\v09_e802ec1a\SolutionCaches</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>

View file

@ -86,10 +86,12 @@ namespace ArchiSteamFarm {
return;
}
ClientMsg<CMsgClientClanInviteAction> request = new ClientMsg<CMsgClientClanInviteAction>();
request.Body.ClanID = clanID;
request.Body.AcceptInvite = accept;
ClientMsg<CMsgClientClanInviteAction> request = new ClientMsg<CMsgClientClanInviteAction> {
Body = {
ClanID = clanID,
AcceptInvite = accept
}
};
Client.Send(request);
}
@ -190,11 +192,10 @@ namespace ArchiSteamFarm {
}
ClientMsgProtobuf<CMsgClientRedeemGuestPass> request = new ClientMsgProtobuf<CMsgClientRedeemGuestPass>(EMsg.ClientRedeemGuestPass) {
SourceJobID = Client.GetNextJobID()
SourceJobID = Client.GetNextJobID(),
Body = { guest_pass_id = guestPassID }
};
request.Body.guest_pass_id = guestPassID;
Client.Send(request);
try {
@ -216,11 +217,10 @@ namespace ArchiSteamFarm {
}
ClientMsgProtobuf<CMsgClientRegisterKey> request = new ClientMsgProtobuf<CMsgClientRegisterKey>(EMsg.ClientRegisterKey) {
SourceJobID = Client.GetNextJobID()
SourceJobID = Client.GetNextJobID(),
Body = { key = key }
};
request.Body.key = key;
Client.Send(request);
try {

View file

@ -361,7 +361,7 @@ namespace ArchiSteamFarm {
string request = SteamCommunityURL + "/mobileconf/details/" + confirmation.ID + "?l=english&p=" + deviceID + "&a=" + SteamID + "&k=" + WebUtility.UrlEncode(confirmationHash) + "&t=" + time + "&m=android&tag=conf";
Steam.ConfirmationDetails response = await WebBrowser.UrlGetToJsonResultRetry<Steam.ConfirmationDetails>(request).ConfigureAwait(false);
if ((response == null) || !response.Success) {
if (response?.Success != true) {
return null;
}
@ -704,7 +704,8 @@ namespace ArchiSteamFarm {
HtmlDocument htmlDocument = await WebBrowser.UrlGetToHtmlDocumentRetry(request).ConfigureAwait(false);
HtmlNode htmlNode = htmlDocument?.DocumentNode.SelectSingleNode("//div[@class='pagecontent']/script");
if (htmlNode == null) { // Trade can be no longer valid
if (htmlNode == null) {
// Trade can be no longer valid
return null;
}

View file

@ -513,7 +513,8 @@ namespace ArchiSteamFarm {
private async Task Farm() {
do {
// Now the algorithm used for farming depends on whether account is restricted or not
if (Bot.BotConfig.CardDropsRestricted) { // If we have restricted card drops, we use complex algorithm
if (Bot.BotConfig.CardDropsRestricted) {
// If we have restricted card drops, we use complex algorithm
Bot.ArchiLogger.LogGenericInfo(string.Format(Strings.ChosenFarmingAlgorithm, "Complex"));
while (GamesToFarm.Count > 0) {
HashSet<Game> gamesToFarmSolo = GamesToFarm.Count > 1 ? new HashSet<Game>(GamesToFarm.Where(game => game.HoursPlayed >= HoursToBump)) : new HashSet<Game>(GamesToFarm);
@ -536,7 +537,8 @@ namespace ArchiSteamFarm {
}
}
}
} else { // If we have unrestricted card drops, we use simple algorithm
} else {
// If we have unrestricted card drops, we use simple algorithm
Bot.ArchiLogger.LogGenericInfo(string.Format(Strings.ChosenFarmingAlgorithm, "Simple"));
while (GamesToFarm.Count > 0) {
Game game = GamesToFarm.First();

View file

@ -113,11 +113,7 @@ namespace ArchiSteamFarm {
}
Steam.ConfirmationDetails response = await Bot.ArchiWebHandler.GetConfirmationDetails(DeviceID, confirmationHash, time, confirmation).ConfigureAwait(false);
if ((response == null) || !response.Success) {
return null;
}
return response;
return response?.Success == true ? response : null;
}
internal async Task<HashSet<Confirmation>> GetConfirmations() {
@ -221,11 +217,13 @@ namespace ArchiSteamFarm {
}
bool? result = await Bot.ArchiWebHandler.HandleConfirmations(DeviceID, confirmationHash, time, confirmations, accept).ConfigureAwait(false);
if (!result.HasValue) { // Request timed out
if (!result.HasValue) {
// Request timed out
return false;
}
if (result.Value) { // Request succeeded
if (result.Value) {
// Request succeeded
return true;
}

View file

@ -47,9 +47,7 @@ namespace ArchiSteamFarm {
);
}
public void Dispose() {
SteamDiscoveryQueueTimer.Dispose();
}
public void Dispose() => SteamDiscoveryQueueTimer.Dispose();
private async Task ExploreDiscoveryQueue() {
if (!Bot.IsConnectedAndLoggedOn) {

View file

@ -150,12 +150,12 @@ namespace ArchiSteamFarm {
internal async Task<T> UrlGetToJsonResultRetry<T>(string request, string referer = null) {
if (string.IsNullOrEmpty(request)) {
ArchiLogger.LogNullError(nameof(request));
return default(T);
return default;
}
string json = await UrlGetToContentRetry(request, referer).ConfigureAwait(false);
if (string.IsNullOrEmpty(json)) {
return default(T);
return default;
}
try {
@ -167,7 +167,7 @@ namespace ArchiSteamFarm {
ArchiLogger.LogGenericDebug(string.Format(Strings.Content, json));
}
return default(T);
return default;
}
}
@ -275,12 +275,12 @@ namespace ArchiSteamFarm {
internal async Task<T> UrlPostToJsonResultRetry<T>(string request, ICollection<KeyValuePair<string, string>> data = null, string referer = null) {
if (string.IsNullOrEmpty(request)) {
ArchiLogger.LogNullError(nameof(request));
return default(T);
return default;
}
string json = await UrlPostToContentRetry(request, data, referer).ConfigureAwait(false);
if (string.IsNullOrEmpty(json)) {
return default(T);
return default;
}
try {
@ -292,7 +292,7 @@ namespace ArchiSteamFarm {
ArchiLogger.LogGenericDebug(string.Format(Strings.Content, json));
}
return default(T);
return default;
}
}

View file

@ -1,23 +1,23 @@
{
"AutoRestart": true,
"AutoUpdates": true,
"Blacklist": [],
"ConnectionTimeout": 60,
"CurrentCulture": null,
"Debug": false,
"FarmingDelay": 15,
"GiftsLimiterDelay": 1,
"Headless": false,
"IdleFarmingPeriod": 3,
"InventoryLimiterDelay": 3,
"IPCHost": "127.0.0.1",
"IPCPort": 1242,
"LoginLimiterDelay": 10,
"MaxFarmingTime": 10,
"MaxTradeHoldDuration": 15,
"OptimizationMode": 0,
"Statistics": true,
"SteamOwnerID": 0,
"SteamProtocol": 6,
"UpdateChannel": 1
}
"AutoRestart": true,
"AutoUpdates": true,
"Blacklist": [],
"ConnectionTimeout": 60,
"CurrentCulture": null,
"Debug": false,
"FarmingDelay": 15,
"GiftsLimiterDelay": 1,
"Headless": false,
"IdleFarmingPeriod": 3,
"InventoryLimiterDelay": 3,
"IPCHost": "127.0.0.1",
"IPCPort": 1242,
"LoginLimiterDelay": 10,
"MaxFarmingTime": 10,
"MaxTradeHoldDuration": 15,
"OptimizationMode": 0,
"Statistics": true,
"SteamOwnerID": 0,
"SteamProtocol": 6,
"UpdateChannel": 1
}

View file

@ -1,31 +1,31 @@
{
"AcceptGifts": false,
"CardDropsRestricted": true,
"CustomGamePlayedWhileFarming": null,
"CustomGamePlayedWhileIdle": null,
"DismissInventoryNotifications": false,
"Enabled": false,
"FarmingOrder": 0,
"FarmOffline": false,
"GamesPlayedWhileIdle": [],
"HandleOfflineMessages": false,
"IsBotAccount": false,
"LootableTypes": [
1,
3,
5
],
"PasswordFormat": 0,
"Paused": false,
"RedeemingPreferences": 0,
"SendOnFarmingFinished": false,
"SendTradePeriod": 0,
"ShutdownOnFarmingFinished": false,
"SteamLogin": null,
"SteamMasterClanID": 0,
"SteamParentalPIN": "0",
"SteamPassword": null,
"SteamTradeToken": null,
"SteamUserPermissions": {},
"TradingPreferences": 0
}
"AcceptGifts": false,
"CardDropsRestricted": true,
"CustomGamePlayedWhileFarming": null,
"CustomGamePlayedWhileIdle": null,
"DismissInventoryNotifications": false,
"Enabled": false,
"FarmingOrder": 0,
"FarmOffline": false,
"GamesPlayedWhileIdle": [],
"HandleOfflineMessages": false,
"IsBotAccount": false,
"LootableTypes": [
1,
3,
5
],
"PasswordFormat": 0,
"Paused": false,
"RedeemingPreferences": 0,
"SendOnFarmingFinished": false,
"SendTradePeriod": 0,
"ShutdownOnFarmingFinished": false,
"SteamLogin": null,
"SteamMasterClanID": 0,
"SteamParentalPIN": "0",
"SteamPassword": null,
"SteamTradeToken": null,
"SteamUserPermissions": {},
"TradingPreferences": 0
}

View file

@ -1,5 +1,5 @@
{
"Enabled": false,
"SteamLogin": null,
"SteamPassword": null
}
"Enabled": false,
"SteamLogin": null,
"SteamPassword": null
}

File diff suppressed because one or more lines are too long