<commit_before>﻿/*
    _                _      _  ____   _                           _____
   / \    _ __  ___ | |__  (_)/ ___| | |_  ___   __ _  _ __ ___  |  ___|__ _  _ __  _ __ ___
  / _ \  | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_  / _` || '__|| '_ ` _ \
 / ___ \ | |  | (__ | | | || | ___) || |_|  __/| (_| || | | | | ||  _|| (_| || |   | | | | | |
/_/   \_\|_|   \___||_| |_||_||____/  \__|\___| \__,_||_| |_| |_||_|   \__,_||_|   |_| |_| |_|

 Copyright 2015-2017 Łukasz "JustArchi" Domeradzki
 Contact: <EMAIL>

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0
					
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.

*/

using System.Diagnostics.CodeAnalysis;
using System.Linq;
using NLog;
using NLog.Config;
using NLog.Targets;

namespace ArchiSteamFarm {
	[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
	[Target("Steam")]
	internal sealed class SteamTarget : TargetWithLayout {
		[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
		[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
		// This is NLog config property, it must have public get() and set() capabilities
		public string BotName { get; set; }

		[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
		[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
		[RequiredParameter]
		// This is NLog config property, it must have public get() and set() capabilities
		public ulong SteamID { get; set; }

		[SuppressMessage("ReSharper", "EmptyConstructor")]
		public SteamTarget() => Layout = "${level:uppercase=true}|${logger}|${message}";

		protected override void Write(LogEventInfo logEvent) {
			if (logEvent == null) {
				ASF.ArchiLogger.LogNullError(nameof(logEvent));
				return;
			}

			if (SteamID == 0) {
				return;
			}

			Bot bot;
			if (string.IsNullOrEmpty(BotName)) {
				bot = Bot.Bots.Values.FirstOrDefault(targetBot => targetBot.IsConnectedAndLoggedOn && (targetBot.SteamID != SteamID));
				if (bot == null) {<commit_msg>Add back accidentally removed comments<commit_after>﻿/*
    _                _      _  ____   _                           _____
   / \    _ __  ___ | |__  (_)/ ___| | |_  ___   __ _  _ __ ___  |  ___|__ _  _ __  _ __ ___
  / _ \  | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_  / _` || '__|| '_ ` _ \
 / ___ \ | |  | (__ | | | || | ___) || |_|  __/| (_| || | | | | ||  _|| (_| || |   | | | | | |
/_/   \_\|_|   \___||_| |_||_||____/  \__|\___| \__,_||_| |_| |_||_|   \__,_||_|   |_| |_| |_|

 Copyright 2015-2017 Łukasz "JustArchi" Domeradzki
 Contact: <EMAIL>

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0
					
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.

*/

using System.Diagnostics.CodeAnalysis;
using System.Linq;
using NLog;
using NLog.Config;
using NLog.Targets;

namespace ArchiSteamFarm {
	[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
	[Target("Steam")]
	internal sealed class SteamTarget : TargetWithLayout {
		// This is NLog config property, it must have public get() and set() capabilities
		[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
		[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
		public string BotName { get; set; }

		// This is NLog config property, it must have public get() and set() capabilities
		[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
		[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
		[RequiredParameter]
		public ulong SteamID { get; set; }

		// This constructor is intentionally public, as NLog uses it for creating targets
		// It must stay like this as we want to have SteamTargets defined in our NLog.config
		// Keeping date in default layout also doesn't make much sense, so we remove it by default
		[SuppressMessage("ReSharper", "EmptyConstructor")]
		public SteamTarget() => Layout = "${level:uppercase=true}|${logger}|${message}";

		protected override void Write(LogEventInfo logEvent) {
			if (logEvent == null) {
				ASF.ArchiLogger.LogNullError(nameof(logEvent));
				return;
			}

			if (SteamID == 0) {
				return;
			}

			Bot bot;
			if (string.IsNullOrEmpty(BotName)) {
				bot = Bot.Bots.Values.FirstOrDefault(targetBot => targetBot.IsConnectedAndLoggedOn && (targetBot.SteamID != SteamID));
				if (bot == null) {
{'fraction_non_alphanumeric': 0.1368850865253743, 'fraction_numerical': 0.005055415127357573, 'mean_word_length': 3.32996632996633, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6411428', 'n_tokens_mistral': 1748, 'n_tokens_neox': 1633, 'n_words': 413}