diff --git a/.gitignore b/.gitignore index 9f499984..4481baa6 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,12 @@ Thumbs.db.meta *.vscode *.keystore + +#UI-TESTS related +/UI-TESTS/bin/Debug/ +/UI-TESTS/obj/Debug/ +/UI-TESTS/BUILDS/Android/ +/UI-TESTS/BUILDS/iOS/ +/UI-TESTS/obj/project.nuget.cache +/UI-TESTS/obj/ +!/UI-TESTS/UI-TESTS.csproj \ No newline at end of file diff --git a/Assets/AltTester.meta b/Assets/AltTester.meta new file mode 100644 index 00000000..6ea38d02 --- /dev/null +++ b/Assets/AltTester.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2837dc542bf6347bda98c7c54df7ce9b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor.meta b/Assets/AltTester/Editor.meta new file mode 100644 index 00000000..c7dbc178 --- /dev/null +++ b/Assets/AltTester/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8e6bf33820c08ff44982a817e73d9769 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/AltTester.AltTesterUnitySDK.Editor.asmdef b/Assets/AltTester/Editor/AltTester.AltTesterUnitySDK.Editor.asmdef new file mode 100644 index 00000000..fc27418f --- /dev/null +++ b/Assets/AltTester/Editor/AltTester.AltTesterUnitySDK.Editor.asmdef @@ -0,0 +1,33 @@ +{ + "name": "AltTester.AltTesterUnitySDK.Editor", + "rootNamespace": "", + "references": [ + "GUID:0acc523941302664db1f4e527237feb3", + "GUID:478b585cfbb242f4c977b9aec772e042", + "GUID:478a2357cc57436488a56e564b08d223", + "GUID:451516970bc990e418454aa78b72586e", + "GUID:9e24947de15b9834991c9d8411ea37cf", + "GUID:69448af7b92c7f342b298e06a37122aa" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll", + "NLog.dll", + "Newtonsoft.Json.dll" + ], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [ + { + "name": "com.unity.addressables", + "expression": "1", + "define": "ADDRESSABLES" + } + ], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/AltTester/Editor/AltTester.AltTesterUnitySDK.Editor.asmdef.meta b/Assets/AltTester/Editor/AltTester.AltTesterUnitySDK.Editor.asmdef.meta new file mode 100644 index 00000000..3283b87d --- /dev/null +++ b/Assets/AltTester/Editor/AltTester.AltTesterUnitySDK.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: dd83e24336764a74b8b9e785544452a4 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/DefaultTestExample.txt b/Assets/AltTester/Editor/DefaultTestExample.txt new file mode 100644 index 00000000..f6cfecfb --- /dev/null +++ b/Assets/AltTester/Editor/DefaultTestExample.txt @@ -0,0 +1,27 @@ +using NUnit.Framework; +using AltTester.AltTesterUnitySDK.Driver; + +public class #SCRIPTNAME# +{ //Important! If your test file is inside a folder that contains an .asmdef file, please make sure that the assembly definition references NUnit. + public AltDriver altDriver; + //Before any test it connects with the socket + [OneTimeSetUp] + public void SetUp() + { + altDriver =new AltDriver(); + } + + //At the end of the test closes the connection with the socket + [OneTimeTearDown] + public void TearDown() + { + altDriver.Stop(); + } + + [Test] + public void Test() + { + //Here you can write the test + } + +} \ No newline at end of file diff --git a/Assets/AltTester/Editor/DefaultTestExample.txt.meta b/Assets/AltTester/Editor/DefaultTestExample.txt.meta new file mode 100644 index 00000000..2182acff --- /dev/null +++ b/Assets/AltTester/Editor/DefaultTestExample.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2b33d15c84c489b41931c9260f3d48f8 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Logging.meta b/Assets/AltTester/Editor/Logging.meta new file mode 100644 index 00000000..e24b63b9 --- /dev/null +++ b/Assets/AltTester/Editor/Logging.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6e570a74d8a892e43b8c5af27002882b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Logging/EditorLogManager.cs b/Assets/AltTester/Editor/Logging/EditorLogManager.cs new file mode 100644 index 00000000..74335ea1 --- /dev/null +++ b/Assets/AltTester/Editor/Logging/EditorLogManager.cs @@ -0,0 +1,48 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using AltTester.AltTesterUnitySDK.Driver.Logging; +using NLog; +using NLog.Layouts; + +namespace AltTester.AltTesterUnitySDK.Editor.Logging +{ + public class EditorLogManager + { + public static LogFactory Instance { get { return instance.Value; } } + private static readonly Lazy instance = new Lazy(buildLogFactory); + + private static LogFactory buildLogFactory() + { + var config = new NLog.Config.LoggingConfiguration(); + var unitylog = new UnityTarget("AltEditorUnityTarget") + { + Layout = Layout.FromString("${longdate}|Editor|${level:uppercase=true}|${message}"), + }; + config.AddRule(LogLevel.Debug, LogLevel.Fatal, unitylog); + + LogFactory logFactory = new LogFactory + { + Configuration = config, + AutoShutdown = true + }; + + return logFactory; + } + } +} diff --git a/Assets/AltTester/Editor/Logging/EditorLogManager.cs.meta b/Assets/AltTester/Editor/Logging/EditorLogManager.cs.meta new file mode 100644 index 00000000..347febb1 --- /dev/null +++ b/Assets/AltTester/Editor/Logging/EditorLogManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c2e08ec036d90f64599b424e55483e76 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Scripts.meta b/Assets/AltTester/Editor/Scripts.meta new file mode 100644 index 00000000..e8b62f86 --- /dev/null +++ b/Assets/AltTester/Editor/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 973bbae060427624f915277422b69116 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Scripts/AltBuilder.cs b/Assets/AltTester/Editor/Scripts/AltBuilder.cs new file mode 100644 index 00000000..c63fec4b --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltBuilder.cs @@ -0,0 +1,429 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections.Generic; +using System.IO; +using System.Linq; +using AltTester.AltTesterUnitySDK.Driver; +using AltTester.AltTesterUnitySDK.Editor.Logging; +#if UNITY_2021_3_OR_NEWER && ADDRESSABLES +using UnityEditor.AddressableAssets; +using UnityEditor.AddressableAssets.Settings; +#endif + +using UnityEditor.Compilation; +using UnityEditor.SceneManagement; +using UnityEngine; + +namespace AltTester.AltTesterUnitySDK.Editor +{ + public static class PlatformName + { + public const string Android = "Android"; + public const string iOS = "iOS"; + public const string Standalone = "Standalone"; + } + + + public class AltBuilder + { + private const string ALTTESTERDEFINE = "ALTTESTER"; + private const string PREFABNAME = "AltTesterPrefab"; + private const string WEBGLDEFINE = "UNITY_WEBGL"; + + private static readonly NLog.Logger logger = EditorLogManager.Instance.GetCurrentClassLogger(); + + public static bool Built = false; + public static string PreviousScenePath; + public static UnityEngine.SceneManagement.Scene SceneWithAltRunner; + public static UnityEngine.Object AltRunner; + + public static void InitBuildSetup(UnityEditor.BuildTargetGroup buildTargetGroup) + { + AltTesterEditorWindow.InitEditorConfiguration(); + + if (AltTesterEditorWindow.EditorConfiguration.appendToName) + { + UnityEditor.PlayerSettings.productName += "Test"; + UnityEditor.PlayerSettings.SetApplicationIdentifier(buildTargetGroup, $"{UnityEditor.PlayerSettings.GetApplicationIdentifier(buildTargetGroup)}Test"); + } + AddAltTesterInScriptingDefineSymbolsGroup(buildTargetGroup); + if (buildTargetGroup == UnityEditor.BuildTargetGroup.Standalone) + CreateJsonFileForInputMappingOfAxis(); + + } + public static void BuildGameFromUI(UnityEditor.BuildTarget buildTarget, UnityEditor.BuildTargetGroup buildTargetGroup, bool autoRun = false) + { + try + { +#if UNITY_2021_3_OR_NEWER && ADDRESSABLES + AddressableAssetSettings settings = AddressableAssetSettingsDefaultObject.Settings; + AddressableAssetSettings.PlayerBuildOption currentValue = AddressableAssetSettings.PlayerBuildOption.PreferencesValue; + if (settings != null) + { + currentValue = settings.BuildAddressablesWithPlayerBuild; + if (!(settings.BuildAddressablesWithPlayerBuild == AddressableAssetSettings.PlayerBuildOption.DoNotBuildWithPlayer)) + { + AddressableAssetSettings.CleanPlayerContent(); + AddressableAssetSettings.BuildPlayerContent(out _); + } + settings.BuildAddressablesWithPlayerBuild = AddressableAssetSettings.PlayerBuildOption.DoNotBuildWithPlayer; + } +#endif + InitBuildSetup(buildTargetGroup); + logger.Debug($"Starting {buildTarget} build...{UnityEditor.PlayerSettings.productName}:{UnityEditor.PlayerSettings.bundleVersion}"); + + var buildPlayerOptions = new UnityEditor.BuildPlayerOptions + { + locationPathName = getOutputPath(buildTarget), + scenes = getScenesForBuild(), + target = buildTarget, + targetGroup = buildTargetGroup + }; + + buildGame(autoRun, buildPlayerOptions); +#if UNITY_2021_3_OR_NEWER && ADDRESSABLES + if (settings != null) + { + settings.BuildAddressablesWithPlayerBuild = currentValue; + } +#endif + } + catch (System.Exception e) + { + logger.Error(e); + } + finally + { + Built = true; + resetBuildSetup(buildTargetGroup); + } + + } + public static void RemoveAltTesterFromScriptingDefineSymbols(UnityEditor.BuildTargetGroup targetGroup) + { + RemoveScriptingDefineSymbol(ALTTESTERDEFINE, targetGroup); + } + public static void RemoveScriptingDefineSymbol(string symbol, UnityEditor.BuildTargetGroup targetGroup) + { + if (AltTesterEditorWindow.EditorConfiguration != null && AltTesterEditorWindow.EditorConfiguration.KeepAUTSymbolDefined) + return; + try + { + var scriptingDefineSymbolsForGroup = + UnityEditor.PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup); + string newScriptingDefineSymbolsForGroup = ""; + if (scriptingDefineSymbolsForGroup.Contains(symbol)) + { + var split = scriptingDefineSymbolsForGroup.Split(';'); + foreach (var define in split) + { + if (define != symbol) + { + newScriptingDefineSymbolsForGroup += define + ";"; + } + } + if (newScriptingDefineSymbolsForGroup.Length != 0) + newScriptingDefineSymbolsForGroup.Remove(newScriptingDefineSymbolsForGroup.Length - 1); + UnityEditor.PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, + newScriptingDefineSymbolsForGroup); + } + } + catch (System.Exception e) + { + logger.Error("Some Error Happened +" + e.Message); + logger.Error("Stack trace " + e.StackTrace); + } + } + + public static void AddAltTesterInScriptingDefineSymbolsGroup(UnityEditor.BuildTargetGroup targetGroup) + { + AddScriptingDefineSymbol(ALTTESTERDEFINE, targetGroup); + } + public static void AddScriptingDefineSymbol(string symbol, UnityEditor.BuildTargetGroup targetGroup) + { + + var scriptingDefineSymbolsForGroup = UnityEditor.PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup); + if (!scriptingDefineSymbolsForGroup.Contains(symbol)) + { + scriptingDefineSymbolsForGroup += ";" + symbol; + } + UnityEditor.PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, scriptingDefineSymbolsForGroup); + } + + [System.Obsolete("Use AddAltTesterInScriptingDefineSymbolsGroup instead.")] + public static void AddAltTesterInScritpingDefineSymbolsGroup(UnityEditor.BuildTargetGroup targetGroup) + { + AddAltTesterInScriptingDefineSymbolsGroup(targetGroup); + } + + public static bool CheckAltTesterIsDefineAsAScriptingSymbol(UnityEditor.BuildTargetGroup targetGroup) + { + var scriptingDefineSymbolsForGroup = UnityEditor.PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup); + return scriptingDefineSymbolsForGroup.Contains(ALTTESTERDEFINE); + } + + public static void CreateJsonFileForInputMappingOfAxis() + { + string gameDataProjectFilePath = "/Resources/AltTester/AltTesterInputAxisData.json"; + var inputManager = UnityEditor.AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/InputManager.asset")[0]; + var obj = new UnityEditor.SerializedObject(inputManager); + + UnityEditor.SerializedProperty axisArray = obj.FindProperty("m_Axes"); + + if (axisArray.arraySize == 0) + logger.Info("No Axes"); + var axisList = new List(); + for (int i = 0; i < axisArray.arraySize; ++i) + { + var axis = axisArray.GetArrayElementAtIndex(i); + + var name = axis.FindPropertyRelative("m_Name").stringValue; + var inputType = (InputType)axis.FindPropertyRelative("type").intValue; + var negativeButton = axis.FindPropertyRelative("negativeButton").stringValue; + var positiveButton = axis.FindPropertyRelative("positiveButton").stringValue; + var altPositiveButton = axis.FindPropertyRelative("altPositiveButton").stringValue; + var altNegativeButton = axis.FindPropertyRelative("altNegativeButton").stringValue; + var axisDirection = axis.FindPropertyRelative("axis").intValue; + axisList.Add(new AltAxis(name, inputType, negativeButton, positiveButton, altPositiveButton, altNegativeButton, axisDirection)); + } + + string dataAsJson = Newtonsoft.Json.JsonConvert.SerializeObject(axisList); + string filePath = Application.dataPath + gameDataProjectFilePath; + if (!UnityEditor.AssetDatabase.IsValidFolder("Assets/Resources/AltTester")) + { + if (!UnityEditor.AssetDatabase.IsValidFolder("Assets/Resources")) + { + UnityEditor.AssetDatabase.CreateFolder("Assets", "Resources"); + } + UnityEditor.AssetDatabase.CreateFolder("Assets/Resources", "AltTester"); + } + using (StreamWriter sw = new StreamWriter(filePath)) + { + sw.Write(dataAsJson); + } + UnityEditor.AssetDatabase.Refresh(); + } + + public static void InsertAltInScene(string scene, AltInstrumentationSettings instrumentationSettings) + { + logger.Debug("Adding AltTesterPrefab into the [" + scene + "] scene."); + var altRunner = UnityEditor.AssetDatabase.LoadAssetAtPath(UnityEditor.AssetDatabase.GUIDToAssetPath(UnityEditor.AssetDatabase.FindAssets(PREFABNAME)[0])); + + SceneWithAltRunner = EditorSceneManager.OpenScene(scene); + AltRunner = UnityEditor.PrefabUtility.InstantiatePrefab(altRunner); + var altRunnerComponent = ((GameObject)AltRunner).GetComponent(); + altRunnerComponent.InstrumentationSettings = instrumentationSettings; + + EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene()); + EditorSceneManager.SaveOpenScenes(); + logger.Info("AltTesterPrefab successfully modified into the [" + scene + "] scene."); + } + + public static void InsertAltInTheActiveScene(AltInstrumentationSettings instrumentationSettings) + { + var activeScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().path; + InsertAltInScene(activeScene, instrumentationSettings); + } + + public static void InsertAltInTheFirstScene(AltInstrumentationSettings instrumentationSettings) + { + var altRunner = UnityEditor.AssetDatabase.LoadAssetAtPath(UnityEditor.AssetDatabase.GUIDToAssetPath(UnityEditor.AssetDatabase.FindAssets(PREFABNAME)[0])); + + PreviousScenePath = UnityEngine.SceneManagement.SceneManager.GetActiveScene().path; + SceneWithAltRunner = EditorSceneManager.OpenScene(GetFirstSceneWhichWillBeBuilt()); + + AltRunner = UnityEditor.PrefabUtility.InstantiatePrefab(altRunner); + AltRunner altRunnerComponent = ((GameObject)AltRunner).GetComponent(); + altRunnerComponent.InstrumentationSettings = instrumentationSettings; + + + EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene()); + EditorSceneManager.SaveOpenScenes(); + + try + { + EditorSceneManager.OpenScene(PreviousScenePath); + } + catch + { + logger.Info("No scene was loaded yet."); + } + } + + public static string GetFirstSceneWhichWillBeBuilt() + { + foreach (var scene in AltTesterEditorWindow.EditorConfiguration.Scenes) + { + if (scene.ToBeBuilt) + { + return scene.Path; + } + } + + return ""; + } + + private static string getOutputPath(UnityEditor.BuildTarget target) + { + var outputPath = AltTesterEditorWindow.EditorConfiguration.BuildLocationPath; + + outputPath = string.IsNullOrEmpty(outputPath) ? "build" : outputPath; + outputPath = System.IO.Path.Combine(outputPath, UnityEditor.PlayerSettings.productName); + + switch (target) + { + case UnityEditor.BuildTarget.Android: + if (!outputPath.EndsWith(".apk")) + { + outputPath += ".apk"; + } + + break; + case UnityEditor.BuildTarget.StandaloneOSX: + if (!outputPath.EndsWith(".app")) + { + outputPath += ".app"; + } + break; + case UnityEditor.BuildTarget.StandaloneWindows: + case UnityEditor.BuildTarget.StandaloneWindows64: + if (!outputPath.EndsWith(".exe")) + { + outputPath += ".exe"; + } + break; + case UnityEditor.BuildTarget.StandaloneLinux64: + if (!outputPath.EndsWith(".x86_64")) + { + outputPath += ".x86_64"; + } + break; + + case UnityEditor.BuildTarget.iOS: + default: + break; + + } + + return outputPath; + } + + private static void resetBuildSetup(UnityEditor.BuildTargetGroup buildTargetGroup) + { + if (AltTesterEditorWindow.EditorConfiguration.appendToName) + { + UnityEditor.PlayerSettings.productName = UnityEditor.PlayerSettings.productName.Remove(UnityEditor.PlayerSettings.productName.Length - 5); + string bundleIdentifier = UnityEditor.PlayerSettings.GetApplicationIdentifier(buildTargetGroup).Remove(UnityEditor.PlayerSettings.GetApplicationIdentifier(buildTargetGroup).Length - 5); + UnityEditor.PlayerSettings.SetApplicationIdentifier(buildTargetGroup, bundleIdentifier); + } + + RemoveAltTesterFromScriptingDefineSymbols(buildTargetGroup); + } + + private static void buildGame(bool autoRun, UnityEditor.BuildPlayerOptions buildPlayerOptions) + { + UnityEditor.PlayerSettings.SetStackTraceLogType(LogType.Log, StackTraceLogType.None); + UnityEditor.PlayerSettings.SetStackTraceLogType(LogType.Warning, StackTraceLogType.None); + UnityEditor.PlayerSettings.SetStackTraceLogType(LogType.Assert, StackTraceLogType.None); + +#if ENABLE_INPUT_SYSTEM + modifyTestAssembliesToOnlyWorkInEditor(); + buildPlayerOptions.options = UnityEditor.BuildOptions.Development | (autoRun ? UnityEditor.BuildOptions.AutoRunPlayer : UnityEditor.BuildOptions.ShowBuiltPlayer) | UnityEditor.BuildOptions.IncludeTestAssemblies; +#else + buildPlayerOptions.options = UnityEditor.BuildOptions.Development | (autoRun ? UnityEditor.BuildOptions.AutoRunPlayer : UnityEditor.BuildOptions.ShowBuiltPlayer); +#endif + + + var results = UnityEditor.BuildPipeline.BuildPlayer(buildPlayerOptions); + + +#if UNITY_2017 + if (results.Equals("")) + { + logger.Info("Build path: " + buildPlayerOptions.locationPathName); + logger.Info("Build " + UnityEditor.PlayerSettings.productName + ":" + UnityEditor.PlayerSettings.bundleVersion + " Succeeded"); + } + else + { + logger.Error("Build Error!"); + } + +#else + if (results.summary.totalErrors == 0 || results.summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded) + { + logger.Info($"Build path: {buildPlayerOptions.locationPathName}"); + logger.Info($"Build {UnityEditor.PlayerSettings.productName}:{UnityEditor.PlayerSettings.bundleVersion} Succeeded"); + } + else + { + logger.Error($"Build Error! {results.steps}\n Result: {results.summary.result}\n Stripping info: {results.strippingInfo}"); + } +#endif + + } + + private static void modifyTestAssembliesToOnlyWorkInEditor() + { + var assemblies = CompilationPipeline.GetAssemblies(); + foreach (var assembly in assemblies) + { + if (assembly.flags == AssemblyFlags.None) + { + + var path = CompilationPipeline.GetAssemblyDefinitionFilePathFromAssemblyName(assembly.name); + if (path == null) + continue; + StreamReader reader = new StreamReader(path); + string input = reader.ReadToEnd(); + reader.Close(); + if (input.Contains("UNITY_INCLUDE_TESTS")) + { + using (StreamWriter writer = new StreamWriter(path, false)) + { + string output = input.Replace("\"includePlatforms\": [],", + "\"includePlatforms\": [\"Editor\"],"); + writer.Write(output); + writer.Close(); + } + } + } + } + } + + private static string[] getScenesForBuild() + { + if (AltTesterEditorWindow.EditorConfiguration.Scenes.Count == 0) + { + AltTesterEditorWindow.AddAllScenes(); + AltTesterEditorWindow.SelectAllScenes(); + } + var sceneList = new List(); + foreach (var scene in AltTesterEditorWindow.EditorConfiguration.Scenes) + { + if (scene.ToBeBuilt) + { + sceneList.Add(scene.Path); + } + } + + InsertAltInTheFirstScene(AltTesterEditorWindow.EditorConfiguration.GetInstrumentationSettings()); + + return sceneList.ToArray(); + } + } +} diff --git a/Assets/AltTester/Editor/Scripts/AltBuilder.cs.meta b/Assets/AltTester/Editor/Scripts/AltBuilder.cs.meta new file mode 100644 index 00000000..f350ba4e --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltBuilder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1d1257143ce7041419b3fe9726fe34ff +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Scripts/AltEditorConfiguration.cs b/Assets/AltTester/Editor/Scripts/AltEditorConfiguration.cs new file mode 100644 index 00000000..c86b1461 --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltEditorConfiguration.cs @@ -0,0 +1,64 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections.Generic; +using AltTester.AltTesterUnitySDK; +using UnityEngine; +using System; + +namespace AltTester.AltTesterUnitySDK.Editor +{ + public class AltEditorConfiguration : ScriptableObject + { + public bool appendToName; + public string AdbPath = "/usr/local/bin/adb"; + public string IProxyPath = "/usr/local/bin/iproxy"; + public string XcrunPath = "/usr/bin/xcrun"; + public List MyTests = new List(); + public List Scenes = new List(); + public AltPlatform platform = AltPlatform.Standalone; + public UnityEditor.BuildTarget StandaloneTarget = UnityEditor.BuildTarget.NoTarget; + public bool RanInEditor = false; + public bool ScenePathDisplayed; + public bool ShowPopUp = true; + public string BuildLocationPath = ""; + public bool createXMLReport = false; + public string xMLFilePath = ""; + + public int AltServerPort = 13000; + public string AltServerHost = "127.0.0.1"; + + public string AppName = "__default__"; + public int assemblyTestDisplayedIndex; + public bool ResetConnectionData = false; + public string UID = ""; + + public AltInstrumentationSettings GetInstrumentationSettings() + { + return new AltInstrumentationSettings() + { + ShowPopUp = ShowPopUp, + AltServerPort = AltServerPort, + AltServerHost = AltServerHost, + AppName = AppName, + ResetConnectionData = ResetConnectionData, + UID = SystemInfo.deviceUniqueIdentifier.ToString() + DateTimeOffset.Now.ToUnixTimeSeconds().ToString() + }; + } + public bool KeepAUTSymbolDefined = false; + } +} diff --git a/Assets/AltTester/Editor/Scripts/AltEditorConfiguration.cs.meta b/Assets/AltTester/Editor/Scripts/AltEditorConfiguration.cs.meta new file mode 100644 index 00000000..45b8117d --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltEditorConfiguration.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 073b5878cbef2364cb928faafba64ca5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Scripts/AltMyScenes.cs b/Assets/AltTester/Editor/Scripts/AltMyScenes.cs new file mode 100644 index 00000000..8a6d269c --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltMyScenes.cs @@ -0,0 +1,52 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Editor +{ + [System.Serializable] + public class AltMyScenes + { + public bool _toBeBuilt; + public string _path; + public int _buildIndex; + + public AltMyScenes(bool beBuilt, string path, int buildIndex) + { + _toBeBuilt = beBuilt; + _path = path; + _buildIndex = buildIndex; + } + + public bool ToBeBuilt + { + get { return _toBeBuilt; } + set { _toBeBuilt = value; } + } + + public string Path + { + get { return _path; } + set { _path = value; } + } + + public int BuildScene + { + get { return _buildIndex; } + set { _buildIndex = value; } + } + } +} diff --git a/Assets/AltTester/Editor/Scripts/AltMyScenes.cs.meta b/Assets/AltTester/Editor/Scripts/AltMyScenes.cs.meta new file mode 100644 index 00000000..07f970dd --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltMyScenes.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9d0e91cd7e7987048bc1167b2b056ab7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Scripts/AltMyTest.cs b/Assets/AltTester/Editor/Scripts/AltMyTest.cs new file mode 100644 index 00000000..742c3562 --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltMyTest.cs @@ -0,0 +1,253 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using UnityEngine; + +namespace AltTester.AltTesterUnitySDK.Editor +{ + [System.Serializable] + public class AltMyTest + { + [SerializeField] + private bool _selected; + [SerializeField] + private string _testName; + [SerializeField] + private string _testAssembly; + [SerializeField] + private int _status; + [SerializeField] + private bool _isSuite; + [SerializeField] + private string _type; + [SerializeField] + private string _parentName; + [SerializeField] + private int _testCaseCount; + [SerializeField] + private bool _foldOut; + [SerializeField] + private string _testResultMessage; + [SerializeField] + private string _testStackTrace; + [SerializeField] + private Double _testDuration; + [SerializeField] + private string path; + [SerializeField] + private int _testSelectedCount; + + public AltMyTest(bool selected, string testName, string testAssembly, int status, bool isSuite, string type, string parentName, int testCaseCount, bool foldOut, string testResultMessage, string testStackTrace, Double testDuration, string path, int testSelectedCount) + { + _selected = selected; + _testName = testName; + _testAssembly = testAssembly; + _status = status; + _isSuite = isSuite; + _type = type; + _parentName = parentName; + _testCaseCount = testCaseCount; + _foldOut = foldOut; + _testResultMessage = testResultMessage; + _testStackTrace = testStackTrace; + _testDuration = testDuration; + _testSelectedCount = testSelectedCount; + this.path = path; + } + + public bool Selected + { + get + { + return _selected; + } + + set + { + _selected = value; + } + } + + public string TestName + { + get + { + return _testName; + } + + set + { + _testName = value; + } + } + + public string TestAssembly + { + get + { + return _testAssembly; + } + + set + { + _testAssembly = value; + } + } + + public int Status + { + get + { + return _status; + } + + set + { + _status = value; + } + } + + public bool IsSuite + { + get + { + return _isSuite; + } + + set + { + _isSuite = value; + } + } + + public string Type + { + get + { + return _type; + } + + set + { + _type = value; + } + } + + public string ParentName + { + get + { + return _parentName; + } + + set + { + _parentName = value; + } + } + + public int TestCaseCount + { + get + { + return _testCaseCount; + } + + set + { + _testCaseCount = value; + } + } + public int TestSelectedCount + { + get + { + return _testSelectedCount; + } + set + { + _testSelectedCount = value; + } + } + + public bool FoldOut + { + get + { + return _foldOut; + } + + set + { + _foldOut = value; + } + } + + public string TestResultMessage + { + get + { + return _testResultMessage; + } + + set + { + _testResultMessage = value; + } + } + + public string TestStackTrace + { + get + { + return _testStackTrace; + } + + set + { + _testStackTrace = value; + } + } + + public Double TestDuration + { + get + { + return _testDuration; + } + + set + { + _testDuration = value; + } + } + + public string Path + { + get + { + return path; + } + + set + { + path = value; + } + } + } +} diff --git a/Assets/AltTester/Editor/Scripts/AltMyTest.cs.meta b/Assets/AltTester/Editor/Scripts/AltMyTest.cs.meta new file mode 100644 index 00000000..eefda4a6 --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltMyTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a20f86f9d15e4c047b90ce5fe79ba83b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Scripts/AltPlatform.cs b/Assets/AltTester/Editor/Scripts/AltPlatform.cs new file mode 100644 index 00000000..f58d96aa --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltPlatform.cs @@ -0,0 +1,28 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Editor +{ + public enum AltPlatform + { + Android, + iOS, + Editor, + Standalone, + WebGL + } +} diff --git a/Assets/AltTester/Editor/Scripts/AltPlatform.cs.meta b/Assets/AltTester/Editor/Scripts/AltPlatform.cs.meta new file mode 100644 index 00000000..7dec8054 --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltPlatform.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f81fe803080c6114581ae05b0e8dd0dd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Scripts/AltProxyFinderPostProcess.cs b/Assets/AltTester/Editor/Scripts/AltProxyFinderPostProcess.cs new file mode 100644 index 00000000..8f0fcbdf --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltProxyFinderPostProcess.cs @@ -0,0 +1,85 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#if UNITY_IOS +using System.IO; +using UnityEngine; +using UnityEditor; +using UnityEditor.Callbacks; +using UnityEditor.iOS.Xcode; + +public static class AltProxyFinderPostProcess +{ + [PostProcessBuild] + public static void OnPostProcessBuild(BuildTarget buildTarget, string buildPath) + { + Debug.Log("OnPostProcessBuild: " + buildTarget); + + string modulemapContent = "framework module UnityFramework {\n" + + " umbrella header \"UnityFramework.h\"\n" + + " export *\n" + + " module * { export * }\n" + + " module UnityInterface {\n" + + " header \"UnityInterface.h\"\n" + + " export *\n" + + " }\n" + + "}\n"; + + if (buildTarget == BuildTarget.iOS) + { + var projectPath = buildPath + "/Unity-iPhone.xcodeproj/project.pbxproj"; + + var project = new PBXProject(); + project.ReadFromFile(projectPath); + + var unityFrameworkGuid = project.GetUnityFrameworkTargetGuid(); + + // Modulemap + project.AddBuildProperty(unityFrameworkGuid, "DEFINES_MODULE", "YES"); + + var moduleFile = buildPath + "/UnityFramework/UnityFramework.modulemap"; + if (!File.Exists(moduleFile)) + { + StreamWriter writer = new StreamWriter(moduleFile, false); + writer.Write(modulemapContent); + writer.Close(); + + project.AddFile(moduleFile, "UnityFramework/UnityFramework.modulemap"); + project.AddBuildProperty(unityFrameworkGuid, "MODULEMAP_FILE", "$(SRCROOT)/UnityFramework/UnityFramework.modulemap"); + } + + // Headers + string unityInterfaceGuid = project.FindFileGuidByProjectPath("Classes/Unity/UnityInterface.h"); + project.AddPublicHeaderToBuild(unityFrameworkGuid, unityInterfaceGuid); + + string unityForwardDeclsGuid = project.FindFileGuidByProjectPath("Classes/Unity/UnityForwardDecls.h"); + project.AddPublicHeaderToBuild(unityFrameworkGuid, unityForwardDeclsGuid); + + string unityRenderingGuid = project.FindFileGuidByProjectPath("Classes/Unity/UnityRendering.h"); + project.AddPublicHeaderToBuild(unityFrameworkGuid, unityRenderingGuid); + + string unitySharedDeclsGuid = project.FindFileGuidByProjectPath("Classes/Unity/UnitySharedDecls.h"); + project.AddPublicHeaderToBuild(unityFrameworkGuid, unitySharedDeclsGuid); + + // Save project + project.WriteToFile(projectPath); + } + + Debug.Log("OnPostProcessBuild: Complete"); + } +} +#endif diff --git a/Assets/AltTester/Editor/Scripts/AltProxyFinderPostProcess.cs.meta b/Assets/AltTester/Editor/Scripts/AltProxyFinderPostProcess.cs.meta new file mode 100644 index 00000000..dc407ef6 --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltProxyFinderPostProcess.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5c8ccb2dcc1214d54b55ac872a3c5eaf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Scripts/AltTestRunListener.cs b/Assets/AltTester/Editor/Scripts/AltTestRunListener.cs new file mode 100644 index 00000000..7a92294f --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltTestRunListener.cs @@ -0,0 +1,59 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using AltTester.AltTesterUnitySDK.Editor.Logging; + +namespace AltTester.AltTesterUnitySDK.Editor +{ + public class AltTestRunListener : NUnit.Framework.Interfaces.ITestListener + { + private static readonly NLog.Logger logger = EditorLogManager.Instance.GetCurrentClassLogger(); + + private readonly TestRunDelegate callRunDelegate; + + public AltTestRunListener(TestRunDelegate callRunDelegate) + { + this.callRunDelegate = callRunDelegate; + } + + public void TestStarted(NUnit.Framework.Interfaces.ITest test) + { + if (!test.IsSuite) + { + if (callRunDelegate != null) + callRunDelegate(test.Name); + } + } + + public void TestFinished(NUnit.Framework.Interfaces.ITestResult result) + { + if (!result.Test.IsSuite) + { + logger.Info("==============> TEST " + result.Test.FullName + ": " + result.ResultState.ToString().ToUpper()); + if (result.ResultState != NUnit.Framework.Interfaces.ResultState.Success) + { + logger.Error(result.Message + System.Environment.NewLine + result.StackTrace); + } + logger.Info("======================================================"); + } + } + + public void TestOutput(NUnit.Framework.Interfaces.TestOutput output) + { + } + } +} diff --git a/Assets/AltTester/Editor/Scripts/AltTestRunListener.cs.meta b/Assets/AltTester/Editor/Scripts/AltTestRunListener.cs.meta new file mode 100644 index 00000000..2316e1cb --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltTestRunListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 737910aa707394542a0e97689c95f50e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Scripts/AltTestRunner.cs b/Assets/AltTester/Editor/Scripts/AltTestRunner.cs new file mode 100644 index 00000000..8d942744 --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltTestRunner.cs @@ -0,0 +1,662 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Xml; +using AltTester.AltTesterUnitySDK.Driver; +using AltTester.AltTesterUnitySDK.Editor.Logging; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal.Filters; +using Unity.EditorCoroutines.Editor; + +namespace AltTester.AltTesterUnitySDK.Editor +{ + public delegate void TestRunDelegate(string name); + + public class AltTestRunner + { + private static readonly NLog.Logger logger = EditorLogManager.Instance.GetCurrentClassLogger(); + + public enum TestRunMode { RunAllTest, RunSelectedTest, RunFailedTest } + + //This are for progressBar when are run + private static float progress; + private static float total; + private static string testName; + const string NUNIT_ASSEMBLY_NAME = "nunit.framework"; + + public static TestRunDelegate CallRunDelegate = new TestRunDelegate(showProgressBar); + + + public static void RunTests(TestRunMode testMode) + { + logger.Debug("Started running test"); + System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies(); + + List assemblyList = new List(); + var filters = addTestToBeRun(testMode, out assemblyList); + NUnit.Framework.Interfaces.ITestListener listener = new AltTestRunListener(CallRunDelegate); + var testAssemblyRunner = new NUnit.Framework.Api.NUnitTestAssemblyRunner(new NUnit.Framework.Api.DefaultTestAssemblyBuilder()); + progress = 0; + total = filters.Filters.Count; + TNode xmlContent = new TNode("test-run"); + foreach (var assembly in assemblies) + { + if (!assemblyList.Contains(assembly.GetName().Name)) + continue; + + testAssemblyRunner.Load(assembly, new Dictionary()); + var runTestThread = new System.Threading.Thread(() => + { + var result = testAssemblyRunner.Run(listener, filters); + result.AddToXml(xmlContent, true); + setTestStatus(result); + }); + + runTestThread.Start(); + if (AltTesterEditorWindow.EditorConfiguration.platform != AltPlatform.Editor) + { + float previousProgress = progress - 1; + while (runTestThread.IsAlive) + { + if (previousProgress == progress) continue; + UnityEditor.EditorUtility.DisplayProgressBar(progress == total ? "This may take a few seconds" : testName, + progress + "/" + total, progress / total); + previousProgress = progress; + } + } + + runTestThread.Join(); + } + if (AltTesterEditorWindow.EditorConfiguration.createXMLReport) + { + if (File.Exists(AltTesterEditorWindow.EditorConfiguration.xMLFilePath) || Directory.Exists(AltTesterEditorWindow.EditorConfiguration.xMLFilePath)) + { + FileAttributes attr = File.GetAttributes(AltTesterEditorWindow.EditorConfiguration.xMLFilePath); + if (Path.GetExtension(AltTesterEditorWindow.EditorConfiguration.xMLFilePath) != ".xml" && !attr.HasFlag(FileAttributes.Directory)) + AltTesterEditorWindow.EditorConfiguration.xMLFilePath = "test-report.xml"; + else if (attr.HasFlag(FileAttributes.Directory)) + AltTesterEditorWindow.EditorConfiguration.xMLFilePath = Path.Combine(AltTesterEditorWindow.EditorConfiguration.xMLFilePath, "test-report.xml"); + } + if (AltTesterEditorWindow.EditorConfiguration.xMLFilePath.Equals("")) + AltTesterEditorWindow.EditorConfiguration.xMLFilePath = "test-report.xml"; + createXMLReport(AltTesterEditorWindow.EditorConfiguration.xMLFilePath, xmlContent); + } + + AltTesterEditorWindow.IsTestRunResultAvailable = true; + AltTesterEditorWindow.SelectedTest = -1; + + if (AltTesterEditorWindow.EditorConfiguration.platform != AltPlatform.Editor) + { + AltTesterEditorWindow.NeedsRepainting = true; + UnityEditor.EditorUtility.ClearProgressBar(); + } + } + + + + private static void showProgressBar(string name) + { + progress++; + testName = name; + } + + private void setTestStatus(List results) + { + bool passed = true; + int numberOfTestPassed = 0; + int numberOfTestFailed = 0; + double totalTime = 0; + foreach (var test in AltTesterEditorWindow.EditorConfiguration.MyTests) + { + int counter = 0; + // int testPassed = 0; + int testPassedCounter = 0; + int testFailedCounter = 0; + foreach (var result in results) + { + switch (test.Type.ToString()) + { + case "NUnit.Framework.Internal.TestMethod": + var enumerator = result.Children.GetEnumerator(); + enumerator.MoveNext(); + if (enumerator.Current != null) + { + var enumerator2 = enumerator.Current.Children.GetEnumerator(); + enumerator2.MoveNext(); + if (enumerator2.Current != null && enumerator2.Current.FullName.Equals(test.TestName)) + { + if (enumerator2.Current.FailCount > 0) + { + test.Status = -1; + test.TestResultMessage = enumerator2.Current.Message + " \n\n\n StackTrace: " + enumerator2.Current.StackTrace; + passed = false; + numberOfTestFailed++; + + } + else if (enumerator2.Current.PassCount > 0) + { + test.Status = 1; + test.TestResultMessage = "Passed in " + enumerator2.Current.Duration; + numberOfTestPassed++; + } + + totalTime += (enumerator2.Current.EndTime - enumerator2.Current.StartTime).TotalSeconds; + } + enumerator2.Dispose(); + } + + enumerator.Dispose(); + break; + case "NUnit.Framework.Internal.TestFixture": + enumerator = result.Children.GetEnumerator(); + enumerator.MoveNext(); + if (enumerator.Current != null && enumerator.Current.FullName.Equals(test.TestName)) + { + counter++; + var enumerator2 = enumerator.Current.Children.GetEnumerator(); + enumerator2.MoveNext(); + if (enumerator2.Current != null && enumerator2.Current.FailCount > 0) + { + testFailedCounter++; + + } + else if (enumerator2.Current != null && enumerator2.Current.PassCount > 0) + { + testPassedCounter++; + + } + enumerator2.Dispose(); + } + enumerator.Dispose(); + break; + case "NUnit.Framework.Internal.TestAssembly": + counter++; + enumerator = result.Children.GetEnumerator(); + enumerator.MoveNext(); + if (enumerator.Current != null) + { + var enumerator2 = enumerator.Current.Children.GetEnumerator(); + enumerator2.MoveNext(); + if (enumerator2.Current != null && enumerator2.Current.FailCount > 0) + { + + testFailedCounter++; + } + else if (enumerator2.Current != null && enumerator2.Current.PassCount > 0) + { + testPassedCounter++; + } + + enumerator2.Dispose(); + } + + enumerator.Dispose(); + break; + } + + } + + if (test.Type.Equals("NUnit.Framework.Internal.TestMethod")) + { + if (test.TestCaseCount == counter) + { + if (testFailedCounter == 0 && testPassedCounter == counter) + { + test.Status = 1; + test.TestResultMessage = "All method passed "; + } + else + { + test.Status = -1; + passed = false; + test.TestResultMessage = "There are methods that failed"; + } + } + } + } + var listOfTests = AltTesterEditorWindow.EditorConfiguration.MyTests; + var serializeTests = JsonConvert.SerializeObject(listOfTests, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings + { + ReferenceLoopHandling = ReferenceLoopHandling.Ignore, + ContractResolver = new DefaultContractResolver() + }); + UnityEditor.EditorPrefs.SetString("tests", serializeTests); + + AltTesterEditorWindow.ReportTestPassed = numberOfTestPassed; + AltTesterEditorWindow.ReportTestFailed = numberOfTestFailed; + AltTesterEditorWindow.IsTestRunResultAvailable = true; + AltTesterEditorWindow.SelectedTest = -1; + AltTesterEditorWindow.TimeTestRan = totalTime; + if (passed) + { + logger.Debug("All test passed"); + } + else + { + logger.Debug("Test failed"); + } + } + + private static NUnit.Framework.Internal.Filters.OrFilter addTestToBeRun(TestRunMode testMode, out List assemblyList) + { + var filter = new NUnit.Framework.Internal.Filters.OrFilter(); + assemblyList = new List(); + switch (testMode) + { + case TestRunMode.RunAllTest: + foreach (var test in AltTesterEditorWindow.EditorConfiguration.MyTests) + if (!test.IsSuite) + { + filter.Add(new NUnit.Framework.Internal.Filters.FullNameFilter(test.TestName)); + if (!assemblyList.Contains(test.TestAssembly)) + assemblyList.Add(test.TestAssembly); + } + break; + case TestRunMode.RunSelectedTest: + foreach (var test in AltTesterEditorWindow.EditorConfiguration.MyTests) + if (test.Selected && !test.IsSuite) + { + filter.Add(new NUnit.Framework.Internal.Filters.FullNameFilter(test.TestName)); + if (!assemblyList.Contains(test.TestAssembly)) + assemblyList.Add(test.TestAssembly); + } + break; + case TestRunMode.RunFailedTest: + foreach (var test in AltTesterEditorWindow.EditorConfiguration.MyTests) + if (test.Status == -1 && !test.IsSuite) + { + filter.Add(new NUnit.Framework.Internal.Filters.FullNameFilter(test.TestName)); + if (!assemblyList.Contains(test.TestAssembly)) + assemblyList.Add(test.TestAssembly); + } + break; + } + + return filter; + } + + private static int setTestStatus(NUnit.Framework.Interfaces.ITestResult test) + { + + if (!test.Test.IsSuite) + { + var status = 0; + if (test.PassCount == 1) + { + status = 1; + AltTesterEditorWindow.ReportTestPassed++; + } + else if (test.FailCount == 1) + { + status = -1; + AltTesterEditorWindow.ReportTestFailed++; + } + AltTesterEditorWindow.TimeTestRan += test.Duration; + int index = AltTesterEditorWindow.EditorConfiguration.MyTests.FindIndex(a => a.TestName.Equals(test.Test.FullName)); + AltTesterEditorWindow.EditorConfiguration.MyTests[index].Status = status; + AltTesterEditorWindow.EditorConfiguration.MyTests[index].TestDuration = test.Duration; + AltTesterEditorWindow.EditorConfiguration.MyTests[index].TestStackTrace = test.StackTrace; + AltTesterEditorWindow.EditorConfiguration.MyTests[index].TestResultMessage = test.Message; + return status; + } + + var failCount = 0; + var notExecutedCount = 0; + var passCount = 0; + foreach (var testChild in test.Children) + { + var status = setTestStatus(testChild); + if (status == 0) + notExecutedCount++; + else if (status == -1) + { + failCount++; + + } + else + { + passCount++; + } + } + + if (test.Test.TestCaseCount != passCount + failCount + notExecutedCount) + { + AltTesterEditorWindow.EditorConfiguration.MyTests[AltTesterEditorWindow.EditorConfiguration.MyTests.FindIndex(a => a.TestName.Equals(test.Test.FullName))].Status = 0; + return 0; + } + + if (failCount > 0) + { + AltTesterEditorWindow.EditorConfiguration.MyTests[AltTesterEditorWindow.EditorConfiguration.MyTests.FindIndex(a => a.TestName.Equals(test.Test.FullName))].Status = -1; + return -1; + + } + AltTesterEditorWindow.EditorConfiguration.MyTests[AltTesterEditorWindow.EditorConfiguration.MyTests.FindIndex(a => a.TestName.Equals(test.Test.FullName))].Status = 1; + return 1; + } + + public static IEnumerator SetUpListTestCoroutine() + { + var myTests = new List(); + System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies().Where(a => a.GetReferencedAssemblies().FirstOrDefault( + reference => reference.Name.Contains(NUNIT_ASSEMBLY_NAME)) != null).ToArray(); + foreach (var assembly in assemblies) + { + + if (AltTesterEditorWindow.EditorConfiguration.assemblyTestDisplayedIndex != 0 && System.Array.IndexOf(assemblies, assembly) != AltTesterEditorWindow.EditorConfiguration.assemblyTestDisplayedIndex - 1) + continue; + + var testSuite = (NUnit.Framework.Internal.TestSuite)new NUnit.Framework.Api.DefaultTestAssemblyBuilder().Build(assembly, new Dictionary()); + var coroutine = EditorCoroutineUtility.StartCoroutineOwnerless(addTestSuiteToMyTestCoroutine(testSuite, myTests, assembly.GetName().Name)); + yield return coroutine; + } + setCorrectCheck(myTests); + AltTesterEditorWindow.EditorConfiguration.MyTests = myTests; + AltTesterEditorWindow.LoadTestCompleted = true; + AltTesterEditorWindow.Window.Repaint(); + } + + public static void SetUpListTest() + { + var myTests = new List(); + System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies(); + foreach (var assembly in assemblies) + { + bool isNunitTestAssembly = assembly.GetReferencedAssemblies().FirstOrDefault( + reference => reference.Name.Contains(NUNIT_ASSEMBLY_NAME)) != null; + if (!isNunitTestAssembly) + continue; + + var testSuite = (NUnit.Framework.Internal.TestSuite)new NUnit.Framework.Api.DefaultTestAssemblyBuilder().Build(assembly, new Dictionary()); + addTestSuiteToMyTest(testSuite, myTests, assembly.GetName().Name); + } + setCorrectCheck(myTests); + AltTesterEditorWindow.EditorConfiguration.MyTests = myTests; + AltTesterEditorWindow.LoadTestCompleted = true; + } + + + private static void setCorrectCheck(List myTests) + { + bool classCheck = true; + bool assemblyCheck = true; + for (int i = myTests.Count - 1; i >= 0; i--) + { + AltMyTest test = myTests[i]; + switch (test.Type.ToString()) + { + case "NUnit.Framework.Internal.TestMethod": + if (!test.Selected)//test not selected then the class which the test belong must be not selected + { + classCheck = false; + } + else + { + var parentTest = AltTesterEditorWindow.EditorConfiguration.MyTests.FirstOrDefault(a => a.TestName.Equals(test.ParentName)); + parentTest.TestSelectedCount++; + } + break; + case "NUnit.Framework.Internal.TestFixture": + if (classCheck) + { + test.Selected = true; + } + else + { + test.Selected = false; + assemblyCheck = false;//class not selected then the assembly which the test belong must be not selected + } + classCheck = true;//Reset value for new class + break; + case "NUnit.Framework.Internal.TestAssembly": + if (assemblyCheck) + { + test.Selected = true; + } + else + { + test.Selected = false; + } + assemblyCheck = true;//Reset value for new assembly + break; + } + } + } + + private static IEnumerator addTestSuiteToMyTestCoroutine(NUnit.Framework.Interfaces.ITest testSuite, List newMyTests, string assembly) + { + addCurrentSuiteToTestList(testSuite, newMyTests, assembly); + foreach (var test in testSuite.Tests) + { + var coroutine = EditorCoroutineUtility.StartCoroutineOwnerless(addTestSuiteToMyTestCoroutine(test, newMyTests, assembly)); + yield return coroutine; + } + } + private static void addTestSuiteToMyTest(NUnit.Framework.Interfaces.ITest testSuite, List newMyTests, string assembly) + { + addCurrentSuiteToTestList(testSuite, newMyTests, assembly); + foreach (var test in testSuite.Tests) + { + addTestSuiteToMyTest(test, newMyTests, assembly); + } + } + + private static void addCurrentSuiteToTestList(ITest testSuite, List newMyTests, string assembly) + { + string path = null; + + if (testSuite.GetType() == typeof(NUnit.Framework.Internal.TestMethod)) + { + string fullName = testSuite.FullName; + int indexOfParenthesis = fullName.IndexOf("("); + if (indexOfParenthesis > -1) + fullName = testSuite.FullName.Substring(0, indexOfParenthesis); + var hierarchyNames = fullName.Split('.'); + var className = hierarchyNames[hierarchyNames.Length - 2]; + var assets = UnityEditor.AssetDatabase.FindAssets(className); + if (assets.Length != 0) + { + path = UnityEditor.AssetDatabase.GUIDToAssetPath(assets[0]); + } + } + var parentName = string.Empty; + if (testSuite.Parent != null) + parentName = testSuite.Parent.FullName; + AltMyTest index = null; + if (AltTesterEditorWindow.EditorConfiguration.MyTests != null) + index = AltTesterEditorWindow.EditorConfiguration.MyTests.FirstOrDefault(a => a.TestName.Equals(testSuite.FullName) && a.ParentName.Equals(parentName)); + if (index == null) + { + newMyTests.Add(new AltMyTest(false, testSuite.FullName, assembly, 0, testSuite.IsSuite, testSuite.GetType().ToString(), + parentName, testSuite.TestCaseCount, false, null, null, 0, path, 0)); + } + else + { + newMyTests.Add(new AltMyTest(index.Selected, index.TestName, assembly, index.Status, index.IsSuite, testSuite.GetType().ToString(), + index.ParentName, testSuite.TestCaseCount, index.FoldOut, index.TestResultMessage, index.TestStackTrace, index.TestDuration, path, index.TestSelectedCount)); + } + } + + public static void RunTestFromCommandLine() + { + var arguments = System.Environment.GetCommandLineArgs(); + + int failed = 0; + bool runAllTests = true; + bool createReport = false; + string reportPath = ""; + List assemblyList = new List(); + var ClassToTest = new List(); + var Tests = new List(); + var AssemblyToTest = new List(); + var filter = new NUnit.Framework.Internal.Filters.OrFilter(); + TNode xmlContent = new TNode("test-run"); + var testAssemblyRunner = new NUnit.Framework.Api.NUnitTestAssemblyRunner(new NUnit.Framework.Api.DefaultTestAssemblyBuilder()); + NUnit.Framework.Interfaces.ITestListener listener = new AltTestRunListener(null); + System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies(); + var allTestsFoundInProject = setUpTestsForCommandLineRun(); + + checkCommandLineArguments(arguments, ref runAllTests, ref createReport, ref reportPath, ref ClassToTest, ref Tests, ref AssemblyToTest); + addTestsToFilter(runAllTests, filter, assemblies, assemblyList, ClassToTest, Tests, AssemblyToTest, allTestsFoundInProject); + + + foreach (var assembly in assemblies) + { + if (!assemblyList.Contains(assembly.GetName().Name)) + continue; + testAssemblyRunner.Load(assembly, new Dictionary()); + var result = testAssemblyRunner.Run(listener, filter); + failed += result.FailCount; + result.AddToXml(xmlContent, true); + } + if (createReport) + createXMLReport(reportPath, xmlContent); + + UnityEditor.EditorApplication.Exit(failed > 0 ? 1 : 0); + } + + private static void addTestsToFilter(bool runAllTests, OrFilter filter, Assembly[] assemblies, List assemblyList, List ClassToTest, List Tests, List AssemblyToTest, List tests) + { + if (runAllTests) + addAllTestsToFilter(filter, assemblyList, tests); + else + { + addClassTestsToFilter(filter, assemblyList, ClassToTest, tests); + addTestNamesToFilter(filter, assemblyList, Tests, tests); + var allAssemblies = assemblies.ToList(); + addAssemblyTestsToFilter(filter, assemblyList, AssemblyToTest, tests, allAssemblies); + } + } + + private static void addTestNamesToFilter(OrFilter filter, List assemblyList, List Tests, List tests) + { + foreach (var testName in Tests) + { + var classIndex = tests.FindIndex(test => test.TestName.Equals(testName)); + if (classIndex == -1) + throw new System.Exception("Test name: " + testName + " not found"); + addTestToRun(filter, assemblyList, tests[classIndex]); + } + } + + + + private static void addAssemblyTestsToFilter(OrFilter filter, List assemblyList, List AssemblyToTest, List tests, List allAssemblies) + { + foreach (var assembly in AssemblyToTest) + { + if (!allAssemblies.Exists(a => a.GetName().Name == assembly)) + throw new System.Exception("Assembly: " + assembly + " not found"); + } + if (AssemblyToTest.Count != 0) + foreach (var test in tests) + if (AssemblyToTest.Contains(test.TestAssembly)) + addTestToRun(filter, assemblyList, test); + } + + private static void addClassTestsToFilter(OrFilter filter, List assemblyList, List ClassToTest, List tests) + { + foreach (var className in ClassToTest) + { + var classIndex = tests.FindIndex(test => test.TestName.Equals(className)); + if (classIndex == -1) + throw new System.Exception("Class name: " + className + " not found"); + + var classFoundInList = tests[classIndex]; + for (int i = 0; i < classFoundInList.TestCaseCount; i++) + { + var index = i + classIndex + 1; + addTestToRun(filter, assemblyList, tests[index]); + } + } + } + + private static void addAllTestsToFilter(OrFilter filter, List assemblyList, List tests) + { + foreach (var test in tests) + if (!test.IsSuite) + addTestToRun(filter, assemblyList, test); + } + + private static void addTestToRun(OrFilter filter, List assemblyList, AltMyTest test) + { + filter.Add(new NUnit.Framework.Internal.Filters.FullNameFilter(test.TestName)); + if (!assemblyList.Contains(test.TestAssembly)) + assemblyList.Add(test.TestAssembly); + } + + private static void checkCommandLineArguments(string[] arguments, ref bool runAllTests, ref bool createReport, ref string reportPath, ref List ClassToTest, ref List Tests, ref List AssemblyToTest) + { + for (int i = 0; i < arguments.Length; i++) + { + switch (arguments[i]) + { + case "-reportPath": + if (i == arguments.Length - 1 || arguments[i + 1].StartsWith("-") || !arguments[i + 1].EndsWith(".xml")) + throw new InvalidPathException("Invalid path for report, please add a valid path after -reportPath that ends with .xml"); + createReport = true; + reportPath = arguments[i + 1]; + break; + case "-testsClass": + runAllTests = false; + addArgumentsToList(arguments, ClassToTest, i); + break; + case "-tests": + runAllTests = false; + addArgumentsToList(arguments, Tests, i); + break; + case "-testsAssembly": + runAllTests = false; + addArgumentsToList(arguments, AssemblyToTest, i); + break; + } + } + } + + private static void addArgumentsToList(string[] arguments, List testsList, int i) + { + int j = i + 1; + while (j < arguments.Length - 1 && !arguments[j].StartsWith("-")) + { + testsList.Add(arguments[j]); + j++; + } + } + + private static void createXMLReport(string reportPath, TNode xmlContent) + { + XmlWriter xmlWriter = XmlWriter.Create(reportPath); + xmlContent.WriteTo(xmlWriter); + xmlWriter.Flush(); + xmlWriter.Close(); + } + + private static List setUpTestsForCommandLineRun() + { + AltTesterEditorWindow.InitEditorConfiguration(); + SetUpListTest(); + return AltTesterEditorWindow.EditorConfiguration.MyTests; + } + } +} diff --git a/Assets/AltTester/Editor/Scripts/AltTestRunner.cs.meta b/Assets/AltTester/Editor/Scripts/AltTestRunner.cs.meta new file mode 100644 index 00000000..c8bd7ed5 --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltTestRunner.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 09004c37e429d0b4f8ac3ad7f2a8abdb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Scripts/AltTesterEditorWindow.cs b/Assets/AltTester/Editor/Scripts/AltTesterEditorWindow.cs new file mode 100644 index 00000000..7a9d5c86 --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltTesterEditorWindow.cs @@ -0,0 +1,1869 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using AltTester.AltTesterUnitySDK.Driver; +using AltTester.AltTesterUnitySDK.Editor.Logging; +using Unity.EditorCoroutines.Editor; +using UnityEditor; +using UnityEditor.SceneManagement; +using UnityEngine; + +namespace AltTester.AltTesterUnitySDK.Editor +{ + public class AltTesterEditorWindow : UnityEditor.EditorWindow + { + private static readonly NLog.Logger logger = EditorLogManager.Instance.GetCurrentClassLogger(); + + public static bool NeedsRepainting = false; + public static AltEditorConfiguration EditorConfiguration; + public static AltTesterEditorWindow Window; + public static int SelectedTest = -1; + + // TestResult after running a test + public static bool IsTestRunResultAvailable = false; + public static int ReportTestPassed; + public static int ReportTestFailed; + public static double TimeTestRan; + + public static List Devices = new List(); + + UnityEngine.Object obj; + private static UnityEngine.Texture2D passIcon; + private static UnityEngine.Texture2D failIcon; + private static UnityEngine.Texture2D downArrowIcon; + private static UnityEngine.Texture2D upArrowIcon; + private static UnityEngine.Texture2D xIcon; + private static UnityEngine.Texture2D reloadIcon; + + private static UnityEngine.Color greenColor = new UnityEngine.Color(0.0f, 0.5f, 0.2f, 1f); + private static UnityEngine.Color redColor = new UnityEngine.Color(0.7f, 0.15f, 0.15f, 1f); + private static UnityEngine.Color grayColor = new UnityEngine.Color(0.5f, 0.5f, 0.5f, 1f); + private static UnityEngine.Color selectedTestColor = new UnityEngine.Color(1f, 1f, 1f, 1f); + private static UnityEngine.Color selectedTestColorDark = new UnityEngine.Color(0.6f, 0.6f, 0.6f, 1f); + private static UnityEngine.Color oddNumberTestColor = new UnityEngine.Color(0.75f, 0.75f, 0.75f, 1f); + private static UnityEngine.Color evenNumberTestColor = new UnityEngine.Color(0.7f, 0.7f, 0.7f, 1f); + private static UnityEngine.Color oddNumberTestColorDark = new UnityEngine.Color(0.23f, 0.23f, 0.23f, 1f); + private static UnityEngine.Color evenNumberTestColorDark = new UnityEngine.Color(0.25f, 0.25f, 0.25f, 1f); + private static UnityEngine.Color borderColorDark = new UnityEngine.Color(0.18f, 0.18f, 0.18f, 1f); + private static UnityEngine.Color borderColor = new UnityEngine.Color(0.6f, 0.6f, 0.6f, 1f); + private static UnityEngine.Texture2D selectedTestTexture; + private static UnityEngine.Texture2D oddNumberTestTexture; + private static UnityEngine.Texture2D borderTexture; + private static UnityEngine.Texture2D evenNumberTestTexture; + private static UnityEngine.Texture2D verticalSplitTexture; + private static UnityEngine.Texture2D horizontalSplitTexture; + public static UnityEngine.Texture2D PortForwardingTexture; + public static UnityEngine.Texture2D SelectedTestsCountTexture; + + private const string PREFABNAME = "AltTesterPrefab"; + private static string version; + + + private static long timeSinceLastClick; + private static UnityEngine.Font font; + private static UnityEngine.Networking.UnityWebRequest www; + private UnityEngine.Vector2 scrollPositionTestResult; + + private bool foldOutScenes = true; + private bool foldOutTestRunSettings = true; + private bool foldOutBuildSettings = true; + private bool foldOutIosSettings = true; + private bool foldOutPortForwarding = true; + UnityEngine.Rect popUpPosition; + UnityEngine.Rect popUpContentPosition; + float splitNormalizedPosition = 0.33f; + float splitNormalizedPositionHorizontal = 0.33f; + UnityEngine.Rect resizeHandleRect; + UnityEngine.Rect resizeHandleRectHorizontal; + + private static bool insideMultilineComment = false; + + private static Dictionary availableTargetDictionary = new Dictionary(); + private int selectedTarget; + + static float windowWidth = 600; + bool resize; + bool resizeHorizontal; + public UnityEngine.Vector2 ScrollPositionVertical; + public UnityEngine.Vector2 ScrollPositionVerticalSecond; + public UnityEngine.Vector2 ScrollPositionHorizontal; + public UnityEngine.Vector2 ScrollPositionVerticalRightSide; + + public static bool LoadTestCompleted = true; + + UnityEngine.Rect availableRect; + UnityEngine.Rect availableRectHorizontal; + + private bool playInEditorPressed; + #region UnityEditor MenuItems + // Add menu item named "My Window" to the Window menu + [UnityEditor.MenuItem("AltTester®/AltTester® Editor", false, 80)] + public static void ShowWindow() + { + Window = (AltTesterEditorWindow)GetWindow(typeof(AltTesterEditorWindow)); + Window.minSize = new UnityEngine.Vector2(windowWidth, 100); + Window.titleContent = new UnityEngine.GUIContent("AltTester® Editor"); + Window.Show(); + } + + [UnityEditor.MenuItem("Assets/Create/AltTest", true, 80)] + public static bool CanCreateAltTest() + { + return (getPathForSelectedItem() + "/").Contains("/Editor/"); + } + + [UnityEditor.MenuItem("Assets/Create/AltTest", false, 80)] + public static void CreateAltTest() + { + var templatePath = UnityEditor.AssetDatabase.GUIDToAssetPath(UnityEditor.AssetDatabase.FindAssets("DefaultTestExample")[0]); + string folderPath = getPathForSelectedItem(); + string newFilePath = System.IO.Path.Combine(folderPath, "NewAltTest.cs"); +#if UNITY_2019_1_OR_NEWER + UnityEditor.ProjectWindowUtil.CreateScriptAssetFromTemplateFile(templatePath, newFilePath); +#else + System.Reflection.MethodInfo method = typeof(UnityEditor.ProjectWindowUtil).GetMethod("CreateScriptAsset", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic); + if (method == null) + throw new AltTester.AltTesterUnitySDK.Driver.NotFoundException("Method to create Script file was not found"); + method.Invoke((object)null, new object[2] + { + (object) templatePath, + (object) newFilePath + }); +#endif + } + + [UnityEditor.MenuItem("AltTester®/Create AltTester® Package", false, 800)] + public static void CreateAltTesterPackage() + { + UnityEngine.Debug.Log("AltTester® - Unity Package creation started..."); + var version = AltRunner.VERSION.Replace('.', '_'); + string packageName = "AltTester_" + version + ".unitypackage"; + string assetPathName = "Assets/AltTester"; + + // add all paths inside AltTester® except examples + var assetPathNames = Directory.GetDirectories(assetPathName).Where(dir => !dir.EndsWith("Examples")).ToList(); + assetPathNames.AddRange(Directory.GetFiles(assetPathName)); + + UnityEditor.AssetDatabase.ExportPackage(assetPathNames.ToArray(), packageName, UnityEditor.ExportPackageOptions.Recurse); + UnityEngine.Debug.Log("AltTester® - Unity Package done."); + } + + public static void CreateSampleScenesPackage() + { + UnityEngine.Debug.Log("SampleScenes - Unity Package creation started..."); + string packageName = "SampleScenes.unitypackage"; + string assetPathNames = "Assets/Examples"; + UnityEditor.AssetDatabase.ExportPackage(assetPathNames, packageName, UnityEditor.ExportPackageOptions.Recurse); + UnityEngine.Debug.Log("SampleScenes - Unity Package done."); + } + + public static void CreatePackages() + { + CreateAltTesterPackage(); + CreateSampleScenesPackage(); + } + + protected void Awake() + { + if (EditorConfiguration == null) + { + InitEditorConfiguration(); + } + + EditorConfiguration.MyTests = null; + LoadTestCompleted = false; + this.StartCoroutine(AltTestRunner.SetUpListTestCoroutine()); + } + protected void OnEnable() + { + Window = this; + } + + [UnityEditor.MenuItem("AltTester®/AltId/Add AltId to every object", false, 800)] + public static void AddIdComponentToEveryObjectInTheProject() + { + var scenes = altGetAllScenes(); + foreach (var scene in scenes) + { + EditorSceneManager.OpenScene(scene); + AddIdComponentToEveryObjectInActiveScene(); + } + } + + [UnityEditor.MenuItem("AltTester®/AltId/Add AltId to every object in active scene", false, 800)] + public static void AddIdComponentToEveryObjectInActiveScene() + { + var rootObjects = new List(); + UnityEngine.SceneManagement.Scene scene = EditorSceneManager.GetActiveScene(); + scene.GetRootGameObjects(rootObjects); + + for (int i = 0; i < rootObjects.Count; i++) + { + addComponentToObjectAndHisChildren(rootObjects[i]); + } + EditorSceneManager.MarkSceneDirty(scene); + EditorSceneManager.SaveScene(scene); + } + + + [UnityEditor.MenuItem("AltTester®/AltId/Remove AltId from every object", false, 800)] + public static void RemoveIdComponentFromEveryObjectInTheProject() + { + var scenes = altGetAllScenes(); + foreach (var scene in scenes) + { + EditorSceneManager.OpenScene(scene); + RemoveComponentFromEveryObjectInTheScene(); + } + } + + [UnityEditor.MenuItem("AltTester®/AltId/Remove AltId from every object in active scene", false, 800)] + public static void RemoveComponentFromEveryObjectInTheScene() + { + var rootObjects = new List(); + UnityEngine.SceneManagement.Scene scene = EditorSceneManager.GetActiveScene(); + scene.GetRootGameObjects(rootObjects); + + for (int i = 0; i < rootObjects.Count; i++) + { + removeComponentFromObjectAndHisChildren(rootObjects[i]); + } + EditorSceneManager.MarkSceneDirty(scene); + EditorSceneManager.SaveScene(scene); + } + + [UnityEditor.MenuItem("AltTester®/Support/Documentation", false, 800)] + public static void GoToDocumentation() + { + Application.OpenURL("https://alttester.com/docs/sdk/latest/"); + } + + [UnityEditor.MenuItem("AltTester®/Support/Discord", false, 800)] + public static void GoToDiscord() + { + Application.OpenURL("https://discord.com/channels/744769398023127102/748159679426985984"); + } + + #endregion + + #region Unity Events + protected void OnFocus() + { + Repaint(); + if (EditorConfiguration == null) + { + InitEditorConfiguration(); + } + + if (!UnityEditor.AssetDatabase.IsValidFolder("Assets/Resources/AltTester")) + { + AltBuilder.CreateJsonFileForInputMappingOfAxis(); + } + if (failIcon == null) + { + var findIcon = UnityEditor.AssetDatabase.FindAssets("16px-indicator-fail"); + failIcon = UnityEditor.AssetDatabase.LoadAssetAtPath(UnityEditor.AssetDatabase.GUIDToAssetPath(findIcon[0])); + } + if (passIcon == null) + { + var findIcon = UnityEditor.AssetDatabase.FindAssets("16px-indicator-pass"); + passIcon = UnityEditor.AssetDatabase.LoadAssetAtPath(UnityEditor.AssetDatabase.GUIDToAssetPath(findIcon[0])); + } + if (downArrowIcon == null) + { + var findIcon = UnityEditor.EditorGUIUtility.isProSkin ? UnityEditor.AssetDatabase.FindAssets("downArrowIcon") : UnityEditor.AssetDatabase.FindAssets("downArrowIconDark"); + downArrowIcon = UnityEditor.AssetDatabase.LoadAssetAtPath(UnityEditor.AssetDatabase.GUIDToAssetPath(findIcon[0])); + } + if (upArrowIcon == null) + { + var findIcon = UnityEditor.EditorGUIUtility.isProSkin ? UnityEditor.AssetDatabase.FindAssets("upArrowIcon") : UnityEditor.AssetDatabase.FindAssets("upArrowIconDark"); + upArrowIcon = UnityEditor.AssetDatabase.LoadAssetAtPath(UnityEditor.AssetDatabase.GUIDToAssetPath(findIcon[0])); + } + + if (xIcon == null) + { + var findIcon = UnityEditor.EditorGUIUtility.isProSkin ? UnityEditor.AssetDatabase.FindAssets("xIcon") : UnityEditor.AssetDatabase.FindAssets("xIconDark"); + xIcon = UnityEditor.AssetDatabase.LoadAssetAtPath(UnityEditor.AssetDatabase.GUIDToAssetPath(findIcon[0])); + } + if (reloadIcon == null) + { + var findIcon = UnityEditor.EditorGUIUtility.isProSkin ? UnityEditor.AssetDatabase.FindAssets("reloadIcon") : UnityEditor.AssetDatabase.FindAssets("reloadIconDark"); + reloadIcon = UnityEditor.AssetDatabase.LoadAssetAtPath(UnityEditor.AssetDatabase.GUIDToAssetPath(findIcon[0])); + } + + if (selectedTestTexture == null) + { + selectedTestTexture = MakeTexture(20, 20, UnityEditor.EditorGUIUtility.isProSkin ? selectedTestColorDark : selectedTestColor); + } + + if (SelectedTestsCountTexture == null) + { + SelectedTestsCountTexture = MakeTexture(20, 20, grayColor); + } + + getListOfSceneFromEditor(); + } + + protected void OnGUI() + { + if (EditorConfiguration == null) + { + InitEditorConfiguration(); + return; + } + + if (NeedsRepainting) + { + NeedsRepainting = false; + Repaint(); + } + DrawGUI(); + + if (EditorConfiguration != null) + { + if (UnityEngine.Application.isPlaying && !EditorConfiguration.RanInEditor) + { + EditorConfiguration.RanInEditor = true; + } + if (!UnityEngine.Application.isPlaying && EditorConfiguration.RanInEditor) + { + afterExitPlayMode(); + } + } + if (playInEditorPressed && !UnityEditor.EditorApplication.isCompiling && AltBuilder.CheckAltTesterIsDefineAsAScriptingSymbol(UnityEditor.BuildPipeline.GetBuildTargetGroup(UnityEditor.EditorUserBuildSettings.activeBuildTarget))) + { + playInEditorPressed = false; + UnityEditor.EditorApplication.isPlaying = true; + } + } + + public void BeginHorizontalSplitView() + { + UnityEngine.Rect tempRect; + + tempRect = UnityEditor.EditorGUILayout.BeginHorizontal(UnityEngine.GUILayout.ExpandWidth(false)); + if (tempRect.width > 0.0f) + { + availableRectHorizontal = tempRect; + } + } + public void BeginVerticalSplitView() + { + UnityEngine.Rect tempRect; + + tempRect = UnityEditor.EditorGUILayout.BeginVertical(UnityEngine.GUILayout.ExpandHeight(false)); + if (tempRect.width > 0.0f) + { + availableRect = tempRect; + } + } + private void resizeHorizontalSplitView() + { + resizeHandleRectHorizontal = new UnityEngine.Rect(availableRectHorizontal.width * splitNormalizedPositionHorizontal * 2, availableRectHorizontal.y, 2f, availableRectHorizontal.height); + if (horizontalSplitTexture == null) + { + horizontalSplitTexture = MakeTexture(20, 100, UnityEditor.EditorGUIUtility.isProSkin ? oddNumberTestColorDark : oddNumberTestColor); + } + UnityEngine.GUI.DrawTexture(resizeHandleRectHorizontal, horizontalSplitTexture); + UnityEditor.EditorGUIUtility.AddCursorRect(resizeHandleRectHorizontal, UnityEditor.MouseCursor.ResizeHorizontal); + if (UnityEngine.Event.current.type == UnityEngine.EventType.MouseDown && resizeHandleRectHorizontal.Contains(UnityEngine.Event.current.mousePosition)) + { + resizeHorizontal = true; + resize = false; + } + if (resizeHorizontal) + { + var width = availableRectHorizontal.width * 2; + splitNormalizedPositionHorizontal = UnityEngine.Event.current.mousePosition.x / width; + } + if (UnityEngine.Event.current.type == UnityEngine.EventType.MouseUp) + resizeHorizontal = false; + } + private void resizeVerticalSplitView() + { + + resizeHandleRect = new UnityEngine.Rect(availableRect.x, availableRect.height * splitNormalizedPosition + 25f, availableRect.width, 2f); + if (verticalSplitTexture == null) + { + verticalSplitTexture = MakeTexture(20, 100, UnityEditor.EditorGUIUtility.isProSkin ? oddNumberTestColorDark : oddNumberTestColor); + } + UnityEngine.GUI.DrawTexture(resizeHandleRect, verticalSplitTexture); + UnityEditor.EditorGUIUtility.AddCursorRect(resizeHandleRect, UnityEditor.MouseCursor.ResizeVertical); + if (UnityEngine.Event.current.type == UnityEngine.EventType.MouseDown && resizeHandleRect.Contains(UnityEngine.Event.current.mousePosition)) + { + resize = true; + } + if (resize) + { + splitNormalizedPosition = UnityEngine.Event.current.mousePosition.y / availableRect.height; + } + if (UnityEngine.Event.current.type == UnityEngine.EventType.MouseUp) + resize = false; + } + + protected void OnInspectorUpdate() + { + if (IsTestRunResultAvailable) + { + Repaint(); + IsTestRunResultAvailable = EditorUtility.DisplayDialog("Test Report", + $" Total tests:{ReportTestFailed + ReportTestPassed}{Environment.NewLine} Tests passed:{ReportTestPassed}{System.Environment.NewLine} Tests failed:{ReportTestFailed}{System.Environment.NewLine} Duration:{TimeTestRan} seconds", "Ok"); + if (IsTestRunResultAvailable) + { + IsTestRunResultAvailable = !IsTestRunResultAvailable; + } + ReportTestFailed = 0; + ReportTestPassed = 0; + TimeTestRan = 0; + } + } + + protected void DrawGUI() + { + var screenWidth = UnityEditor.EditorGUIUtility.currentViewWidth; + + + //----------------------Left Panel------------ + + BeginHorizontalSplitView(); + var leftSide = (screenWidth / 3) * 2; + + ScrollPositionHorizontal = UnityEngine.GUILayout.BeginScrollView(ScrollPositionHorizontal, UnityEngine.GUILayout.Width(availableRectHorizontal.width * splitNormalizedPositionHorizontal * 2)); + + BeginVerticalSplitView(); + + displayTestGui(EditorConfiguration.MyTests); + resizeVerticalSplitView(); + ScrollPositionVerticalSecond = UnityEngine.GUILayout.BeginScrollView(ScrollPositionVerticalSecond, UnityEngine.GUILayout.ExpandHeight(true)); + UnityEditor.EditorGUILayout.Separator(); + + displayBuildSettings(); + UnityEditor.EditorGUILayout.Separator(); + displayTestRunSettings(); + UnityEditor.EditorGUILayout.Separator(); + displayScenes(); + UnityEditor.EditorGUILayout.Separator(); + + UnityEditor.EditorGUILayout.EndVertical(); + UnityEditor.EditorGUILayout.EndScrollView(); + UnityEditor.EditorGUILayout.EndScrollView(); + + resizeHorizontalSplitView(); + + //-------------------Right Panel-------------- + + ScrollPositionVerticalRightSide = UnityEditor.EditorGUILayout.BeginScrollView(ScrollPositionVerticalRightSide, UnityEngine.GUI.skin.textArea, UnityEngine.GUILayout.ExpandHeight(true)); + + var rightSide = (screenWidth / 3); + UnityEditor.EditorGUILayout.BeginVertical(); + + displayPlatformAndPlatformSettings(rightSide); + + UnityEditor.EditorGUILayout.Separator(); + UnityEditor.EditorGUILayout.Separator(); + UnityEditor.EditorGUILayout.Separator(); + + + if (AltBuilder.Built) + { + var found = false; + + UnityEngine.SceneManagement.Scene scene = EditorSceneManager.OpenScene(AltBuilder.GetFirstSceneWhichWillBeBuilt()); + if (scene.path.Equals(AltBuilder.GetFirstSceneWhichWillBeBuilt())) + { + if (scene.GetRootGameObjects() + .Any(gameObject => gameObject.name.Equals(PREFABNAME))) + { + UnityEngine.SceneManagement.SceneManager.SetActiveScene(scene); + var altRunner = scene.GetRootGameObjects() + .First(a => a.name.Equals(PREFABNAME)); + destroyAltRunner(altRunner); + found = true; + } + + if (found == false) + AltBuilder.Built = false; + } + + } + + UnityEditor.EditorGUILayout.LabelField("Build", UnityEditor.EditorStyles.boldLabel); + if (EditorConfiguration.platform != AltPlatform.Editor) + { + if (GUILayout.Button("Build Only")) + BuildGameFromUI(false); + } + else + { + CreateDisabledButton("Build Only"); + } + + UnityEditor.EditorGUILayout.Separator(); + UnityEditor.EditorGUILayout.Separator(); + UnityEditor.EditorGUILayout.Separator(); + + UnityEditor.EditorGUILayout.LabelField("Run", UnityEditor.EditorStyles.boldLabel); + if (EditorConfiguration.platform == AltPlatform.Editor && !UnityEditor.EditorApplication.isCompiling && !UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode) + { + if (UnityEngine.GUILayout.Button("Play in Editor")) + runInEditor(); + } + else + { + CreateDisabledButton("Play in Editor"); + } + + if (EditorConfiguration.platform != AltPlatform.Editor) + { + if (GUILayout.Button("Build & Run")) + BuildGameFromUI(true); + } + else + { + CreateDisabledButton("Build & Run"); + } + GUIStyle style = new GUIStyle(GUI.skin.label) + { + fontSize = 10, + wordWrap = true + }; + UnityEditor.EditorGUILayout.LabelField("Building or Playing in editor will add ALTTESTER as a define", style); + UnityEditor.EditorGUILayout.LabelField("If New Input System is active when you build your app, AltTester® will modify your existing test assembly to be run only in editor to prevent errors", style); + UnityEditor.EditorGUILayout.Separator(); + UnityEditor.EditorGUILayout.Separator(); + UnityEditor.EditorGUILayout.Separator(); + var selectedTests = 0; + var totalTests = 0; + var failedTests = 0; + if (AltTesterEditorWindow.EditorConfiguration.MyTests != null) + foreach (var test in AltTesterEditorWindow.EditorConfiguration.MyTests) + { + if (test.IsSuite) + continue; + totalTests++; + if (test.Selected) + selectedTests += 1; + if (test.Status != 1 && test.Status != 0) + failedTests++; + } + UnityEditor.EditorGUILayout.LabelField("Run tests", UnityEditor.EditorStyles.boldLabel); + + if (UnityEngine.GUILayout.Button("Run All Tests (" + totalTests.ToString() + ")")) + { + if (EditorConfiguration.platform == AltPlatform.Editor) + { + var testThread = new Thread(() => AltTestRunner.RunTests(AltTestRunner.TestRunMode.RunAllTest)); + testThread.Start(); + } + else + { + + AltTestRunner.RunTests(AltTestRunner.TestRunMode.RunAllTest); + } + } + if (UnityEngine.GUILayout.Button("Run Selected Tests (" + selectedTests.ToString() + ")")) + { + if (EditorConfiguration.platform == AltPlatform.Editor) + { + var testThread = new Thread(() => AltTestRunner.RunTests(AltTestRunner.TestRunMode.RunSelectedTest)); + testThread.Start(); + } + else + { + + AltTestRunner.RunTests(AltTestRunner.TestRunMode.RunSelectedTest); + } + } + if (UnityEngine.GUILayout.Button("Run Failed Tests (" + failedTests.ToString() + ")")) + { + if (EditorConfiguration.platform == AltPlatform.Editor) + { + var testThread = new Thread(() => AltTestRunner.RunTests(AltTestRunner.TestRunMode.RunFailedTest)); + testThread.Start(); + } + else + { + + AltTestRunner.RunTests(AltTestRunner.TestRunMode.RunFailedTest); + } + } + //Status test + + scrollPositionTestResult = UnityEditor.EditorGUILayout.BeginScrollView(scrollPositionTestResult, UnityEngine.GUI.skin.textArea, UnityEngine.GUILayout.ExpandHeight(true)); + if (SelectedTest != -1) + { + var gUIStyle = new UnityEngine.GUIStyle(UnityEngine.GUI.skin.label) + { + wordWrap = true, + richText = true, + alignment = UnityEngine.TextAnchor.MiddleCenter + }; + var gUIStyle2 = new UnityEngine.GUIStyle(); + UnityEditor.EditorGUILayout.LabelField("" + EditorConfiguration.MyTests[SelectedTest].TestName + "", gUIStyle); + + + UnityEditor.EditorGUILayout.Separator(); + string textToDisplayForMessage; + if (EditorConfiguration.MyTests[SelectedTest].Status == 0) + { + textToDisplayForMessage = "No information about this test available.\nPlease rerun the test."; + UnityEditor.EditorGUILayout.LabelField(textToDisplayForMessage, gUIStyle, UnityEngine.GUILayout.MinWidth(30)); + } + else + { + gUIStyle = new UnityEngine.GUIStyle(UnityEngine.GUI.skin.label) + { + wordWrap = true, + richText = true + }; + + string status = ""; + switch (EditorConfiguration.MyTests[SelectedTest].Status) + { + case 1: + status = "Passed"; + break; + case -1: + status = "Failed"; + break; + + } + + UnityEngine.GUILayout.BeginHorizontal(); + UnityEditor.EditorGUILayout.LabelField("Time", gUIStyle, UnityEngine.GUILayout.MinWidth(30)); + UnityEditor.EditorGUILayout.LabelField(EditorConfiguration.MyTests[SelectedTest].TestDuration.ToString(), gUIStyle, UnityEngine.GUILayout.MinWidth(100)); + UnityEngine.GUILayout.EndHorizontal(); + + UnityEngine.GUILayout.BeginHorizontal(); + UnityEditor.EditorGUILayout.LabelField("Status", gUIStyle, UnityEngine.GUILayout.MinWidth(30)); + UnityEditor.EditorGUILayout.LabelField(status, gUIStyle, UnityEngine.GUILayout.MinWidth(100)); + UnityEngine.GUILayout.EndHorizontal(); + if (EditorConfiguration.MyTests[SelectedTest].Status == -1) + { + UnityEngine.GUILayout.BeginHorizontal(); + UnityEditor.EditorGUILayout.LabelField("Message", gUIStyle, UnityEngine.GUILayout.MinWidth(30)); + UnityEditor.EditorGUILayout.LabelField(EditorConfiguration.MyTests[SelectedTest].TestResultMessage, gUIStyle, UnityEngine.GUILayout.MinWidth(100)); + UnityEngine.GUILayout.EndHorizontal(); + + UnityEngine.GUILayout.BeginHorizontal(); + UnityEditor.EditorGUILayout.LabelField("StackTrace", gUIStyle, UnityEngine.GUILayout.MinWidth(30)); + UnityEditor.EditorGUILayout.LabelField(EditorConfiguration.MyTests[SelectedTest].TestStackTrace, gUIStyle, UnityEngine.GUILayout.MinWidth(100)); + UnityEngine.GUILayout.EndHorizontal(); + } + } + } + else + { + UnityEditor.EditorGUILayout.LabelField("No test selected"); + } + UnityEditor.EditorGUILayout.EndScrollView(); + UnityEditor.EditorGUILayout.EndVertical(); + UnityEditor.EditorGUILayout.EndHorizontal(); + + UnityEditor.EditorGUILayout.EndScrollView(); + + void BuildGameFromUI(bool autoRun) + { + if (EditorConfiguration.platform == AltPlatform.Android) + { + AltBuilder.BuildGameFromUI(BuildTarget.Android, BuildTargetGroup.Android, autoRun); + } + else if (EditorConfiguration.platform == AltPlatform.iOS) + { + AltBuilder.BuildGameFromUI(BuildTarget.iOS, BuildTargetGroup.iOS, autoRun); + } + else if (EditorConfiguration.platform == AltPlatform.Standalone) + { + AltBuilder.BuildGameFromUI(EditorConfiguration.StandaloneTarget, BuildTargetGroup.Standalone, autoRun); + } + else if (EditorConfiguration.platform == AltPlatform.WebGL) + { + AltBuilder.BuildGameFromUI(BuildTarget.WebGL, BuildTargetGroup.WebGL, autoRun); + } + else + { + runInEditor(); + } + UnityEngine.GUIUtility.ExitGUI(); + } + } + + private static void CreateDisabledButton(string buttonText) + { + UnityEditor.EditorGUI.BeginDisabledGroup(true); + UnityEngine.GUILayout.Button(buttonText, UnityEngine.GUILayout.MinWidth(50)); + UnityEditor.EditorGUI.EndDisabledGroup(); + } + + private BuildTargetGroup getBuildTargetGroupFromAltPlatform(AltPlatform altPlatform) + { + switch (altPlatform) + { + case AltPlatform.Android: + return BuildTargetGroup.Android; + case AltPlatform.Standalone: + return BuildTargetGroup.Standalone; + case AltPlatform.iOS: + return BuildTargetGroup.iOS; + case AltPlatform.WebGL: + return BuildTargetGroup.WebGL; + default: + throw new NotImplementedException(); + + + } + } + private static AltPlatform getAltPlatformFromBuildTargetGroup(BuildTargetGroup targetGroup) + { + switch (targetGroup) + { + case BuildTargetGroup.Standalone: + return AltPlatform.Standalone; + case BuildTargetGroup.Android: + return AltPlatform.Android; + case BuildTargetGroup.WebGL: + return AltPlatform.WebGL; + case BuildTargetGroup.iOS: + return AltPlatform.iOS; + default: + return AltPlatform.Editor; + }; + + + + } + private BuildTarget[] getBuildTargetFromAltPlatform(AltPlatform altPlatform) + { + switch (altPlatform) + { + case AltPlatform.Android: + return new BuildTarget[] { BuildTarget.Android }; + case AltPlatform.Standalone: + return new BuildTarget[] { BuildTarget.StandaloneWindows, BuildTarget.StandaloneWindows64, BuildTarget.StandaloneOSX, BuildTarget.StandaloneLinux64 }; + case AltPlatform.iOS: + return new BuildTarget[] { BuildTarget.iOS }; + case AltPlatform.WebGL: + return new BuildTarget[] { BuildTarget.WebGL }; + default: + throw new NotImplementedException(); + + + } + } + + private void displayPlatformAndPlatformSettings(float size) + { + UnityEditor.EditorGUILayout.LabelField("Platform", UnityEditor.EditorStyles.boldLabel); + var guiStyleRadioButton = new UnityEngine.GUIStyle(UnityEditor.EditorStyles.radioButton) + { + padding = new UnityEngine.RectOffset(20, 0, 1, 0) + }; + + EditorGUI.BeginDisabledGroup(UnityEngine.Application.isPlaying || UnityEditor.EditorApplication.isCompiling); + UnityEditor.EditorGUILayout.BeginHorizontal(); + availableTargetDictionary.Clear(); + foreach (AltPlatform platform in Enum.GetValues(typeof(AltPlatform))) + { + if (platform == AltPlatform.Editor) + { + availableTargetDictionary.Add(BuildTarget.NoTarget, "Editor"); + continue; + } + var targetGroup = getBuildTargetGroupFromAltPlatform(platform); + var targets = getBuildTargetFromAltPlatform(platform); + foreach (var target in targets) + if (BuildPipeline.IsBuildTargetSupported(targetGroup, target)) + { + availableTargetDictionary.Add(target, platform.ToString()); + } + } + var listOfPlatforms = availableTargetDictionary.Values.Distinct().ToArray(); + selectedTarget = Array.IndexOf(listOfPlatforms, EditorConfiguration.platform.ToString()); + selectedTarget = GUILayout.SelectionGrid(selectedTarget, listOfPlatforms, size <= 300 ? 1 : listOfPlatforms.Length, guiStyleRadioButton); + UnityEditor.EditorGUILayout.EndHorizontal(); + EditorGUI.EndDisabledGroup(); + + EditorConfiguration.platform = (AltPlatform)Enum.Parse(typeof(AltPlatform), listOfPlatforms[selectedTarget]); + + switch (EditorConfiguration.platform) + { + case AltPlatform.Android: + EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Android, BuildTarget.Android); + showSettings(BuildTargetGroup.Android, AltPlatform.Android); + + break; + case AltPlatform.Standalone: + List optionsList = new List(); + foreach (var key in availableTargetDictionary.Keys) + { + if (availableTargetDictionary[key].Equals("Standalone")) + optionsList.Add(key); + } + var options = optionsList.ToArray(); + int selected = Mathf.Clamp(Array.IndexOf(options, EditorConfiguration.StandaloneTarget), 0, options.Length); + selected = EditorGUILayout.Popup("Build Target", selected, optionsList.ConvertAll(x => x.ToString()).ToArray()); + EditorConfiguration.StandaloneTarget = options[selected]; + EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, EditorConfiguration.StandaloneTarget); + browseBuildLocation(); + break; +#if UNITY_EDITOR_OSX + case AltPlatform.iOS: + EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.iOS, BuildTarget.iOS); + showSettings(UnityEditor.BuildTargetGroup.iOS, AltPlatform.iOS); + break; +#endif + case AltPlatform.WebGL: + EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.WebGL, BuildTarget.WebGL); + showSettings(UnityEditor.BuildTargetGroup.WebGL, AltPlatform.WebGL); + break; + } + checkAltTesterSymbol(); + + } + + private void showSettings(BuildTargetGroup targetGroup, AltPlatform platform) + { + browseBuildLocation(); + EditorGUILayout.Separator(); + EditorGUILayout.LabelField("Settings", UnityEditor.EditorStyles.boldLabel); + + if (UnityEngine.GUILayout.Button(platform.ToString() + " player settings")) + { +#if UNITY_2018_3_OR_NEWER + UnityEditor.SettingsService.OpenProjectSettings("Project/Player"); +#else + UnityEditor.EditorApplication.ExecuteMenuItem("Edit/Project Settings/Player"); +#endif + UnityEditor.EditorUserBuildSettings.selectedBuildTargetGroup = targetGroup; + } + } + + + #endregion + + #region public methods + public static void InitEditorConfiguration() + { + if (UnityEditor.AssetDatabase.FindAssets("AltTesterEditorSettings").Length == 0) + { + if (!AssetDatabase.IsValidFolder("Assets/Plugins/AltTester")) + { + if (!AssetDatabase.IsValidFolder("Assets/Plugins")) + { + AssetDatabase.CreateFolder("Assets", "Plugins"); + } + AssetDatabase.CreateFolder("Assets/Plugins", "AltTester"); + } + EditorConfiguration = CreateInstance(); + EditorConfiguration.MyTests = null; + EditorConfiguration.platform = getAltPlatformFromBuildTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup); + UnityEditor.AssetDatabase.CreateAsset(EditorConfiguration, "Assets/Plugins/AltTester/AltTesterEditorSettings.asset"); + UnityEditor.AssetDatabase.SaveAssets(); + } + else + { + EditorConfiguration = UnityEditor.AssetDatabase.LoadAssetAtPath( + UnityEditor.AssetDatabase.GUIDToAssetPath(UnityEditor.AssetDatabase.FindAssets("AltTesterEditorSettings")[0])); + } + UnityEditor.EditorUtility.SetDirty(EditorConfiguration); + } + + public static UnityEngine.Texture2D MakeTexture(int width, int height, UnityEngine.Color col) + { + UnityEngine.Color[] pix = new UnityEngine.Color[width * height]; + + for (int i = 0; i < pix.Length; i++) + pix[i] = col; + + var result = new UnityEngine.Texture2D(width, height); + result.SetPixels(pix); + result.Apply(); + + return result; + } + + + public static UnityEngine.Texture2D SetColor(UnityEngine.Texture2D tex2, UnityEngine.Color32 color) + { + + var fillColorArray = tex2.GetPixels32(); + + for (var i = 0; i < fillColorArray.Length; ++i) + { + fillColorArray[i] = color; + } + + tex2.SetPixels32(fillColorArray); + + tex2.Apply(); + return tex2; + } + + + public static void AddAllScenes() + { + var scenesToBeAddedGuid = UnityEditor.AssetDatabase.FindAssets("t:SceneAsset"); + EditorConfiguration.Scenes = new System.Collections.Generic.List(); + foreach (var sceneGuid in scenesToBeAddedGuid) + { + var scenePath = UnityEditor.AssetDatabase.GUIDToAssetPath(sceneGuid); + EditorConfiguration.Scenes.Add(new AltMyScenes(false, scenePath, 0)); + } + UnityEditor.EditorBuildSettings.scenes = pathFromTheSceneInCurrentList(); + } + + public static void SelectAllScenes() + { + foreach (var scene in EditorConfiguration.Scenes) + { + scene.ToBeBuilt = true; + } + UnityEditor.EditorBuildSettings.scenes = pathFromTheSceneInCurrentList(); + } + + #endregion + private static void swap(int index1, int index2) + { + (EditorConfiguration.Scenes[index2], EditorConfiguration.Scenes[index1]) = (EditorConfiguration.Scenes[index1], EditorConfiguration.Scenes[index2]); + } + private static void browseBuildLocation() + { + UnityEngine.GUILayout.BeginHorizontal(); + var guiStyleTextField = new UnityEngine.GUIStyle(UnityEngine.GUI.skin.textField) + { + fixedHeight = 15, + margin = new UnityEngine.RectOffset(3, 2, 4, 2), + padding = new UnityEngine.RectOffset(2, 0, 0, 0) + }; + EditorConfiguration.BuildLocationPath = UnityEditor.EditorGUILayout.TextField("Build Location", EditorConfiguration.BuildLocationPath, guiStyleTextField); + UnityEngine.GUI.SetNextControlName("Browse"); + var guiStyleButton = new UnityEngine.GUIStyle(UnityEngine.GUI.skin.button) + { + fixedHeight = 15, + margin = new UnityEngine.RectOffset(2, 2, 4, 2) + }; + var buildLocationPath = EditorConfiguration.BuildLocationPath; + if (UnityEngine.GUILayout.Button("Browse", guiStyleButton)) + { + EditorConfiguration.BuildLocationPath = UnityEditor.EditorUtility.OpenFolderPanel("Select Build Location", "", ""); + if (EditorConfiguration.BuildLocationPath.Length == 0) + EditorConfiguration.BuildLocationPath = buildLocationPath; + UnityEngine.GUI.FocusControl("Browse"); + } + UnityEngine.GUILayout.EndHorizontal(); + } + + private void getListOfSceneFromEditor() + { + var newScenes = new List(); + foreach (var scene in UnityEditor.EditorBuildSettings.scenes) + { + newScenes.Add(new AltMyScenes(scene.enabled, scene.path, 0)); + } + EditorConfiguration.Scenes = newScenes; + } + + private void afterExitPlayMode() + { + removeAltTesterPrefab(); + AltBuilder.RemoveAltTesterFromScriptingDefineSymbols(UnityEditor.BuildPipeline.GetBuildTargetGroup(UnityEditor.EditorUserBuildSettings.activeBuildTarget)); + EditorConfiguration.RanInEditor = false; + } + + private static void removeAltTesterPrefab() + { + var activeScene = EditorSceneManager.GetActiveScene(); + var altRunners = activeScene.GetRootGameObjects() + .Where(gameObject => gameObject.name.Equals(PREFABNAME)).ToList(); + if (altRunners.Count != 0) + { + foreach (var altRunner in altRunners) + { + DestroyImmediate(altRunner); + + } + EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); + EditorSceneManager.SaveOpenScenes(); + } + } + + private void runInEditor() + { + AltBuilder.InsertAltInTheActiveScene(AltTesterEditorWindow.EditorConfiguration.GetInstrumentationSettings()); + AltBuilder.CreateJsonFileForInputMappingOfAxis(); + AltBuilder.AddAltTesterInScriptingDefineSymbolsGroup(UnityEditor.BuildPipeline.GetBuildTargetGroup(UnityEditor.EditorUserBuildSettings.activeBuildTarget)); + playInEditorPressed = true; + } + private void displayTestRunSettings() + { + foldOutTestRunSettings = UnityEditor.EditorGUILayout.Foldout(foldOutTestRunSettings, "Test run Settings"); + if (foldOutTestRunSettings) + { + labelAndCheckboxHorizontalLayout("Create XML Report", ref EditorConfiguration.createXMLReport); + if (EditorConfiguration.createXMLReport) + labelAndInputFieldHorizontalLayout("XML file path", ref EditorConfiguration.xMLFilePath); + } + } + private void displayBuildSettings() + { + foldOutBuildSettings = UnityEditor.EditorGUILayout.Foldout(foldOutBuildSettings, "Build Settings"); + if (foldOutBuildSettings) + { + var companyName = UnityEditor.PlayerSettings.companyName; + labelAndInputFieldHorizontalLayout("Company Name*", ref companyName); + UnityEditor.PlayerSettings.companyName = companyName; + + var productName = UnityEditor.PlayerSettings.productName; + labelAndInputFieldHorizontalLayout("Product Name*", ref productName); + UnityEditor.PlayerSettings.productName = productName; + + labelAndCheckboxHorizontalLayout("Show Popup*", ref EditorConfiguration.ShowPopUp); + labelAndCheckboxHorizontalLayout("Append \"Test\" to product name for AltTester® builds*", ref EditorConfiguration.appendToName); + var keepATSymbolChanged = labelAndCheckboxHorizontalLayout("Keep ALTTESTER symbol defined", ref EditorConfiguration.KeepAUTSymbolDefined); + if (keepATSymbolChanged) + checkAltTesterSymbol(); + labelAndInputFieldHorizontalLayout("AltTester® Server Host*", ref EditorConfiguration.AltServerHost); + labelAndInputFieldHorizontalLayout("AltTester® Server Port*", ref EditorConfiguration.AltServerPort); + + + labelAndInputFieldHorizontalLayout("App Name", ref EditorConfiguration.AppName); + labelAndCheckboxHorizontalLayout("Reset Connection Data", ref EditorConfiguration.ResetConnectionData); + } + GUIStyle style = new GUIStyle(GUI.skin.label) + { + fontSize = 10 + }; + UnityEditor.EditorGUILayout.LabelField("* Shared setting between multiple platforms", style); + + + switch (EditorConfiguration.platform) + { + case AltPlatform.Android: + UnityEditor.EditorGUILayout.Separator(); + + foldOutIosSettings = UnityEditor.EditorGUILayout.Foldout(foldOutIosSettings, "Android Settings"); + if (foldOutIosSettings) + { + string androidBundleIdentifier = UnityEditor.PlayerSettings.GetApplicationIdentifier(UnityEditor.BuildTargetGroup.Android); + labelAndInputFieldHorizontalLayout("Android Bundle Identifier", ref androidBundleIdentifier); + if (androidBundleIdentifier != UnityEditor.PlayerSettings.GetApplicationIdentifier(UnityEditor.BuildTargetGroup.Android)) + { + UnityEditor.PlayerSettings.SetApplicationIdentifier(UnityEditor.BuildTargetGroup.Android, androidBundleIdentifier); + } + labelAndInputFieldHorizontalLayout("Adb Path:", ref EditorConfiguration.AdbPath); + } + break; + case AltPlatform.Standalone: + break; +#if UNITY_EDITOR_OSX + case AltPlatform.iOS: + foldOutIosSettings = UnityEditor.EditorGUILayout.Foldout(foldOutIosSettings, "iOS Settings"); + if (foldOutIosSettings) + { + string iOSBundleIdentifier = UnityEditor.PlayerSettings.GetApplicationIdentifier(UnityEditor.BuildTargetGroup.iOS); + labelAndInputFieldHorizontalLayout("iOS Bundle Identifier", ref iOSBundleIdentifier); + if (iOSBundleIdentifier != UnityEditor.PlayerSettings.GetApplicationIdentifier(UnityEditor.BuildTargetGroup.iOS)) + { + UnityEditor.PlayerSettings.SetApplicationIdentifier(UnityEditor.BuildTargetGroup.iOS, iOSBundleIdentifier); + } + + var appleDeveloperTeamID = UnityEditor.PlayerSettings.iOS.appleDeveloperTeamID; + labelAndInputFieldHorizontalLayout("Signing Team Id: ", ref appleDeveloperTeamID); + UnityEditor.PlayerSettings.iOS.appleDeveloperTeamID = appleDeveloperTeamID; + + var appleEnableAutomaticsSigning = UnityEditor.PlayerSettings.iOS.appleEnableAutomaticSigning; + labelAndCheckboxHorizontalLayout("Automatically Sign: ", ref appleEnableAutomaticsSigning); + UnityEditor.PlayerSettings.iOS.appleEnableAutomaticSigning = appleEnableAutomaticsSigning; + } + break; +#endif + } + } + + private static void checkAltTesterSymbol() + { + if (UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || UnityEditor.EditorApplication.isCompiling || Window.playInEditorPressed) + return; + if (EditorConfiguration.KeepAUTSymbolDefined && !AltBuilder.CheckAltTesterIsDefineAsAScriptingSymbol(UnityEditor.BuildPipeline.GetBuildTargetGroup(UnityEditor.EditorUserBuildSettings.activeBuildTarget))) + { + AltBuilder.AddAltTesterInScriptingDefineSymbolsGroup(UnityEditor.BuildPipeline.GetBuildTargetGroup(UnityEditor.EditorUserBuildSettings.activeBuildTarget)); + return; + } + if (!EditorConfiguration.KeepAUTSymbolDefined && AltBuilder.CheckAltTesterIsDefineAsAScriptingSymbol(UnityEditor.BuildPipeline.GetBuildTargetGroup(UnityEditor.EditorUserBuildSettings.activeBuildTarget))) + { + AltBuilder.RemoveAltTesterFromScriptingDefineSymbols(UnityEditor.BuildPipeline.GetBuildTargetGroup(UnityEditor.EditorUserBuildSettings.activeBuildTarget)); + return; + } + } + + private static bool labelAndCheckboxHorizontalLayout(string labelText, ref bool editorConfigVariable) + { + bool initialValue = editorConfigVariable; + var labelStyle = new GUIStyle(EditorStyles.label) { wordWrap = true }; + UnityEditor.EditorGUILayout.BeginHorizontal(); + UnityEditor.EditorGUI.BeginDisabledGroup(UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || UnityEditor.EditorApplication.isCompiling); + UnityEditor.EditorGUILayout.LabelField("", UnityEngine.GUILayout.MaxWidth(30)); + UnityEditor.EditorGUILayout.LabelField(labelText, labelStyle, UnityEngine.GUILayout.Width(150)); + editorConfigVariable = + UnityEditor.EditorGUILayout.Toggle(editorConfigVariable, UnityEngine.GUILayout.MaxWidth(30)); + UnityEngine.GUILayout.FlexibleSpace(); + UnityEditor.EditorGUI.EndDisabledGroup(); + UnityEditor.EditorGUILayout.EndHorizontal(); + return initialValue != editorConfigVariable; + } + + private static void labelAndInputFieldHorizontalLayout(string labelText, ref string editorConfigVariable, bool isValid = true) + { + UnityEditor.EditorGUILayout.BeginHorizontal(); + UnityEditor.EditorGUI.BeginDisabledGroup(UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || UnityEditor.EditorApplication.isCompiling); + UnityEditor.EditorGUILayout.LabelField("", UnityEngine.GUILayout.MaxWidth(30)); + if (isValid) + editorConfigVariable = UnityEditor.EditorGUILayout.TextField(labelText, editorConfigVariable.Trim()); + else + { + GUIStyle style = new GUIStyle(GUI.skin.textField); + style.normal.textColor = Color.red; + style.focused.textColor = Color.red; + editorConfigVariable = UnityEditor.EditorGUILayout.TextField(labelText, editorConfigVariable.Trim(), style); + } + UnityEditor.EditorGUI.EndDisabledGroup(); + UnityEditor.EditorGUILayout.EndHorizontal(); + } + + private static void labelAndInputFieldHorizontalLayout(string labelText, ref int editorConfigVariable) + { + UnityEditor.EditorGUILayout.BeginHorizontal(); + UnityEditor.EditorGUI.BeginDisabledGroup(UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || UnityEditor.EditorApplication.isCompiling); + UnityEditor.EditorGUILayout.LabelField("", UnityEngine.GUILayout.MaxWidth(30)); + editorConfigVariable = UnityEditor.EditorGUILayout.IntField(labelText, editorConfigVariable); + UnityEditor.EditorGUI.EndDisabledGroup(); + UnityEditor.EditorGUILayout.EndHorizontal(); + } + + private static void labelAndDropdownFieldHorizontalLayout(string labelText, string[] options, ref int selected) + { + UnityEditor.EditorGUILayout.BeginHorizontal(); + UnityEditor.EditorGUILayout.LabelField("", UnityEngine.GUILayout.MaxWidth(30)); + + selected = UnityEditor.EditorGUILayout.Popup(labelText, selected, options); + UnityEditor.EditorGUILayout.EndHorizontal(); + } + + private void displayScenes() + { + foldOutScenes = UnityEditor.EditorGUILayout.Foldout(foldOutScenes, "Scene Manager"); + UnityEditor.EditorGUILayout.BeginHorizontal(); + UnityEditor.EditorGUI.BeginDisabledGroup(UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || UnityEditor.EditorApplication.isCompiling); + if (foldOutScenes) + UnityEditor.EditorGUILayout.LabelField("", UnityEngine.GUILayout.MaxWidth(30)); + UnityEditor.EditorGUILayout.BeginVertical(); + UnityEngine.GUIStyle guiStyle = setTextGuiStyle(); + if (foldOutScenes) + { + if (EditorConfiguration.Scenes.Count != 0) + { + UnityEditor.EditorGUILayout.BeginHorizontal(); + UnityEditor.EditorGUILayout.LabelField("Display scene full path:", UnityEngine.GUILayout.Width(150), UnityEngine.GUILayout.ExpandWidth(false)); + EditorConfiguration.ScenePathDisplayed = UnityEditor.EditorGUILayout.Toggle(EditorConfiguration.ScenePathDisplayed, UnityEngine.GUILayout.ExpandWidth(false), UnityEngine.GUILayout.Width(30)); + UnityEngine.GUILayout.FlexibleSpace(); + + + UnityEditor.EditorGUILayout.EndHorizontal(); + UnityEngine.GUILayout.BeginVertical(UnityEngine.GUI.skin.textField); + AltMyScenes sceneToBeRemoved = null; + int counter = 0; + foreach (var scene in EditorConfiguration.Scenes) + { + UnityEngine.GUILayout.BeginHorizontal(UnityEngine.GUI.skin.textArea); + + var valToggle = UnityEditor.EditorGUILayout.Toggle(scene.ToBeBuilt, UnityEngine.GUILayout.MaxWidth(15)); + if (valToggle != scene.ToBeBuilt) + { + scene.ToBeBuilt = valToggle; + UnityEditor.EditorBuildSettings.scenes = pathFromTheSceneInCurrentList(); + } + var sceneName = scene.Path; + if (!EditorConfiguration.ScenePathDisplayed) + { + var splittedPath = sceneName.Split('/'); + sceneName = splittedPath[splittedPath.Length - 1]; + } + + UnityEditor.EditorGUILayout.LabelField(sceneName, guiStyle); + UnityEngine.GUILayout.FlexibleSpace(); + string value; + if (scene.ToBeBuilt) + { + scene.BuildScene = counter; + counter++; + value = scene.BuildScene.ToString(); + } + else + { + value = ""; + } + var buttonWidth = 20; + UnityEditor.EditorGUILayout.LabelField(value, guiStyle, UnityEngine.GUILayout.MaxWidth(buttonWidth)); + + + if (EditorConfiguration.Scenes.IndexOf(scene) != 0 && EditorConfiguration.Scenes.Count > 1) + { + + if (UnityEngine.GUILayout.Button(upArrowIcon, UnityEngine.GUILayout.MaxWidth(buttonWidth))) + { + sceneMove(scene, true); + UnityEditor.EditorBuildSettings.scenes = pathFromTheSceneInCurrentList(); + } + } + else + { + UnityEditor.EditorGUILayout.LabelField("", UnityEngine.GUILayout.MaxWidth(buttonWidth)); + } + + if (EditorConfiguration.Scenes.IndexOf(scene) != EditorConfiguration.Scenes.Count - 1 && EditorConfiguration.Scenes.Count > 1) + { + if (UnityEngine.GUILayout.Button(downArrowIcon, UnityEngine.GUILayout.MaxWidth(buttonWidth))) + { + sceneMove(scene, false); + UnityEditor.EditorBuildSettings.scenes = pathFromTheSceneInCurrentList(); + } + } + else + { + UnityEditor.EditorGUILayout.LabelField("", UnityEngine.GUILayout.MaxWidth(buttonWidth)); + } + + + if (UnityEngine.GUILayout.Button(xIcon, UnityEngine.GUILayout.MaxWidth(buttonWidth))) + { + sceneToBeRemoved = scene; + } + + UnityEngine.GUILayout.EndHorizontal(); + + } + + + if (sceneToBeRemoved != null) + { + removeScene(sceneToBeRemoved); + } + + UnityEngine.GUILayout.EndVertical(); + } + + UnityEngine.GUILayout.BeginVertical(); + UnityEditor.EditorGUILayout.BeginHorizontal(); + UnityEditor.EditorGUILayout.LabelField("Add scene: ", UnityEngine.GUILayout.MaxWidth(80)); + obj = UnityEditor.EditorGUILayout.ObjectField(obj, typeof(UnityEditor.SceneAsset), true); + + if (obj != null) + { + var path = UnityEditor.AssetDatabase.GetAssetPath(obj); + if (EditorConfiguration.Scenes.All(n => n.Path != path)) + { + EditorConfiguration.Scenes.Add(new AltMyScenes(false, path, -1)); + UnityEditor.EditorBuildSettings.scenes = pathFromTheSceneInCurrentList(); + } + + obj = null; + } + UnityEditor.EditorGUILayout.EndHorizontal(); + + if (UnityEditor.EditorGUIUtility.currentViewWidth / 3 * 2 > 700)//All scene button in one line + { + UnityEditor.EditorGUILayout.BeginHorizontal(); + if (UnityEngine.GUILayout.Button("Add all scenes", UnityEditor.EditorStyles.miniButtonLeft, UnityEngine.GUILayout.MinWidth(30))) + { + AddAllScenes(); + } + + if (UnityEngine.GUILayout.Button("Select all scenes", UnityEditor.EditorStyles.miniButtonMid, UnityEngine.GUILayout.MinWidth(30))) + { + SelectAllScenes(); + } + if (UnityEngine.GUILayout.Button("Deselect all scenes", UnityEditor.EditorStyles.miniButtonMid, UnityEngine.GUILayout.MinWidth(30))) + { + deselectAllScenes(); + } + if (UnityEngine.GUILayout.Button("Remove unselected scenes", UnityEditor.EditorStyles.miniButtonMid, UnityEngine.GUILayout.MinWidth(30))) + { + removeNotSelectedScenes(); + } + if (UnityEngine.GUILayout.Button("Remove all scenes", UnityEditor.EditorStyles.miniButtonRight, UnityEngine.GUILayout.MinWidth(30))) + { + EditorConfiguration.Scenes = new System.Collections.Generic.List(); + UnityEditor.EditorBuildSettings.scenes = pathFromTheSceneInCurrentList(); + } + UnityEditor.EditorGUILayout.EndHorizontal(); + } + else + { + UnityEditor.EditorGUILayout.BeginHorizontal(); + if (UnityEngine.GUILayout.Button("Add all scenes", UnityEditor.EditorStyles.miniButtonLeft, UnityEngine.GUILayout.MinWidth(30))) + { + AddAllScenes(); + } + + if (UnityEngine.GUILayout.Button("Select all scenes", UnityEditor.EditorStyles.miniButtonRight, UnityEngine.GUILayout.MinWidth(30))) + { + SelectAllScenes(); + } + UnityEditor.EditorGUILayout.EndHorizontal(); + UnityEditor.EditorGUILayout.BeginHorizontal(); + + if (UnityEngine.GUILayout.Button("Deselect all scenes", UnityEditor.EditorStyles.miniButtonLeft, UnityEngine.GUILayout.MinWidth(30))) + { + deselectAllScenes(); + } + if (UnityEngine.GUILayout.Button("Remove unselected scenes", UnityEditor.EditorStyles.miniButtonMid, UnityEngine.GUILayout.MinWidth(30))) + { + removeNotSelectedScenes(); + } + if (UnityEngine.GUILayout.Button("Remove all scenes", UnityEditor.EditorStyles.miniButtonRight, UnityEngine.GUILayout.MinWidth(30))) + { + EditorConfiguration.Scenes = new System.Collections.Generic.List(); + UnityEditor.EditorBuildSettings.scenes = pathFromTheSceneInCurrentList(); + } + UnityEditor.EditorGUILayout.EndHorizontal(); + } + + UnityEditor.EditorGUILayout.EndVertical(); + } + + UnityEditor.EditorGUILayout.EndVertical(); + UnityEditor.EditorGUILayout.EndHorizontal(); + UnityEditor.EditorGUI.EndDisabledGroup(); + + } + + private static UnityEngine.GUIStyle setTextGuiStyle() + { + var guiStyle = new UnityEngine.GUIStyle + { + alignment = UnityEngine.TextAnchor.MiddleLeft, + stretchHeight = true + }; + guiStyle.normal.textColor = UnityEditor.EditorGUIUtility.isProSkin ? UnityEngine.Color.white : UnityEngine.Color.black; + guiStyle.wordWrap = true; + return guiStyle; + } + + private void removeNotSelectedScenes() + { + var copyMyScenes = new List(); + foreach (var scene in EditorConfiguration.Scenes) + { + if (scene.ToBeBuilt) + { + copyMyScenes.Add(scene); + } + } + + EditorConfiguration.Scenes = copyMyScenes; + UnityEditor.EditorBuildSettings.scenes = pathFromTheSceneInCurrentList(); + } + + private void deselectAllScenes() + { + foreach (var scene in EditorConfiguration.Scenes) + { + scene.ToBeBuilt = false; + } + UnityEditor.EditorBuildSettings.scenes = pathFromTheSceneInCurrentList(); + + } + + private void displayTestGui(System.Collections.Generic.List tests) + { + System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies().Where(a => a.GetReferencedAssemblies().FirstOrDefault( + reference => reference.Name.Contains("nunit.framework")) != null).ToArray(); + + int selected = Mathf.Clamp(EditorConfiguration.assemblyTestDisplayedIndex, 0, assemblies.Length); + string[] assemblyNames = new string[assemblies.Length + 1]; + assemblyNames[0] = "All"; + for (int i = 0; i < assemblies.Length; i++) + { + assemblyNames[i + 1] = assemblies[i].GetName().Name; + } + selected = EditorGUILayout.Popup("Assembly", selected, assemblyNames); + if (EditorConfiguration.assemblyTestDisplayedIndex != selected) + { + SelectedTest = -1; + this.StartCoroutine(AltTestRunner.SetUpListTestCoroutine()); + LoadTestCompleted = false; + } + EditorConfiguration.assemblyTestDisplayedIndex = selected; + UnityEditor.EditorGUILayout.BeginHorizontal(); + UnityEditor.EditorGUILayout.LabelField("Tests list", UnityEditor.EditorStyles.boldLabel); + if (UnityEngine.GUILayout.Button("Refresh")) + { + SelectedTest = -1; + this.StartCoroutine(AltTestRunner.SetUpListTestCoroutine()); + LoadTestCompleted = false; + } + UnityEditor.EditorGUILayout.EndHorizontal(); + UnityEditor.EditorGUILayout.BeginVertical(); + ScrollPositionVertical = UnityEngine.GUILayout.BeginScrollView(ScrollPositionVertical, UnityEngine.GUILayout.Height(availableRect.height * splitNormalizedPosition)); + + + if (!LoadTestCompleted) + { + UnityEditor.EditorGUILayout.LabelField("Loading", UnityEditor.EditorStyles.boldLabel); + } + else + { + + + int foldOutCounter = 0; + int testCounter = 0; + var parentNames = new List(); + var selectedTests = new List(); + foreach (var test in tests) + { + if (test.TestCaseCount == 0) + { + continue; + } + if (foldOutCounter > 0) + { + if (test.Type.Equals("NUnit.Framework.Internal.TestMethod")) + { + foldOutCounter--; + } + continue; + } + testCounter++; + var idx = parentNames.IndexOf(test.ParentName) + 1; + parentNames.RemoveRange(idx, parentNames.Count - idx); + + var horizontalStyle = new UnityEngine.GUIStyle(); + if (tests.IndexOf(test) == SelectedTest) + { + horizontalStyle.normal.background = selectedTestTexture; + } + else + { + if (testCounter % 2 == 0) + { + if (evenNumberTestTexture == null) + { + evenNumberTestTexture = MakeTexture(20, 20, UnityEditor.EditorGUIUtility.isProSkin ? evenNumberTestColorDark : evenNumberTestColor); + } + horizontalStyle.normal.background = evenNumberTestTexture; + } + else + { + + if (oddNumberTestTexture == null) + { + oddNumberTestTexture = MakeTexture(20, 20, UnityEditor.EditorGUIUtility.isProSkin ? oddNumberTestColorDark : oddNumberTestColor); + } + horizontalStyle.normal.background = oddNumberTestTexture; + } + } + UnityEditor.EditorGUILayout.BeginHorizontal(horizontalStyle); + + + if (test.Type.Equals("NUnit.Framework.Internal.TestMethod")) + { + test.FoldOut = true; + } + else + { + if (!test.FoldOut) + { + foldOutCounter = test.TestCaseCount; + } + parentNames.Add(test.TestName); + selectedTests.Add(test.TestSelectedCount); + } + EditorGUILayout.LabelField(" ", GUILayout.Width((!test.IsSuite ? 13 : 10) * parentNames.Count)); + + + UnityEngine.GUILayout.BeginVertical(); + GUILayout.Space(0); + var valueChanged = UnityEditor.EditorGUILayout.Toggle(test.Selected, UnityEngine.GUILayout.Width(15)); + GUILayout.EndVertical(); + if (valueChanged == test.Selected) + { + updateNumberOfSelectedTests(test); + } + else + { + test.Selected = valueChanged; + changeSelectionChildrenAndParent(test); + } + + var testName = test.TestName; + + if (test.ParentName == "") + { + var splitPath = testName.Split('/'); + testName = splitPath[splitPath.Length - 1]; + } + else + { + if (testName.Contains('(')) + { + var splitPath = testName.Split(new[] { '.' }, 2); + testName = splitPath[1]; + } + else + { + var splitPath = testName.Split('.'); + testName = splitPath[splitPath.Length - 1]; + } + } + + var guiStyle = new UnityEngine.GUIStyle { normal = { textColor = UnityEditor.EditorGUIUtility.isProSkin ? UnityEngine.Color.white : UnityEngine.Color.black } }; + if (test.Status != 0) + { + UnityEngine.Color color = redColor; + UnityEngine.Texture2D icon = failIcon; + if (test.Status == 1) + { + color = greenColor; + icon = passIcon; + } + var gUIStyleLabel = new UnityEngine.GUIStyle + { + alignment = UnityEngine.TextAnchor.MiddleLeft + }; + UnityEngine.GUILayout.Label(icon, gUIStyleLabel, UnityEngine.GUILayout.Width(20)); + guiStyle = new UnityEngine.GUIStyle { normal = { textColor = color } }; + } + selectTest(tests, test, testName, guiStyle); + UnityEngine.GUILayout.FlexibleSpace(); + UnityEditor.EditorGUILayout.EndHorizontal(); + } + } + UnityEditor.EditorGUILayout.EndScrollView(); + UnityEditor.EditorGUILayout.EndVertical(); + + } + + private static void selectTest(System.Collections.Generic.List tests, AltMyTest test, string testName, UnityEngine.GUIStyle guiStyle) + { + if (!test.IsSuite) + { + if (UnityEngine.GUILayout.Button(testName, guiStyle)) + { + + SelectedTest = tests.IndexOf(test); + var parentTest = EditorConfiguration.MyTests.FirstOrDefault(a => a.TestName.Equals(test.ParentName)); + if (SelectedTest == tests.IndexOf(test)) + { + var actualTime = System.DateTime.Now.Ticks; + if (actualTime - timeSinceLastClick < 5000000) + { + if (test.Path == null) + throw new AltPathNotFoundException("The path to your test is invalid. Please make sure you have matching class and file names."); +#if UNITY_2019_1_OR_NEWER + UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(test.Path, findLine(test.Path, testName), 0); +#else + UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(test.Path, findLine(test.Path, testName)); +#endif + } + } + else + { + SelectedTest = tests.IndexOf(test); + var parentTestTwo = EditorConfiguration.MyTests.FirstOrDefault(a => a.TestName.Equals(test.ParentName)); + } + timeSinceLastClick = System.DateTime.Now.Ticks; + } + } + else + { + var selectedTests = test.TestSelectedCount; + if (selectedTests == 0) + { + test.FoldOut = UnityEditor.EditorGUILayout.Foldout(test.FoldOut, testName); + } + else + { + test.FoldOut = UnityEditor.EditorGUILayout.Foldout(test.FoldOut, testName + "(" + test.TestSelectedCount.ToString() + ")"); + } + } + } + + private static int findLine(String path, String nameOfTest) + { + String[] lines = File.ReadAllLines(path); + int index = nameOfTest.IndexOf("("); + if (index > -1) + nameOfTest = nameOfTest.Substring(0, index); + for (int i = 0; i < lines.Length; i++) + { + if (isComment(lines[i])) + continue; + if (System.Text.RegularExpressions.Regex.Match(lines[i], @"(\s+)" + nameOfTest + @"(\s*\()").Success) + return i + 1; + } + return 1; + } + + private static bool isComment(String line) + { + if (System.Text.RegularExpressions.Regex.Match(line, @"^(\s*//)").Success) + return true; + if (System.Text.RegularExpressions.Regex.Match(line, @"^(\s*/\*)").Success) + insideMultilineComment = true; + if (System.Text.RegularExpressions.Regex.Match(line, @"^(\s*\*/)").Success) + insideMultilineComment = false; + return insideMultilineComment; + } + + private void changeSelectionChildrenAndParent(AltMyTest test) + { + if (test.Type.ToString().Equals("NUnit.Framework.Internal.TestAssembly")) + { + var index = EditorConfiguration.MyTests.IndexOf(test); + for (int i = index + 1; i < EditorConfiguration.MyTests.Count; i++) + { + if (EditorConfiguration.MyTests[i].Type.ToString().Equals("NUnit.Framework.Internal.TestAssembly")) + { + break; + } + else + { + var totalTests = 0; + foreach (var selectedTest in AltTesterEditorWindow.EditorConfiguration.MyTests) + { + if (!selectedTest.IsSuite) + totalTests++; + } + if (test.Selected) + { + test.TestSelectedCount = totalTests; + foreach (var selectedTest in AltTesterEditorWindow.EditorConfiguration.MyTests) + { + if (selectedTest.IsSuite) + selectedTest.TestSelectedCount = selectedTest.TestCaseCount; + } + } + else + { + test.TestSelectedCount = 0; + foreach (var selectedTest in AltTesterEditorWindow.EditorConfiguration.MyTests) + { + if (selectedTest.IsSuite) + selectedTest.TestSelectedCount = 0; + } + } + if (EditorConfiguration.MyTests[i].Selected != test.Selected) + { + EditorConfiguration.MyTests[i].Selected = test.Selected; + } + + } + } + } + else + { + if (test.IsSuite) + { + var index = EditorConfiguration.MyTests.IndexOf(test); + var testCount = test.TestCaseCount; + var testName = test.TestName; + var parentTest = EditorConfiguration.MyTests.FirstOrDefault(a => a.TestName.Equals(test.ParentName)); + setSelectedTestsNumberForSuite(test, test.Selected); + for (int i = index + 1; i <= index + testCount; i++) + { + var selectedTest = EditorConfiguration.MyTests[i]; + if (selectedTest.Selected != test.Selected) + { + selectedTest.Selected = test.Selected; + if (test.Selected) + { + test.TestSelectedCount = test.TestCaseCount; + if (selectedTest.IsSuite) + selectedTest.TestSelectedCount = selectedTest.TestCaseCount; + } + else + { + test.TestSelectedCount = 0; + selectedTest.TestSelectedCount = 0; + } + } + if (selectedTest.IsSuite) + { + testCount++; + } + } + } + + if (!test.IsSuite) + { + setSelectedTestsNumberForParent(test, test.Selected); + } + } + } + private void updateNumberOfSelectedTests(AltMyTest test) + { + if (test != null && test.IsSuite) + { + test.TestSelectedCount = 0; + var index = EditorConfiguration.MyTests.IndexOf(test); + var testCount = test.TestCaseCount; + for (int i = index + 1; i <= index + testCount; i++) + { + var selectedTest = EditorConfiguration.MyTests[i]; + if (selectedTest.Selected) + { + if (!selectedTest.IsSuite) + test.TestSelectedCount++; + } + if (selectedTest.IsSuite) + testCount++; + } + } + + } + private void setSelectedTestsNumberForParent(AltMyTest test, bool isSelected) + { + while (test.ParentName != null) + { + test = EditorConfiguration.MyTests.FirstOrDefault(a => a.TestName.Equals(test.ParentName)); + if (test != null) + { + if (isSelected) + test.TestSelectedCount++; + else + { + if (test.TestSelectedCount > 0) + test.TestSelectedCount--; + test.Selected = false; + } + } + else + return; + } + } + private void setSelectedTestsNumberForSuite(AltMyTest test, bool isSelected) + { + var totalTests = test.TestCaseCount; + + while (test.ParentName != null) + { + test = EditorConfiguration.MyTests.FirstOrDefault(a => a.TestName.Equals(test.ParentName)); + if (test != null) + { + if (isSelected) + { + test.TestSelectedCount += totalTests; + } + else + { + test.TestSelectedCount -= totalTests; + test.Selected = false; + } + } + else + return; + } + } + private static void sceneMove(AltMyScenes scene, bool up) + { + int index = EditorConfiguration.Scenes.IndexOf(scene); + swap(index, up ? index - 1 : index + 1); + } + + private static UnityEditor.EditorBuildSettingsScene[] pathFromTheSceneInCurrentList() + { + var listOfPath = new List(); + foreach (var scene in EditorConfiguration.Scenes) + { + listOfPath.Add(new UnityEditor.EditorBuildSettingsScene(scene.Path, scene.ToBeBuilt)); + } + + return listOfPath.ToArray(); + } + + private void removeScene(AltMyScenes scene) + { + EditorConfiguration.Scenes.Remove(scene); + UnityEditor.EditorBuildSettings.scenes = pathFromTheSceneInCurrentList(); + } + + private static string getPathForSelectedItem() + { + string path = UnityEditor.AssetDatabase.GetAssetPath(UnityEditor.Selection.activeObject); + if (System.IO.Path.GetExtension(path) != "") //checks if current item is a folder or a file + { + path = path.Replace(System.IO.Path.GetFileName(UnityEditor.AssetDatabase.GetAssetPath(UnityEditor.Selection.activeObject)), ""); + } + return path; + } + + private static void destroyAltRunner(UnityEngine.Object altRunner) + { + + DestroyImmediate(altRunner); + EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); + EditorSceneManager.SaveOpenScenes(); + EditorSceneManager.OpenScene(AltBuilder.PreviousScenePath); + } + + private static void addComponentToObjectAndHisChildren(UnityEngine.GameObject gameObject) + { + var component = gameObject.GetComponent(); + if (component == null) + { + gameObject.AddComponent(typeof(AltId)); + + } + int childCount = gameObject.transform.childCount; + for (int j = 0; j < childCount; j++) + { + addComponentToObjectAndHisChildren(gameObject.transform.GetChild(j).gameObject); + } + } + + private static void removeComponentFromObjectAndHisChildren(UnityEngine.GameObject gameObject) + { + var component = gameObject.GetComponent(); + if (component != null) + { + DestroyImmediate(component); + } + int childCount = gameObject.transform.childCount; + for (int j = 0; j < childCount; j++) + { + removeComponentFromObjectAndHisChildren(gameObject.transform.GetChild(j).gameObject); + } + } + + private static string[] altGetAllScenes() + { + string[] temp = UnityEditor.AssetDatabase.GetAllAssetPaths(); + var result = new List(); + foreach (string s in temp) + { + if (s.EndsWith(".unity")) result.Add(s); + } + return result.ToArray(); + } + } +} diff --git a/Assets/AltTester/Editor/Scripts/AltTesterEditorWindow.cs.meta b/Assets/AltTester/Editor/Scripts/AltTesterEditorWindow.cs.meta new file mode 100644 index 00000000..428552c3 --- /dev/null +++ b/Assets/AltTester/Editor/Scripts/AltTesterEditorWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 59008efc63959f6418fba72e3bc99ae1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Sprites.meta b/Assets/AltTester/Editor/Sprites.meta new file mode 100644 index 00000000..81b04d32 --- /dev/null +++ b/Assets/AltTester/Editor/Sprites.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dad12aad268c3e44d846b8fc62419747 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Sprites/16px-indicator-fail.png b/Assets/AltTester/Editor/Sprites/16px-indicator-fail.png new file mode 100644 index 00000000..a0390ec1 Binary files /dev/null and b/Assets/AltTester/Editor/Sprites/16px-indicator-fail.png differ diff --git a/Assets/AltTester/Editor/Sprites/16px-indicator-fail.png.meta b/Assets/AltTester/Editor/Sprites/16px-indicator-fail.png.meta new file mode 100644 index 00000000..7bdccdc2 --- /dev/null +++ b/Assets/AltTester/Editor/Sprites/16px-indicator-fail.png.meta @@ -0,0 +1,128 @@ +fileFormatVersion: 2 +guid: 9511b1a257df445c19107bc47b27f3d9 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 32 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 32 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 32 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 32 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 67d15956e9582438482d56c1efc8f7ee + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Sprites/16px-indicator-pass.png b/Assets/AltTester/Editor/Sprites/16px-indicator-pass.png new file mode 100644 index 00000000..e23b0185 Binary files /dev/null and b/Assets/AltTester/Editor/Sprites/16px-indicator-pass.png differ diff --git a/Assets/AltTester/Editor/Sprites/16px-indicator-pass.png.meta b/Assets/AltTester/Editor/Sprites/16px-indicator-pass.png.meta new file mode 100644 index 00000000..545ab30c --- /dev/null +++ b/Assets/AltTester/Editor/Sprites/16px-indicator-pass.png.meta @@ -0,0 +1,128 @@ +fileFormatVersion: 2 +guid: af9795f0604ce466eb2867967a840c3b +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 32 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 32 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 32 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 32 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 0890eb044e40c48578d0b3d34eda3c8b + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Sprites/UIButtonDefault.png b/Assets/AltTester/Editor/Sprites/UIButtonDefault.png new file mode 100644 index 00000000..25e2eb96 Binary files /dev/null and b/Assets/AltTester/Editor/Sprites/UIButtonDefault.png differ diff --git a/Assets/AltTester/Editor/Sprites/UIButtonDefault.png.meta b/Assets/AltTester/Editor/Sprites/UIButtonDefault.png.meta new file mode 100644 index 00000000..85dcb09f --- /dev/null +++ b/Assets/AltTester/Editor/Sprites/UIButtonDefault.png.meta @@ -0,0 +1,195 @@ +fileFormatVersion: 2 +guid: 967c7b47090d34cf090c40749e45f0b4 +TextureImporter: + internalIDToNameTable: + - first: + 213: 21300000 + second: UIButtonDefault_0 + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 1024 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 16 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 2 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: tvOS + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: UIButtonDefault_0 + rect: + serializedVersion: 2 + x: 7 + y: 7 + width: 113 + height: 112 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 15, y: 19, z: 15, w: 15} + outline: [] + physicsShape: [] + tessellationDetail: -1 + bones: [] + spriteID: 02305410000000000800000000000000 + internalID: 21300000 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: + UIButtonDefault_0: 21300000 + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Sprites/XIcon.png b/Assets/AltTester/Editor/Sprites/XIcon.png new file mode 100644 index 00000000..86571968 Binary files /dev/null and b/Assets/AltTester/Editor/Sprites/XIcon.png differ diff --git a/Assets/AltTester/Editor/Sprites/XIcon.png.meta b/Assets/AltTester/Editor/Sprites/XIcon.png.meta new file mode 100644 index 00000000..f34e770f --- /dev/null +++ b/Assets/AltTester/Editor/Sprites/XIcon.png.meta @@ -0,0 +1,116 @@ +fileFormatVersion: 2 +guid: efa55d938e62b48469ea132b374e52cd +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Sprites/XIconWhite.png b/Assets/AltTester/Editor/Sprites/XIconWhite.png new file mode 100644 index 00000000..9ac296a1 Binary files /dev/null and b/Assets/AltTester/Editor/Sprites/XIconWhite.png differ diff --git a/Assets/AltTester/Editor/Sprites/XIconWhite.png.meta b/Assets/AltTester/Editor/Sprites/XIconWhite.png.meta new file mode 100644 index 00000000..b77878ea --- /dev/null +++ b/Assets/AltTester/Editor/Sprites/XIconWhite.png.meta @@ -0,0 +1,116 @@ +fileFormatVersion: 2 +guid: 903bb101d290e67469548feecf3b0ba2 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Sprites/downArrowIcon.png b/Assets/AltTester/Editor/Sprites/downArrowIcon.png new file mode 100644 index 00000000..88cd183f Binary files /dev/null and b/Assets/AltTester/Editor/Sprites/downArrowIcon.png differ diff --git a/Assets/AltTester/Editor/Sprites/downArrowIcon.png.meta b/Assets/AltTester/Editor/Sprites/downArrowIcon.png.meta new file mode 100644 index 00000000..2bbf02a4 --- /dev/null +++ b/Assets/AltTester/Editor/Sprites/downArrowIcon.png.meta @@ -0,0 +1,116 @@ +fileFormatVersion: 2 +guid: d3f7dd540536e65489d10729719e6227 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Sprites/downArrowIconDark.png b/Assets/AltTester/Editor/Sprites/downArrowIconDark.png new file mode 100644 index 00000000..a37fc9d1 Binary files /dev/null and b/Assets/AltTester/Editor/Sprites/downArrowIconDark.png differ diff --git a/Assets/AltTester/Editor/Sprites/downArrowIconDark.png.meta b/Assets/AltTester/Editor/Sprites/downArrowIconDark.png.meta new file mode 100644 index 00000000..d1d17e95 --- /dev/null +++ b/Assets/AltTester/Editor/Sprites/downArrowIconDark.png.meta @@ -0,0 +1,116 @@ +fileFormatVersion: 2 +guid: e4456d158a883c341882b4a194489b42 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Sprites/infoIcon.png b/Assets/AltTester/Editor/Sprites/infoIcon.png new file mode 100644 index 00000000..36c3cf81 Binary files /dev/null and b/Assets/AltTester/Editor/Sprites/infoIcon.png differ diff --git a/Assets/AltTester/Editor/Sprites/infoIcon.png.meta b/Assets/AltTester/Editor/Sprites/infoIcon.png.meta new file mode 100644 index 00000000..de3d1ac3 --- /dev/null +++ b/Assets/AltTester/Editor/Sprites/infoIcon.png.meta @@ -0,0 +1,116 @@ +fileFormatVersion: 2 +guid: 9a8cb33f9ae989c4687279f8a7013748 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Sprites/openFileIcon.png b/Assets/AltTester/Editor/Sprites/openFileIcon.png new file mode 100644 index 00000000..4196c44d Binary files /dev/null and b/Assets/AltTester/Editor/Sprites/openFileIcon.png differ diff --git a/Assets/AltTester/Editor/Sprites/openFileIcon.png.meta b/Assets/AltTester/Editor/Sprites/openFileIcon.png.meta new file mode 100644 index 00000000..2785ccc2 --- /dev/null +++ b/Assets/AltTester/Editor/Sprites/openFileIcon.png.meta @@ -0,0 +1,116 @@ +fileFormatVersion: 2 +guid: 2e186705276c18d4384806ab96189a18 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Sprites/reloadIcon.png b/Assets/AltTester/Editor/Sprites/reloadIcon.png new file mode 100644 index 00000000..9730d012 Binary files /dev/null and b/Assets/AltTester/Editor/Sprites/reloadIcon.png differ diff --git a/Assets/AltTester/Editor/Sprites/reloadIcon.png.meta b/Assets/AltTester/Editor/Sprites/reloadIcon.png.meta new file mode 100644 index 00000000..dbb46d10 --- /dev/null +++ b/Assets/AltTester/Editor/Sprites/reloadIcon.png.meta @@ -0,0 +1,116 @@ +fileFormatVersion: 2 +guid: 81a78984f5a728f4f8da121e6809726c +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Sprites/reloadIconDark.png b/Assets/AltTester/Editor/Sprites/reloadIconDark.png new file mode 100644 index 00000000..1fe709be Binary files /dev/null and b/Assets/AltTester/Editor/Sprites/reloadIconDark.png differ diff --git a/Assets/AltTester/Editor/Sprites/reloadIconDark.png.meta b/Assets/AltTester/Editor/Sprites/reloadIconDark.png.meta new file mode 100644 index 00000000..5b7b0c3f --- /dev/null +++ b/Assets/AltTester/Editor/Sprites/reloadIconDark.png.meta @@ -0,0 +1,116 @@ +fileFormatVersion: 2 +guid: c3829a2b55e53024485f60795e53210e +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Sprites/upArrowIcon.png b/Assets/AltTester/Editor/Sprites/upArrowIcon.png new file mode 100644 index 00000000..0d0cb7a9 Binary files /dev/null and b/Assets/AltTester/Editor/Sprites/upArrowIcon.png differ diff --git a/Assets/AltTester/Editor/Sprites/upArrowIcon.png.meta b/Assets/AltTester/Editor/Sprites/upArrowIcon.png.meta new file mode 100644 index 00000000..5cba3581 --- /dev/null +++ b/Assets/AltTester/Editor/Sprites/upArrowIcon.png.meta @@ -0,0 +1,116 @@ +fileFormatVersion: 2 +guid: fbc0cd982eb8b9d4eba88548c9de8c34 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Sprites/upArrowIconDark.png b/Assets/AltTester/Editor/Sprites/upArrowIconDark.png new file mode 100644 index 00000000..139fe6b3 Binary files /dev/null and b/Assets/AltTester/Editor/Sprites/upArrowIconDark.png differ diff --git a/Assets/AltTester/Editor/Sprites/upArrowIconDark.png.meta b/Assets/AltTester/Editor/Sprites/upArrowIconDark.png.meta new file mode 100644 index 00000000..a515aa57 --- /dev/null +++ b/Assets/AltTester/Editor/Sprites/upArrowIconDark.png.meta @@ -0,0 +1,116 @@ +fileFormatVersion: 2 +guid: 3402e7c2909141f4f80f5cdb2d292aca +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Editor/Sprites/xIconDark.png b/Assets/AltTester/Editor/Sprites/xIconDark.png new file mode 100644 index 00000000..b687ac0d Binary files /dev/null and b/Assets/AltTester/Editor/Sprites/xIconDark.png differ diff --git a/Assets/AltTester/Editor/Sprites/xIconDark.png.meta b/Assets/AltTester/Editor/Sprites/xIconDark.png.meta new file mode 100644 index 00000000..7a72c750 --- /dev/null +++ b/Assets/AltTester/Editor/Sprites/xIconDark.png.meta @@ -0,0 +1,116 @@ +fileFormatVersion: 2 +guid: 0d8e0548b673786489a06c15b396a41f +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 1 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/LICENSE b/Assets/AltTester/LICENSE new file mode 100644 index 00000000..ce92f42e --- /dev/null +++ b/Assets/AltTester/LICENSE @@ -0,0 +1,3 @@ +# License + +Distributed under the **GNU General Public License v3.0**. See [LICENSE](https://github.com/alttester/AltTester-Unity-SDK/blob/master/LICENSE) for more information. diff --git a/Assets/AltTester/LICENSE.meta b/Assets/AltTester/LICENSE.meta new file mode 100644 index 00000000..ef4969bb --- /dev/null +++ b/Assets/AltTester/LICENSE.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2f0679f5de47f674d9a63185acd9148b +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/README.md b/Assets/AltTester/README.md new file mode 100644 index 00000000..de43e1e0 --- /dev/null +++ b/Assets/AltTester/README.md @@ -0,0 +1,32 @@ +# AltTester® Unity SDK + +AltTester® Unity SDK is an open-source UI driven test automation tool that helps you find objects in your application and interacts with them using tests written in C#, Python, Java or Robot Framework. + +## Documentation + +Our documentation is available here: + +* https://alttester.com/docs/sdk/latest/ + +## Support + +* Join our Discord Server: https://discord.gg/Ag9RSuS +* Join our Google Group for questions and discussions: https://groups.google.com/a/altom.com/g/alttesterforum + +## Development Setup + +### Build a Unity package from source + +1. Open your project in Unity. +1. From `AltTester` menu choose `Create AltTester® Package`. +1. See the created unity package under the project. + +## Contributing + +Check out the full contributing guide [here](https://alttester.com/docs/sdk/latest/pages/contributing.html). + +## License + +Distributed under the **GNU General Public License v3.0**. See [LICENSE](https://github.com/alttester/AltTester-Unity-SDK/blob/master/LICENSE) for more information. + +This project is tested with [BrowserStack](https://www.browserstack.com/). diff --git a/Assets/AltTester/README.md.meta b/Assets/AltTester/README.md.meta new file mode 100644 index 00000000..6a1dbd80 --- /dev/null +++ b/Assets/AltTester/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1d3e550e33b47bb4db69f8f4d9cfb1a8 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime.meta b/Assets/AltTester/Runtime.meta new file mode 100644 index 00000000..bd84836b --- /dev/null +++ b/Assets/AltTester/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9f3551d71027f6e4995066f6c46d518f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/3rdParty.meta b/Assets/AltTester/Runtime/3rdParty.meta new file mode 100644 index 00000000..7d778980 --- /dev/null +++ b/Assets/AltTester/Runtime/3rdParty.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 174a68d614b284ab583bce1afe2b26bd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9.meta b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9.meta new file mode 100644 index 00000000..1648dd8f --- /dev/null +++ b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 83af01fba9c3605408a709d3faac5dd2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/NLog.nuspec b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/NLog.nuspec new file mode 100644 index 00000000..49d30489 --- /dev/null +++ b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/NLog.nuspec @@ -0,0 +1,108 @@ + + + + NLog + 4.7.9 + NLog for .NET Framework and .NET Standard + Jarek Kowalski,Kim Christensen,Julian Verdurmen + Jarek Kowalski,Kim Christensen,Julian Verdurmen + false + https://github.com/NLog/NLog/blob/master/LICENSE.txt + https://nlog-project.org/ + https://nlog-project.org/N.png + NLog is a logging platform for .NET with rich log routing and management capabilities. +NLog supports traditional logging, structured logging and the combination of both. + +Supported platforms: + +- .NET 5 +- .NET Core 1, 2 and 3 +- .NET Standard 1.3+ and 2.0+; +- .NET Framework 3.5, 4, 4.5, 4.6, 4.7 & 4.8 +- .NET Framework 4 client profile +- Xamarin Android, Xamarin iOs +- UWP +- Windows Phone 8 +- Silverlight 4 and 5 +- Mono 4 + +For ASP.NET Core, check: https://www.nuget.org/packages/NLog.Web.AspNetCore + ## Bugfixes +- Fixed TrimDirectorySeparators to not use the root-path on Linux (#4349) (@snakefoot) +- Fixed FileTarget archive cleanup within same folder at startup (#4353) (@snakefoot) +- Fixed FileTarget archive cleanup when using short filename (#4352) (@snakefoot) + +## Improvements +- Make it possible to extend the FuncLayoutRenderer (#4326) (@304NotModified) +- LoggingConfigurationParser - Recognize LoggingRule.FilterDefaultAction (#4369 + #4375) (@snakefoot) + +## Performance +- JsonLayout - Avoid constant string-escape of JsonAttribute Name-property (#4337) (@snakefoot) + +Full changelog: https://github.com/NLog/NLog/blob/master/CHANGELOG.md + +For all config options and platform support, check https://nlog-project.org/config/ + Copyright (c) 2004-2021 NLog Project - https://nlog-project.org/ + NLog logging log structured tracing logfiles database eventlog email wcf console + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/NLog.nuspec.meta b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/NLog.nuspec.meta new file mode 100644 index 00000000..92a6bcb5 --- /dev/null +++ b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/NLog.nuspec.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a9abb435ff781a74f8a05b5089614e5b +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/[Content_Types].xml b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/[Content_Types].xml new file mode 100644 index 00000000..678321a5 --- /dev/null +++ b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/[Content_Types].xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/[Content_Types].xml.meta b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/[Content_Types].xml.meta new file mode 100644 index 00000000..029820b7 --- /dev/null +++ b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/[Content_Types].xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0838bff9b4fa278489a08831d14492a7 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/netstandard2.0.meta b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/netstandard2.0.meta new file mode 100644 index 00000000..2ac523b7 --- /dev/null +++ b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/netstandard2.0.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: adea59f38fb8b5a41b2ca99ebed4fa9c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/netstandard2.0/NLog.dll b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/netstandard2.0/NLog.dll new file mode 100644 index 00000000..b1da8592 Binary files /dev/null and b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/netstandard2.0/NLog.dll differ diff --git a/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/netstandard2.0/NLog.dll.meta b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/netstandard2.0/NLog.dll.meta new file mode 100644 index 00000000..99c86917 --- /dev/null +++ b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/netstandard2.0/NLog.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 074105f5072c1a24c80fe40829bc07e2 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/netstandard2.0/NLog.xml b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/netstandard2.0/NLog.xml new file mode 100644 index 00000000..04849f12 --- /dev/null +++ b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/netstandard2.0/NLog.xml @@ -0,0 +1,27594 @@ + + + + NLog + + + + + Indicates that the value of the marked element could be null sometimes, + so the check for null is necessary before its usage. + + + [CanBeNull] object Test() => null; + + void UseTest() { + var p = Test(); + var s = p.ToString(); // Warning: Possible 'System.NullReferenceException' + } + + + + + Indicates that the value of the marked element could never be null. + + + [NotNull] object Foo() { + return null; // Warning: Possible 'null' assignment + } + + + + + Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task + and Lazy classes to indicate that the value of a collection item, of the Task.Result property + or of the Lazy.Value property can never be null. + + + + + Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task + and Lazy classes to indicate that the value of a collection item, of the Task.Result property + or of the Lazy.Value property can be null. + + + + + Indicates that the marked method builds string by format pattern and (optional) arguments. + Parameter, which contains format string, should be given in constructor. The format string + should be in -like form. + + + [StringFormatMethod("message")] + void ShowError(string message, params object[] args) { /* do something */ } + + void Foo() { + ShowError("Failed: {0}"); // Warning: Non-existing argument in format string + } + + + + + Specifies which parameter of an annotated method should be treated as format-string + + + + + For a parameter that is expected to be one of the limited set of values. + Specify fields of which type should be used as values for this parameter. + + + + + Indicates that the function argument should be string literal and match one + of the parameters of the caller function. For example, ReSharper annotates + the parameter of . + + + void Foo(string param) { + if (param == null) + throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol + } + + + + + Indicates that the method is contained in a type that implements + System.ComponentModel.INotifyPropertyChanged interface and this method + is used to notify that some property value changed. + + + The method should be non-static and conform to one of the supported signatures: + + NotifyChanged(string) + NotifyChanged(params string[]) + NotifyChanged{T}(Expression{Func{T}}) + NotifyChanged{T,U}(Expression{Func{T,U}}) + SetProperty{T}(ref T, T, string) + + + + public class Foo : INotifyPropertyChanged { + public event PropertyChangedEventHandler PropertyChanged; + + [NotifyPropertyChangedInvocator] + protected virtual void NotifyChanged(string propertyName) { ... } + + string _name; + + public string Name { + get { return _name; } + set { _name = value; NotifyChanged("LastName"); /* Warning */ } + } + } + + Examples of generated notifications: + + NotifyChanged("Property") + NotifyChanged(() => Property) + NotifyChanged((VM x) => x.Property) + SetProperty(ref myField, value, "Property") + + + + + + Describes dependency between method input and output. + + +

Function Definition Table syntax:

+ + FDT ::= FDTRow [;FDTRow]* + FDTRow ::= Input => Output | Output <= Input + Input ::= ParameterName: Value [, Input]* + Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value} + Value ::= true | false | null | notnull | canbenull + + If method has single input parameter, it's name could be omitted.
+ Using halt (or void/nothing, which is the same) for method output + means that the methods doesn't return normally (throws or terminates the process).
+ Value canbenull is only applicable for output parameters.
+ You can use multiple [ContractAnnotation] for each FDT row, or use single attribute + with rows separated by semicolon. There is no notion of order rows, all rows are checked + for applicability and applied per each program state tracked by R# analysis.
+
+ + + [ContractAnnotation("=> halt")] + public void TerminationMethod() + + + [ContractAnnotation("halt <= condition: false")] + public void Assert(bool condition, string text) // regular assertion method + + + [ContractAnnotation("s:null => true")] + public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty() + + + // A method that returns null if the parameter is null, + // and not null if the parameter is not null + [ContractAnnotation("null => null; notnull => notnull")] + public object Transform(object data) + + + [ContractAnnotation("=> true, result: notnull; => false, result: null")] + public bool TryParse(string s, out Person result) + + +
+ + + Indicates that marked element should be localized or not. + + + [LocalizationRequiredAttribute(true)] + class Foo { + string str = "my string"; // Warning: Localizable string + } + + + + + Indicates that the value of the marked type (or its derivatives) + cannot be compared using '==' or '!=' operators and Equals() + should be used instead. However, using '==' or '!=' for comparison + with null is always permitted. + + + [CannotApplyEqualityOperator] + class NoEquality { } + + class UsesNoEquality { + void Test() { + var ca1 = new NoEquality(); + var ca2 = new NoEquality(); + if (ca1 != null) { // OK + bool condition = ca1 == ca2; // Warning + } + } + } + + + + + When applied to a target attribute, specifies a requirement for any type marked + with the target attribute to implement or inherit specific type or types. + + + [BaseTypeRequired(typeof(IComponent)] // Specify requirement + class ComponentAttribute : Attribute { } + + [Component] // ComponentAttribute requires implementing IComponent interface + class MyComponent : IComponent { } + + + + + Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library), + so this symbol will not be marked as unused (as well as by other usage inspections). + + + + + Should be used on attributes and causes ReSharper to not mark symbols marked with such attributes + as unused (as well as by other usage inspections) + + + + Only entity marked with attribute considered used. + + + Indicates implicit assignment to a member. + + + + Indicates implicit instantiation of a type with fixed constructor signature. + That means any unused constructor parameters won't be reported as such. + + + + Indicates implicit instantiation of a type. + + + + Specify what is considered used implicitly when marked + with or . + + + + Members of entity marked with attribute are considered used. + + + Entity marked with attribute and all its members considered used. + + + + This attribute is intended to mark publicly available API + which should not be removed and so is treated as used. + + + + + Tells code analysis engine if the parameter is completely handled when the invoked method is on stack. + If the parameter is a delegate, indicates that delegate is executed while the method is executed. + If the parameter is an enumerable, indicates that it is enumerated while the method is executed. + + + + + Indicates that a method does not make any observable state changes. + The same as System.Diagnostics.Contracts.PureAttribute. + + + [Pure] int Multiply(int x, int y) => x * y; + + void M() { + Multiply(123, 42); // Waring: Return value of pure method is not used + } + + + + + Indicates that the return value of method invocation must be used. + + + + + Indicates the type member or parameter of some type, that should be used instead of all other ways + to get the value that type. This annotation is useful when you have some "context" value evaluated + and stored somewhere, meaning that all other ways to get this value must be consolidated with existing one. + + + class Foo { + [ProvidesContext] IBarService _barService = ...; + + void ProcessNode(INode node) { + DoSomething(node, node.GetGlobalServices().Bar); + // ^ Warning: use value of '_barService' field + } + } + + + + + Indicates that a parameter is a path to a file or a folder within a web project. + Path can be relative or absolute, starting from web root (~). + + + + + An extension method marked with this attribute is processed by ReSharper code completion + as a 'Source Template'. When extension method is completed over some expression, it's source code + is automatically expanded like a template at call site. + + + Template method body can contain valid source code and/or special comments starting with '$'. + Text inside these comments is added as source code when the template is applied. Template parameters + can be used either as additional method parameters or as identifiers wrapped in two '$' signs. + Use the attribute to specify macros for parameters. + + + In this example, the 'forEach' method is a source template available over all values + of enumerable types, producing ordinary C# 'foreach' statement and placing caret inside block: + + [SourceTemplate] + public static void forEach<T>(this IEnumerable<T> xs) { + foreach (var x in xs) { + //$ $END$ + } + } + + + + + + Allows specifying a macro for a parameter of a source template. + + + You can apply the attribute on the whole method or on any of its additional parameters. The macro expression + is defined in the property. When applied on a method, the target + template parameter is defined in the property. To apply the macro silently + for the parameter, set the property value = -1. + + + Applying the attribute on a source template method: + + [SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")] + public static void forEach<T>(this IEnumerable<T> collection) { + foreach (var item in collection) { + //$ $END$ + } + } + + Applying the attribute on a template method parameter: + + [SourceTemplate] + public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) { + /*$ var $x$Id = "$newguid$" + x.ToString(); + x.DoSomething($x$Id); */ + } + + + + + + Allows specifying a macro that will be executed for a source template + parameter when the template is expanded. + + + + + Allows specifying which occurrence of the target parameter becomes editable when the template is deployed. + + + If the target parameter is used several times in the template, only one occurrence becomes editable; + other occurrences are changed synchronously. To specify the zero-based index of the editable occurrence, + use values >= 0. To make the parameter non-editable when the template is expanded, use -1. + > + + + + Identifies the target parameter of a source template if the + is applied on a template method. + + + + + ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter + is an MVC action. If applied to a method, the MVC action name is calculated + implicitly from the context. Use this attribute for custom wrappers similar to + System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String). + + + + + ASP.NET MVC attribute. Indicates that a parameter is an MVC area. + Use this attribute for custom wrappers similar to + System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String). + + + + + ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is + an MVC controller. If applied to a method, the MVC controller name is calculated + implicitly from the context. Use this attribute for custom wrappers similar to + System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String). + + + + + ASP.NET MVC attribute. Indicates that a parameter is an MVC Master. Use this attribute + for custom wrappers similar to System.Web.Mvc.Controller.View(String, String). + + + + + ASP.NET MVC attribute. Indicates that a parameter is an MVC model type. Use this attribute + for custom wrappers similar to System.Web.Mvc.Controller.View(String, Object). + + + + + ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is an MVC + partial view. If applied to a method, the MVC partial view name is calculated implicitly + from the context. Use this attribute for custom wrappers similar to + System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String). + + + + + ASP.NET MVC attribute. Allows disabling inspections for MVC views within a class or a method. + + + + + ASP.NET MVC attribute. Indicates that a parameter is an MVC display template. + Use this attribute for custom wrappers similar to + System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String). + + + + + ASP.NET MVC attribute. Indicates that a parameter is an MVC editor template. + Use this attribute for custom wrappers similar to + System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String). + + + + + ASP.NET MVC attribute. Indicates that a parameter is an MVC template. + Use this attribute for custom wrappers similar to + System.ComponentModel.DataAnnotations.UIHintAttribute(System.String). + + + + + ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter + is an MVC view component. If applied to a method, the MVC view name is calculated implicitly + from the context. Use this attribute for custom wrappers similar to + System.Web.Mvc.Controller.View(Object). + + + + + ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter + is an MVC view component name. + + + + + ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter + is an MVC view component view. If applied to a method, the MVC view component view name is default. + + + + + ASP.NET MVC attribute. When applied to a parameter of an attribute, + indicates that this parameter is an MVC action name. + + + [ActionName("Foo")] + public ActionResult Login(string returnUrl) { + ViewBag.ReturnUrl = Url.Action("Foo"); // OK + return RedirectToAction("Bar"); // Error: Cannot resolve action + } + + + + + Razor attribute. Indicates that a parameter or a method is a Razor section. + Use this attribute for custom wrappers similar to + System.Web.WebPages.WebPageBase.RenderSection(String). + + + + + Indicates how method, constructor invocation or property access + over collection type affects content of the collection. + + + + Method does not use or modify content of the collection. + + + Method only reads content of the collection but does not modify it. + + + Method can change content of the collection but does not add new elements. + + + Method can add new elements to the collection. + + + + Indicates that the marked method is assertion method, i.e. it halts control flow if + one of the conditions is satisfied. To set the condition, mark one of the parameters with + attribute. + + + + + Indicates the condition parameter of the assertion method. The method itself should be + marked by attribute. The mandatory argument of + the attribute is the assertion type. + + + + + Specifies assertion type. If the assertion method argument satisfies the condition, + then the execution continues. Otherwise, execution is assumed to be halted. + + + + Marked parameter should be evaluated to true. + + + Marked parameter should be evaluated to false. + + + Marked parameter should be evaluated to null value. + + + Marked parameter should be evaluated to not null value. + + + + Indicates that the marked method unconditionally terminates control flow execution. + For example, it could unconditionally throw exception. + + + + + Indicates that method is pure LINQ method, with postponed enumeration (like Enumerable.Select, + .Where). This annotation allows inference of [InstantHandle] annotation for parameters + of delegate type by analyzing LINQ method chains. + + + + + Indicates that IEnumerable, passed as parameter, is not enumerated. + + + + + Indicates that parameter is regular expression pattern. + + + + + Prevents the Member Reordering feature from tossing members of the marked class. + + + The attribute must be mentioned in your member reordering patterns + + + + + XAML attribute. Indicates the type that has ItemsSource property and should be treated + as ItemsControl-derived type, to enable inner items DataContext type resolve. + + + + + XAML attribute. Indicates the property of some BindingBase-derived type, that + is used to bind some item of ItemsControl-derived type. This annotation will + enable the DataContext type resolve for XAML bindings for such properties. + + + Property should have the tree ancestor of the ItemsControl type or + marked with the attribute. + + + + + Support implementation of + + + + + + + + + + + + + + + + + Asynchronous continuation delegate - function invoked at the end of asynchronous + processing. + + Exception during asynchronous processing or null if no exception + was thrown. + + + + Helpers for asynchronous operations. + + + + + Iterates over all items in the given collection and runs the specified action + in sequence (each action executes only after the preceding one has completed without an error). + + Type of each item. + The items to iterate. + The asynchronous continuation to invoke once all items + have been iterated. + The action to invoke for each item. + + + + Repeats the specified asynchronous action multiple times and invokes asynchronous continuation at the end. + + The repeat count. + The asynchronous continuation to invoke at the end. + The action to invoke. + + + + Modifies the continuation by pre-pending given action to execute just before it. + + The async continuation. + The action to pre-pend. + Continuation which will execute the given action before forwarding to the actual continuation. + + + + Attaches a timeout to a continuation which will invoke the continuation when the specified + timeout has elapsed. + + The asynchronous continuation. + The timeout. + Wrapped continuation. + + + + Iterates over all items in the given collection and runs the specified action + in parallel (each action executes on a thread from thread pool). + + Type of each item. + The items to iterate. + The asynchronous continuation to invoke once all items + have been iterated. + The action to invoke for each item. + + + + Runs the specified asynchronous action synchronously (blocks until the continuation has + been invoked). + + The action. + + Using this method is not recommended because it will block the calling thread. + + + + + Wraps the continuation with a guard which will only make sure that the continuation function + is invoked only once. + + The asynchronous continuation. + Wrapped asynchronous continuation. + + + + Gets the combined exception from all exceptions in the list. + + The exceptions. + Combined exception or null if no exception was thrown. + + + + Disposes the Timer, and waits for it to leave the Timer-callback-method + + The Timer object to dispose + Timeout to wait (TimeSpan.Zero means dispose without waiting) + Timer disposed within timeout (true/false) + + + + Asynchronous action. + + Continuation to be invoked at the end of action. + + + + Asynchronous action with one argument. + + Type of the argument. + Argument to the action. + Continuation to be invoked at the end of action. + + + + Represents the logging event with asynchronous continuation. + + + + + Initializes a new instance of the struct. + + The log event. + The continuation. + + + + Gets the log event. + + + + + Gets the continuation. + + + + + Implements the operator ==. + + The event info1. + The event info2. + The result of the operator. + + + + Implements the operator ==. + + The event info1. + The event info2. + The result of the operator. + + + + Determines whether the specified is equal to this instance. + + The to compare with this instance. + + A value of true if the specified is equal to this instance; otherwise, false. + + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + String Conversion Helpers + + + + + Converts input string value into . Parsing is case-insensitive. + + Input value + Output value + Default value + Returns false if the input value could not be parsed + + + + Converts input string value into . Parsing is case-insensitive. + + Input value + The type of the enum + Output value. Null if parse failed + + + + Converts the string representation of the name or numeric value of one or more enumerated constants to an equivalent enumerated object. A parameter specifies whether the operation is case-sensitive. The return value indicates whether the conversion succeeded. + + The enumeration type to which to convert value. + The string representation of the enumeration name or underlying value to convert. + true to ignore case; false to consider case. + When this method returns, result contains an object of type TEnum whose value is represented by value if the parse operation succeeds. If the parse operation fails, result contains the default value of the underlying type of TEnum. Note that this value need not be a member of the TEnum enumeration. This parameter is passed uninitialized. + true if the value parameter was converted successfully; otherwise, false. + Wrapper because Enum.TryParse is not present in .net 3.5 + + + + Enum.TryParse implementation for .net 3.5 + + + + Don't uses reflection + + + + Enables to extract extra context details for + + + + + Name of context + + + + + The current LogFactory next to LogManager + + + + + NLog internal logger. + + Writes to file, console or custom text writer (see ) + + + Don't use as that can lead to recursive calls - stackoverflow + + + + + Gets a value indicating whether internal log includes Trace messages. + + + + + Gets a value indicating whether internal log includes Debug messages. + + + + + Gets a value indicating whether internal log includes Info messages. + + + + + Gets a value indicating whether internal log includes Warn messages. + + + + + Gets a value indicating whether internal log includes Error messages. + + + + + Gets a value indicating whether internal log includes Fatal messages. + + + + + Logs the specified message without an at the Trace level. + + Message which may include positional parameters. + Arguments to the message. + + + + Logs the specified message without an at the Trace level. + + Log message. + + + + Logs the specified message without an at the Trace level. + will be only called when logging is enabled for level Trace. + + Function that returns the log message. + + + + Logs the specified message with an at the Trace level. + + Exception to be logged. + Message which may include positional parameters. + Arguments to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + Message which may include positional parameters. + Argument {0} to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + The type of the second argument. + Message which may include positional parameters. + Argument {0} to the message. + Argument {1} to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + Message which may include positional parameters. + Argument {0} to the message. + Argument {1} to the message. + Argument {2} to the message. + + + + Logs the specified message with an at the Trace level. + + Exception to be logged. + Log message. + + + + Logs the specified message with an at the Trace level. + will be only called when logging is enabled for level Trace. + + Exception to be logged. + Function that returns the log message. + + + + Logs the specified message without an at the Debug level. + + Message which may include positional parameters. + Arguments to the message. + + + + Logs the specified message without an at the Debug level. + + Log message. + + + + Logs the specified message without an at the Debug level. + will be only called when logging is enabled for level Debug. + + Function that returns the log message. + + + + Logs the specified message with an at the Debug level. + + Exception to be logged. + Message which may include positional parameters. + Arguments to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + Message which may include positional parameters. + Argument {0} to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + The type of the second argument. + Message which may include positional parameters. + Argument {0} to the message. + Argument {1} to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + Message which may include positional parameters. + Argument {0} to the message. + Argument {1} to the message. + Argument {2} to the message. + + + + Logs the specified message with an at the Debug level. + + Exception to be logged. + Log message. + + + + Logs the specified message with an at the Debug level. + will be only called when logging is enabled for level Debug. + + Exception to be logged. + Function that returns the log message. + + + + Logs the specified message without an at the Info level. + + Message which may include positional parameters. + Arguments to the message. + + + + Logs the specified message without an at the Info level. + + Log message. + + + + Logs the specified message without an at the Info level. + will be only called when logging is enabled for level Info. + + Function that returns the log message. + + + + Logs the specified message with an at the Info level. + + Exception to be logged. + Message which may include positional parameters. + Arguments to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + Message which may include positional parameters. + Argument {0} to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + The type of the second argument. + Message which may include positional parameters. + Argument {0} to the message. + Argument {1} to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + Message which may include positional parameters. + Argument {0} to the message. + Argument {1} to the message. + Argument {2} to the message. + + + + Logs the specified message with an at the Info level. + + Exception to be logged. + Log message. + + + + Logs the specified message with an at the Info level. + will be only called when logging is enabled for level Info. + + Exception to be logged. + Function that returns the log message. + + + + Logs the specified message without an at the Warn level. + + Message which may include positional parameters. + Arguments to the message. + + + + Logs the specified message without an at the Warn level. + + Log message. + + + + Logs the specified message without an at the Warn level. + will be only called when logging is enabled for level Warn. + + Function that returns the log message. + + + + Logs the specified message with an at the Warn level. + + Exception to be logged. + Message which may include positional parameters. + Arguments to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + Message which may include positional parameters. + Argument {0} to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + The type of the second argument. + Message which may include positional parameters. + Argument {0} to the message. + Argument {1} to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + Message which may include positional parameters. + Argument {0} to the message. + Argument {1} to the message. + Argument {2} to the message. + + + + Logs the specified message with an at the Warn level. + + Exception to be logged. + Log message. + + + + Logs the specified message with an at the Warn level. + will be only called when logging is enabled for level Warn. + + Exception to be logged. + Function that returns the log message. + + + + Logs the specified message without an at the Error level. + + Message which may include positional parameters. + Arguments to the message. + + + + Logs the specified message without an at the Error level. + + Log message. + + + + Logs the specified message without an at the Error level. + will be only called when logging is enabled for level Error. + + Function that returns the log message. + + + + Logs the specified message with an at the Error level. + + Exception to be logged. + Message which may include positional parameters. + Arguments to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + Message which may include positional parameters. + Argument {0} to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + The type of the second argument. + Message which may include positional parameters. + Argument {0} to the message. + Argument {1} to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + Message which may include positional parameters. + Argument {0} to the message. + Argument {1} to the message. + Argument {2} to the message. + + + + Logs the specified message with an at the Error level. + + Exception to be logged. + Log message. + + + + Logs the specified message with an at the Error level. + will be only called when logging is enabled for level Error. + + Exception to be logged. + Function that returns the log message. + + + + Logs the specified message without an at the Fatal level. + + Message which may include positional parameters. + Arguments to the message. + + + + Logs the specified message without an at the Fatal level. + + Log message. + + + + Logs the specified message without an at the Fatal level. + will be only called when logging is enabled for level Fatal. + + Function that returns the log message. + + + + Logs the specified message with an at the Fatal level. + + Exception to be logged. + Message which may include positional parameters. + Arguments to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + Message which may include positional parameters. + Argument {0} to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + The type of the second argument. + Message which may include positional parameters. + Argument {0} to the message. + Argument {1} to the message. + + + + Logs the specified message without an at the Trace level. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + Message which may include positional parameters. + Argument {0} to the message. + Argument {1} to the message. + Argument {2} to the message. + + + + Logs the specified message with an at the Fatal level. + + Exception to be logged. + Log message. + + + + Logs the specified message with an at the Fatal level. + will be only called when logging is enabled for level Fatal. + + Exception to be logged. + Function that returns the log message. + + + + Initializes static members of the InternalLogger class. + + + + + Set the config of the InternalLogger with defaults and config. + + + + + Gets or sets the minimal internal log level. + + If set to , then messages of the levels , and will be written. + + + + Gets or sets a value indicating whether internal messages should be written to the console output stream. + + Your application must be a console application. + + + + Gets or sets a value indicating whether internal messages should be written to the console error stream. + + Your application must be a console application. + + + + Gets or sets a value indicating whether internal messages should be written to the .Trace + + + + + Gets or sets the file path of the internal log file. + + A value of value disables internal logging to a file. + + + + Gets or sets the text writer that will receive internal logs. + + + + + Event written to the internal log. + Please note that the event is not triggered when then event hasn't the minimal log level set by + + + + + Gets or sets a value indicating whether timestamp should be included in internal log output. + + + + + Is there an thrown when writing the message? + + + + + Logs the specified message without an at the specified level. + + Log level. + Message which may include positional parameters. + Arguments to the message. + + + + Logs the specified message without an at the specified level. + + Log level. + Log message. + + + + Logs the specified message without an at the specified level. + will be only called when logging is enabled for level . + + Log level. + Function that returns the log message. + + + + Logs the specified message with an at the specified level. + will be only called when logging is enabled for level . + + Exception to be logged. + Log level. + Function that returns the log message. + + + + Logs the specified message with an at the specified level. + + Exception to be logged. + Log level. + Message which may include positional parameters. + Arguments to the message. + + + + Logs the specified message with an at the specified level. + + Exception to be logged. + Log level. + Log message. + + + + Write to internallogger. + + optional exception to be logged. + level + message + optional args for + + + + Create log line with timestamp, exception message etc (if configured) + + + + + Determine if logging should be avoided because of exception type. + + The exception to check. + true if logging should be avoided; otherwise, false. + + + + Determine if logging is enabled for given LogLevel + + The for the log event. + true if logging is enabled; otherwise, false. + + + + Determine if logging is enabled. + + true if logging is enabled; otherwise, false. + + + + Write internal messages to the log file defined in . + + Message to write. + + Message will be logged only when the property is not null, otherwise the + method has no effect. + + + + + Write internal messages to the defined in . + + Message to write. + + Message will be logged only when the property is not null, otherwise the + method has no effect. + + + + + Write internal messages to the . + + Message to write. + + Message will be logged only when the property is true, otherwise the + method has no effect. + + + + + Write internal messages to the . + + Message to write. + + Message will be logged when the property is true, otherwise the + method has no effect. + + + + + Write internal messages to the . + + A message to write. + + Works when property set to true. + The is used in Debug and Release configuration. + The works only in Debug configuration and this is reason why is replaced by . + in DEBUG + + + + + Logs the assembly version and file version of the given Assembly. + + The assembly to log. + + + + A message has been written to the internal logger + + + + + The rendered message + + + + + The log level + + + + + The exception. Could be null. + + + + + The type that triggered this internal log event, for example the FileTarget. + This property is not always populated. + + + + + The context name that triggered this internal log event, for example the name of the Target. + This property is not always populated. + + + + + + + + A cyclic buffer of object. + + + + + Initializes a new instance of the class. + + Buffer size. + Whether buffer should grow as it becomes full. + The maximum number of items that the buffer can grow to. + + + + Gets the capacity of the buffer + + + + + Gets the number of items in the buffer + + + + + Adds the specified log event to the buffer. + + Log event. + The number of items in the buffer. + + + + Gets the array of events accumulated in the buffer and clears the buffer as one atomic operation. + + Events in the buffer. + + + + Condition and expression. + + + + + Initializes a new instance of the class. + + Left hand side of the AND expression. + Right hand side of the AND expression. + + + + Gets the left hand side of the AND expression. + + + + + Gets the right hand side of the AND expression. + + + + + Returns a string representation of this expression. + + A concatenated '(Left) and (Right)' string. + + + + Evaluates the expression by evaluating and recursively. + + Evaluation context. + The value of the conjunction operator. + + + + Exception during evaluation of condition expression. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + The parameter is null. + + + The class name is null or is zero (0). + + + + + Base class for representing nodes in condition expression trees. + + + + + Converts condition text to a condition expression tree. + + Condition text to be converted. + Condition expression tree. + + + + Evaluates the expression. + + Evaluation context. + Expression result. + + + + Returns a string representation of the expression. + + + A that represents the condition expression. + + + + + Evaluates the expression. + + Evaluation context. + Expression result. + + + + Condition layout expression (represented by a string literal + with embedded ${}). + + + + + Initializes a new instance of the class. + + The layout. + + + + Gets the layout. + + The layout. + + + + Returns a string representation of this expression. + + String literal in single quotes. + + + + Evaluates the expression by calculating the value + of the layout in the specified evaluation context. + + Evaluation context. + The value of the layout. + + + + Condition level expression (represented by the level keyword). + + + + + Returns a string representation of the expression. + + The 'level' string. + + + + Evaluates to the current log level. + + Evaluation context. Ignored. + The object representing current log level. + + + + Condition literal expression (numeric, LogLevel.XXX, true or false). + + + + + Initializes a new instance of the class. + + Literal value. + ToString value. + + + + Gets the literal value. + + The literal value. + + + + Returns a string representation of the expression. + + The literal value. + + + + Evaluates the expression. + + Evaluation context. + The literal value as passed in the constructor. + + + + Condition logger name expression (represented by the logger keyword). + + + + + Returns a string representation of this expression. + + A logger string. + + + + Evaluates to the logger name. + + Evaluation context. + The logger name. + + + + Condition message expression (represented by the message keyword). + + + + + Returns a string representation of this expression. + + The 'message' string. + + + + Evaluates to the logger message. + + Evaluation context. + The logger message. + + + + Marks class as a log event Condition and assigns a name to it. + + + + + Initializes a new instance of the class. + + Condition method name. + + + + Condition method invocation expression (represented by method(p1,p2,p3) syntax). + + + + + Initializes a new instance of the class. + + Name of the condition method. + of the condition method. + Precompiled delegate of the condition method. + The method parameters. + + + + Gets the method info. + + + + + Returns a string representation of the expression. + + + A that represents the condition expression. + + + + + Evaluates the expression. + + Evaluation context. + Expression result. + + + + A bunch of utility methods (mostly predicates) which can be used in + condition expressions. Partially inspired by XPath 1.0. + + + + + Compares two values for equality. + + The first value. + The second value. + true when two objects are equal, false otherwise. + + + + Compares two strings for equality. + + The first string. + The second string. + Optional. If true, case is ignored; if false (default), case is significant. + true when two strings are equal, false otherwise. + + + + Gets or sets a value indicating whether the second string is a substring of the first one. + + The first string. + The second string. + Optional. If true (default), case is ignored; if false, case is significant. + true when the second string is a substring of the first string, false otherwise. + + + + Gets or sets a value indicating whether the second string is a prefix of the first one. + + The first string. + The second string. + Optional. If true (default), case is ignored; if false, case is significant. + true when the second string is a prefix of the first string, false otherwise. + + + + Gets or sets a value indicating whether the second string is a suffix of the first one. + + The first string. + The second string. + Optional. If true (default), case is ignored; if false, case is significant. + true when the second string is a prefix of the first string, false otherwise. + + + + Returns the length of a string. + + A string whose lengths is to be evaluated. + The length of the string. + + + + Indicates whether the specified regular expression finds a match in the specified input string. + + The string to search for a match. + The regular expression pattern to match. + A string consisting of the desired options for the test. The possible values are those of the separated by commas. + true if the regular expression finds a match; otherwise, false. + + + + + + + + + + + Marks the class as containing condition methods. + + + + + Condition not expression. + + + + + Initializes a new instance of the class. + + The expression. + + + + Gets the expression to be negated. + + The expression. + + + + Returns a string representation of the expression. + + + A that represents the condition expression. + + + + + Evaluates the expression. + + Evaluation context. + Expression result. + + + + Condition or expression. + + + + + Initializes a new instance of the class. + + Left hand side of the OR expression. + Right hand side of the OR expression. + + + + Gets the left expression. + + The left expression. + + + + Gets the right expression. + + The right expression. + + + + Returns a string representation of the expression. + + + A that represents the condition expression. + + + + + Evaluates the expression by evaluating and recursively. + + Evaluation context. + The value of the alternative operator. + + + + Exception during parsing of condition expression. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + The parameter is null. + + + The class name is null or is zero (0). + + + + + Condition parser. Turns a string representation of condition expression + into an expression tree. + + + + + Initializes a new instance of the class. + + The string reader. + Instance of used to resolve references to condition methods and layout renderers. + + + + Parses the specified condition string and turns it into + tree. + + The expression to be parsed. + The root of the expression syntax tree which can be used to get the value of the condition in a specified context. + + + + Parses the specified condition string and turns it into + tree. + + The expression to be parsed. + Instance of used to resolve references to condition methods and layout renderers. + The root of the expression syntax tree which can be used to get the value of the condition in a specified context. + + + + Parses the specified condition string and turns it into + tree. + + The string reader. + Instance of used to resolve references to condition methods and layout renderers. + + The root of the expression syntax tree which can be used to get the value of the condition in a specified context. + + + + + Try stringed keyword to + + + + success? + + + + Parse number + + negative number? minus should be parsed first. + + + + + Condition relational (==, !=, <, <=, + > or >=) expression. + + + + + Initializes a new instance of the class. + + The left expression. + The right expression. + The relational operator. + + + + Gets the left expression. + + The left expression. + + + + Gets the right expression. + + The right expression. + + + + Gets the relational operator. + + The operator. + + + + Returns a string representation of the expression. + + + A that represents the condition expression. + + + + + Evaluates the expression. + + Evaluation context. + Expression result. + + + + Compares the specified values using specified relational operator. + + The first value. + The second value. + The relational operator. + Result of the given relational operator. + + + + Promote values to the type needed for the comparision, e.g. parse a string to int. + + + + + + + Promotes to type + + + + success? + + + + Try to promote both values. First try to promote to , + when failed, try to . + + + + + + Get the order for the type for comparision. + + + index, 0 to max int. Lower is first + + + + Dictionary from type to index. Lower index should be tested first. + + + + + Build the dictionary needed for the order of the types. + + + + + + Get the string representing the current + + + + + + Relational operators used in conditions. + + + + + Equality (==). + + + + + Inequality (!=). + + + + + Less than (<). + + + + + Greater than (>). + + + + + Less than or equal (<=). + + + + + Greater than or equal (>=). + + + + + Hand-written tokenizer for conditions. + + + + + Initializes a new instance of the class. + + The string reader. + + + + Gets the type of the token. + + The type of the token. + + + + Gets the token value. + + The token value. + + + + Gets the value of a string token. + + The string token value. + + + + Asserts current token type and advances to the next token. + + Expected token type. + If token type doesn't match, an exception is thrown. + + + + Asserts that current token is a keyword and returns its value and advances to the next token. + + Keyword value. + + + + Gets or sets a value indicating whether current keyword is equal to the specified value. + + The keyword. + + A value of true if current keyword is equal to the specified value; otherwise, false. + + + + + Gets or sets a value indicating whether the tokenizer has reached the end of the token stream. + + + A value of true if the tokenizer has reached the end of the token stream; otherwise, false. + + + + + Gets or sets a value indicating whether current token is a number. + + + A value of true if current token is a number; otherwise, false. + + + + + Gets or sets a value indicating whether the specified token is of specified type. + + The token type. + + A value of true if current token is of specified type; otherwise, false. + + + + + Gets the next token and sets and properties. + + + + + Try the comparison tokens (greater, smaller, greater-equals, smaller-equals) + + current char + is match + + + + Try the logical tokens (and, or, not, equals) + + current char + is match + + + + Mapping between characters and token types for punctuations. + + + + + Initializes a new instance of the CharToTokenType struct. + + The character. + Type of the token. + + + + Token types for condition expressions. + + + + + Marks the class or a member as advanced. Advanced classes and members are hidden by + default in generated documentation. + + + + + Initializes a new instance of the class. + + + + + Identifies that the output of layout or layout render does not change for the lifetime of the current appdomain. + + + A layout(renderer) could be converted to a literal when: + - The layout and all layout properties are SimpleLayout or [AppDomainFixedOutput] + + Recommendation: Apply this attribute to a layout or layout-renderer which have the result only changes by properties of type Layout. + + + + + Used to mark configurable parameters which are arrays. + Specifies the mapping between XML elements and .NET types. + + + + + Initializes a new instance of the class. + + The type of the array item. + The XML element name that represents the item. + + + + Gets the .NET type of the array item. + + + + + Gets the XML element name. + + + + + An assembly is trying to load. + + + + + New event args + + + + + + The assembly that is trying to load. + + + + + Constructs a new instance the configuration item (target, layout, layout renderer, etc.) given its type. + + Type of the item. + Created object of the specified type. + + + + Provides registration information for named items (targets, layouts, layout renderers, etc.) managed by NLog. + + Everything of an assembly could be loaded by + + + + + Called before the assembly will be loaded. + + + + + Initializes a new instance of the class. + + The assemblies to scan for named items. + + + + Gets or sets default singleton instance of . + + + This property implements lazy instantiation so that the is not built before + the internal logger is configured. + + + + + Gets or sets the creator delegate used to instantiate configuration objects. + + + By overriding this property, one can enable dependency injection or interception for created objects. + + + + + Gets the factory. + + The target factory. + + + + Gets the factory. + + The filter factory. + + + + gets the factory + + not using due to backwards-compatibility. + + + + + Gets the factory. + + The layout renderer factory. + + + + Gets the factory. + + The layout factory. + + + + Gets the ambient property factory. + + The ambient property factory. + + + + Legacy interface, no longer used by the NLog engine + + + + + Gets or sets the JSON serializer to use with or + + + + + Gets or sets the string serializer to use with + + + + + Gets or sets the custom object-type transformation for use in , or + + + + + Gets or sets the parameter converter to use with , or + + + + + Perform message template parsing and formatting of LogEvent messages (True = Always, False = Never, Null = Auto Detect) + + + - Null (Auto Detect) : NLog-parser checks for positional parameters, and will then fallback to string.Format-rendering. + - True: Always performs the parsing of and rendering of using the NLog-parser (Allows custom formatting with ) + - False: Always performs parsing and rendering using string.Format (Fastest if not using structured logging) + + + + + Gets the time source factory. + + The time source factory. + + + + Gets the condition method factory. + + The condition method factory. + + + + Gets the condition method factory (precompiled) + + The condition method factory. + + + + Registers named items from the assembly. + + The assembly. + + + + Registers named items from the assembly. + + The assembly. + Item name prefix. + + + + Call Preload for NLogPackageLoader + + + Every package could implement a class "NLogPackageLoader" (namespace not important) with the public static method "Preload" (no arguments) + This method will be called just before registering all items in the assembly. + + + + + + Call the Preload method for . The Preload method must be static. + + + + + + Clears the contents of all factories. + + + + + Registers the type. + + The type to register. + The item name prefix. + + + + Builds the default configuration item factory. + + Default factory. + + + + Registers items in NLog.Extended.dll using late-bound types, so that we don't need a reference to NLog.Extended.dll. + + + + + Attribute used to mark the default parameters for layout renderers. + + + + + Initializes a new instance of the class. + + + + + Dynamic filtering with a positive list of enabled levels + + + + + Dynamic filtering with a minlevel and maxlevel range + + + + + Format of the exception output to the specific target. + + + + + Appends the Message of an Exception to the specified target. + + + + + Appends the type of an Exception to the specified target. + + + + + Appends the short type of an Exception to the specified target. + + + + + Appends the result of calling ToString() on an Exception to the specified target. + + + + + Appends the method name from Exception's stack trace to the specified target. + + + + + Appends the stack trace from an Exception to the specified target. + + + + + Appends the contents of an Exception's Data property to the specified target. + + + + + Destructure the exception (usually into JSON) + + + + + Appends the from the application or the object that caused the error. + + + + + Appends the from the application or the object that caused the error. + + + + + Appends any additional properties that specific type of Exception might have. + + + + + Factory for class-based items. + + The base type of each item. + The type of the attribute used to annotate items. + + + + Scans the assembly. + + The types to scan. + The prefix. + + + + Registers the type. + + The type to register. + The item name prefix. + + + + Registers the item based on a type name. + + Name of the item. + Name of the type. + + + + Clears the contents of the factory. + + + + + Registers a single type definition. + + The item name. + The type of the item. + + + + Tries to get registered item definition. + + Name of the item. + Reference to a variable which will store the item definition. + Item definition. + + + + Tries to create an item instance. + + Name of the item. + The result. + True if instance was created successfully, false otherwise. + + + + Creates an item instance. + + The name of the item. + Created item. + + + + Factory specialized for s. + + + + + Clear all func layouts + + + + + Register a layout renderer with a callback function. + + Name of the layoutrenderer, without ${}. + the renderer that renders the value. + + + + Tries to create an item instance. + + Name of the item. + The result. + True if instance was created successfully, false otherwise. + + + + Provides means to populate factories of named items (such as targets, layouts, layout renderers, etc.). + + + + + Implemented by objects which support installation and uninstallation. + + + + + Performs installation which requires administrative permissions. + + The installation context. + + + + Performs uninstallation which requires administrative permissions. + + The installation context. + + + + Determines whether the item is installed. + + The installation context. + + Value indicating whether the item is installed or null if it is not possible to determine. + + + + + Interface for accessing configuration details + + + + + Name of the config section + + + + + Configuration Key/Value Pairs + + + + + Child config sections + + + + + Interface for loading NLog + + + + + Finds and loads the NLog configuration + + LogFactory that owns the NLog configuration + Name of NLog.config file (optional) + NLog configuration (or null if none found) + + + + Notifies when LoggingConfiguration has been successfully applied + + LogFactory that owns the NLog configuration + NLog Config + + + + Get file paths (including filename) for the possible NLog config files. + + Name of NLog.config file (optional) + The file paths to the possible config file + + + + Level enabled flags for each LogLevel ordinal + + + + + Converts the filter into a simple + + + + + Represents a factory of named items (such as targets, layouts, layout renderers, etc.). + + Base type for each item instance. + Item definition type (typically or ). + + + + Registers new item definition. + + Name of the item. + Item definition. + + + + Tries to get registered item definition. + + Name of the item. + Reference to a variable which will store the item definition. + Item definition. + + + + Creates item instance. + + Name of the item. + Newly created item instance. + + + + Tries to create an item instance. + + Name of the item. + The result. + True if instance was created successfully, false otherwise. + + + + Provides context for install/uninstall operations. + + + + + Mapping between log levels and console output colors. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The log output. + + + + Gets or sets the installation log level. + + + + + Gets or sets a value indicating whether to ignore failures during installation. + + + + + Whether installation exceptions should be rethrown. If IgnoreFailures is set to true, + this property has no effect (there are no exceptions to rethrow). + + + + + Gets the installation parameters. + + + + + Gets or sets the log output. + + + + + Logs the specified trace message. + + The message. + The arguments. + + + + Logs the specified debug message. + + The message. + The arguments. + + + + Logs the specified informational message. + + The message. + The arguments. + + + + Logs the specified warning message. + + The message. + The arguments. + + + + Logs the specified error message. + + The message. + The arguments. + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Creates the log event which can be used to render layouts during installation/uninstallations. + + Log event info object. + + + + Convert object-value into specified type + + + + + Parses the input value and converts into the wanted type + + Input Value + Wanted Type + Format to use when parsing + Culture to use when parsing + Output value with wanted type + + + + Interface for fluent setup of LogFactory options + + + + + LogFactory under configuration + + + + + Interface for fluent setup of LogFactory options for extension loading + + + + + LogFactory under configuration + + + + + Interface for fluent setup of LogFactory options for enabling NLog + + + + + LogFactory under configuration + + + + + Interface for fluent setup of LogFactory options + + + + + LogFactory under configuration + + + + + LoggingConfiguration being built + + + + + Interface for fluent setup of LogFactory options for logevent serialization + + + + + LogFactory under configuration + + + + + Encapsulates and the logic to match the actual logger name + All subclasses defines immutable objects. + Concrete subclasses defines various matching rules through + + + + + Creates a concrete based on . + + + Rules used to select the concrete implementation returned: + + if is null => returns (never matches) + if doesn't contains any '*' nor '?' => returns (matches only on case sensitive equals) + if == '*' => returns (always matches) + if doesn't contain '?' + + if contains exactly 2 '*' one at the beginning and one at the end (i.e. "*foobar*) => returns + if contains exactly 1 '*' at the beginning (i.e. "*foobar") => returns + if contains exactly 1 '*' at the end (i.e. "foobar*") => returns + + + returns + + + + It may include one or more '*' or '?' wildcards at any position. + + '*' means zero or more occurrences of any character + '?' means exactly one occurrence of any character + + + A concrete + + + + Returns the argument passed to + + + + + Checks whether given name matches the logger name pattern. + + String to be matched. + A value of when the name matches, otherwise. + + + + Defines a that never matches. + Used when pattern is null + + + + + Defines a that always matches. + Used when pattern is '*' + + + + + Defines a that matches with a case-sensitive Equals + Used when pattern is a string without wildcards '?' '*' + + + + + Defines a that matches with a case-sensitive StartsWith + Used when pattern is a string like "*foobar" + + + + + Defines a that matches with a case-sensitive EndsWith + Used when pattern is a string like "foobar*" + + + + + Defines a that matches with a case-sensitive Contains + Used when pattern is a string like "*foobar*" + + + + + Defines a that matches with a complex wildcards combinations: + + '*' means zero or more occurrences of any character + '?' means exactly one occurrence of any character + + used when pattern is a string containing any number of '?' or '*' in any position + i.e. "*Server[*].Connection[?]" + + + + + Keeps logging configuration and provides simple API to modify it. + + This class is thread-safe..ToList() is used for that purpose. + + + + Variables defined in xml or in API. name is case case insensitive. + + + + + Gets the factory that will be configured + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Use the old exception log handling of NLog 3.0? + + This method was marked as obsolete on NLog 4.1 and it may be removed in a future release. + + + + Gets the variables defined in the configuration. + + + + + Gets a collection of named targets specified in the configuration. + + + A list of named targets. + + + Unnamed targets (such as those wrapped by other targets) are not returned. + + + + + Gets the collection of file names which should be watched for changes by NLog. + + + + + Gets the collection of logging rules. + + + + + Gets or sets the default culture info to use as . + + + Specific culture info or null to use + + + + + Gets all targets. + + + + + Compare objects based on their name. + + This property is use to cache the comparer object. + + + + Defines methods to support the comparison of objects for equality based on their name. + + + + + Registers the specified target object. The name of the target is read from . + + + The target object with a non + + when is + + + + Registers the specified target object under a given name. + + Name of the target. + The target object. + when is + when is + + + + Finds the target with the specified name. + + + The name of the target to be found. + + + Found target or when the target is not found. + + + + + Finds the target with the specified name and specified type. + + + The name of the target to be found. + + Type of the target + + Found target or when the target is not found of not of type + + + + + Add a rule with min- and maxLevel. + + Minimum log level needed to trigger this rule. + Maximum log level needed to trigger this rule. + Name of the target to be written when the rule matches. + Logger name pattern. It may include the '*' wildcard at the beginning, at the end or at both ends. + + + + Add a rule with min- and maxLevel. + + Minimum log level needed to trigger this rule. + Maximum log level needed to trigger this rule. + Target to be written to when the rule matches. + Logger name pattern. It may include the '*' wildcard at the beginning, at the end or at both ends. + + + + Add a rule with min- and maxLevel. + + Minimum log level needed to trigger this rule. + Maximum log level needed to trigger this rule. + Target to be written to when the rule matches. + Logger name pattern. It may include the '*' wildcard at the beginning, at the end or at both ends. + Gets or sets a value indicating whether to quit processing any further rule when this one matches. + + + + Add a rule for one loglevel. + + log level needed to trigger this rule. + Name of the target to be written when the rule matches. + Logger name pattern. It may include the '*' wildcard at the beginning, at the end or at both ends. + + + + Add a rule for one loglevel. + + log level needed to trigger this rule. + Target to be written to when the rule matches. + Logger name pattern. It may include the '*' wildcard at the beginning, at the end or at both ends. + + + + Add a rule for one loglevel. + + log level needed to trigger this rule. + Target to be written to when the rule matches. + Logger name pattern. It may include the '*' wildcard at the beginning, at the end or at both ends. + Gets or sets a value indicating whether to quit processing any further rule when this one matches. + + + + Add a rule for all loglevels. + + Name of the target to be written when the rule matches. + Logger name pattern. It may include the '*' wildcard at the beginning, at the end or at both ends. + + + + Add a rule for all loglevels. + + Target to be written to when the rule matches. + Logger name pattern. It may include the '*' wildcard at the beginning, at the end or at both ends. + + + + Add a rule for all loglevels. + + Target to be written to when the rule matches. + Logger name pattern. It may include the '*' wildcard at the beginning, at the end or at both ends. + Gets or sets a value indicating whether to quit processing any further rule when this one matches. + + + + Finds the logging rule with the specified name. + + The name of the logging rule to be found. + Found logging rule or when not found. + + + + Removes the specified named logging rule. + + The name of the logging rule to be removed. + Found one or more logging rule to remove, or when not found. + + + + Called by LogManager when one of the log configuration files changes. + + + A new instance of that represents the updated configuration. + + + + + Removes the specified named target. + + Name of the target. + + + + Installs target-specific objects on current system. + + The installation context. + + Installation typically runs with administrative permissions. + + + + + Uninstalls target-specific objects from current system. + + The installation context. + + Uninstallation typically runs with administrative permissions. + + + + + Closes all targets and releases any unmanaged resources. + + + + + Log to the internal (NLog) logger the information about the and associated with this instance. + + + The information are only recorded in the internal logger if Debug level is enabled, otherwise nothing is + recorded. + + + + + Validates the configuration. + + + + + Copies all variables from provided dictionary into current configuration variables. + + Master variables dictionary + + + + Replace a simple variable with a value. The original value is removed and thus we cannot redo this in a later stage. + + + + + + + Checks whether unused targets exist. If found any, just write an internal log at Warn level. + If initializing not started or failed, then checking process will be canceled + + + + + + + + Arguments for events. + + + + + Initializes a new instance of the class. + + The new configuration. + The old configuration. + + + + Gets the old configuration. + + The old configuration. + + + + Gets the new configuration. + + The new configuration. + + + + Gets the new configuration + + The new configuration. + + + + Gets the old configuration + + The old configuration. + + + + Gets the optional boolean attribute value. + + + Name of the attribute. + Default value to return if the attribute is not found or if there is a parse error + Boolean attribute value or default. + + + + Remove the namespace (before :) + + + x:a, will be a + + + + + + + Enables loading of NLog configuration from a file + + + + + Get default file paths (including filename) for possible NLog config files. + + + + + Get default file paths (including filename) for possible NLog config files. + + + + + Loads NLog configuration from + + + + + Constructor + + + + + + Loads NLog configuration from provided config section + + + + + + + Builds list with unique keys, using last value of duplicates. High priority keys placed first. + + + + + + + Parse loglevel, but don't throw if exception throwing is disabled + + Name of attribute for logging. + Value of parse. + Used if there is an exception + + + + + Parses a single config section within the NLog-config + + + Section was recognized + + + + Parse {Rules} xml element + + + Rules are added to this parameter. + + + + Parse {Logger} xml element + + + + + + Parse boolean + + Name of the property for logging. + value to parse + Default value to return if the parse failed + Boolean attribute value or default. + + + + Arguments for . + + + + + Initializes a new instance of the class. + + Whether configuration reload has succeeded. + + + + Initializes a new instance of the class. + + Whether configuration reload has succeeded. + The exception during configuration reload. + + + + Gets a value indicating whether configuration reload has succeeded. + + A value of true if succeeded; otherwise, false. + + + + Gets the exception which occurred during configuration reload. + + The exception. + + + + Enables FileWatcher for the currently loaded NLog Configuration File, + and supports automatic reload on file modification. + + + + + Represents a logging rule. An equivalent of <logger /> configuration element. + + + + + Create an empty . + + + + + Create an empty . + + + + + Create a new with a and which writes to . + + Logger name pattern used for . It may include one or more '*' or '?' wildcards at any position. + Minimum log level needed to trigger this rule. + Maximum log level needed to trigger this rule. + Target to be written to when the rule matches. + + + + Create a new with a which writes to . + + Logger name pattern used for . It may include one or more '*' or '?' wildcards at any position. + Minimum log level needed to trigger this rule. + Target to be written to when the rule matches. + + + + Create a (disabled) . You should call or see cref="EnableLoggingForLevels"/> to enable logging. + + Logger name pattern used for . It may include one or more '*' or '?' wildcards at any position. + Target to be written to when the rule matches. + + + + Rule identifier to allow rule lookup + + + + + Gets a collection of targets that should be written to when this rule matches. + + + + + Gets a collection of child rules to be evaluated when this rule matches. + + + + + Gets a collection of filters to be checked before writing to targets. + + + + + Gets or sets a value indicating whether to quit processing any further rule when this one matches. + + + + + Gets or sets logger name pattern. + + + Logger name pattern used by to check if a logger name matches this rule. + It may include one or more '*' or '?' wildcards at any position. + + '*' means zero or more occurrences of any character + '?' means exactly one occurrence of any character + + + + + + Gets the collection of log levels enabled by this rule. + + + + + Default action if none of the filters match + + + + + Enables logging for a particular level. + + Level to be enabled. + + + + Enables logging for a particular levels between (included) and . + + Minimum log level needed to trigger this rule. + Maximum log level needed to trigger this rule. + + + + Disables logging for a particular level. + + Level to be disabled. + + + + Disables logging for particular levels between (included) and . + + Minimum log level to be disables. + Maximum log level to de disabled. + + + + Enables logging the levels between (included) and . All the other levels will be disabled. + + >Minimum log level needed to trigger this rule. + Maximum log level needed to trigger this rule. + + + + Returns a string representation of . Used for debugging. + + + A that represents the current . + + + + + Checks whether te particular log level is enabled for this rule. + + Level to be checked. + A value of when the log level is enabled, otherwise. + + + + Checks whether given name matches the . + + String to be matched. + A value of when the name matches, otherwise. + + + + Default filtering with static level config + + + + + Factory for locating methods. + + + + + Initializes a new instance of the class. + + Helper method to extract relevant methods from type + + + + Scans the assembly for classes marked with expected class + and methods marked with expected and adds them + to the factory. + + The types to scan. + The prefix to use for names. + + + + Registers the type. + + The type to register. + The item name prefix. + + + + Scans a type for relevant methods with their symbolic names + + Include types that are marked with this attribute + Include methods that are marked with this attribute + Class Type to scan + Collection of methods with their symbolic names + + + + Clears contents of the factory. + + + + + Registers the definition of a single method. + + The method name. + The method info. + + + + Registers the definition of a single method. + + The method name. + The method info. + The precompiled method delegate. + + + + Tries to retrieve method by name. + + The method name. + The result. + A value of true if the method was found, false otherwise. + + + + Tries to retrieve method-delegate by name. + + The method name. + The result. + A value of true if the method was found, false otherwise. + + + + Retrieves method by name. + + Method name. + MethodInfo object. + + + + Retrieves method by name. + + Method name. + Method delegate object. + + + + Tries to get method definition. + + The method name. + The result. + A value of true if the method was found, false otherwise. + + + + Marks the layout or layout renderer depends on mutable objects from the LogEvent + + This can be or + + + + + Attaches a simple name to an item (such as , + , , etc.). + + + + + Initializes a new instance of the class. + + The name of the item. + + + + Gets the name of the item. + + The name of the item. + + + + Indicates NLog should not scan this property during configuration. + + + + + Initializes a new instance of the class. + + + + + Marks the object as configuration item for NLog. + + + + + Initializes a new instance of the class. + + + + + Represents simple XML element with case-insensitive attribute semantics. + + + + + Initializes a new instance of the class. + + The reader to initialize element from. + + + + Prevents a default instance of the class from being created. + + + + + Gets the element name. + + + + + Gets the dictionary of attribute values. + + + + + Gets the collection of child elements. + + + + + Gets the value of the element. + + + + + Last error occured during configuration read + + + + + Returns children elements with the specified element name. + + Name of the element. + Children elements with the specified element name. + + + + Asserts that the name of the element is among specified element names. + + The allowed names. + + + + Returns all parsing errors from current and all child elements. + + + + + Special attribute we could ignore + + + + + Default implementation of + + + + + + + + Attribute used to mark the required parameters for targets, + layout targets and filters. + + + + + Provides simple programmatic configuration API used for trivial logging cases. + + Warning, these methods will overwrite the current config. + + + + + Configures NLog for console logging so that all messages above and including + the level are output to the console. + + + + + Configures NLog for console logging so that all messages above and including + the specified level are output to the console. + + The minimal logging level. + + + + Configures NLog for to log to the specified target so that all messages + above and including the level are output. + + The target to log all messages to. + + + + Configures NLog for to log to the specified target so that all messages + above and including the specified level are output. + + The target to log all messages to. + The minimal logging level. + + + + Configures NLog for file logging so that all messages above and including + the level are written to the specified file. + + Log file name. + + + + Configures NLog for file logging so that all messages above and including + the specified level are written to the specified file. + + Log file name. + The minimal logging level. + + + + Value indicating how stack trace should be captured when processing the log event. + + + + + Stack trace should not be captured. + + + + + Stack trace should be captured without source-level information. + + + + + Stack trace should be captured including source-level information such as line numbers. + + + + + Capture maximum amount of the stack trace information supported on the platform. + + + + + Marks the layout or layout renderer as thread independent - it producing correct results + regardless of the thread it's running on. + + Without this attribute everything is rendered on the main thread. + + + If this attribute is set on a layout, it could be rendered on the another thread. + This could be more efficient as it's skipped when not needed. + + If context like HttpContext.Current is needed, which is only available on the main thread, this attribute should not be applied. + + See the AsyncTargetWrapper and BufferTargetWrapper with the , using + + Apply this attribute when: + - The result can we rendered in another thread. Delaying this could be more efficient. And/Or, + - The result should not be precalculated, for example the target sends some extra context information. + + + + + Marks the layout or layout renderer as thread safe - it producing correct results + regardless of the number of threads it's running on. + + Without this attribute then the target concurrency will be reduced + + + + + A class for configuring NLog through an XML configuration file + (App.config style or App.nlog style). + + Parsing of the XML file is also implemented in this class. + + + - This class is thread-safe..ToList() is used for that purpose. + - Update TemplateXSD.xml for changes outside targets + + + + + Initializes a new instance of the class. + + Configuration file to be read. + + + + Initializes a new instance of the class. + + Configuration file to be read. + The to which to apply any applicable configuration values. + + + + Initializes a new instance of the class. + + Configuration file to be read. + Ignore any errors during configuration. + + + + Initializes a new instance of the class. + + Configuration file to be read. + Ignore any errors during configuration. + The to which to apply any applicable configuration values. + + + + Initializes a new instance of the class. + + XML reader to read from. + + + + Initializes a new instance of the class. + + containing the configuration section. + Name of the file that contains the element (to be used as a base for including other files). null is allowed. + + + + Initializes a new instance of the class. + + containing the configuration section. + Name of the file that contains the element (to be used as a base for including other files). null is allowed. + The to which to apply any applicable configuration values. + + + + Initializes a new instance of the class. + + containing the configuration section. + Name of the file that contains the element (to be used as a base for including other files). null is allowed. + Ignore any errors during configuration. + + + + Initializes a new instance of the class. + + containing the configuration section. + Name of the file that contains the element (to be used as a base for including other files). null is allowed. + Ignore any errors during configuration. + The to which to apply any applicable configuration values. + + + + Initializes a new instance of the class. + + The XML contents. + Name of the XML file. + The to which to apply any applicable configuration values. + + + + Parse XML string as NLog configuration + + NLog configuration in XML to be parsed + + + + Parse XML string as NLog configuration + + NLog configuration in XML to be parsed + NLog LogFactory + + + + Did the Succeeded? true= success, false= error, null = initialize not started yet. + + + + + Gets or sets a value indicating whether all of the configuration files + should be watched for changes and reloaded automatically when changed. + + + + + Gets the collection of file names which should be watched for changes by NLog. + This is the list of configuration files processed. + If the autoReload attribute is not set it returns empty collection. + + + + + Re-reads the original configuration file and returns the new object. + + The new object. + + + + Get file paths (including filename) for the possible NLog config files. + + The file paths to the possible config file + + + + Overwrite the paths (including filename) for the possible NLog config files. + + The file paths to the possible config file + + + + Clear the candidate file paths and return to the defaults. + + + + + Create XML reader for (xml config) file. + + filepath + reader or null if filename is empty. + + + + Initializes the configuration. + + containing the configuration section. + Name of the file that contains the element (to be used as a base for including other files). null is allowed. + Ignore any errors during configuration. + + + + Checks whether any error during XML configuration parsing has occured. + If there are any and ThrowConfigExceptions or ThrowExceptions + setting is enabled - throws NLogConfigurationException, otherwise + just write an internal log at Warn level. + + Root NLog configuration xml element + + + + Add a file with configuration. Check if not already included. + + + + + + + Parse the root + + + path to config file. + The default value for the autoReload option. + + + + Parse {configuration} xml element. + + + path to config file. + The default value for the autoReload option. + + + + Parse {NLog} xml element. + + + path to config file. + The default value for the autoReload option. + + + + Parses a single config section within the NLog-config + + + Section was recognized + + + + Include (multiple) files by filemask, e.g. *.nlog + + base directory in case if is relative + relative or absolute fileMask + + + + + + + + Matches when the specified condition is met. + + + Conditions are expressed using a simple language + described here. + + + + + Gets or sets the condition expression. + + + + + + Checks whether log event should be logged or not. + + Log event. + + - if the log event should be ignored
+ - if the filter doesn't want to decide
+ - if the log event should be logged
+ .
+
+ + + An abstract filter class. Provides a way to eliminate log messages + based on properties other than logger name and log level. + + + + + Initializes a new instance of the class. + + + + + Gets or sets the action to be taken when filter matches. + + + + + + Gets the result of evaluating filter against given log event. + + The log event. + Filter result. + + + + Checks whether log event should be logged or not. + + Log event. + + - if the log event should be ignored
+ - if the filter doesn't want to decide
+ - if the log event should be logged
+ .
+
+ + + Marks class as a layout renderer and assigns a name to it. + + + + + Initializes a new instance of the class. + + Name of the filter. + + + + Filter result. + + + + + The filter doesn't want to decide whether to log or discard the message. + + + + + The message should be logged. + + + + + The message should not be logged. + + + + + The message should be logged and processing should be finished. + + + + + The message should not be logged and processing should be finished. + + + + + A base class for filters that are based on comparing a value to a layout. + + + + + Initializes a new instance of the class. + + + + + Gets or sets the layout to be used to filter log messages. + + The layout. + + + + + Matches when the calculated layout contains the specified substring. + This filter is deprecated in favor of <when /> which is based on conditions. + + + + + Gets or sets a value indicating whether to ignore case when comparing strings. + + + + + + Gets or sets the substring to be matched. + + + + + + Checks whether log event should be logged or not. + + Log event. + + - if the log event should be ignored
+ - if the filter doesn't want to decide
+ - if the log event should be logged
+ .
+
+ + + Matches when the calculated layout is equal to the specified substring. + This filter is deprecated in favor of <when /> which is based on conditions. + + + + + Gets or sets a value indicating whether to ignore case when comparing strings. + + + + + + Gets or sets a string to compare the layout to. + + + + + + Checks whether log event should be logged or not. + + Log event. + + - if the log event should be ignored
+ - if the filter doesn't want to decide
+ - if the log event should be logged
+ .
+
+ + + Matches the provided filter-method + + + + + Initializes a new instance of the class. + + + + + + + + Matches when the calculated layout does NOT contain the specified substring. + This filter is deprecated in favor of <when /> which is based on conditions. + + + + + Gets or sets the substring to be matched. + + + + + + Gets or sets a value indicating whether to ignore case when comparing strings. + + + + + + Checks whether log event should be logged or not. + + Log event. + + - if the log event should be ignored
+ - if the filter doesn't want to decide
+ - if the log event should be logged
+ .
+
+ + + Matches when the calculated layout is NOT equal to the specified substring. + This filter is deprecated in favor of <when /> which is based on conditions. + + + + + Initializes a new instance of the class. + + + + + Gets or sets a string to compare the layout to. + + + + + + Gets or sets a value indicating whether to ignore case when comparing strings. + + + + + + Checks whether log event should be logged or not. + + Log event. + + - if the log event should be ignored
+ - if the filter doesn't want to decide
+ - if the log event should be logged
+ .
+
+ + + Matches when the result of the calculated layout has been repeated a moment ago + + + + + How long before a filter expires, and logging is accepted again + + + + + + Max length of filter values, will truncate if above limit + + + + + + Applies the configured action to the initial logevent that starts the timeout period. + Used to configure that it should ignore all events until timeout. + + + + + + Max number of unique filter values to expect simultaneously + + + + + + Default number of unique filter values to expect, will automatically increase if needed + + + + + + Insert FilterCount value into when an event is no longer filtered + + + + + + Append FilterCount to the when an event is no longer filtered + + + + + + Reuse internal buffers, and doesn't have to constantly allocate new buffers + + + + + + Default buffer size for the internal buffers + + + + + + Can be used if has been enabled. + + + + + Initializes a new instance of the class. + + + + + Checks whether log event should be logged or not. In case the LogEvent has just been repeated. + + Log event. + + - if the log event should be ignored
+ - if the filter doesn't want to decide
+ - if the log event should be logged
+ .
+
+ + + Uses object pooling, and prunes stale filter items when the pool runs dry + + + + + Remove stale filter-value from the cache, and fill them into the pool for reuse + + + + + Renders the Log Event into a filter value, that is used for checking if just repeated + + + + + Repeated LogEvent detected. Checks if it should activate filter-action + + + + + Filter Value State (mutable) + + + + + Filter Lookup Key (immutable) + + + + + A global logging class using caller info to find the logger. + + + + + Starts building a log event with the specified . + + The log level. + The full path of the source file that contains the caller. This is the file path at the time of compile. + An instance of the fluent . + + + + Starts building a log event at the Trace level. + + The full path of the source file that contains the caller. This is the file path at the time of compile. + An instance of the fluent . + + + + Starts building a log event at the Debug level. + + The full path of the source file that contains the caller. This is the file path at the time of compile. + An instance of the fluent . + + + + Starts building a log event at the Info level. + + The full path of the source file that contains the caller. This is the file path at the time of compile. + An instance of the fluent . + + + + Starts building a log event at the Warn level. + + The full path of the source file that contains the caller. This is the file path at the time of compile. + An instance of the fluent . + + + + Starts building a log event at the Error level. + + The full path of the source file that contains the caller. This is the file path at the time of compile. + An instance of the fluent . + + + + Starts building a log event at the Fatal level. + + The full path of the source file that contains the caller. This is the file path at the time of compile. + An instance of the fluent . + + + + A fluent class to build log events for NLog. + + + + + Initializes a new instance of the class. + + The to send the log event. + + + + Initializes a new instance of the class. + + The to send the log event. + The for the log event. + + + + Gets the created by the builder. + + + + + Sets the information of the logging event. + + The exception information of the logging event. + current for chaining calls. + + + + Sets the level of the logging event. + + The level of the logging event. + current for chaining calls. + + + + Sets the logger name of the logging event. + + The logger name of the logging event. + current for chaining calls. + + + + Sets the log message on the logging event. + + The log message for the logging event. + current for chaining calls. + + + + Sets the log message and parameters for formatting on the logging event. + + A composite format string. + The object to format. + current for chaining calls. + + + + Sets the log message and parameters for formatting on the logging event. + + A composite format string. + The first object to format. + The second object to format. + current for chaining calls. + + + + Sets the log message and parameters for formatting on the logging event. + + A composite format string. + The first object to format. + The second object to format. + The third object to format. + current for chaining calls. + + + + Sets the log message and parameters for formatting on the logging event. + + A composite format string. + The first object to format. + The second object to format. + The third object to format. + The fourth object to format. + current for chaining calls. + + + + Sets the log message and parameters for formatting on the logging event. + + A composite format string. + An object array that contains zero or more objects to format. + current for chaining calls. + + + + Sets the log message and parameters for formatting on the logging event. + + An object that supplies culture-specific formatting information. + A composite format string. + An object array that contains zero or more objects to format. + current for chaining calls. + + + + Sets a per-event context property on the logging event. + + The name of the context property. + The value of the context property. + current for chaining calls. + + + + Sets multiple per-event context properties on the logging event. + + The properties to set. + current for chaining calls. + + + + Sets the timestamp of the logging event. + + The timestamp of the logging event. + current for chaining calls. + + + + Sets the stack trace for the event info. + + The stack trace. + Index of the first user stack frame within the stack trace. + current for chaining calls. + + + + Writes the log event to the underlying logger. + + The method or property name of the caller to the method. This is set at by the compiler. + The full path of the source file that contains the caller. This is set at by the compiler. + The line number in the source file at which the method is called. This is set at by the compiler. + + + + Writes the log event to the underlying logger if the condition delegate is true. + + If condition is true, write log event; otherwise ignore event. + The method or property name of the caller to the method. This is set at by the compiler. + The full path of the source file that contains the caller. This is set at by the compiler. + The line number in the source file at which the method is called. This is set at by the compiler. + + + + Writes the log event to the underlying logger if the condition is true. + + If condition is true, write log event; otherwise ignore event. + The method or property name of the caller to the method. This is set at by the compiler. + The full path of the source file that contains the caller. This is set at by the compiler. + The line number in the source file at which the method is called. This is set at by the compiler. + + + + Extension methods for NLog . + + + + + Starts building a log event with the specified . + + The logger to write the log event to. + The log level. + current for chaining calls. + + + + Starts building a log event at the Trace level. + + The logger to write the log event to. + current for chaining calls. + + + + Starts building a log event at the Debug level. + + The logger to write the log event to. + current for chaining calls. + + + + Starts building a log event at the Info level. + + The logger to write the log event to. + current for chaining calls. + + + + Starts building a log event at the Warn level. + + The logger to write the log event to. + current for chaining calls. + + + + Starts building a log event at the Error level. + + The logger to write the log event to. + current for chaining calls. + + + + Starts building a log event at the Fatal level. + + The logger to write the log event to. + current for chaining calls. + + + + Global Diagnostics Context + + This class was marked as obsolete on NLog 2.0 and it may be removed in a future release. + + + + Sets the Global Diagnostics Context item to the specified value. + + Item name. + Item value. + + + + Gets the Global Diagnostics Context named item. + + Item name. + The value of , if defined; otherwise . + If the value isn't a already, this call locks the for reading the needed for converting to . + + + + Gets the Global Diagnostics Context item. + + Item name. + to use when converting the item's value to a string. + The value of as a string, if defined; otherwise . + If is null and the value isn't a already, this call locks the for reading the needed for converting to . + + + + Gets the Global Diagnostics Context named item. + + Item name. + The value of , if defined; otherwise null. + + + + Checks whether the specified item exists in the Global Diagnostics Context. + + Item name. + A boolean indicating whether the specified item exists in current thread GDC. + + + + Removes the specified item from the Global Diagnostics Context. + + Item name. + + + + Clears the content of the GDC. + + + + + Global Diagnostics Context - a dictionary structure to hold per-application-instance values. + + + + + Sets the Global Diagnostics Context item to the specified value. + + Item name. + Item value. + + + + Sets the Global Diagnostics Context item to the specified value. + + Item name. + Item value. + + + + Gets the Global Diagnostics Context named item. + + Item name. + The value of , if defined; otherwise . + If the value isn't a already, this call locks the for reading the needed for converting to . + + + + Gets the Global Diagnostics Context item. + + Item name. + to use when converting the item's value to a string. + The value of as a string, if defined; otherwise . + If is null and the value isn't a already, this call locks the for reading the needed for converting to . + + + + Gets the Global Diagnostics Context named item. + + Item name. + The item value, if defined; otherwise null. + + + + Returns all item names + + A collection of the names of all items in the Global Diagnostics Context. + + + + Checks whether the specified item exists in the Global Diagnostics Context. + + Item name. + A boolean indicating whether the specified item exists in current thread GDC. + + + + Removes the specified item from the Global Diagnostics Context. + + Item name. + + + + Clears the content of the GDC. + + + + + Include context properties + + + + + Gets or sets a value indicating whether to include contents of the dictionary. + + + + + + Gets or sets a value indicating whether to include contents of the stack. + + + + + + Gets or sets the option to include all properties from the log events + + + + + + Gets or sets a value indicating whether to include contents of the dictionary. + + + + + + Gets or sets a value indicating whether to include contents of the stack. + + + + + + Interface for serialization of object values into JSON format + + + + + Serialization of an object into JSON format. + + The object to serialize to JSON. + Output destination. + Serialize succeeded (true/false) + + + + Auto-generated Logger members for binary compatibility with NLog 1.0. + + + Provides logging interface and utility functions. + + + + + Writes the diagnostic message at the Trace level. + + A to be written. + + + + Writes the diagnostic message at the Trace level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the Trace level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the Trace level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format.s + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level. + + A to be written. + + + + Writes the diagnostic message at the Debug level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the Debug level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the Debug level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level. + + A to be written. + + + + Writes the diagnostic message at the Info level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the Info level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the Info level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level. + + A to be written. + + + + Writes the diagnostic message at the Warn level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the Warn level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the Warn level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level. + + A to be written. + + + + Writes the diagnostic message at the Error level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the Error level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the Error level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level. + + A to be written. + + + + Writes the diagnostic message at the Fatal level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the Fatal level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Gets a value indicating whether logging is enabled for the Trace level. + + A value of if logging is enabled for the Trace level, otherwise it returns . + + + + Gets a value indicating whether logging is enabled for the Debug level. + + A value of if logging is enabled for the Debug level, otherwise it returns . + + + + Gets a value indicating whether logging is enabled for the Info level. + + A value of if logging is enabled for the Info level, otherwise it returns . + + + + Gets a value indicating whether logging is enabled for the Warn level. + + A value of if logging is enabled for the Warn level, otherwise it returns . + + + + Gets a value indicating whether logging is enabled for the Error level. + + A value of if logging is enabled for the Error level, otherwise it returns . + + + + Gets a value indicating whether logging is enabled for the Fatal level. + + A value of if logging is enabled for the Fatal level, otherwise it returns . + + + + Writes the diagnostic message at the Trace level using the specified format provider and format parameters. + + + Writes the diagnostic message at the Trace level. + + Type of the value. + The value to be written. + + + + Writes the diagnostic message at the Trace level. + + Type of the value. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the Trace level. + + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Trace level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message and exception at the Trace level. + + A to be written. + An exception to be logged. + + + + Writes the diagnostic message and exception at the Trace level. + + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message and exception at the Trace level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message at the Trace level using the specified parameters and formatting them with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Trace level. + + Log message. + + + + Writes the diagnostic message at the Trace level using the specified parameters. + + A containing format items. + Arguments to format. + + + + Writes the diagnostic message and exception at the Trace level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message at the Trace level using the specified parameter and formatting it with the supplied format provider. + + The type of the argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified parameter. + + The type of the argument. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Trace level using the specified parameters. + + The type of the first argument. + The type of the second argument. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Trace level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Trace level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Debug level using the specified format provider and format parameters. + + + Writes the diagnostic message at the Debug level. + + Type of the value. + The value to be written. + + + + Writes the diagnostic message at the Debug level. + + Type of the value. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the Debug level. + + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Debug level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message and exception at the Debug level. + + A to be written. + An exception to be logged. + + + + Writes the diagnostic message and exception at the Debug level. + + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message and exception at the Debug level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message at the Debug level using the specified parameters and formatting them with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Debug level. + + Log message. + + + + Writes the diagnostic message at the Debug level using the specified parameters. + + A containing format items. + Arguments to format. + + + + Writes the diagnostic message and exception at the Debug level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message at the Debug level using the specified parameter and formatting it with the supplied format provider. + + The type of the argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified parameter. + + The type of the argument. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Debug level using the specified parameters. + + The type of the first argument. + The type of the second argument. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Debug level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Debug level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Info level using the specified format provider and format parameters. + + + Writes the diagnostic message at the Info level. + + Type of the value. + The value to be written. + + + + Writes the diagnostic message at the Info level. + + Type of the value. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the Info level. + + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Info level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message and exception at the Info level. + + A to be written. + An exception to be logged. + + + + Writes the diagnostic message and exception at the Info level. + + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message and exception at the Info level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message at the Info level using the specified parameters and formatting them with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Info level. + + Log message. + + + + Writes the diagnostic message at the Info level using the specified parameters. + + A containing format items. + Arguments to format. + + + + Writes the diagnostic message and exception at the Info level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message at the Info level using the specified parameter and formatting it with the supplied format provider. + + The type of the argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified parameter. + + The type of the argument. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Info level using the specified parameters. + + The type of the first argument. + The type of the second argument. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Info level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Info level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Warn level using the specified format provider and format parameters. + + + Writes the diagnostic message at the Warn level. + + Type of the value. + The value to be written. + + + + Writes the diagnostic message at the Warn level. + + Type of the value. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the Warn level. + + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Warn level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message and exception at the Warn level. + + A to be written. + An exception to be logged. + + + + Writes the diagnostic message and exception at the Warn level. + + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message and exception at the Warn level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message at the Warn level using the specified parameters and formatting them with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Warn level. + + Log message. + + + + Writes the diagnostic message at the Warn level using the specified parameters. + + A containing format items. + Arguments to format. + + + + Writes the diagnostic message and exception at the Warn level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message at the Warn level using the specified parameter and formatting it with the supplied format provider. + + The type of the argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified parameter. + + The type of the argument. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Warn level using the specified parameters. + + The type of the first argument. + The type of the second argument. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Warn level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Warn level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Error level using the specified format provider and format parameters. + + + Writes the diagnostic message at the Error level. + + Type of the value. + The value to be written. + + + + Writes the diagnostic message at the Error level. + + Type of the value. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the Error level. + + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Error level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message and exception at the Error level. + + A to be written. + An exception to be logged. + + + + Writes the diagnostic message and exception at the Error level. + + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message and exception at the Error level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message at the Error level using the specified parameters and formatting them with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Error level. + + Log message. + + + + Writes the diagnostic message at the Error level using the specified parameters. + + A containing format items. + Arguments to format. + + + + Writes the diagnostic message and exception at the Error level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message at the Error level using the specified parameter and formatting it with the supplied format provider. + + The type of the argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified parameter. + + The type of the argument. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Error level using the specified parameters. + + The type of the first argument. + The type of the second argument. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Error level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Error level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified format provider and format parameters. + + + Writes the diagnostic message at the Fatal level. + + Type of the value. + The value to be written. + + + + Writes the diagnostic message at the Fatal level. + + Type of the value. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the Fatal level. + + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Fatal level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message and exception at the Fatal level. + + A to be written. + An exception to be logged. + + + + Writes the diagnostic message and exception at the Fatal level. + + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message and exception at the Fatal level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message at the Fatal level using the specified parameters and formatting them with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Fatal level. + + Log message. + + + + Writes the diagnostic message at the Fatal level using the specified parameters. + + A containing format items. + Arguments to format. + + + + Writes the diagnostic message and exception at the Fatal level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message at the Fatal level using the specified parameter and formatting it with the supplied format provider. + + The type of the argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified parameter. + + The type of the argument. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified parameters. + + The type of the first argument. + The type of the second argument. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Auto-generated Logger members for binary compatibility with NLog 1.0. + + + Logger with only generic methods (passing 'LogLevel' to methods) and core properties. + + + + + Writes the diagnostic message at the specified level. + + The log level. + A to be written. + + + + Writes the diagnostic message at the specified level. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the specified level using the specified parameters. + + The log level. + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the specified level using the specified parameters. + + The log level. + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Occurs when logger configuration changes. + + + + + Gets the name of the logger. + + + + + Gets the factory that created this logger. + + + + + Gets a value indicating whether logging is enabled for the specified level. + + Log level to be checked. + A value of if logging is enabled for the specified level, otherwise it returns . + + + + Writes the specified diagnostic message. + + Log event. + + + + Writes the specified diagnostic message. + + The name of the type that wraps Logger. + Log event. + + + + Writes the diagnostic message at the specified level using the specified format provider and format parameters. + + + Writes the diagnostic message at the specified level. + + Type of the value. + The log level. + The value to be written. + + + + Writes the diagnostic message at the specified level. + + Type of the value. + The log level. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the specified level. + + The log level. + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the specified level. + + The log level. + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message and exception at the specified level. + + The log level. + A to be written. + Arguments to format. + An exception to be logged. + + + + Writes the diagnostic message and exception at the specified level. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + Arguments to format. + An exception to be logged. + + + + Writes the diagnostic message at the specified level using the specified parameters and formatting them with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the specified level. + + The log level. + Log message. + + + + Writes the diagnostic message at the specified level using the specified parameters. + + The log level. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message and exception at the specified level. + + The log level. + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message at the specified level using the specified parameter and formatting it with the supplied format provider. + + The type of the argument. + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified parameter. + + The type of the argument. + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the specified level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The log level. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the specified level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the specified level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + The log level. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Extensions for NLog . + + + + + Writes the diagnostic message and exception at the specified level. + + A logger implementation that will handle the message. + The log level. + An exception to be logged. + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Trace level. + + A logger implementation that will handle the message. + An exception to be logged. + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Debug level. + + A logger implementation that will handle the message. + An exception to be logged. + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Info level. + + A logger implementation that will handle the message. + An exception to be logged. + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Warn level. + + A logger implementation that will handle the message. + An exception to be logged. + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Error level. + + A logger implementation that will handle the message. + An exception to be logged. + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Fatal level. + + A logger implementation that will handle the message. + An exception to be logged. + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Allocates new builder and appends to the provided target builder on dispose + + + + + Access the new builder allocated + + + + + Helpers for . + + + + + Load from url + + file or path, including .dll + basepath, optional + + + + + Load from url + + name without .dll + + + + + Forward declare of system delegate type for use by other classes + + + + + Keeps track of pending operation count, and can notify when pending operation count reaches zero + + + + + Mark operation has started + + + + + Mark operation has completed + + Exception coming from the completed operation [optional] + + + + Registers an AsyncContinuation to be called when all pending operations have completed + + Invoked on completion + AsyncContinuation operation + + + + Clear o + + + + + Sets the stack trace for the event info. + + The stack trace. + Index of the first user stack frame within the stack trace. + Type of the logger or logger wrapper. This is still Logger if it's a subclass of Logger. + + + + Sets the details retrieved from the Caller Information Attributes + + + + + + + + + Gets the stack frame of the method that did the logging. + + + + + Gets the number index of the stack frame that represents the user + code (not the NLog code). + + + + + Legacy attempt to skip async MoveNext, but caused source file line number to be lost + + + + + Gets the entire stack trace. + + + + + Finds first user stack frame in a stack trace + + The stack trace of the logging method invocation + Type of the logger or logger wrapper. This is still Logger if it's a subclass of Logger. + Index of the first user stack frame or 0 if all stack frames are non-user + + + + This is only done for legacy reason, as the correct method-name and line-number should be extracted from the MoveNext-StackFrame + + The stack trace of the logging method invocation + Starting point for skipping async MoveNext-frames + + + + Assembly to skip? + + Find assembly via this frame. + true, we should skip. + + + + Is this the type of the logger? + + get type of this logger in this frame. + Type of the logger. + + + + + Memory optimized filtering + + Passing state too avoid delegate capture and memory-allocations. + + + + Provides untyped IDictionary interface on top of generic IDictionary. + + The type of the key. + The type of the value. + + + + Initializes a new instance of the DictionaryAdapter class. + + The implementation. + + + + Gets an object containing the values in the object. + + + + An object containing the values in the object. + + + + + Gets the number of elements contained in the . + + + + The number of elements contained in the . + + + + + Gets a value indicating whether access to the is synchronized (thread safe). + + + true if access to the is synchronized (thread safe); otherwise, false. + + + + + Gets an object that can be used to synchronize access to the . + + + + An object that can be used to synchronize access to the . + + + + + Gets a value indicating whether the object has a fixed size. + + + true if the object has a fixed size; otherwise, false. + + + + + Gets a value indicating whether the object is read-only. + + + true if the object is read-only; otherwise, false. + + + + + Gets an object containing the keys of the object. + + + + An object containing the keys of the object. + + + + + Gets or sets the with the specified key. + + Dictionary key. + Value corresponding to key or null if not found + + + + Adds an element with the provided key and value to the object. + + The to use as the key of the element to add. + The to use as the value of the element to add. + + + + Removes all elements from the object. + + + + + Determines whether the object contains an element with the specified key. + + The key to locate in the object. + + True if the contains an element with the key; otherwise, false. + + + + + Returns an object for the object. + + + An object for the object. + + + + + Removes the element with the specified key from the object. + + The key of the element to remove. + + + + Copies the elements of the to an , starting at a particular index. + + The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. + The zero-based index in at which copying begins. + + + + Returns an enumerator that iterates through a collection. + + + An object that can be used to iterate through the collection. + + + + + Wrapper IDictionaryEnumerator. + + + + + Initializes a new instance of the class. + + The wrapped. + + + + Gets both the key and the value of the current dictionary entry. + + + + A containing both the key and the value of the current dictionary entry. + + + + + Gets the key of the current dictionary entry. + + + + The key of the current element of the enumeration. + + + + + Gets the value of the current dictionary entry. + + + + The value of the current element of the enumeration. + + + + + Gets the current element in the collection. + + + + The current element in the collection. + + + + + Advances the enumerator to the next element of the collection. + + + True if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection. + + + + + Sets the enumerator to its initial position, which is before the first element in the collection. + + + + + Ensures that IDictionary.GetEnumerator returns DictionaryEntry values + + + + + UTF-8 BOM 239, 187, 191 + + + + + Safe way to get environment variables. + + + + + Helper class for dealing with exceptions. + + + + + Mark this exception as logged to the . + + + + + + + Is this exception logged to the ? + + + trueif the has been logged to the . + + + + Determines whether the exception must be rethrown and logs the error to the if is false. + + Advised to log first the error to the before calling this method. + + The exception to check. + Target context of the exception. + trueif the must be rethrown, false otherwise. + + + + Determines whether the exception must be rethrown immediately, without logging the error to the . + + Only used this method in special cases. + + The exception to check. + trueif the must be rethrown, false otherwise. + + + + Object construction helper. + + + + + Adapter for to + + + + + Initializes a new instance of the class. + + The to wrap. + + + + Creates an AppDomainWrapper for the current + + + + + Gets or sets the base directory that the assembly resolver uses to probe for assemblies. + + + + + Gets or sets the name of the configuration file for an application domain. + + + + + Gets or sets the list of directories under the application base directory that are probed for private assemblies. + + + + + Gets or set the friendly name. + + + + + Gets an integer that uniquely identifies the application domain within the process. + + + + + Gets the assemblies that have been loaded into the execution context of this application domain. + + A list of assemblies in this application domain. + + + + Process exit event. + + + + + Domain unloaded event. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Interface for fakeable the current . Not fully implemented, please methods/properties as necessary. + + + + + Gets or sets the base directory that the assembly resolver uses to probe for assemblies. + + + + + Gets or sets the name of the configuration file for an application domain. + + + + + Gets or sets the list of directories under the application base directory that are probed for private assemblies. + + + + + Gets or set the friendly name. + + + + + Gets an integer that uniquely identifies the application domain within the process. + + + + + Gets the assemblies that have been loaded into the execution context of this application domain. + + A list of assemblies in this application domain. + + + + Process exit event. + + + + + Domain unloaded event. + + + + + Abstract calls for the application environment + + + + + Gets current process name (excluding filename extension, if any). + + + + + Abstract calls to FileSystem + + + + Determines whether the specified file exists. + The file to check. + + + Returns the content of the specified file + The file to load. + + + + Base class for optimized file appenders. + + + + + Initializes a new instance of the class. + + Name of the file. + The create parameters. + + + + Gets the path of the file, including file extension. + + The name of the file. + + + + Gets or sets the creation time for a file associated with the appender. The time returned is in Coordinated + Universal Time [UTC] standard. + + The creation time of the file. + + + + Gets or sets the creation time for a file associated with the appender. Synchronized by + The time format is based on + + + + + Gets the last time the file associated with the appender is opened. The time returned is in Coordinated + Universal Time [UTC] standard. + + The time the file was last opened. + + + + Gets the file creation parameters. + + The file creation parameters. + + + + Writes the specified bytes. + + The bytes. + + + + Flushes this instance. + + + + + Closes this instance. + + + + + Gets the creation time for a file associated with the appender. The time returned is in Coordinated Universal + Time [UTC] standard. + + The file creation time. + + + + Gets the length in bytes of the file associated with the appender. + + A long value representing the length of the file in bytes. + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Releases unmanaged and - optionally - managed resources. + + True to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Creates the file stream. + + If set to true sets the file stream to allow shared writing. + If larger than 0 then it will be used instead of the default BufferSize for the FileStream. + A object which can be used to write to the file. + + + + Base class for optimized file appenders which require the usage of a mutex. + + It is possible to use this class as replacement of BaseFileAppender and the mutex functionality + is not enforced to the implementing subclasses. + + + + + Initializes a new instance of the class. + + Name of the file. + The create parameters. + + + + Gets the mutually-exclusive lock for archiving files. + + The mutex for archiving. + + + + Releases unmanaged and - optionally - managed resources. + + True to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Creates a mutex that is sharable by more than one process. + + The prefix to use for the name of the mutex. + A object which is sharable by multiple processes. + + + + Implementation of which caches + file information. + + + + + Initializes a new instance of the class. + + Name of the file. + The parameters. + + + + Closes this instance of the appender. + + + + + Flushes this current appender. + + + + + Gets the creation time for a file associated with the appender. The time returned is in Coordinated Universal + Time [UTC] standard. + + The file creation time. + + + + Gets the length in bytes of the file associated with the appender. + + A long value representing the length of the file in bytes. + + + + Writes the specified bytes to a file. + + The bytes array. + The bytes array offset. + The number of bytes. + + + + Factory class which creates objects. + + + + + Opens the appender for given file name and parameters. + + Name of the file. + Creation parameters. + + Instance of which can be used to write to the file. + + + + + Maintains a collection of file appenders usually associated with file targets. + + + + + An "empty" instance of the class with zero size and empty list of appenders. + + + + + Initializes a new "empty" instance of the class with zero size and empty + list of appenders. + + + + + Initializes a new instance of the class. + + + The size of the list should be positive. No validations are performed during initialization as it is an + internal class. + + Total number of appenders allowed in list. + Factory used to create each appender. + Parameters used for creating a file. + + + + The archive file path pattern that is used to detect when archiving occurs. + + + + + Invalidates appenders for all files that were archived. + + + + + Gets the parameters which will be used for creating a file. + + + + + Gets the file appender factory used by all the appenders in this list. + + + + + Gets the number of appenders which the list can hold. + + + + + Subscribe to background monitoring of active file appenders + + + + + It allocates the first slot in the list when the file name does not already in the list and clean up any + unused slots. + + File name associated with a single appender. + The allocated appender. + + Thrown when is called on an Empty instance. + + + + + Close all the allocated appenders. + + + + + Close the allocated appenders initialized before the supplied time. + + The time which prior the appenders considered expired + + + + Flush all the allocated appenders. + + + + + File Archive Logic uses the File-Creation-TimeStamp to detect if time to archive, and the File-LastWrite-Timestamp to name the archive-file. + + + NLog always closes all relevant appenders during archive operation, so no need to lookup file-appender + + + + + Closes the specified appender and removes it from the list. + + File name of the appender to be closed. + File Appender that matched the filePath (null if none found) + + + + Interface that provides parameters for create file function. + + + + + Gets or sets the delay in milliseconds to wait before attempting to write to the file again. + + + + + Gets or sets the number of times the write is appended on the file before NLog + discards the log message. + + + + + Gets or sets a value indicating whether concurrent writes to the log file by multiple processes on the same host. + + + This makes multi-process logging possible. NLog uses a special technique + that lets it keep the files open for writing. + + + + + Gets or sets a value indicating whether to create directories if they do not exist. + + + Setting this to false may improve performance a bit, but you'll receive an error + when attempting to write to a directory that's not present. + + + + + Gets or sets a value indicating whether to enable log file(s) to be deleted. + + + + + Gets or sets the log file buffer size in bytes. + + + + + Gets or set a value indicating whether a managed file stream is forced, instead of using the native implementation. + + + + + Gets or sets the file attributes (Windows only). + + + + + Should archive mutex be created? + + + + + Should manual simple detection of file deletion be enabled? + + + + + Gets the parameters which will be used for creating a file. + + + + + Gets the file appender factory used by all the appenders in this list. + + + + + Gets the number of appenders which the list can hold. + + + + + Subscribe to background monitoring of active file appenders + + + + + It allocates the first slot in the list when the file name does not already in the list and clean up any + unused slots. + + File name associated with a single appender. + The allocated appender. + + Thrown when is called on an Empty instance. + + + + + Close all the allocated appenders. + + + + + Close the allocated appenders initialized before the supplied time. + + The time which prior the appenders considered expired + + + + Flush all the allocated appenders. + + + + + File Archive Logic uses the File-Creation-TimeStamp to detect if time to archive, and the File-LastWrite-Timestamp to name the archive-file. + + + NLog always closes all relevant appenders during archive operation, so no need to lookup file-appender + + + + + Closes the specified appender and removes it from the list. + + File name of the appender to be closed. + File Appender that matched the filePath (null if none found) + + + + The archive file path pattern that is used to detect when archiving occurs. + + + + + Invalidates appenders for all files that were archived. + + + + + Interface implemented by all factories capable of creating file appenders. + + + + + Opens the appender for given file name and parameters. + + Name of the file. + Creation parameters. + Instance of which can be used to write to the file. + + + + Provides a multi process-safe atomic file appends while + keeping the files open. + + + On Unix you can get all the appends to be atomic, even when multiple + processes are trying to write to the same file, because setting the file + pointer to the end of the file and appending can be made one operation. + On Win32 we need to maintain some synchronization between processes + (global named mutex is used for this) + + + + + Initializes a new instance of the class. + + Name of the file. + The parameters. + + + + Writes the specified bytes. + + The bytes array. + The bytes array offset. + The number of bytes. + + + + Closes this instance. + + + + + Flushes this instance. + + + + + Gets the creation time for a file associated with the appender. The time returned is in Coordinated Universal + Time [UTC] standard. + + The file creation time. + + + + Gets the length in bytes of the file associated with the appender. + + A long value representing the length of the file in bytes. + + + + Factory class. + + + + + Opens the appender for given file name and parameters. + + Name of the file. + Creation parameters. + + Instance of which can be used to write to the file. + + + + + Appender used to discard data for the FileTarget. + Used mostly for testing entire stack except the actual writing to disk. + Throws away all data. + + + + + Factory class. + + + + + Opens the appender for given file name and parameters. + + Name of the file. + Creation parameters. + + Instance of which can be used to write to the file. + + + + + Multi-process and multi-host file appender which attempts + to get exclusive write access and retries if it's not available. + + + + + Initializes a new instance of the class. + + Name of the file. + The parameters. + + + + Writes the specified bytes. + + The bytes array. + The bytes array offset. + The number of bytes. + + + + Flushes this instance. + + + + + Closes this instance. + + + + + Gets the creation time for a file associated with the appender. The time returned is in Coordinated Universal + Time [UTC] standard. + + The file creation time. + + + + Gets the length in bytes of the file associated with the appender. + + A long value representing the length of the file in bytes. + + + + Factory class. + + + + + Opens the appender for given file name and parameters. + + Name of the file. + Creation parameters. + + Instance of which can be used to write to the file. + + + + + Optimized single-process file appender which keeps the file open for exclusive write. + + + + + Initializes a new instance of the class. + + Name of the file. + The parameters. + + + + Writes the specified bytes. + + The bytes array. + The bytes array offset. + The number of bytes. + + + + Flushes this instance. + + + + + Closes this instance. + + + + + Gets the creation time for a file associated with the appender. The time returned is in Coordinated Universal + Time [UTC] standard. + + The file creation time. + + + + Gets the length in bytes of the file associated with the appender. + + A long value representing the length of the file in bytes. + + + + Factory class. + + + + + Opens the appender for given file name and parameters. + + Name of the file. + Creation parameters. + + Instance of which can be used to write to the file. + + + + + A layout that represents a filePath. + + + + + Cached directory separator char array to avoid memory allocation on each method call. + + + + + Cached invalid file names char array to avoid memory allocation every time Path.GetInvalidFileNameChars() is called. + + + + + not null when == false + + + + + non null is fixed, + + + + + is the cache-key, and when newly rendered filename matches the cache-key, + then it reuses the cleaned cache-value . + + + + + is the cache-value that is reused, when the newly rendered filename + matches the cache-key + + + + Initializes a new instance of the class. + + + + Render the raw filename from Layout + + The log event. + StringBuilder to minimize allocations [optional]. + String representation of a layout. + + + + Convert the raw filename to a correct filename + + The filename generated by Layout. + String representation of a correct filename. + + + + Is this (templated/invalid) path an absolute, relative or unknown? + + + + + Is this (templated/invalid) path an absolute, relative or unknown? + + + + + Convert object to string + + value + format for conversion. + + + If is null and isn't a already, then the will get a locked by + + + + + Format a log message + + + + + Format the message and return + + LogEvent with message to be formatted + formatted message + + + + Has the logevent properties? + + LogEvent with message to be formatted + False when logevent has no properties to be extracted + + + + Appends the logevent message to the provided StringBuilder + + LogEvent with message to be formatted + The to append the formatted message. + + + + Get the Raw, unformatted and unstrinyfied, value + + + + + Get the raw value + + + The value + RawValue supported? + + + + Interface implemented by layouts and layout renderers. + + + + + Renders the the value of layout or layout renderer in the context of the specified log event. + + The log event. + String representation of a layout. + + + + Supports mocking of SMTP Client code. + + + + + Specifies how outgoing email messages will be handled. + + + + + Gets or sets the name or IP address of the host used for SMTP transactions. + + + + + Gets or sets the port used for SMTP transactions. + + + + + Gets or sets a value that specifies the amount of time after which a synchronous Send call times out. + + + + + Gets or sets the credentials used to authenticate the sender. + + + + + Sends an e-mail message to an SMTP server for delivery. These methods block while the message is being transmitted. + + + System.Net.Mail.MailMessage + MailMessage + A MailMessage that contains the message to send. + + + + Gets or sets the folder where applications save mail messages to be processed by the local SMTP server. + + + + + Supports rendering as string value with limited or no allocations (preferred) + + + + + Renders the value of layout renderer in the context of the specified log event + + + null if not possible or unknown + + + + Supports object initialization and termination. + + + + + Initializes this instance. + + The configuration. + + + + Closes this instance. + + + + + Allows components to request stack trace information to be provided in the . + + + + + Gets the level of stack trace information required by the implementing class. + + + + + Render the event info as parse as short + + current layout + + default value when the render + layout name for log message to internal log when logging fails + + + + + Render the event info as parse as int + + current layout + + default value when the render + layout name for log message to internal log when logging fails + + + + + Render the event info as parse as bool + + current layout + + default value when the render + layout name for log message to internal log when logging fails + + + + + Logger configuration. + + + + + Initializes a new instance of the class. + + The targets by level. + Use the old exception log handling of NLog 3.0? + + + + Use the old exception log handling of NLog 3.0? + + This method was marked as obsolete before NLog 4.3.11 and it will be removed in NLog 5. + + + + Gets targets for the specified level. + + The level. + Chain of targets with attached filters. + + + + When true: Do not fallback to StringBuilder.Format for positional templates + + + + + New formatter + + When true: Do not fallback to StringBuilder.Format for positional templates + + + + + The MessageFormatter delegate + + + + + + + + Most-Recently-Used-Cache, that discards less frequently used items on overflow + + + + + Constructor + + Maximum number of items the cache will hold before discarding. + + + + Attempt to insert item into cache. + + Key of the item to be inserted in the cache. + Value of the item to be inserted in the cache. + true when the key does not already exist in the cache, false otherwise. + + + + Lookup existing item in cache. + + Key of the item to be searched in the cache. + Output value of the item found in the cache. + True when the key is found in the cache, false otherwise. + + + + Watches multiple files at the same time and raises an event whenever + a single change is detected in any of those files. + + + + + The types of changes to watch for. + + + + + Occurs when a change is detected in one of the monitored files. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Stops watching all files. + + + + + Stops watching the specified file. + + + + + + Watches the specified files for changes. + + The file names. + + + + Supports mocking of SMTP Client code. + + + Disabled Error CS0618 'SmtpClient' is obsolete: 'SmtpClient and its network of types are poorly designed, + we strongly recommend you use https://github.com/jstedfast/MailKit and https://github.com/jstedfast/MimeKit instead' + + + + + Network sender which uses HTTP or HTTPS POST. + + + + + Initializes a new instance of the class. + + The network URL. + + + + Creates instances of objects for given URLs. + + + + + Creates a new instance of the network sender based on a network URL. + + URL that determines the network sender to be created. + The maximum queue size. + SSL protocols for TCP + KeepAliveTime for TCP + + A newly created network sender. + + + + + Interface for mocking socket calls. + + + + + A base class for all network senders. Supports one-way sending of messages + over various protocols. + + + + + Initializes a new instance of the class. + + The network URL. + + + + Gets the address of the network endpoint. + + + + + Gets the last send time. + + + + + Initializes this network sender. + + + + + Closes the sender and releases any unmanaged resources. + + The continuation. + + + + Flushes any pending messages and invokes a continuation. + + The continuation. + + + + Send the given text over the specified protocol. + + Bytes to be sent. + Offset in buffer. + Number of bytes to send. + The asynchronous continuation. + + + + Closes the sender and releases any unmanaged resources. + + + + + Performs sender-specific initialization. + + + + + Performs sender-specific close operation. + + The continuation. + + + + Performs sender-specific flush. + + The continuation. + + + + Actually sends the given text over the specified protocol. + + The bytes to be sent. + Offset in buffer. + Number of bytes to send. + The async continuation to be invoked after the buffer has been sent. + To be overridden in inheriting classes. + + + + Parses the URI into an endpoint address. + + The URI to parse. + The address family. + Parsed endpoint. + + + + Default implementation of . + + + + + + + + A base class for network senders that can block or send out-of-order + + + + + Initializes a new instance of the class. + + URL. Must start with tcp://. + + + + Actually sends the given text over the specified protocol. + + The bytes to be sent. + Offset in buffer. + Number of bytes to send. + The async continuation to be invoked after the buffer has been sent. + To be overridden in inheriting classes. + + + + Performs sender-specific flush. + + The continuation. + + + + Socket proxy for mocking Socket code. + + + + + Initializes a new instance of the class. + + The address family. + Type of the socket. + Type of the protocol. + + + + Gets underlying socket instance. + + + + + Closes the wrapped socket. + + + + + Invokes ConnectAsync method on the wrapped socket. + + The instance containing the event data. + Result of original method. + + + + Invokes SendAsync method on the wrapped socket. + + The instance containing the event data. + Result of original method. + + + + Invokes SendToAsync method on the wrapped socket. + + The instance containing the event data. + Result of original method. + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Sends messages over a TCP network connection. + + + + + Initializes a new instance of the class. + + URL. Must start with tcp://. + The address family. + + + + Creates the socket with given parameters. + + The host address. + The address family. + Type of the socket. + Type of the protocol. + Instance of which represents the socket. + + + + Performs sender-specific initialization. + + + + + Closes the socket. + + The continuation. + + + + Facilitates mocking of class. + + + + + Raises the Completed event. + + + + + Sends messages over the network as UDP datagrams. + + + + + Initializes a new instance of the class. + + URL. Must start with udp://. + The address family. + + + + Creates the socket. + + The address family. + Type of the socket. + Type of the protocol. + Implementation of to use. + + + + Performs sender-specific initialization. + + + + + Closes the socket. + + The continuation. + + + + Sends the specified text as a UDP datagram. + + The bytes to be sent. + Offset in buffer. + Number of bytes to send. + The async continuation to be invoked after the buffer has been sent. + To be overridden in inheriting classes. + + + + Scans (breadth-first) the object graph following all the edges whose are + instances have attached and returns + all objects implementing a specified interfaces. + + + + + Finds the objects which have attached which are reachable + from any of the given root objects when traversing the object graph over public properties. + + Type of the objects to return. + Also search the properties of the wanted objects. + The root objects. + Ordered list of objects implementing T. + + + ISet is not there in .net35, so using HashSet + + + + Helper for extracting propertyPath + + + + + Object Path to check + + + + + Try get value from , using , and set into + + + + + + + + Converts object into a List of property-names and -values using reflection + + + + + Scans properties for name (Skips string-compare and value-lookup until finding match) + + + + + Scans properties for name (Skips property value lookup until finding match) + + + + + Scans properties for name + + + + + Binder for retrieving value of + + + + + + + + Combine paths + + basepath, not null + optional dir + optional file + + + + + Cached directory separator char array to avoid memory allocation on each method call. + + + + + Trims directory separators from the path + + path, could be null + never null + + + + Detects the platform the NLog is running on. + + + + + Gets the current runtime OS. + + + + + Gets a value indicating whether current OS is Win32-based (desktop or mobile). + + + + + Gets a value indicating whether current OS is Unix-based. + + + + + Gets a value indicating whether current runtime is Mono-based + + + + + Gets a value indicating whether current runtime supports use of mutex + + + + + Will creating a mutex succeed runtime? + "Cached" detection + + + + + Will creating a mutex succeed runtime? + + + + + Dictionary that combines the standard with the + MessageTemplate-properties extracted from the . + + The are returned as the first items + in the collection, and in positional order. + + + + + Value of the property + + + + + Is this a property of the message? + + + + + + + Value of the property + Is this a property of the message? + + + + The properties of the logEvent + + + + + The properties extracted from the message + + + + + Injects the list of message-template-parameter into the IDictionary-interface + + Message-template-parameters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Check if the message-template-parameters can be used directly without allocating a dictionary + + Message-template-parameters + Are all parameter names unique (true / false) + + + + Attempt to insert the message-template-parameters into an empty dictionary + + Message-template-parameters + The initially empty dictionary + Message-template-parameters was inserted into dictionary without trouble (true/false) + + + + Attempt to override the existing dictionary values using the message-template-parameters + + Message-template-parameters + The already filled dictionary + List of unique message-template-parameters + + + + + + + + + + + + + + + + + + + + + Will always throw, as collection is readonly + + + Will always throw, as collection is readonly + + + Will always throw, as collection is readonly + + + + + + + + + + + + + + + + + + + Reflection helpers for accessing properties. + + + + + Set value parsed from string. + + object instance to set with property + name of the property on + The value to be parsed. + + + + + Get property info + + object which could have property + property name on + result when success. + success. + + + + Try parse of string to (Generic) list, comma separated. + + + If there is a comma in the value, then (single) quote the value. For single quotes, use the backslash as escape + + + + + Attempt to reuse the HashSet.Comparer from the original HashSet-object (Ex. StringComparer.OrdinalIgnoreCase) + + + + + Try get the property + + + + + Reflection helpers. + + + + + Gets all usable exported types from the given assembly. + + Assembly to scan. + Usable types from the given assembly. + Types which cannot be loaded are skipped. + + + + Is this a static class? + + + + This is a work around, as Type doesn't have this property. + From: https://stackoverflow.com/questions/1175888/determine-if-a-type-is-static + + + + + Optimized delegate for calling MethodInfo + + Object instance, use null for static methods. + Complete list of parameters that matches the method, including optional/default parameters. + + + + + Creates an optimized delegate for calling the MethodInfo using Expression-Trees + + Method to optimize + Optimized delegate for invoking the MethodInfo + + + + Creates an optimized delegate for calling the MethodInfo using Expression-Trees + + Method to optimize + Optimized delegate for invoking the MethodInfo + + + + Compile the ? This can improve the performance, but at the costs of more memory usage. If false, the Regex Cache is used. + + + + + + Gets or sets a value indicating whether to match whole words only. + + + + + + Gets or sets a value indicating whether to ignore case when comparing texts. + + + + + + Controls a single allocated AsyncLogEventInfo-List for reuse (only one active user) + + + + + Controls a single allocated char[]-buffer for reuse (only one active user) + + + + + Controls a single allocated StringBuilder for reuse (only one active user) + + + + + Controls a single allocated object for reuse (only one active user) + + + + Empty handle when is disabled + + + + Creates handle to the reusable char[]-buffer for active usage + + Handle to the reusable item, that can release it again + + + + Access the acquired reusable object + + + + + Controls a single allocated MemoryStream for reuse (only one active user) + + + + + Supported operating systems. + + + If you add anything here, make sure to add the appropriate detection + code to + + + + + Unknown operating system. + + + + + Unix/Linux operating systems. + + + + + Desktop versions of Windows (95,98,ME). + + + + + Windows NT, 2000, 2003 and future versions based on NT technology. + + + + + Macintosh Mac OSX + + + + + Simple character tokenizer. + + + + + Initializes a new instance of the class. + + The text to be tokenized. + + + + Current position in + + + + + Full text to be parsed + + + + + Check current char while not changing the position. + + + + + + Read the current char and change position + + + + + + Get the substring of the + + + + + + + + Implements a single-call guard around given continuation function. + + + + + Initializes a new instance of the class. + + The asynchronous continuation. + + + + Continuation function which implements the single-call guard. + + The exception. + + + + HashSet optimized for single item + + + + + + Insert single item on scope start, and remove on scope exit + + Item to insert in scope + Existing hashset to update + Force allocation of real hashset-container + HashSet EqualityComparer + + + + Add item to collection, if it not already exists + + Item to insert + + + + Clear hashset + + + + + Check if hashset contains item + + + Item exists in hashset (true/false) + + + + Remove item from hashset + + + Item removed from hashset (true/false) + + + + Copy items in hashset to array + + Destination array + Array offset + + + + Create hashset enumerator + + Enumerator + + + + Provides helpers to sort log events and associated continuations. + + + + + Key selector delegate. + + The type of the value. + The type of the key. + Value to extract key information from. + Key selected from log event. + + + + Performs bucket sort (group by) on an array of items and returns a dictionary for easy traversal of the result set. + + The type of the value. + The type of the key. + The inputs. + The key selector function. + + Dictionary where keys are unique input keys, and values are lists of . + + + + + Performs bucket sort (group by) on an array of items and returns a dictionary for easy traversal of the result set. + + The type of the value. + The type of the key. + The inputs. + The key selector function. + + Dictionary where keys are unique input keys, and values are lists of . + + + + + Performs bucket sort (group by) on an array of items and returns a dictionary for easy traversal of the result set. + + The type of the value. + The type of the key. + The inputs. + The key selector function. + The key comparer function. + + Dictionary where keys are unique input keys, and values are lists of . + + + + + Single-Bucket optimized readonly dictionary. Uses normal internally Dictionary if multiple buckets are needed. + + Avoids allocating a new dictionary, when all items are using the same bucket + + The type of the key. + The type of the value. + + + + + + + + + + + + + + + + Allows direct lookup of existing keys. If trying to access non-existing key exception is thrown. + Consider to use instead for better safety. + + Key value for lookup + Mapped value found + + + + Non-Allocating struct-enumerator + + + + + + + + + + + + + Will always throw, as dictionary is readonly + + + Will always throw, as dictionary is readonly + + + + + + Will always throw, as dictionary is readonly + + + Will always throw, as dictionary is readonly + + + + + + + + + Will always throw, as dictionary is readonly + + + + Utilities for dealing with values. + + + + + Gets the fully qualified name of the class invoking the calling method, including the + namespace but not the assembly. + + + + + Gets the fully qualified name of the class invoking the calling method, including the + namespace but not the assembly. + + StackFrame from the calling method + Fully qualified class name + + + + Returns the assembly from the provided StackFrame (If not internal assembly) + + Valid assembly, or null if assembly was internal + + + + Returns the classname from the provided StackFrame (If not from internal assembly) + + + Valid class name, or empty string if assembly was internal + + + + Stream helpers + + + + + Copy to output stream and skip BOM if encoding is UTF8 + + + + + + + + Copy stream input to output. Skip the first bytes + + stream to read from + stream to write to + .net35 doesn't have a .copyto + + + + Copy stream input to output. Skip the first bytes + + stream to read from + stream to write to + first bytes to skip (optional) + + + + Helpers for , which is used in e.g. layout renderers. + + + + + Renders the specified log event context item and appends it to the specified . + + append to this + value to be appended + format string. If @, then serialize the value with the Default JsonConverter. + provider, for example culture + + + + Appends int without using culture, and most importantly without garbage + + + value to append + + + + Appends uint without using culture, and most importantly without garbage + + Credits Gavin Pugh - https://www.gavpugh.com/2010/04/01/xnac-avoiding-garbage-when-working-with-stringbuilder/ + + + value to append + + + + Convert DateTime into UTC and format to yyyy-MM-ddTHH:mm:ss.fffffffZ - ISO 6801 date (Round-Trip-Time) + + + + + Clears the provider StringBuilder + + + + + + Copies the contents of the StringBuilder to the MemoryStream using the specified encoding (Without BOM/Preamble) + + StringBuilder source + MemoryStream destination + Encoding used for converter string into byte-stream + Helper char-buffer to minimize memory allocations + + + + Copies the contents of the StringBuilder to the destination StringBuilder + + StringBuilder source + StringBuilder destination + + + + Scans the StringBuilder for the position of needle character + + StringBuilder source + needle character to search for + + Index of the first occurrence (Else -1) + + + + Scans the StringBuilder for the position of needle character + + StringBuilder source + needle characters to search for + + Index of the first occurrence (Else -1) + + + + Compares the contents of two StringBuilders + + + Correct implementation of that also works when is not the same + + True when content is the same + + + + Compares the contents of a StringBuilder and a String + + True when content is the same + + + + Append a number and pad with 0 to 2 digits + + append to this + the number + + + + Append a number and pad with 0 to 4 digits + + append to this + the number + + + + Append a int type (byte, int) as string + + + + + Constructor + + Max number of items + Initial StringBuilder Size + Max StringBuilder Size + + + + Takes StringBuilder from pool + + Allow return to pool + + + + Releases StringBuilder back to pool at its right place + + + + + Keeps track of acquired pool item + + + + + Releases pool item back into pool + + + + + Helpers for . + + + + + IsNullOrWhiteSpace, including for .NET 3.5 + + + + + + + Split a string + + + + + Split a string, optional quoted value + + Text to split + Character to split the + Quote character + + Escape for the , not escape for the + , use quotes for that. + + + + + Split a string, optional quoted value + + Text to split + Character to split the + Quote character + + Escape for the , not escape for the + , use quotes for that. + + + + + Represents target with a chain of filters which determine + whether logging should happen. + + + + + cached result as calculating is expensive. + + + + + Initializes a new instance of the class. + + The target. + The filter chain. + Default action if none of the filters match. + + + + Gets the target. + + The target. + + + + Gets the filter chain. + + The filter chain. + + + + Default action if none of the filters match. + + + + + Gets or sets the next item in the chain. + + The next item in the chain. + This is for example the 'target2' logger in writeTo='target1,target2' + + + + Gets the stack trace usage. + + A value that determines stack trace handling. + + + + Helper for dealing with thread-local storage. + + + + + Allocates the data slot for storing thread-local information. + + Allocated slot key. + + + + Gets the data for a slot in thread-local storage. + + Type of the data. + The slot to get data for. + Automatically create the object if it doesn't exist. + + Slot data (will create T if null). + + + + + Wraps with a timeout. + + + + + Initializes a new instance of the class. + + The asynchronous continuation. + The timeout. + + + + Continuation function which implements the timeout logic. + + The exception. + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Transformation on a layout. Pre-calculated if the layout has a fixed value. + + + + + Create TransformedLayout. + + Layout + Transformation method + Optional renderer, otherwise is used + + + + + + + Create TransformedLayout. If is null, then the returns null + + Layout + Transformation method + Optional renderer, otherwise is used + null if is null + + + + + + + + + + URL Encoding helper. + + + + Allow UnreservedMarks instead of ReservedMarks, as specified by chosen RFC + + + Use RFC2396 standard (instead of RFC3986) + + + Should use lowercase when doing HEX escaping of special characters + + + Replace space ' ' with '+' instead of '%20' + + + Skip UTF8 encoding, and prefix special characters with '%u' + + + + Escape unicode string data for use in http-requests + + unicode string-data to be encoded + target for the encoded result + s for how to perform the encoding + + + + Convert the wide-char into utf8-bytes, and then escape + + + + + + + + + Is allowed? + + + + + + + + Is a-z / A-Z / 0-9 + + + + + + + Prevents the Xamarin linker from linking the target. + + + By applying this attribute all of the members of the target will be kept as if they had been referenced by the code. + + + + + Ensures that all members of this type are preserved + + + + + Flags the method as a method to preserve during linking if the container class is pulled in. + + + + + Helper class for XML + + + + + removes any unusual unicode characters that can't be encoded into XML + + + + + Cleans string of any invalid XML chars found + + unclean string + string with only valid XML chars + + + + Pretest, small text and not escape needed + + + + + + + + Converts object value to invariant format, and strips any invalid xml-characters + + Object value + Object value converted to string + + + + Converts object value to invariant format (understood by JavaScript) + + Object value + Object value converted to string + + + + XML elements must follow these naming rules: + - Element names are case-sensitive + - Element names must start with a letter or underscore + - Element names can contain letters, digits, hyphens, underscores, and periods + - Element names cannot contain spaces + + + + + + + Converts object value to invariant format (understood by JavaScript) + + Object value + Object TypeCode + Check and remove unusual unicode characters from the result string. + Object value converted to string + + + + Safe version of WriteAttributeString + + + + + + + + + + Safe version of WriteAttributeString + + + + + + + + Safe version of WriteElementSafeString + + + + + + + + + + Safe version of WriteCData + + + + + + + Interface for handling object transformation + + + + + Takes a dangerous (or massive) object and converts into a safe (or reduced) object + + + Null if unknown object, or object cannot be handled + + + + + Provides an interface to execute System.Actions without surfacing any exceptions raised for that action. + + + + + Runs the provided action. If the action throws, the exception is logged at Error level. The exception is not propagated outside of this method. + + Action to execute. + + + + Runs the provided function and returns its result. If an exception is thrown, it is logged at Error level. + The exception is not propagated outside of this method; a default value is returned instead. + + Return type of the provided function. + Function to run. + Result returned by the provided function or the default value of type in case of exception. + + + + Runs the provided function and returns its result. If an exception is thrown, it is logged at Error level. + The exception is not propagated outside of this method; a fallback value is returned instead. + + Return type of the provided function. + Function to run. + Fallback value to return in case of exception. + Result returned by the provided function or fallback value in case of exception. + + + + Logs an exception is logged at Error level if the provided task does not run to completion. + + The task for which to log an error if it does not run to completion. + This method is useful in fire-and-forget situations, where application logic does not depend on completion of task. This method is avoids C# warning CS4014 in such situations. + + + + Returns a task that completes when a specified task to completes. If the task does not run to completion, an exception is logged at Error level. The returned task always runs to completion. + + The task for which to log an error if it does not run to completion. + A task that completes in the state when completes. + + + + Runs async action. If the action throws, the exception is logged at Error level. The exception is not propagated outside of this method. + + Async action to execute. + A task that completes in the state when completes. + + + + Runs the provided async function and returns its result. If the task does not run to completion, an exception is logged at Error level. + The exception is not propagated outside of this method; a default value is returned instead. + + Return type of the provided function. + Async function to run. + A task that represents the completion of the supplied task. If the supplied task ends in the state, the result of the new task will be the result of the supplied task; otherwise, the result of the new task will be the default value of type . + + + + Runs the provided async function and returns its result. If the task does not run to completion, an exception is logged at Error level. + The exception is not propagated outside of this method; a fallback value is returned instead. + + Return type of the provided function. + Async function to run. + Fallback value to return if the task does not end in the state. + A task that represents the completion of the supplied task. If the supplied task ends in the state, the result of the new task will be the result of the supplied task; otherwise, the result of the new task will be the fallback value. + + + + Render a message template property to a string + + + + + Serialization of an object, e.g. JSON and append to + + The object to serialize to string. + Parameter Format + Parameter CaptureType + An object that supplies culture-specific formatting information. + Output destination. + Serialize succeeded (true/false) + + + + Log event context data. + + + + + Initializes a new instance of the class. + + + + + Gets or sets string that will be used to separate key/value pairs. + + + + + + Get or set if empty values should be included. + + A value is empty when null or in case of a string, null or empty string. + + + + + + Gets or sets the keys to exclude from the output. If omitted, none are excluded. + + + + + + Also render the caller information attributes? (, + , ). + + See https://msdn.microsoft.com/en-us/library/hh534540.aspx + + + + + + Gets or sets how key/value pairs will be formatted. + + + + + + Renders all log event's properties and appends them to the specified . + + The to append the rendered data to. + Logging event. + + + + The names of caller information attributes. + , , ). + https://msdn.microsoft.com/en-us/library/hh534540.aspx + TODO NLog ver. 5 - Remove these properties + + + + + Designates a property of the class as an ambient property. + + + non-ambient: ${uppercase:${level}} + ambient : ${level:uppercase} + + + + + Initializes a new instance of the class. + + Ambient property name. + + + + Used to render the application domain name. + + + + + Create a new renderer + + + + + Create a new renderer + + + + + Format string. Possible values: "Short", "Long" or custom like {0} {1}. Default "Long" + The first parameter is the , the second the second the + This string is used in + + + + + + + + + + + + + + + Renders the assembly version information for the entry assembly or a named assembly. + + + As this layout renderer uses reflection and version information is unlikely to change during application execution, + it is recommended to use it in conjunction with the . + + + The entry assembly can't be found in some cases e.g. ASP.NET, unit tests, etc. + + + + + Initializes a new instance of the class. + + + + + The (full) name of the assembly. If null, using the entry assembly. + + + + + + Gets or sets the type of assembly version to retrieve. + + + Some version type and platform combinations are not fully supported. + - UWP earlier than .NET Standard 1.5: Value for is always returned unless the parameter is specified. + - Silverlight: Value for is always returned. + + + + + + Gets or sets the custom format of the assembly version output. + + + Supported placeholders are 'major', 'minor', 'build' and 'revision'. + The default .NET template for version numbers is 'major.minor.build.revision'. See + https://docs.microsoft.com/en-gb/dotnet/api/system.version?view=netframework-4.7.2#remarks + for details. + + + + + + Initializes the layout renderer. + + + + + Closes the layout renderer. + + + + + Renders an assembly version and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Gets the assembly specified by , or entry assembly otherwise + + Found assembly + + + + Type of assembly version to retrieve. + + + + + Gets the assembly version. + + + + + Gets the file version. + + + + + Gets additional version information. + + + + + The current application domain's base directory. + + + + + cached + + + + + Use base dir of current process. Alternative one can just use ${processdir} + + + + + + Fallback to the base dir of current process, when AppDomain.BaseDirectory is Temp-Path (.NET Core 3 - Single File Publish) + + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Gets or sets the name of the file to be Path.Combine()'d with with the base directory. + + + + + + Gets or sets the name of the directory to be Path.Combine()'d with with the base directory. + + + + + + Renders the application base directory and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + The call site source file name. Full callsite + + + + + Gets or sets a value indicating whether to include source file path. + + + + + + Gets or sets the number of frames to skip. + + + + + + Logger should capture StackTrace, if it was not provided manually + + + + + Gets the level of stack trace information required by the implementing class. + + + + + + + + + + + The call site (class name, method name and source information). + + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating whether to render the class name. + + + + + + Gets or sets a value indicating whether to render the include the namespace with . + + + + + + Gets or sets a value indicating whether to render the method name. + + + + + + Gets or sets a value indicating whether the method name will be cleaned up if it is detected as an anonymous delegate. + + + + + + Gets or sets a value indicating whether the method and class names will be cleaned up if it is detected as an async continuation + (everything after an await-statement inside of an async method). + + + + + + Gets or sets the number of frames to skip. + + + + + + Gets or sets a value indicating whether to render the source file name and line number. + + + + + + Gets or sets a value indicating whether to include source file path. + + + + + + Logger should capture StackTrace, if it was not provided manually + + + + + Gets the level of stack trace information required by the implementing class. + + + + + Renders the call site and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + The call site source line number. Full callsite + + + + + Gets or sets the number of frames to skip. + + + + + + Logger should capture StackTrace, if it was not provided manually + + + + + Gets the level of stack trace information required by the implementing class. + + + + + + + + + + + A counter value (increases on each layout rendering). + + + + + Gets or sets the initial value of the counter. + + + + + + Gets or sets the value to be added to the counter after each layout rendering. + + + + + + Gets or sets the name of the sequence. Different named sequences can have individual values. + + + + + + + + + The current working directory of the application. + + + + + Gets or sets the name of the file to be Path.Combine()'d with the current directory. + + + + + + Gets or sets the name of the directory to be Path.Combine()'d with the current directory. + + + + + + + + + + + + Current date and time. + + + + + Initializes a new instance of the class. + + + + + Gets or sets the culture used for rendering. + + + + + + Gets or sets the date format. Can be any argument accepted by DateTime.ToString(format). + + + + + + Gets or sets a value indicating whether to output UTC time instead of local time. + + + + + + + + + + + + + + + DB null for a database + + + + + + + + + + + The OS dependent directory separator + + + + + + + + + + + The environment variable. + + + + + Gets or sets the name of the environment variable. + + + + + + Gets or sets the default value to be used when the environment variable is not set. + + + + + + + + + + + + Thread identity information (username). + + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating whether username should be included. + + + + + + Gets or sets a value indicating whether domain name should be included. + + + + + + Gets or sets the default value to be used when the User is not set. + + + + + + Gets or sets the default value to be used when the Domain is not set. + + + + + + + + + + + + Log event context data. + + This class was marked as obsolete on NLog 2.0 and it may be removed in a future release. + + + + Gets or sets the name of the item. + + + + + + Renders the specified log event context item and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Log event context data. See . + + + + + Gets or sets the name of the item. + + + + + + Format string for conversion from object to string. + + + + + + Gets or sets the culture used for rendering. + + + + + + Gets or sets the object-property-navigation-path for lookup of nested property + + + + + + + + + + + + + + + Exception information provided through + a call to one of the Logger.*Exception() methods. + + + + + Initializes a new instance of the class. + + + + + Gets or sets the format of the output. Must be a comma-separated list of exception + properties: Message, Type, ShortType, ToString, Method, StackTrace. + This parameter value is case-insensitive. + + + + + + + + Gets or sets the format of the output of inner exceptions. Must be a comma-separated list of exception + properties: Message, Type, ShortType, ToString, Method, StackTrace. + This parameter value is case-insensitive. + + + + + + Gets or sets the separator used to concatenate parts specified in the Format. + + + + + + Gets or sets the separator used to concatenate exception data specified in the Format. + + + + + + Gets or sets the maximum number of inner exceptions to include in the output. + By default inner exceptions are not enabled for compatibility with NLog 1.0. + + + + + + Gets or sets the separator between inner exceptions. + + + + + + Gets or sets whether to render innermost Exception from + + + + + Gets or sets whether to collapse exception tree using + + + + + Gets the formats of the output of inner exceptions to be rendered in target. + + + + + + + Gets the formats of the output to be rendered in target. + + + + + + + + + + + + + Appends the Message of an Exception to the specified . + + The to append the rendered data to. + The exception containing the Message to append. + + + + Appends the method name from Exception's stack trace to the specified . + + The to append the rendered data to. + The Exception whose method name should be appended. + + + + Appends the stack trace from an Exception to the specified . + + The to append the rendered data to. + The Exception whose stack trace should be appended. + + + + Appends the result of calling ToString() on an Exception to the specified . + + The to append the rendered data to. + The Exception whose call to ToString() should be appended. + + + + Appends the type of an Exception to the specified . + + The to append the rendered data to. + The Exception whose type should be appended. + + + + Appends the short type of an Exception to the specified . + + The to append the rendered data to. + The Exception whose short type should be appended. + + + + Appends the application source of an Exception to the specified . + + The to append the rendered data to. + The Exception whose source should be appended. + + + + Appends the HResult of an Exception to the specified . + + The to append the rendered data to. + The Exception whose HResult should be appended. + + + + Appends the contents of an Exception's Data property to the specified . + + The to append the rendered data to. + The Exception whose Data property elements should be appended. + + + + Appends all the serialized properties of an Exception into the specified . + + The to append the rendered data to. + The Exception whose properties should be appended. + + + + Appends all the additional properties of an Exception like Data key-value-pairs + + The to append the rendered data to. + The Exception whose properties should be appended. + + + + Split the string and then compile into list of Rendering formats. + + + + + Renders contents of the specified file. + + + + + Initializes a new instance of the class. + + + + + Gets or sets the name of the file. + + + + + + Gets or sets the encoding used in the file. + + The encoding. + + + + + Renders the contents of the specified file and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + A layout renderer which could have different behavior per instance by using a . + + + + + Initializes a new instance of the class. + + Name without ${}. + + + + Initializes a new instance of the class. + + Name without ${}. + Method that renders the layout. + + + + Name used in config without ${}. E.g. "test" could be used as "${test}". + + + + + Method that renders the layout. + + This public property will be removed in NLog 5. + + + + + Format string for conversion from object to string. + + + + + + + + + + + + Render the value for this log event + + The event info. + The value. + + + + A layout renderer which could have different behavior per instance by using a . + + + + + Initializes a new instance of the class. + + Name without ${}. + Method that renders the layout. + + + + A layout renderer which could have different behavior per instance by using a . + + + + + Initializes a new instance of the class. + + Name without ${}. + Method that renders the layout. + + + + The information about the garbage collector. + + + + + Gets or sets the property to retrieve. + + + + + + + + + Gets or sets the property of System.GC to retrieve. + + + + + Total memory allocated. + + + + + Total memory allocated (perform full garbage collection first). + + + + + Gets the number of Gen0 collections. + + + + + Gets the number of Gen1 collections. + + + + + Gets the number of Gen2 collections. + + + + + Maximum generation number supported by GC. + + + + + Render a Global Diagnostics Context item. See + + + + + Gets or sets the name of the item. + + + + + + Format string for conversion from object to string. + + + + + + + + + + + + + + + Globally-unique identifier (GUID). + + + + + Gets or sets the GUID format as accepted by Guid.ToString() method. + + + + + + Generate the Guid from the NLog LogEvent (Will be the same for all targets) + + + + + + + + + + + + + + + The host name that the process is running on. + + + + + + + + Gets the host name and falls back to computer name if not available + + + + + Tries the lookup value. + + The lookup function. + Type of the lookup. + + + + + + + + Thread identity information (name and authentication information). + + + + + Gets or sets the separator to be used when concatenating + parts of identity information. + + + + + + Gets or sets a value indicating whether to render Thread.CurrentPrincipal.Identity.Name. + + + + + + Gets or sets a value indicating whether to render Thread.CurrentPrincipal.Identity.AuthenticationType. + + + + + + Gets or sets a value indicating whether to render Thread.CurrentPrincipal.Identity.IsAuthenticated. + + + + + + + + + Retrieve network interfaces + + + + + Retrieve network interfaces + + + + + Installation parameter (passed to InstallNLogConfig). + + + + + Gets or sets the name of the parameter. + + + + + + Renders the specified installation parameter and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Render environmental information related to logging events. + + + + + Gets the logging configuration this target is part of. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + + + + + Renders the the value of layout renderer in the context of the specified log event. + + The log event. + String representation of a layout renderer. + + + + Initializes this instance. + + The configuration. + + + + Closes this instance. + + + + + Initializes this instance. + + The configuration. + + + + Closes this instance. + + + + + Renders the value of layout renderer in the context of the specified log event. + + The log event. + The layout render output is appended to builder + + + + Renders the value of layout renderer in the context of the specified log event into . + + The to append the rendered data to. + Logging event. + + + + Initializes the layout renderer. + + + + + Closes the layout renderer. + + + + + Releases unmanaged and - optionally - managed resources. + + True to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Get the for rendering the messages to a + + LogEvent with culture + Culture in on Layout level + + + + + Get the for rendering the messages to a , needed for date and number formats + + LogEvent with culture + Culture in on Layout level + + + is preferred + + + + + Register a custom layout renderer. + + Short-cut for registering to default + Type of the layout renderer. + Name of the layout renderer - without ${}. + + + + Register a custom layout renderer. + + Short-cut for registering to default + Type of the layout renderer. + Name of the layout renderer - without ${}. + + + + Register a custom layout renderer with a callback function . The callback receives the logEvent. + + Name of the layout renderer - without ${}. + Callback that returns the value for the layout renderer. + + + + Register a custom layout renderer with a callback function . The callback receives the logEvent and the current configuration. + + Name of the layout renderer - without ${}. + Callback that returns the value for the layout renderer. + + + + Register a custom layout renderer with a callback function . The callback receives the logEvent and the current configuration. + + Renderer with callback func + + + + Marks class as a layout renderer and assigns a name to it. + + This attribute is not required when registering the layout in the API. + + + + Initializes a new instance of the class. + + Name of the layout renderer, without the `${ }` + + + + Format of the ${level} layout renderer output. + + + + + Render the LogLevel standard name. + + + + + Render the first character of the level. + + + + + Render the ordinal (aka number) for the level. + + + + + Render the LogLevel full name, expanding Warn / Info abbreviations + + + + + The log level. + + + + + Gets or sets a value indicating the output format of the level. + + + + + + + + + + + + + + + A string literal. + + + This is used to escape '${' sequence + as ;${literal:text=${}' + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The literal text value. + This is used by the layout compiler. + + + + Gets or sets the literal text. + + + + + + Renders the specified string literal and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + The IP address from the network interface card (NIC) on the local machine + + + Skips loopback-adapters and tunnel-interfaces. Skips devices without any MAC-address + + + + + Get or set whether to prioritize IPv6 or IPv4 (default) + + + + + + + + + + + + + + + XML event description compatible with log4j, Chainsaw and NLogViewer. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Initializes the layout renderer. + + + + + Gets or sets a value indicating whether to include NLog-specific extensions to log4j schema. + + + + + + Gets or sets a value indicating whether the XML should use spaces for indentation. + + + + + + Gets or sets the AppInfo field. By default it's the friendly name of the current AppDomain. + + + + + + Gets or sets a value indicating whether to include call site (class and method name) in the information sent over the network. + + + + + + Gets or sets a value indicating whether to include source info (file name and line number) in the information sent over the network. + + + + + + Gets or sets a value indicating whether to include contents of the dictionary. + + + + + + Gets or sets a value indicating whether to include contents of the dictionary. + + + + + + Gets or sets a value indicating whether to include contents of the stack. + + + + + + Gets or sets the NDLC item separator. + + + + + + Gets or sets the option to include all properties from the log events + + + + + + Gets or sets a value indicating whether to include contents of the stack. + + + + + + Gets or sets the NDC item separator. + + + + + + Gets or sets the log4j:event logger-xml-attribute (Default ${logger}) + + + + + + Gets the level of stack trace information required by the implementing class. + + + + + Renders the XML logging event and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + The logger name. + + + + + Gets or sets a value indicating whether to render short logger name (the part after the trailing dot character). + + + + + + + + + + + + The date and time in a long, sortable format yyyy-MM-dd HH:mm:ss.ffff. + + + + + Gets or sets a value indicating whether to output UTC time instead of local time. + + + + + + Renders the date in the long format (yyyy-MM-dd HH:mm:ss.ffff) and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + The machine name that the process is running on. + + + + + + + + + + + Render a Mapped Diagnostic Context item, See + + + + + Gets or sets the name of the item. + + + + + + Format string for conversion from object to string. + + + + + + + + + + + + Render a Mapped Diagnostic Logical Context item (based on CallContext). + See + + + + + Gets or sets the name of the item. + + + + + + Format string for conversion from object to string. + + + + + + + + + + + + The formatted log message. + + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating whether to log exception along with message. + + + + + + Gets or sets the string that separates message from the exception. + + + + + + Gets or sets whether it should render the raw message without formatting parameters + + + + + + + + + + + + Render a Nested Diagnostic Context item. + See + + + + + Initializes a new instance of the class. + + + + + Gets or sets the number of top stack frames to be rendered. + + + + + + Gets or sets the number of bottom stack frames to be rendered. + + + + + + Gets or sets the separator to be used for concatenating nested diagnostics context output. + + + + + + Renders the specified Nested Diagnostics Context item and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Render a Nested Diagnostic Logical Context item (Async scope) + See + + + + + Initializes a new instance of the class. + + + + + Gets or sets the number of top stack frames to be rendered. + + + + + + Gets or sets the number of bottom stack frames to be rendered. + + + + + + Gets or sets the separator to be used for concatenating nested logical context output. + + + + + + Renders the specified Nested Logical Context item and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Timing Renderer (Async scope) + + + + + Gets or sets whether to only include the duration of the last scope created + + + + + + Gets or sets whether to just display the scope creation time, and not the duration + + + + + + Gets or sets the TimeSpan format. Can be any argument accepted by TimeSpan.ToString(format). + + + + + + Renders the timing details of the Nested Logical Context item and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Retrieve network interfaces + + + + + Retrieve network interfaces + + + + + A newline literal. + + + + + Renders the specified string literal and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + The directory where NLog.dll is located. + + + + + Initializes static members of the NLogDirLayoutRenderer class. + + + + + Gets or sets the name of the file to be Path.Combine()'d with the directory name. + + + + + + Gets or sets the name of the directory to be Path.Combine()'d with the directory name. + + + + + + Initializes the layout renderer. + + + + + Closes the layout renderer. + + + + + Renders the directory where NLog is located and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + The executable directory from the FileName, + using the current process + + + + + Gets or sets the name of the file to be Path.Combine()'d with with the process directory. + + + + + + Gets or sets the name of the directory to be Path.Combine()'d with with the process directory. + + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + + + + The identifier of the current process. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + + + + + + + The information about the running process. + + + + + Gets or sets the property to retrieve. + + + + + + Gets or sets the format-string to use if the property supports it (Ex. DateTime / TimeSpan / Enum) + + + + + + + + + + + + + + + Property of System.Diagnostics.Process to retrieve. + + + + + Base Priority. + + + + + Exit Code. + + + + + Exit Time. + + + + + Process Handle. + + + + + Handle Count. + + + + + Whether process has exited. + + + + + Process ID. + + + + + Machine name. + + + + + Handle of the main window. + + + + + Title of the main window. + + + + + Maximum Working Set. + + + + + Minimum Working Set. + + + + + Non-paged System Memory Size. + + + + + Non-paged System Memory Size (64-bit). + + + + + Paged Memory Size. + + + + + Paged Memory Size (64-bit).. + + + + + Paged System Memory Size. + + + + + Paged System Memory Size (64-bit). + + + + + Peak Paged Memory Size. + + + + + Peak Paged Memory Size (64-bit). + + + + + Peak Virtual Memory Size. + + + + + Peak Virtual Memory Size (64-bit).. + + + + + Peak Working Set Size. + + + + + Peak Working Set Size (64-bit). + + + + + Whether priority boost is enabled. + + + + + Priority Class. + + + + + Private Memory Size. + + + + + Private Memory Size (64-bit). + + + + + Privileged Processor Time. + + + + + Process Name. + + + + + Whether process is responding. + + + + + Session ID. + + + + + Process Start Time. + + + + + Total Processor Time. + + + + + User Processor Time. + + + + + Virtual Memory Size. + + + + + Virtual Memory Size (64-bit). + + + + + Working Set Size. + + + + + Working Set Size (64-bit). + + + + + The name of the current process. + + + + + Gets or sets a value indicating whether to write the full path to the process executable. + + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Renders the current process name (optionally with a full path). + + The to append the rendered data to. + Logging event. + + + + The process time in format HH:mm:ss.mmm. + + + + + Gets or sets a value indicating whether to output in culture invariant format + + + + + + + + + + + + Write timestamp to builder with format hh:mm:ss:fff + + + + + The sequence ID + + + + + + + + + + + The short date in a sortable format yyyy-MM-dd. + + + + + Gets or sets a value indicating whether to output UTC time instead of local time. + + + + + + Renders the current short date string (yyyy-MM-dd) and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + System special folder path (includes My Documents, My Music, Program Files, Desktop, and more). + + + + + Gets or sets the system special folder to use. + + + Full list of options is available at MSDN. + The most common ones are: +
    +
  • ApplicationData - roaming application data for current user.
  • +
  • CommonApplicationData - application data for all users.
  • +
  • MyDocuments - My Documents
  • +
  • DesktopDirectory - Desktop directory
  • +
  • LocalApplicationData - non roaming application data
  • +
  • Personal - user profile directory
  • +
  • System - System directory
  • +
+
+ +
+ + + Gets or sets the name of the file to be Path.Combine()'d with the directory name. + + + + + + Gets or sets the name of the directory to be Path.Combine()'d with the directory name. + + + + + + Renders the directory where NLog is located and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Format of the ${stacktrace} layout renderer output. + + + + + Raw format (multiline - as returned by StackFrame.ToString() method). + + + + + Flat format (class and method names displayed in a single line). + + + + + Detailed flat format (method signatures displayed in a single line). + + + + + Stack trace renderer. + + + + + Initializes a new instance of the class. + + + + + Gets or sets the output format of the stack trace. + + + + + + Gets or sets the number of top stack frames to be rendered. + + + + + + Gets or sets the number of frames to skip. + + + + + + Gets or sets the stack frame separator string. + + + + + + Logger should capture StackTrace, if it was not provided manually + + + + + Gets the level of stack trace information required by the implementing class. + + + + + + Renders the call site and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + A temporary directory. + + + + + Gets or sets the name of the file to be Path.Combine()'d with the directory name. + + + + + + Gets or sets the name of the directory to be Path.Combine()'d with the directory name. + + + + + + + + + Renders the directory where NLog is located and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + The identifier of the current thread. + + + + + + + + The name of the current thread. + + + + + + + + The Ticks value of current date and time. + + + + + + + + + + + The time in a 24-hour, sortable format HH:mm:ss.mmmm. + + + + + Gets or sets a value indicating whether to output UTC time instead of local time. + + + + + + Gets or sets a value indicating whether to output in culture invariant format + + + + + + + + + + + + A renderer that puts into log a System.Diagnostics trace correlation id. + + + + + + + + + + + Render a NLog variable (xml or config) + + + + + Gets or sets the name of the NLog variable. + + + + + + Gets or sets the default value to be used when the variable is not set. + + Not used if Name is null + + + + + Initializes the layout renderer. + + + + + Try get the + + + + + + + Renders the specified variable and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Applies caching to another layout output. + + + The value of the inner layout will be rendered only once and reused subsequently. + + + + + A value indicating when the cache is cleared. + + + + Never clear the cache. + + + Clear the cache whenever the is initialized. + + + Clear the cache whenever the is closed. + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating whether this is enabled. + + + + + + Gets or sets a value indicating when the cache is cleared. + + + + + + Cachekey. If the cachekey changes, resets the value. For example, the cachekey would be the current day.s + + + + + + Gets or sets a value indicating how many seconds the value should stay cached until it expires + + + + + + Initializes the layout renderer. + + + + + Closes the layout renderer. + + + + + Transforms the output of another layout. + + Output to be transform. + Transformed text. + + + + Renders the inner layout contents. + + The log event. + Contents of inner layout. + + + + + + + Filters characters not allowed in the file names by replacing them with safe character. + + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating whether to modify the output of this renderer so it can be used as a part of file path + (illegal characters are replaced with '_'). + + + + + + + + + + + + Escapes output of another layout using JSON rules. + + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating whether to apply JSON encoding. + + + + + + Gets or sets a value indicating whether to escape non-ascii characters + + + + + + Should forward slashes be escaped? If true, / will be converted to \/ + + + If not set explicitly then the value of the parent will be used as default. + + + + + + + + + + + + Left part of a text + + + + + Gets or sets the length in characters. + + + + + + Same as -property, so it can be used as ambient property. + + + ${message:truncate=80} + + + + + + + + + + + + Converts the result of another layout output to lower case. + + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating whether lower case conversion should be applied. + + A value of true if lower case conversion should be applied; otherwise, false. + + + + + Gets or sets the culture used for rendering. + + + + + + + + + + + + Render the non-raw value of an object. + + For performance and/or full (formatted) control of the output. + + + + Gets or sets a value indicating whether to disable the IRawValue-interface + + A value of true if IRawValue-interface should be ignored; otherwise, false. + + + + + + + + + + + Render a single property of a object + + + + + Gets or sets the object-property-navigation-path for lookup of nested property + + Shortcut for + + + + + + Gets or sets the object-property-navigation-path for lookup of nested property + + + + + + Format string for conversion from object to string. + + + + + + Gets or sets the culture used for rendering. + + + + + + + + + + + + + + + Only outputs the inner layout when exception has been defined for log message. + + + + + + + + Transforms the output of another layout. + + Output to be transform. + Transformed text. + + + + Outputs alternative layout when the inner layout produces empty result. + + + ${onhasproperties:, Properties\: ${all-event-properties}} + + + + + + + + + + + Horizontal alignment for padding layout renderers. + + + + + When layout text is too long, align it to the left + (remove characters from the right). + + + + + When layout text is too long, align it to the right + (remove characters from the left). + + + + + Applies padding to another layout output. + + + + + Initializes a new instance of the class. + + + + + Gets or sets the number of characters to pad the output to. + + + Positive padding values cause left padding, negative values + cause right padding to the desired width. + + + + + + Gets or sets the padding character. + + + + + + Gets or sets a value indicating whether to trim the + rendered text to the absolute value of the padding length. + + + + + + Gets or sets a value indicating whether a value that has + been truncated (when is true) + will be left-aligned (characters removed from the right) + or right-aligned (characters removed from the left). The + default is left alignment. + + RegistryLayoutRenderer + + + + Transforms the output of another layout. + + Output to be transform. + Transformed text. + + + + Replaces a string in the output of another layout with another string. + + + ${replace:searchFor=\\n+:replaceWith=-:regex=true:inner=${message}} + + + + + Gets or sets the text to search for. + + The text search for. + + + + + Gets or sets a value indicating whether regular expressions should be used. + + A value of true if regular expressions should be used otherwise, false. + + + + + Gets or sets the replacement string. + + The replacement string. + + + + + Gets or sets the group name to replace when using regular expressions. + Leave null or empty to replace without using group name. + + The group name. + + + + + Gets or sets a value indicating whether to ignore case. + + A value of true if case should be ignored when searching; otherwise, false. + + + + + Gets or sets a value indicating whether to search for whole words. + + A value of true if whole words should be searched for; otherwise, false. + + + + + Compile the ? This can improve the performance, but at the costs of more memory usage. If false, the Regex Cache is used. + + + + + + Initializes the layout renderer. + + + + + Post-processes the rendered message. + + The text to be post-processed. + Post-processed text. + + + + This class was created instead of simply using a lambda expression so that the "ThreadAgnosticAttributeTest" will pass + + + + + A match evaluator for Regular Expression based replacing + + Input string. + Group name in the regex. + Replace value. + Match from regex. + Groups replaced with . + + + + Replaces newline characters from the result of another layout renderer with spaces. + + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating the string that should be used for separating lines. + + + + + + + + + + + + Right part of a text + + + + + Gets or sets the length in characters. + + + + + + + + + + + + Decodes text "encrypted" with ROT-13. + + + See https://en.wikipedia.org/wiki/ROT13. + + + + + Gets or sets the layout to be wrapped. + + The layout to be wrapped. + This variable is for backwards compatibility + + + + + Encodes/Decodes ROT-13-encoded string. + + The string to be encoded/decoded. + Encoded/Decoded text. + + + + + + + + + + Encodes/Decodes ROT-13-encoded string. + + + + + Substring the result + + + ${substring:${level}:start=2:length=2} + ${substring:${level}:start=-2:length=2} + ${substring:Inner=${level}:start=2:length=2} + + + + + Initializes a new instance of the class. + + + + + Gets or sets the start index. + + Index + + + + + Gets or sets the length in characters. If null, then the whole string + + Index + + + + + + + + + + + Calculate start position + + 0 or positive number + + + + Calculate needed length + + 0 or positive number + + + + Trims the whitespace from the result of another layout renderer. + + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating whether lower case conversion should be applied. + + A value of true if lower case conversion should be applied; otherwise, false. + + + + + + + + + + + Converts the result of another layout output to upper case. + + + ${uppercase:${level}} //[DefaultParameter] + ${uppercase:Inner=${level}} + ${level:uppercase} // [AmbientProperty] + + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating whether upper case conversion should be applied. + + A value of true if upper case conversion should be applied otherwise, false. + + + + + Gets or sets the culture used for rendering. + + + + + + + + + + + + Encodes the result of another layout output for use with URLs. + + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating whether spaces should be translated to '+' or '%20'. + + A value of true if space should be translated to '+'; otherwise, false. + + + + + Gets or sets a value whether escaping be done according to Rfc3986 (Supports Internationalized Resource Identifiers - IRIs) + + A value of true if Rfc3986; otherwise, false for legacy Rfc2396. + + + + + Gets or sets a value whether escaping be done according to the old NLog style (Very non-standard) + + A value of true if legacy encoding; otherwise, false for standard UTF8 encoding. + + + + + Transforms the output of another layout. + + Output to be transform. + Transformed text. + + + + Outputs alternative layout when the inner layout produces empty result. + + + + + Gets or sets the layout to be rendered when original layout produced empty result. + + + + + + + + + + + + + + + Only outputs the inner layout when the specified condition has been met. + + + + + Gets or sets the condition that must be met for the layout to be printed. + + + + + + If is not met, print this layout. + + + + + + + + + + + + + + + Replaces newline characters from the result of another layout renderer with spaces. + + + + + Initializes a new instance of the class. + + + + + Gets or sets the line length for wrapping. + + + Only positive values are allowed + + + + + + Post-processes the rendered message. + + The text to be post-processed. + Post-processed text. + + + + Base class for s which wrapping other s. + + This has the property (which is default) and can be used to wrap. + + + ${uppercase:${level}} //[DefaultParameter] + ${uppercase:Inner=${level}} + + + + + Gets or sets the wrapped layout. + + [DefaultParameter] so Inner: is not required if it's the first + + + + + + + + + Renders the inner message, processes it and appends it to the specified . + + The to append the rendered data to. + Logging event. + + + + Appends the rendered output from -layout and transforms the added output (when necessary) + + Logging event. + The to append the rendered data to. + Start position for any necessary transformation of . + + + + Transforms the output of another layout. + + Logging event. + Output to be transform. + Transformed text. + + + + Transforms the output of another layout. + + Output to be transform. + Transformed text. + + + + Renders the inner layout contents. + + The log event. + Contents of inner layout. + + + + Base class for s which wrapping other s. + + This expects the transformation to work on a + + + + + + + + Transforms the output of another layout. + + + Output to be transform. + + + + Transforms the output of another layout. + + Output to be transform. + + + + Renders the inner layout contents. + + + for the result + + + + + + + + + + + + + + + + + + Converts the result of another layout output to be XML-compliant. + + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating whether to apply XML encoding. + + Ensures always valid XML, but gives a performance hit + + + + + Gets or sets a value indicating whether to transform newlines (\r\n) into ( ) + + + + + + + + + + + + A layout containing one or more nested layouts. + + + + + Initializes a new instance of the class. + + + + + Gets the inner layouts. + + + + + + Initializes the layout. + + + + + Formats the log event relying on inner layouts. + + The log event to be formatted. + A string representation of the log event. + + + + Formats the log event relying on inner layouts. + + The logging event. + for the result + + + + Closes the layout. + + + + + Generate description of Compound Layout + + Compound Layout String Description + + + + A column in the CSV. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The name of the column. + The layout of the column. + + + + Gets or sets the name of the column. + + + + + + Gets or sets the layout of the column. + + + + + + Gets or sets the override of Quoting mode + + + and are faster than the default + + + + + + Specifies allowed column delimiters. + + + + + Automatically detect from regional settings. + + + + + Comma (ASCII 44). + + + + + Semicolon (ASCII 59). + + + + + Tab character (ASCII 9). + + + + + Pipe character (ASCII 124). + + + + + Space character (ASCII 32). + + + + + Custom string, specified by the CustomDelimiter. + + + + + A specialized layout that renders CSV-formatted events. + + If is set, then the header generation with column names will be disabled. + + + + Initializes a new instance of the class. + + + + + Gets the array of parameters to be passed. + + + + + + Gets or sets a value indicating whether CVS should include header. + + A value of true if CVS should include header; otherwise, false. + + + + + Gets or sets the column delimiter. + + + + + + Gets or sets the quoting mode. + + + + + + Gets or sets the quote Character. + + + + + + Gets or sets the custom column delimiter value (valid when ColumnDelimiter is set to 'Custom'). + + + + + + Initializes the layout. + + + + + Formats the log event for write. + + The log event to be formatted. + A string representation of the log event. + + + + Formats the log event for write. + + The logging event. + for the result + + + + Get the headers with the column names. + + + + + + Header with column names for CSV layout. + + + + + Initializes a new instance of the class. + + The parent. + + + + Renders the layout for the specified logging event by invoking layout renderers. + + The logging event. + The rendered layout. + + + + Renders the layout for the specified logging event by invoking layout renderers. + + The logging event. + for the result + + + + Generate description of CSV Layout + + CSV Layout String Description + + + + Specifies CSV quoting modes. + + + + + Quote all column (Fast) + + + + + Quote nothing (Very fast) + + + + + Quote only whose values contain the quote symbol or the separator (Slow) + + + + + JSON attribute. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The name of the attribute. + The layout of the attribute's value. + + + + Initializes a new instance of the class. + + The name of the attribute. + The layout of the attribute's value. + Encode value with json-encode + + + + Gets or sets the name of the attribute. + + + + + + Gets or sets the layout that will be rendered as the attribute's value. + + + + + + Determines whether or not this attribute will be Json encoded. + + + + + + Gets or sets a value indicating whether to escape non-ascii characters + + + + + + Should forward slashes be escaped? If true, / will be converted to \/ + + + If not set explicitly then the value of the parent will be used as default. + + + + + + Gets or sets whether an attribute with empty value should be included in the output + + + + + + A specialized layout that renders JSON-formatted events. + + + + + Initializes a new instance of the class. + + + + + Gets the array of attributes' configurations. + + + + + + Gets or sets the option to suppress the extra spaces in the output json + + + + + + Gets or sets the option to render the empty object value {} + + + + + + Gets or sets a value indicating whether to include contents of the dictionary. + + + + + + Gets or sets a value indicating whether to include contents of the dictionary. + + + + + + Gets or sets a value indicating whether to include contents of the dictionary. + + + + + + Gets or sets the option to include all properties from the log event (as JSON) + + + + + + Gets or sets the option to exclude null/empty properties from the log event (as JSON) + + + + + + List of property names to exclude when is true + + + + + + How far should the JSON serializer follow object references before backing off + + + + + + Should forward slashes be escaped? If true, / will be converted to \/ + + + If not set explicitly then the value of the parent will be used as default. + + + + + + Initializes the layout. + + + + + Closes the layout. + + + + + Formats the log event as a JSON document for writing. + + The logging event. + for the result + + + + Formats the log event as a JSON document for writing. + + The log event to be formatted. + A JSON string representation of the log event. + + + + Generate description of JSON Layout + + JSON Layout String Description + + + + Abstract interface that layouts must implement. + + + + + Is this layout initialized? See + + + + + Gets a value indicating whether this layout is thread-agnostic (can be rendered on any thread). + + + Layout is thread-agnostic if it has been marked with [ThreadAgnostic] attribute and all its children are + like that as well. + + Thread-agnostic layouts only use contents of for its output. + + + + + Gets the level of stack trace information required for rendering. + + + + + Gets the logging configuration this target is part of. + + + + + Converts a given text to a . + + Text to be converted. + object represented by the text. + + + + Implicitly converts the specified string to a . + + The layout string. + Instance of .' + + + + Implicitly converts the specified string to a . + + The layout string. + The NLog factories to use when resolving layout renderers. + Instance of . + + + + Implicitly converts the specified string to a . + + The layout string. + Whether should be thrown on parse errors (false = replace unrecognized tokens with a space). + Instance of . + + + + Create a from a lambda method. + + Method that renders the layout. + Tell if method is safe for concurrent threading. + Instance of . + + + + Precalculates the layout for the specified log event and stores the result + in per-log event cache. + + Only if the layout doesn't have [ThreadAgnostic] and doesn't contain layouts with [ThreadAgnostic]. + + The log event. + + Calling this method enables you to store the log event in a buffer + and/or potentially evaluate it in another thread even though the + layout may contain thread-dependent renderer. + + + + + Renders the event info in layout. + + The event info. + String representing log event. + + + + Optimized version of for internal Layouts. Works best + when override of is available. + + The event info. + Appends the string representing log event to target + Should rendering result be cached on LogEventInfo + + + + Valid default implementation of , when having implemented the optimized + + The logging event. + StringBuilder to help minimize allocations [optional]. + The rendered layout. + + + + Renders the layout for the specified logging event by invoking layout renderers. + + The logging event. + for the result + + + + Initializes this instance. + + The configuration. + + + + Closes this instance. + + + + + Initializes this instance. + + The configuration. + + + + Closes this instance. + + + + + Initializes the layout. + + + + + Closes the layout. + + + + + Renders the layout for the specified logging event by invoking layout renderers. + + The logging event. + The rendered layout. + + + + Register a custom Layout. + + Short-cut for registering to default + Type of the Layout. + Name of the Layout. + + + + Register a custom Layout. + + Short-cut for registering to default + Type of the Layout. + Name of the Layout. + + + + Optimized version of for internal Layouts, when + override of is available. + + + + + Try get value + + + rawValue if return result is true + false if we could not determine the rawValue + + + + Marks class as a layout renderer and assigns a format string to it. + + + + + Initializes a new instance of the class. + + Layout name. + + + + Parses layout strings. + + + + + Add to + + + + + + + Options available for + + + + + Default options + + + + + Layout renderer method can handle concurrent threads + + + + + Layout renderer method is agnostic to current thread context. This means it will render the same result indepdent of thread-context. + + + + + A specialized layout that supports header and footer. + + + + + Gets or sets the body layout (can be repeated multiple times). + + + + + + Gets or sets the header layout. + + + + + + Gets or sets the footer layout. + + + + + + Renders the layout for the specified logging event by invoking layout renderers. + + The logging event. + The rendered layout. + + + + Renders the layout for the specified logging event by invoking layout renderers. + + The logging event. + for the result. + + + + A specialized layout that renders Log4j-compatible XML events. + + + This layout is not meant to be used explicitly. Instead you can use ${log4jxmlevent} layout renderer. + + + + + Initializes a new instance of the class. + + + + + Gets the instance that renders log events. + + + + + Gets the collection of parameters. Each parameter contains a mapping + between NLog layout and a named parameter. + + + + + + Gets or sets a value indicating whether to include contents of the dictionary. + + + + + + Gets or sets the option to include all properties from the log events + + + + + + Gets or sets a value indicating whether to include contents of the stack. + + + + + + Gets or sets a value indicating whether to include contents of the dictionary. + + + + + + Gets or sets a value indicating whether to include contents of the stack. + + + + + + Gets or sets a value indicating whether to include call site (class and method name) in the information sent over the network. + + + + + + Gets or sets a value indicating whether to include source info (file name and line number) in the information sent over the network. + + + + + + Renders the layout for the specified logging event by invoking layout renderers. + + The logging event. + The rendered layout. + + + + Renders the layout for the specified logging event by invoking layout renderers. + + The logging event. + for the result + + + + Represents a string with embedded placeholders that can render contextual information. + + + This layout is not meant to be used explicitly. Instead you can just use a string containing layout + renderers everywhere the layout is required. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The layout string to parse. + + + + Initializes a new instance of the class. + + The layout string to parse. + The NLog factories to use when creating references to layout renderers. + + + + Initializes a new instance of the class. + + The layout string to parse. + The NLog factories to use when creating references to layout renderers. + Whether should be thrown on parse errors. + + + + Original text before compile to Layout renderes + + + + + Gets or sets the layout text. + + + + + + Is the message fixed? (no Layout renderers used) + + + + + Get the fixed text. Only set when is true + + + + + Is the message a simple formatted string? (Can skip StringBuilder) + + + + + Gets a collection of objects that make up this layout. + + + + + Gets the level of stack trace information required for rendering. + + + + + Converts a text to a simple layout. + + Text to be converted. + A object. + + + + Escapes the passed text so that it can + be used literally in all places where + layout is normally expected without being + treated as layout. + + The text to be escaped. + The escaped text. + + Escaping is done by replacing all occurrences of + '${' with '${literal:text=${}' + + + + + Evaluates the specified text by expanding all layout renderers. + + The text to be evaluated. + Log event to be used for evaluation. + The input text with all occurrences of ${} replaced with + values provided by the appropriate layout renderers. + + + + Evaluates the specified text by expanding all layout renderers + in new context. + + The text to be evaluated. + The input text with all occurrences of ${} replaced with + values provided by the appropriate layout renderers. + + + + Returns a that represents the current object. + + + A that represents the current object. + + + + + + + + + + + + + + + + + + + + XML attribute. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The name of the attribute. + The layout of the attribute's value. + + + + Initializes a new instance of the class. + + The name of the attribute. + The layout of the attribute's value. + Encode value with xml-encode + + + + Gets or sets the name of the attribute. + + + + + + Gets or sets the layout that will be rendered as the attribute's value. + + + + + + Determines whether or not this attribute will be Xml encoded. + + + + + + Gets or sets whether an attribute with empty value should be included in the output + + + + + + A XML Element + + + + + + + + + + + Name of the element + + + + + + Value inside the element + + + + + + Determines whether or not this attribute will be Xml encoded. + + + + + + A specialized layout that renders XML-formatted events. + + + + + Initializes a new instance of the class. + + The name of the top XML node + The value of the top XML node + + + + Name of the XML element + + Upgrade to private protected when using C# 7.2 + + + + + Value inside the XML element + + Upgrade to private protected when using C# 7.2 + + + + + Auto indent and create new lines + + + + + + Gets the array of xml 'elements' configurations. + + + + + + Gets the array of 'attributes' configurations for the element + + + + + + Gets or sets whether a ElementValue with empty value should be included in the output + + + + + + Gets or sets a value indicating whether to include contents of the dictionary. + + + + + + Gets or sets a value indicating whether to include contents of the dictionary. + + + + + + Gets or sets the option to include all properties from the log event (as XML) + + + + + + List of property names to exclude when is true + + + + + + XML element name to use when rendering properties + + + Support string-format where {0} means property-key-name + + Skips closing element tag when having configured + + + + + + XML attribute name to use when rendering property-key + + When null (or empty) then key-attribute is not included + + + Will replace newlines in attribute-value with + + + + + + XML attribute name to use when rendering property-value + + When null (or empty) then value-attribute is not included and + value is formatted as XML-element-value + + + Skips closing element tag when using attribute for value + + Will replace newlines in attribute-value with + + + + + + XML element name to use for rendering IList-collections items + + + + + + How far should the XML serializer follow object references before backing off + + + + + + Initializes the layout. + + + + + Formats the log event as a XML document for writing. + + The logging event. + for the result + + + + Formats the log event as a XML document for writing. + + The log event to be formatted. + A XML string representation of the log event. + + + + write attribute, only if is not empty + + + + + rendered + + + + Generate description of XML Layout + + XML Layout String Description + + + + A specialized layout that renders XML-formatted events. + + + + + Initializes a new instance of the class. + + + + + + + + Name of the root XML element + + + + + + Value inside the root XML element + + + + + + Determines whether or not this attribute will be Xml encoded. + + + + + + Represents the logging event. + + + + + Gets the date of the first log event created. + + + + + The formatted log message. + + + + + The log message including any parameter placeholders + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Log level. + Logger name. + Log message including parameter placeholders. + + + + Initializes a new instance of the class. + + Log level. + Logger name. + Log message including parameter placeholders. + Log message including parameter placeholders. + + + + Initializes a new instance of the class. + + Log level. + Logger name. + An IFormatProvider that supplies culture-specific formatting information. + Log message including parameter placeholders. + Parameter array. + + + + Initializes a new instance of the class. + + Log level. + Logger name. + An IFormatProvider that supplies culture-specific formatting information. + Log message including parameter placeholders. + Parameter array. + Exception information. + + + + Gets the unique identifier of log event which is automatically generated + and monotonously increasing. + + + + + Gets or sets the timestamp of the logging event. + + + + + Gets or sets the level of the logging event. + + + + + Gets a value indicating whether stack trace has been set for this event. + + + + + Gets the stack frame of the method that did the logging. + + + + + Gets the number index of the stack frame that represents the user + code (not the NLog code). + + + + + Gets the entire stack trace. + + + + + Gets the callsite class name + + + + + Gets the callsite member function name + + + + + Gets the callsite source file path + + + + + Gets the callsite source file line number + + + + + Gets or sets the exception information. + + + + + Gets or sets the logger name. + + + + + Gets the logger short name. + + This property was marked as obsolete on NLog 2.0 and it may be removed in a future release. + + + + Gets or sets the log message including any parameter placeholders. + + + + + Gets or sets the parameter values or null if no parameters have been specified. + + + + + Gets or sets the format provider that was provided while logging or + when no formatProvider was specified. + + + + + Gets or sets the message formatter for generating + Uses string.Format(...) when nothing else has been configured. + + + + + Gets the formatted message. + + + + + Checks if any per-event properties (Without allocation) + + + + + Gets the dictionary of per-event context properties. + + + + + Gets the dictionary of per-event context properties. + Internal helper for the PropertiesDictionary type. + + Create the event-properties dictionary, even if no initial template parameters + Provided when having parsed the message template and capture template parameters (else null) + + + + + Gets the named parameters extracted from parsing as MessageTemplate + + + + + Gets the dictionary of per-event context properties. + + This property was marked as obsolete on NLog 2.0 and it may be removed in a future release. + + + + Creates the null event. + + Null log event. + + + + Creates the log event. + + The log level. + Name of the logger. + The message. + Instance of . + + + + Creates the log event. + + The log level. + Name of the logger. + The format provider. + The message. + The parameters. + Instance of . + + + + Creates the log event. + + The log level. + Name of the logger. + The format provider. + The message. + Instance of . + + + + Creates the log event. + + The log level. + Name of the logger. + The message. + The exception. + Instance of . + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Creates the log event. + + The log level. + Name of the logger. + The exception. + The format provider. + The message. + Instance of . + + + + Creates the log event. + + The log level. + Name of the logger. + The exception. + The format provider. + The message. + The parameters. + Instance of . + + + + Creates from this by attaching the specified asynchronous continuation. + + The asynchronous continuation. + Instance of with attached continuation. + + + + Returns a string representation of this log event. + + String representation of the log event. + + + + Sets the stack trace for the event info. + + The stack trace. + Index of the first user stack frame within the stack trace (Negative means NLog should skip stackframes from System-assemblies). + + + + Sets the details retrieved from the Caller Information Attributes + + + + + + + + + Set the + + true = Always, false = Never, null = Auto Detect + + + + Specialized LogFactory that can return instances of custom logger types. + + Use this only when a custom Logger type is defined. + The type of the logger to be returned. Must inherit from . + + + + Gets the logger with type . + + The logger name. + An instance of . + + + + Gets a custom logger with the full name of the current class (so namespace and class name) and type . + + An instance of . + This is a slow-running method. + Make sure you're not doing this in a loop. + + + + Creates and manages instances of objects. + + + + + Internal for unit tests + + + + + Overwrite possible file paths (including filename) for possible NLog config files. + When this property is null, the default file paths ( are used. + + + + + Occurs when logging changes. + + + + + Occurs when logging gets reloaded. + + + + + Initializes static members of the LogManager class. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The config. + + + + Initializes a new instance of the class. + + The config loader + The custom AppEnvironmnet override + + + + Gets the current . + + + + + Gets or sets a value indicating whether exceptions should be thrown. See also . + + A value of true if exception should be thrown; otherwise, false. + By default exceptions are not thrown under any circumstances. + + + + Gets or sets a value indicating whether should be thrown. + + If null then is used. + + A value of true if exception should be thrown; otherwise, false. + + This option is for backwards-compatibility. + By default exceptions are not thrown under any circumstances. + + + + + Gets or sets a value indicating whether Variables should be kept on configuration reload. + Default value - false. + + + + + Gets or sets a value indicating whether to automatically call + on AppDomain.Unload or AppDomain.ProcessExit + + + + + Gets or sets the current logging configuration. After setting this property all + existing loggers will be re-configured, so there is no need to call + manually. + + + + + Gets or sets the global log level threshold. Log events below this threshold are not logged. + + + + + Gets the default culture info to use as . + + + Specific culture info or null to use + + + + + Performs application-defined tasks associated with freeing, releasing, or resetting + unmanaged resources. + + + + + Begins configuration of the LogFactory options using fluent interface + + + + + Begins configuration of the LogFactory options using fluent interface + + + + + Creates a logger that discards all log messages. + + Null logger instance. + + + + Gets the logger with the full name of the current class, so namespace and class name. + + The logger. + This is a slow-running method. + Make sure you're not doing this in a loop. + + + + Gets the logger with the full name of the current class, so namespace and class name. + Use to create instance of a custom . + If you haven't defined your own class, then use the overload without the type parameter. + + The logger with type . + Type of the logger + This is a slow-running method. + Make sure you're not doing this in a loop. + + + + Gets a custom logger with the full name of the current class, so namespace and class name. + Use to create instance of a custom . + If you haven't defined your own class, then use the overload without the loggerType. + + The type of the logger to create. The type must inherit from + The logger of type . + This is a slow-running method. Make sure you are not calling this method in a + loop. + + + + Gets the specified named logger. + + Name of the logger. + The logger reference. Multiple calls to GetLogger with the same argument + are not guaranteed to return the same logger reference. + + + + Gets the specified named logger. + Use to create instance of a custom . + If you haven't defined your own class, then use the overload without the type parameter. + + Name of the logger. + Type of the logger + The logger reference with type . Multiple calls to GetLogger with the same argument + are not guaranteed to return the same logger reference. + + + + Gets the specified named logger. + Use to create instance of a custom . + If you haven't defined your own class, then use the overload without the loggerType. + + Name of the logger. + The type of the logger to create. The type must inherit from . + The logger of type . Multiple calls to GetLogger with the + same argument aren't guaranteed to return the same logger reference. + + + + Loops through all loggers previously returned by GetLogger and recalculates their + target and filter list. Useful after modifying the configuration programmatically + to ensure that all loggers have been properly configured. + + + + + Flush any pending log messages (in case of asynchronous targets) with the default timeout of 15 seconds. + + + + + Flush any pending log messages (in case of asynchronous targets). + + Maximum time to allow for the flush. Any messages after that time + will be discarded. + + + + Flush any pending log messages (in case of asynchronous targets). + + Maximum time to allow for the flush. Any messages + after that time will be discarded. + + + + Flush any pending log messages (in case of asynchronous targets). + + The asynchronous continuation. + + + + Flush any pending log messages (in case of asynchronous targets). + + The asynchronous continuation. + Maximum time to allow for the flush. Any messages + after that time will be discarded. + + + + Flush any pending log messages (in case of asynchronous targets). + + The asynchronous continuation. + Maximum time to allow for the flush. Any messages after that time will be discarded. + + + + Flushes any pending log messages on all appenders. + + Config containing Targets to Flush + Flush completed notification (success / timeout) + Optional timeout that guarantees that completed notication is called. + + + + + Decreases the log enable counter and if it reaches -1 the logs are disabled. + + + Logging is enabled if the number of calls is greater than + or equal to calls. + + This method was marked as obsolete on NLog 4.0 and it may be removed in a future release. + + An object that implements IDisposable whose Dispose() method re-enables logging. + To be used with C# using () statement. + + + + Increases the log enable counter and if it reaches 0 the logs are disabled. + + + Logging is enabled if the number of calls is greater than + or equal to calls. + + This method was marked as obsolete on NLog 4.0 and it may be removed in a future release. + + + + + Decreases the log enable counter and if it reaches -1 the logs are disabled. + + + Logging is enabled if the number of calls is greater than + or equal to calls. + + An object that implements IDisposable whose Dispose() method re-enables logging. + To be used with C# using () statement. + + + + Increases the log enable counter and if it reaches 0 the logs are disabled. + + Logging is enabled if the number of calls is greater + than or equal to calls. + + + + Returns if logging is currently enabled. + + A value of if logging is currently enabled, + otherwise. + Logging is enabled if the number of calls is greater + than or equal to calls. + + + + Raises the event when the configuration is reloaded. + + Event arguments. + + + + Raises the event when the configuration is reloaded. + + Event arguments + + + + Currently this is disposing? + + + + + Releases unmanaged and - optionally - managed resources. + + True to release both managed and unmanaged resources; + false to release only unmanaged resources. + + + + Dispose all targets, and shutdown logging. + + + + + Get file paths (including filename) for the possible NLog config files. + + The file paths to the possible config file + + + + Get file paths (including filename) for the possible NLog config files. + + The file paths to the possible config file + + + + Overwrite the paths (including filename) for the possible NLog config files. + + The file paths to the possible config file + + + + Clear the candidate file paths and return to the defaults. + + + + + Loads logging configuration from file (Currently only XML configuration files supported) + + Configuration file to be read + LogFactory instance for fluent interface + + + + Logger cache key. + + + + + Serves as a hash function for a particular type. + + + A hash code for the current . + + + + + Determines if two objects are equal in value. + + Other object to compare to. + True if objects are equal, false otherwise. + + + + Determines if two objects of the same type are equal in value. + + Other object to compare to. + True if objects are equal, false otherwise. + + + + Logger cache. + + + + + Inserts or updates. + + + + + + + Internal for unit tests + + + + + Enables logging in implementation. + + + + + Initializes a new instance of the class. + + The factory. + + + + Enables logging. + + + + + Logging methods which only are executed when the DEBUG conditional compilation symbol is set. + + Remarks: + The DEBUG conditional compilation symbol is default enabled (only) in a debug build. + + If the DEBUG conditional compilation symbol isn't set in the calling library, the compiler will remove all the invocations to these methods. + This could lead to better performance. + + See: https://msdn.microsoft.com/en-us/library/4xssyw96%28v=vs.90%29.aspx + + + Provides logging interface and utility functions. + + + Auto-generated Logger members for binary compatibility with NLog 1.0. + + + Provides logging interface and utility functions. + + + + + Writes the diagnostic message at the Debug level using the specified format provider and format parameters. + + + Writes the diagnostic message at the Debug level. + Only executed when the DEBUG conditional compilation symbol is set. + Type of the value. + The value to be written. + + + + Writes the diagnostic message at the Debug level. + Only executed when the DEBUG conditional compilation symbol is set. + Type of the value. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the Debug level. + Only executed when the DEBUG conditional compilation symbol is set. + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Debug level. + Only executed when the DEBUG conditional compilation symbol is set. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message and exception at the Debug level. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message at the Debug level using the specified parameters and formatting them with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Debug level. + Only executed when the DEBUG conditional compilation symbol is set. + Log message. + + + + Writes the diagnostic message at the Debug level using the specified parameters. + Only executed when the DEBUG conditional compilation symbol is set. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Debug level using the specified parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + The type of the argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified parameter. + Only executed when the DEBUG conditional compilation symbol is set. + The type of the argument. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified arguments formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + The type of the first argument. + The type of the second argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Debug level using the specified parameters. + Only executed when the DEBUG conditional compilation symbol is set. + The type of the first argument. + The type of the second argument. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Debug level using the specified arguments formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + The type of the first argument. + The type of the second argument. + The type of the third argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Debug level using the specified parameters. + Only executed when the DEBUG conditional compilation symbol is set. + The type of the first argument. + The type of the second argument. + The type of the third argument. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Debug level. + Only executed when the DEBUG conditional compilation symbol is set. + A to be written. + + + + Writes the diagnostic message at the Debug level. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the Debug level using the specified parameters. + Only executed when the DEBUG conditional compilation symbol is set. + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the Debug level using the specified parameters. + Only executed when the DEBUG conditional compilation symbol is set. + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified format provider and format parameters. + + + Writes the diagnostic message at the Trace level. + Only executed when the DEBUG conditional compilation symbol is set. + Type of the value. + The value to be written. + + + + Writes the diagnostic message at the Trace level. + Only executed when the DEBUG conditional compilation symbol is set. + Type of the value. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the Trace level. + Only executed when the DEBUG conditional compilation symbol is set. + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Trace level. + Only executed when the DEBUG conditional compilation symbol is set. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message and exception at the Trace level. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message at the Trace level using the specified parameters and formatting them with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Trace level. + Only executed when the DEBUG conditional compilation symbol is set. + Log message. + + + + Writes the diagnostic message at the Trace level using the specified parameters. + Only executed when the DEBUG conditional compilation symbol is set. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Trace level using the specified parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + The type of the argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified parameter. + Only executed when the DEBUG conditional compilation symbol is set. + The type of the argument. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified arguments formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + The type of the first argument. + The type of the second argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Trace level using the specified parameters. + Only executed when the DEBUG conditional compilation symbol is set. + The type of the first argument. + The type of the second argument. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Trace level using the specified arguments formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + The type of the first argument. + The type of the second argument. + The type of the third argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Trace level using the specified parameters. + Only executed when the DEBUG conditional compilation symbol is set. + The type of the first argument. + The type of the second argument. + The type of the third argument. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Trace level. + Only executed when the DEBUG conditional compilation symbol is set. + A to be written. + + + + Writes the diagnostic message at the Trace level. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the Trace level using the specified parameters. + Only executed when the DEBUG conditional compilation symbol is set. + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the Trace level using the specified parameters. + Only executed when the DEBUG conditional compilation symbol is set. + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + Only executed when the DEBUG conditional compilation symbol is set. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + Only executed when the DEBUG conditional compilation symbol is set. + A containing one format item. + The argument to format. + + + + Gets a value indicating whether logging is enabled for the Trace level. + + A value of if logging is enabled for the Trace level, otherwise it returns . + + + + Gets a value indicating whether logging is enabled for the Debug level. + + A value of if logging is enabled for the Debug level, otherwise it returns . + + + + Gets a value indicating whether logging is enabled for the Info level. + + A value of if logging is enabled for the Info level, otherwise it returns . + + + + Gets a value indicating whether logging is enabled for the Warn level. + + A value of if logging is enabled for the Warn level, otherwise it returns . + + + + Gets a value indicating whether logging is enabled for the Error level. + + A value of if logging is enabled for the Error level, otherwise it returns . + + + + Gets a value indicating whether logging is enabled for the Fatal level. + + A value of if logging is enabled for the Fatal level, otherwise it returns . + + + + Writes the diagnostic message at the Trace level using the specified format provider and format parameters. + + + Writes the diagnostic message at the Trace level. + + Type of the value. + The value to be written. + + + + Writes the diagnostic message at the Trace level. + + Type of the value. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the Trace level. + + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Trace level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message at the Trace level using the specified parameters and formatting them with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Trace level. + + Log message. + + + + Writes the diagnostic message at the Trace level using the specified parameters. + + A containing format items. + Arguments to format. + + + + Writes the diagnostic message and exception at the Trace level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message and exception at the Trace level. + + A to be written. + An exception to be logged. + + + + Writes the diagnostic message and exception at the Trace level. + + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message and exception at the Trace level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message at the Trace level using the specified parameter and formatting it with the supplied format provider. + + The type of the argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified parameter. + + The type of the argument. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Trace level using the specified parameters. + + The type of the first argument. + The type of the second argument. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Trace level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Trace level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Debug level using the specified format provider and format parameters. + + + Writes the diagnostic message at the Debug level. + + Type of the value. + The value to be written. + + + + Writes the diagnostic message at the Debug level. + + Type of the value. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the Debug level. + + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Debug level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message at the Debug level using the specified parameters and formatting them with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Debug level. + + Log message. + + + + Writes the diagnostic message at the Debug level using the specified parameters. + + A containing format items. + Arguments to format. + + + + Writes the diagnostic message and exception at the Debug level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message and exception at the Debug level. + + A to be written. + An exception to be logged. + + + + Writes the diagnostic message and exception at the Debug level. + + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message and exception at the Debug level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message at the Debug level using the specified parameter and formatting it with the supplied format provider. + + The type of the argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified parameter. + + The type of the argument. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Debug level using the specified parameters. + + The type of the first argument. + The type of the second argument. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Debug level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Debug level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Info level using the specified format provider and format parameters. + + + Writes the diagnostic message at the Info level. + + Type of the value. + The value to be written. + + + + Writes the diagnostic message at the Info level. + + Type of the value. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the Info level. + + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Info level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message at the Info level using the specified parameters and formatting them with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Info level. + + Log message. + + + + Writes the diagnostic message at the Info level using the specified parameters. + + A containing format items. + Arguments to format. + + + + Writes the diagnostic message and exception at the Info level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message and exception at the Info level. + + A to be written. + An exception to be logged. + + + + Writes the diagnostic message and exception at the Info level. + + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message and exception at the Info level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message at the Info level using the specified parameter and formatting it with the supplied format provider. + + The type of the argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified parameter. + + The type of the argument. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Info level using the specified parameters. + + The type of the first argument. + The type of the second argument. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Info level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Info level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Warn level using the specified format provider and format parameters. + + + Writes the diagnostic message at the Warn level. + + Type of the value. + The value to be written. + + + + Writes the diagnostic message at the Warn level. + + Type of the value. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the Warn level. + + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Warn level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message at the Warn level using the specified parameters and formatting them with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Warn level. + + Log message. + + + + Writes the diagnostic message at the Warn level using the specified parameters. + + A containing format items. + Arguments to format. + + + + Writes the diagnostic message and exception at the Warn level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message and exception at the Warn level. + + A to be written. + An exception to be logged. + + + + Writes the diagnostic message and exception at the Warn level. + + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message and exception at the Warn level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message at the Warn level using the specified parameter and formatting it with the supplied format provider. + + The type of the argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified parameter. + + The type of the argument. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Warn level using the specified parameters. + + The type of the first argument. + The type of the second argument. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Warn level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Warn level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Error level using the specified format provider and format parameters. + + + Writes the diagnostic message at the Error level. + + Type of the value. + The value to be written. + + + + Writes the diagnostic message at the Error level. + + Type of the value. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the Error level. + + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Error level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message at the Error level using the specified parameters and formatting them with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Error level. + + Log message. + + + + Writes the diagnostic message at the Error level using the specified parameters. + + A containing format items. + Arguments to format. + + + + Writes the diagnostic message and exception at the Error level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message and exception at the Error level. + + A to be written. + An exception to be logged. + + + + Writes the diagnostic message and exception at the Error level. + + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message and exception at the Error level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message at the Error level using the specified parameter and formatting it with the supplied format provider. + + The type of the argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified parameter. + + The type of the argument. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Error level using the specified parameters. + + The type of the first argument. + The type of the second argument. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Error level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Error level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified format provider and format parameters. + + + Writes the diagnostic message at the Fatal level. + + Type of the value. + The value to be written. + + + + Writes the diagnostic message at the Fatal level. + + Type of the value. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the Fatal level. + + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the Fatal level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message at the Fatal level using the specified parameters and formatting them with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the Fatal level. + + Log message. + + + + Writes the diagnostic message at the Fatal level using the specified parameters. + + A containing format items. + Arguments to format. + + + + Writes the diagnostic message and exception at the Fatal level. + + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message and exception at the Fatal level. + + A to be written. + An exception to be logged. + + + + Writes the diagnostic message and exception at the Fatal level. + + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message and exception at the Fatal level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + An exception to be logged. + Arguments to format. + + + + Writes the diagnostic message at the Fatal level using the specified parameter and formatting it with the supplied format provider. + + The type of the argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified parameter. + + The type of the argument. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified parameters. + + The type of the first argument. + The type of the second argument. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the specified level. + + The log level. + A to be written. + + + + Writes the diagnostic message at the specified level. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the specified level using the specified parameters. + + The log level. + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the specified level using the specified parameters. + + The log level. + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter and formatting it with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified value as a parameter. + + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level. + + A to be written. + + + + Writes the diagnostic message at the Trace level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the Trace level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the Trace level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Trace level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level. + + A to be written. + + + + Writes the diagnostic message at the Debug level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the Debug level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the Debug level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Debug level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level. + + A to be written. + + + + Writes the diagnostic message at the Info level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the Info level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the Info level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Info level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level. + + A to be written. + + + + Writes the diagnostic message at the Warn level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the Warn level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the Warn level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Warn level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level. + + A to be written. + + + + Writes the diagnostic message at the Error level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the Error level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the Error level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Error level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level. + + A to be written. + + + + Writes the diagnostic message at the Fatal level. + + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + + + + Writes the diagnostic message at the Fatal level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified parameters. + + A containing format items. + First argument to format. + Second argument to format. + Third argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter and formatting it with the supplied format provider. + + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the Fatal level using the specified value as a parameter. + + A containing one format item. + The argument to format. + + + + Initializes a new instance of the class. + + + + + Occurs when logger configuration changes. + + + + + Gets the name of the logger. + + + + + Gets the factory that created this logger. + + + + + Collection of context properties for the Logger. The logger will append it for all log events + + + It is recommended to use for modifying context properties + when same named logger is used at multiple locations or shared by different thread contexts. + + + + + Gets a value indicating whether logging is enabled for the specified level. + + Log level to be checked. + A value of if logging is enabled for the specified level, otherwise it returns . + + + + Creates new logger that automatically appends the specified property to all log events (without changing current logger) + + Property Name + Property Value + New Logger object that automatically appends specified property + + + + Updates the specified context property for the current logger. The logger will append it for all log events. + + It could be rendered with ${event-properties:YOURNAME} + + With property, all properties could be changed. + + + Will affect all locations/contexts that makes use of the same named logger object. + + Property Name + Property Value + + It is recommended to use for modifying context properties + when same named logger is used at multiple locations or shared by different thread contexts. + + + + + Writes the specified diagnostic message. + + Log event. + + + + Writes the specified diagnostic message. + + The name of the type that wraps Logger. + Log event. + + + + Writes the diagnostic message at the specified level using the specified format provider and format parameters. + + + Writes the diagnostic message at the specified level. + + Type of the value. + The log level. + The value to be written. + + + + Writes the diagnostic message at the specified level. + + Type of the value. + The log level. + An IFormatProvider that supplies culture-specific formatting information. + The value to be written. + + + + Writes the diagnostic message at the specified level. + + The log level. + A function returning message to be written. Function is not evaluated if logging is not enabled. + + + + Writes the diagnostic message and exception at the specified level. + + The log level. + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message at the specified level using the specified parameters and formatting them with the supplied format provider. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message at the specified level. + + The log level. + Log message. + + + + Writes the diagnostic message at the specified level using the specified parameters. + + The log level. + A containing format items. + Arguments to format. + + + + Writes the diagnostic message and exception at the specified level. + + The log level. + A to be written. + An exception to be logged. + This method was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Writes the diagnostic message and exception at the specified level. + + The log level. + A to be written. + Arguments to format. + An exception to be logged. + + + + Writes the diagnostic message and exception at the specified level. + + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A to be written. + Arguments to format. + An exception to be logged. + + + + Writes the diagnostic message at the specified level using the specified parameter and formatting it with the supplied format provider. + + The type of the argument. + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified parameter. + + The type of the argument. + The log level. + A containing one format item. + The argument to format. + + + + Writes the diagnostic message at the specified level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the specified level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The log level. + A containing one format item. + The first argument to format. + The second argument to format. + + + + Writes the diagnostic message at the specified level using the specified arguments formatting it with the supplied format provider. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + The log level. + An IFormatProvider that supplies culture-specific formatting information. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Writes the diagnostic message at the specified level using the specified parameters. + + The type of the first argument. + The type of the second argument. + The type of the third argument. + The log level. + A containing one format item. + The first argument to format. + The second argument to format. + The third argument to format. + + + + Runs the provided action. If the action throws, the exception is logged at Error level. The exception is not propagated outside of this method. + + Action to execute. + + + + Runs the provided function and returns its result. If an exception is thrown, it is logged at Error level. + The exception is not propagated outside of this method; a default value is returned instead. + + Return type of the provided function. + Function to run. + Result returned by the provided function or the default value of type in case of exception. + + + + Runs the provided function and returns its result. If an exception is thrown, it is logged at Error level. + The exception is not propagated outside of this method; a fallback value is returned instead. + + Return type of the provided function. + Function to run. + Fallback value to return in case of exception. + Result returned by the provided function or fallback value in case of exception. + + + + Logs an exception is logged at Error level if the provided task does not run to completion. + + The task for which to log an error if it does not run to completion. + This method is useful in fire-and-forget situations, where application logic does not depend on completion of task. This method is avoids C# warning CS4014 in such situations. + + + + Returns a task that completes when a specified task to completes. If the task does not run to completion, an exception is logged at Error level. The returned task always runs to completion. + + The task for which to log an error if it does not run to completion. + A task that completes in the state when completes. + + + + Runs async action. If the action throws, the exception is logged at Error level. The exception is not propagated outside of this method. + + Async action to execute. + + + + Runs the provided async function and returns its result. If the task does not run to completion, an exception is logged at Error level. + The exception is not propagated outside of this method; a default value is returned instead. + + Return type of the provided function. + Async function to run. + A task that represents the completion of the supplied task. If the supplied task ends in the state, the result of the new task will be the result of the supplied task; otherwise, the result of the new task will be the default value of type . + + + + Runs the provided async function and returns its result. If the task does not run to completion, an exception is logged at Error level. + The exception is not propagated outside of this method; a fallback value is returned instead. + + Return type of the provided function. + Async function to run. + Fallback value to return if the task does not end in the state. + A task that represents the completion of the supplied task. If the supplied task ends in the state, the result of the new task will be the result of the supplied task; otherwise, the result of the new task will be the fallback value. + + + + Raises the event when the logger is reconfigured. + + Event arguments + + + + Implementation of logging engine. + + + + + Gets the filter result. + + The filter chain. + The log event. + default result if there are no filters, or none of the filters decides. + The result of the filter. + + + + Defines available log levels. + + + + + Trace log level. + + + + + Debug log level. + + + + + Info log level. + + + + + Warn log level. + + + + + Error log level. + + + + + Fatal log level. + + + + + Off log level. + + + + + Gets all the available log levels (Trace, Debug, Info, Warn, Error, Fatal, Off). + + + + + Gets all the log levels that can be used to log events (Trace, Debug, Info, Warn, Error, Fatal) + i.e LogLevel.Off is excluded. + + + + + Initializes a new instance of . + + The log level name. + The log level ordinal number. + + + + Gets the name of the log level. + + + + + Gets the ordinal of the log level. + + + + + Compares two objects + and returns a value indicating whether + the first one is equal to the second one. + + The first level. + The second level. + The value of level1.Ordinal == level2.Ordinal. + + + + Compares two objects + and returns a value indicating whether + the first one is not equal to the second one. + + The first level. + The second level. + The value of level1.Ordinal != level2.Ordinal. + + + + Compares two objects + and returns a value indicating whether + the first one is greater than the second one. + + The first level. + The second level. + The value of level1.Ordinal > level2.Ordinal. + + + + Compares two objects + and returns a value indicating whether + the first one is greater than or equal to the second one. + + The first level. + The second level. + The value of level1.Ordinal >= level2.Ordinal. + + + + Compares two objects + and returns a value indicating whether + the first one is less than the second one. + + The first level. + The second level. + The value of level1.Ordinal < level2.Ordinal. + + + + Compares two objects + and returns a value indicating whether + the first one is less than or equal to the second one. + + The first level. + The second level. + The value of level1.Ordinal <= level2.Ordinal. + + + + Gets the that corresponds to the specified ordinal. + + The ordinal. + The instance. For 0 it returns , 1 gives and so on. + + + + Returns the that corresponds to the supplied . + + The textual representation of the log level. + The enumeration value. + + + + Returns a string representation of the log level. + + Log level name. + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + + + + + Determines whether the specified is equal to this instance. + + The to compare with this instance. + Value of true if the specified is equal to + this instance; otherwise, false. + + + + Determines whether the specified instance is equal to this instance. + + The to compare with this instance. + Value of true if the specified is equal to + this instance; otherwise, false. + + + + Compares the level to the other object. + + + The object object. + + + A value less than zero when this logger's is + less than the other logger's ordinal, 0 when they are equal and + greater than zero when this ordinal is greater than the + other ordinal. + + + + + Creates and manages instances of objects. + + + + + Internal for unit tests + + + + + Delegate used to set/get the culture in use. + + This delegate marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Gets the instance used in the . + + Could be used to pass the to other methods + + + + Occurs when logging changes. + + + + + Occurs when logging gets reloaded. + + + + + Gets or sets a value indicating whether NLog should throw exceptions. + By default exceptions are not thrown under any circumstances. + + + + + Gets or sets a value indicating whether should be thrown. + + A value of true if exception should be thrown; otherwise, false. + + This option is for backwards-compatibility. + By default exceptions are not thrown under any circumstances. + + + + + + Gets or sets a value indicating whether Variables should be kept on configuration reload. + Default value - false. + + + + + Gets or sets a value indicating whether to automatically call + on AppDomain.Unload or AppDomain.ProcessExit + + + + + Gets or sets the current logging configuration. + + + + + + Begins configuration of the LogFactory options using fluent interface + + + + + Begins configuration of the LogFactory options using fluent interface + + + + + Loads logging configuration from file (Currently only XML configuration files supported) + + Configuration file to be read + LogFactory instance for fluent interface + + + + Gets or sets the global log threshold. Log events below this threshold are not logged. + + + + + Gets or sets the default culture to use. + + This property was marked as obsolete before NLog 4.3.11 and it may be removed in a future release. + + + + Gets the logger with the full name of the current class, so namespace and class name. + + The logger. + This is a slow-running method. + Make sure you're not doing this in a loop. + + + + Adds the given assembly which will be skipped + when NLog is trying to find the calling method on stack trace. + + The assembly to skip. + + + + Gets a custom logger with the full name of the current class, so namespace and class name. + Use to create instance of a custom . + If you haven't defined your own class, then use the overload without the loggerType. + + The logger class. This class must inherit from . + The logger of type . + This is a slow-running method. + Make sure you're not doing this in a loop. + + + + Creates a logger that discards all log messages. + + Null logger which discards all log messages. + + + + Gets the specified named logger. + + Name of the logger. + The logger reference. Multiple calls to GetLogger with the same argument aren't guaranteed to return the same logger reference. + + + + Gets the specified named custom logger. + Use to create instance of a custom . + If you haven't defined your own class, then use the overload without the loggerType. + + Name of the logger. + The logger class. This class must inherit from . + The logger of type . Multiple calls to GetLogger with the same argument aren't guaranteed to return the same logger reference. + The generic way for this method is + + + + Loops through all loggers previously returned by GetLogger. + and recalculates their target and filter list. Useful after modifying the configuration programmatically + to ensure that all loggers have been properly configured. + + + + + Flush any pending log messages (in case of asynchronous targets) with the default timeout of 15 seconds. + + + + + Flush any pending log messages (in case of asynchronous targets). + + Maximum time to allow for the flush. Any messages after that time will be discarded. + + + + Flush any pending log messages (in case of asynchronous targets). + + Maximum time to allow for the flush. Any messages after that time will be discarded. + + + + Flush any pending log messages (in case of asynchronous targets). + + The asynchronous continuation. + + + + Flush any pending log messages (in case of asynchronous targets). + + The asynchronous continuation. + Maximum time to allow for the flush. Any messages after that time will be discarded. + + + + Flush any pending log messages (in case of asynchronous targets). + + The asynchronous continuation. + Maximum time to allow for the flush. Any messages after that time will be discarded. + + + + Decreases the log enable counter and if it reaches -1 the logs are disabled. + + Logging is enabled if the number of calls is greater + than or equal to calls. + An object that implements IDisposable whose Dispose() method re-enables logging. + To be used with C# using () statement. + + + + Increases the log enable counter and if it reaches 0 the logs are disabled. + + Logging is enabled if the number of calls is greater + than or equal to calls. + + + + Checks if logging is currently enabled. + + if logging is currently enabled, + otherwise. + Logging is enabled if the number of calls is greater + than or equal to calls. + + + + Dispose all targets, and shutdown logging. + + + + + Generates a formatted message from the log event + + Log event. + Formatted message + + + + Returns a log message. Used to defer calculation of + the log message until it's actually needed. + + Log message. + + + + Mapped Diagnostics Context - a thread-local structure that keeps a dictionary + of strings and provides methods to output them in layouts. + + + + + Gets the thread-local dictionary + + Must be true for any subsequent dictionary modification operation + + + + + Sets the current thread MDC item to the specified value. + + Item name. + Item value. + An that can be used to remove the item from the current thread MDC. + + + + Sets the current thread MDC item to the specified value. + + Item name. + Item value. + >An that can be used to remove the item from the current thread MDC. + + + + Sets the current thread MDC item to the specified value. + + Item name. + Item value. + + + + Sets the current thread MDC item to the specified value. + + Item name. + Item value. + + + + Gets the current thread MDC named item, as . + + Item name. + The value of , if defined; otherwise . + If the value isn't a already, this call locks the for reading the needed for converting to . + + + + Gets the current thread MDC named item, as . + + Item name. + The to use when converting a value to a . + The value of , if defined; otherwise . + If is null and the value isn't a already, this call locks the for reading the needed for converting to . + + + + Gets the current thread MDC named item, as . + + Item name. + The value of , if defined; otherwise null. + + + + Returns all item names + + A set of the names of all items in current thread-MDC. + + + + Checks whether the specified item exists in current thread MDC. + + Item name. + A boolean indicating whether the specified exists in current thread MDC. + + + + Removes the specified from current thread MDC. + + Item name. + + + + Clears the content of current thread MDC. + + + + + Async version of Mapped Diagnostics Context - a logical context structure that keeps a dictionary + of strings and provides methods to output them in layouts. Allows for maintaining state across + asynchronous tasks and call contexts. + + + Ideally, these changes should be incorporated as a new version of the MappedDiagnosticsContext class in the original + NLog library so that state can be maintained for multiple threads in asynchronous situations. + + + + + Simulate ImmutableDictionary behavior (which is not yet part of all .NET frameworks). + In future the real ImmutableDictionary could be used here to minimize memory usage and copying time. + + Must be true for any subsequent dictionary modification operation + Prepare dictionary for additional inserts + + + + + Gets the current logical context named item, as . + + Item name. + The value of , if defined; otherwise . + If the value isn't a already, this call locks the for reading the needed for converting to . + + + + Gets the current logical context named item, as . + + Item name. + The to use when converting a value to a string. + The value of , if defined; otherwise . + If is null and the value isn't a already, this call locks the for reading the needed for converting to . + + + + Gets the current logical context named item, as . + + Item name. + The value of , if defined; otherwise null. + + + + Sets the current logical context item to the specified value. + + Item name. + Item value. + >An that can be used to remove the item from the current logical context. + + + + Sets the current logical context item to the specified value. + + Item name. + Item value. + >An that can be used to remove the item from the current logical context. + + + + Sets the current logical context item to the specified value. + + Item name. + Item value. + >An that can be used to remove the item from the current logical context. + + + + Updates the current logical context with multiple items in single operation + + . + >An that can be used to remove the item from the current logical context (null if no items). + + + + Sets the current logical context item to the specified value. + + Item name. + Item value. + + + + Sets the current logical context item to the specified value. + + Item name. + Item value. + + + + Sets the current logical context item to the specified value. + + Item name. + Item value. + + + + Returns all item names + + A collection of the names of all items in current logical context. + + + + Checks whether the specified exists in current logical context. + + Item name. + A boolean indicating whether the specified exists in current logical context. + + + + Removes the specified from current logical context. + + Item name. + + + + Clears the content of current logical context. + + + + + Clears the content of current logical context. + + Free the full slot. + + + + Mapped Diagnostics Context + + This class marked as obsolete before NLog 2.0 and it may be removed in a future release. + + + + Sets the current thread MDC item to the specified value. + + Item name. + Item value. + + + + Gets the current thread MDC named item. + + Item name. + The value of , if defined; otherwise . + If the value isn't a already, this call locks the for reading the needed for converting to . + + + + Gets the current thread MDC named item. + + Item name. + The value of , if defined; otherwise null. + + + + Checks whether the specified item exists in current thread MDC. + + Item name. + A boolean indicating whether the specified item exists in current thread MDC. + + + + Removes the specified item from current thread MDC. + + Item name. + + + + Clears the content of current thread MDC. + + + + + Mark a parameter of a method for message templating + + + + + Specifies which parameter of an annotated method should be treated as message-template-string + + + + + The name of the parameter that should be as treated as message-template-string + + + + + The type of the captured hole + + + + + Not decided + + + + + normal {x} + + + + + Serialize operator {@x} (aka destructure) + + + + + stringification operator {$x} + + + + + A hole that will be replaced with a value + + + + + Constructor + + + + Parameter name sent to structured loggers. + This is everything between "{" and the first of ",:}". + Including surrounding spaces and names that are numbers. + + + Format to render the parameter. + This is everything between ":" and the first unescaped "}" + + + + Type + + + + When the template is positional, this is the parsed name of this parameter. + For named templates, the value of Index is undefined. + + + Alignment to render the parameter, by default 0. + This is the parsed value between "," and the first of ":}" + + + + A fixed value + + + + Number of characters from the original template to copy at the current position. + This can be 0 when the template starts with a hole or when there are multiple consecutive holes. + + + Number of characters to skip in the original template at the current position. + 0 is a special value that mean: 1 escaped char, no hole. It can also happen last when the template ends with a literal. + + + + Combines Literal and Hole + + + + Literal + + + Hole + Uninitialized when = 0. + + + + Description of a single parameter extracted from a MessageTemplate + + + + + Parameter Name extracted from + This is everything between "{" and the first of ",:}". + + + + + Parameter Value extracted from the -array + + + + + Format to render the parameter. + This is everything between ":" and the first unescaped "}" + + + + + Parameter method that should be used to render the parameter + See also + + + + + Returns index for , when + + + + + Constructs a single message template parameter + + Parameter Name + Parameter Value + Parameter Format + + + + Constructs a single message template parameter + + Parameter Name + Parameter Value + Parameter Format + Parameter CaptureType + + + + Parameters extracted from parsing as MessageTemplate + + + + + + + + + + + Gets the parameters at the given index + + + + + Number of parameters + + + + Indicates whether the template should be interpreted as positional + (all holes are numbers) or named. + + + + Indicates whether the template was parsed successful, and there are no unmatched parameters + + + + + Constructor for parsing the message template with parameters + + including any parameter placeholders + All + + + + Constructor for named parameters that already has been parsed + + + + + Create MessageTemplateParameter from + + + + + A message template + + + + The original template string. + This is the key passed to structured targets. + + + The list of literal parts, useful for string rendering. + It indicates the number of characters from the original string to print, + then there's a hole with how many chars to skip. + + "Hello {firstName} {lastName}!" + ------------------------------------- + ║P |S ║P|S ║P|S║ + ║6 |11 ║1|10 ║1|0║ + ║Hello |{firstName}║ |{lastName}║!║ + + "{x} * 2 = {2x}" + -------------------- + ║P|S ║P |S ║ + ║0|3 ║7 |4 ║ + ║{x}║ * 2 = |{2x}║ + + The tricky part is escaped braces. They are represented by a skip = 0, + which is interpreted as "move one char forward, no hole". + + "Escaped }} is fun." + ---------------------- + ║P |S║P |S║ + ║9 |0║8 |0║ + ║Escaped }|}║ is fun.|║ + + + + This list of holes. It's used both to fill the string rendering + and to send values along the template to structured targets. + + + Indicates whether the template should be interpreted as positional + (all holes are numbers) or named. + + + + Create a template, which is already parsed + + + + + + + + + Create a template, which is already parsed + + + + + + + + This is for testing only: recreates from the parsed data. + + + + This is for testing only: rebuilds the hole + + Add to this string builder + ref for performance + + + + Parse templates. + + + + + Parse a template. + + Template to be parsed. + When is null. + Template, never null + + + + Gets the current literal/hole in the template + + + + + Clears the enumerator + + + + + Restarts the enumerator of the template + + + + + Moves to the next literal/hole in the template + + Found new element [true/false] + + + + Parse format after hole name/index. Handle the escaped { and } in the format. Don't read the last } + + + + + + Parse templates. + + + + + Parse a template. + + Template to be parsed. + When is null. + Template, never null + + + + Error when parsing a template. + + + + + Current index when the error occurred. + + + + + The template we were parsing + + + + + New exception + + The message to be shown. + Current index when the error occurred. + + + + + Render templates + + + + + Render a template to a string. + + The template. + Culture. + Parameters for the holes. + Do not fallback to StringBuilder.Format for positional templates. + The String Builder destination. + Parameters for the holes. + + + + Render a template to a string. + + The template. + The String Builder destination. + Culture. + Parameters for the holes. + Rendered template, never null. + + + + Convert Render or serialize a value, with optionally backwards-compatible with + + + + Singleton + + + + Serialization of an object, e.g. JSON and append to + + The object to serialize to string. + Parameter Format + Parameter CaptureType + An object that supplies culture-specific formatting information. + Output destination. + Serialize succeeded (true/false) + + + + Format an object to a readable string, or if it's an object, serialize + + The value to convert + + + + + + + + Try serializing a scalar (string, int, NULL) or simple type (IFormattable) + + + + + Serialize Dictionary as JSON like structure, without { and } + + + "FirstOrder"=true, "Previous login"=20-12-2017 14:55:32, "number of tries"=1 + + + formatstring of an item + + + + + + + + + Convert a value to a string with format and append to . + + The value to convert. + Format sting for the value. + Format provider for the value. + Append to this + + + + Nested Diagnostics Context + + This class marked as obsolete on NLog 2.0 and it may be removed in a future release. + + + + Gets the top NDC message but doesn't remove it. + + The top message. . + + + + Gets the top NDC object but doesn't remove it. + + The object from the top of the NDC stack, if defined; otherwise null. + + + + Pushes the specified text on current thread NDC. + + The text to be pushed. + An instance of the object that implements IDisposable that returns the stack to the previous level when IDisposable.Dispose() is called. To be used with C# using() statement. + + + + Pops the top message off the NDC stack. + + The top message which is no longer on the stack. + + + + Pops the top object off the NDC stack. The object is removed from the stack. + + The top object from the NDC stack, if defined; otherwise null. + + + + Clears current thread NDC stack. + + + + + Gets all messages on the stack. + + Array of strings on the stack. + + + + Gets all objects on the NDC stack. The objects are not removed from the stack. + + Array of objects on the stack. + + + + Nested Diagnostics Context - a thread-local structure that keeps a stack + of strings and provides methods to output them in layouts + + + + + Gets the top NDC message but doesn't remove it. + + The top message. . + + + + Gets the top NDC object but doesn't remove it. + + The object at the top of the NDC stack if defined; otherwise null. + + + + Pushes the specified text on current thread NDC. + + The text to be pushed. + An instance of the object that implements IDisposable that returns the stack to the previous level when IDisposable.Dispose() is called. To be used with C# using() statement. + + + + Pushes the specified object on current thread NDC. + + The object to be pushed. + An instance of the object that implements IDisposable that returns the stack to the previous level when IDisposable.Dispose() is called. To be used with C# using() statement. + + + + Pops the top message off the NDC stack. + + The top message which is no longer on the stack. + + + + Pops the top message from the NDC stack. + + The to use when converting the value to a string. + The top message, which is removed from the stack, as a string value. + + + + Pops the top object off the NDC stack. + + The object from the top of the NDC stack, if defined; otherwise null. + + + + Peeks the first object on the NDC stack + + The object from the top of the NDC stack, if defined; otherwise null. + + + + Clears current thread NDC stack. + + + + + Gets all messages on the stack. + + Array of strings on the stack. + + + + Gets all messages from the stack, without removing them. + + The to use when converting a value to a string. + Array of strings. + + + + Gets all objects on the stack. + + Array of objects on the stack. + + + + Resets the stack to the original count during . + + + + + Initializes a new instance of the class. + + The stack. + The previous count. + + + + Reverts the stack to original item count. + + + + + Async version of - a logical context structure that keeps a stack + Allows for maintaining scope across asynchronous tasks and call contexts. + + + + + Pushes the specified value on current stack + + The value to be pushed. + An instance of the object that implements IDisposable that returns the stack to the previous level when IDisposable.Dispose() is called. To be used with C# using() statement. + + + + Pushes the specified value on current stack + + The value to be pushed. + An instance of the object that implements IDisposable that returns the stack to the previous level when IDisposable.Dispose() is called. To be used with C# using() statement. + + + + Pops the top message off the NDLC stack. + + The top message which is no longer on the stack. + this methods returns a object instead of string, this because of backwards-compatibility + + + + Pops the top message from the NDLC stack. + + The to use when converting the value to a string. + The top message, which is removed from the stack, as a string value. + + + + Pops the top message off the current NDLC stack + + The object from the top of the NDLC stack, if defined; otherwise null. + + + + Peeks the top object on the current NDLC stack + + The object from the top of the NDLC stack, if defined; otherwise null. + + + + Peeks the current scope, and returns its start time + + Scope Creation Time + + + + Peeks the first scope, and returns its start time + + Scope Creation Time + + + + Clears current stack. + + + + + Gets all messages on the stack. + + Array of strings on the stack. + + + + Gets all messages from the stack, without removing them. + + The to use when converting a value to a string. + Array of strings. + + + + Gets all objects on the stack. The objects are not removed from the stack. + + Array of objects on the stack. + + + + Exception thrown during NLog configuration. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + Parameters for the message + + + + Initializes a new instance of the class. + + The inner exception. + The message. + Parameters for the message + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + The parameter is null. + + + The class name is null or is zero (0). + + + + + Exception thrown during log event processing. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The message. + + + + Initializes a new instance of the class. + + The message. + Parameters for the message + + + + Initializes a new instance of the class. + + The message. + The inner exception. + + + + Initializes a new instance of the class. + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + The parameter is null. + + + The class name is null or is zero (0). + + + + + TraceListener which routes all messages through NLog. + + + + + Initializes a new instance of the class. + + + + + Gets or sets the log factory to use when outputting messages (null - use LogManager). + + + + + Gets or sets the default log level. + + + + + Gets or sets the log which should be always used regardless of source level. + + + + + Gets or sets a value indicating whether flush calls from trace sources should be ignored. + + + + + Gets a value indicating whether the trace listener is thread safe. + + + true if the trace listener is thread safe; otherwise, false. The default is false. + + + + Gets or sets a value indicating whether to use auto logger name detected from the stack trace. + + + + + When overridden in a derived class, writes the specified message to the listener you create in the derived class. + + A message to write. + + + + When overridden in a derived class, writes a message to the listener you create in the derived class, followed by a line terminator. + + A message to write. + + + + When overridden in a derived class, closes the output stream so it no longer receives tracing or debugging output. + + + + + Emits an error message. + + A message to emit. + + + + Emits an error message and a detailed error message. + + A message to emit. + A detailed message to emit. + + + + Flushes the output (if is not true) buffer with the default timeout of 15 seconds. + + + + + Writes trace information, a data object and event information to the listener specific output. + + A object that contains the current process ID, thread ID, and stack trace information. + A name used to identify the output, typically the name of the application that generated the trace event. + One of the values specifying the type of event that has caused the trace. + A numeric identifier for the event. + The trace data to emit. + + + + Writes trace information, an array of data objects and event information to the listener specific output. + + A object that contains the current process ID, thread ID, and stack trace information. + A name used to identify the output, typically the name of the application that generated the trace event. + One of the values specifying the type of event that has caused the trace. + A numeric identifier for the event. + An array of objects to emit as data. + + + + Writes trace and event information to the listener specific output. + + A object that contains the current process ID, thread ID, and stack trace information. + A name used to identify the output, typically the name of the application that generated the trace event. + One of the values specifying the type of event that has caused the trace. + A numeric identifier for the event. + + + + Writes trace information, a formatted array of objects and event information to the listener specific output. + + A object that contains the current process ID, thread ID, and stack trace information. + A name used to identify the output, typically the name of the application that generated the trace event. + One of the values specifying the type of event that has caused the trace. + A numeric identifier for the event. + A format string that contains zero or more format items, which correspond to objects in the array. + An object array containing zero or more objects to format. + + + + Writes trace information, a message, and event information to the listener specific output. + + A object that contains the current process ID, thread ID, and stack trace information. + A name used to identify the output, typically the name of the application that generated the trace event. + One of the values specifying the type of event that has caused the trace. + A numeric identifier for the event. + A message to write. + + + + Writes trace information, a message, a related activity identity and event information to the listener specific output. + + A object that contains the current process ID, thread ID, and stack trace information. + A name used to identify the output, typically the name of the application that generated the trace event. + A numeric identifier for the event. + A message to write. + A object identifying a related activity. + + + + Gets the custom attributes supported by the trace listener. + + + A string array naming the custom attributes supported by the trace listener, or null if there are no custom attributes. + + + + + Translates the event type to level from . + + Type of the event. + Translated log level. + + + + Process the log event + The log level. + The name of the logger. + The log message. + The log parameters. + The event id. + The event type. + The related activity id. + + + + + It works as a normal but it discards all messages which an application requests + to be logged. + + It effectively implements the "Null Object" pattern for objects. + + + + + Initializes a new instance of . + + The factory class to be used for the creation of this logger. + + + + Extension methods to setup LogFactory options + + + + + Gets the logger with the full name of the current class, so namespace and class name. + + + + + Gets the specified named logger. + + + + + Configures loading of NLog extensions for Targets and LayoutRenderers + + + + + Configures the output of NLog for diagnostics / troubleshooting + + + + + Configures serialization and transformation of LogEvents + + + + + Loads NLog config created by the method + + + + + Loads NLog config provided in + + + + + Loads NLog config from filename if provided, else fallback to scanning for NLog.config + + + + + Loads NLog config from XML in + + + + + Extension methods to setup NLog extensions, so they are known when loading NLog LoggingConfiguration + + + + + Enable/disables autoloading of NLog extensions by scanning and loading available assemblies + + + Enabled by default, and gives a huge performance hit during startup. Recommended to disable this when running in the cloud. + + + + + Registers NLog extensions from the assembly. + + + + + Registers NLog extensions from the assembly type name + + + + + Register a custom Target. + + Fluent interface parameter. + Type of the Target. + Name of the Target. + + + + Register a custom Target. + + Fluent interface parameter. + Type of the Target. + Name of the Target. + + + + Register a custom layout renderer. + + Fluent interface parameter. + Type of the layout renderer. + Name of the layout renderer - without ${}. + + + + Register a custom layout renderer. + + Fluent interface parameter. + Type of the layout renderer. + Name of the layout renderer - without ${}. + + + + Register a custom layout renderer with a callback function . The callback receives the logEvent. + + Fluent interface parameter. + Name of the layout renderer - without ${}. + Callback that returns the value for the layout renderer. + + + + Register a custom layout renderer with a callback function . The callback receives the logEvent and the current configuration. + + Fluent interface parameter. + Name of the layout renderer - without ${}. + Callback that returns the value for the layout renderer. + + + + Register a custom condition method, that can use in condition filters + + Fluent interface parameter. + Name of the condition filter method + MethodInfo extracted by reflection - typeof(MyClass).GetMethod("MyFunc", BindingFlags.Static). + + + + Register a custom condition method, that can use in condition filters + + Fluent interface parameter. + Name of the condition filter method + Lambda method. + + + + Register a custom condition method, that can use in condition filters + + Fluent interface parameter. + Name of the condition filter method + Lambda method. + + + + Extension methods to setup NLog options + + + + + Configures + + + + + Configures + + + + + Configures + + + + + Configures + + + + + Configures + + + + + Configures + + + + + Configures + + + + + Extension methods to setup NLog extensions, so they are known when loading NLog LoggingConfiguration + + + + + Overrides the active with a new custom implementation + + + + + Overrides the active with a new custom implementation + + + + + Registers object Type transformation from dangerous (massive) object to safe (reduced) object + + + + + Registers object Type transformation from dangerous (massive) object to safe (reduced) object + + + + + Specifies the way archive numbering is performed. + + + + + Sequence style numbering. The most recent archive has the highest number. + + + + + Rolling style numbering (the most recent is always #0 then #1, ..., #N. + + + + + Date style numbering. Archives will be stamped with the prior period + (Year, Month, Day, Hour, Minute) datetime. + + + + + Date and sequence style numbering. + Archives will be stamped with the prior period (Year, Month, Day) datetime. + The most recent archive has the highest number (in combination with the date). + + + + + Abstract Target with async Task support + + + + + How many milliseconds to delay the actual write operation to optimize for batching + + + + + How many seconds a Task is allowed to run before it is cancelled. + + + + + How many attempts to retry the same Task, before it is aborted + + + + + How many milliseconds to wait before next retry (will double with each retry) + + + + + Gets or sets whether to use the locking queue, instead of a lock-free concurrent queue + The locking queue is less concurrent when many logger threads, but reduces memory allocation + + + + + Gets or sets the action to be taken when the lazy writer thread request queue count + exceeds the set limit. + + + + + + Gets or sets the limit on the number of requests in the lazy writer thread request queue. + + + + + + Gets or sets the number of log events that should be processed in a batch + by the lazy writer thread. + + + + + + Task Scheduler used for processing async Tasks + + + + + Constructor + + + + + Initializes the internal queue for pending logevents + + + + + Override this to create the actual logging task + + Example of how to override this method, and call custom async method + + protected override Task WriteAsyncTask(LogEventInfo logEvent, CancellationToken token) + { + return CustomWriteAsync(logEvent, token); + } + + private async Task CustomWriteAsync(LogEventInfo logEvent, CancellationToken token) + { + await MyLogMethodAsync(logEvent, token).ConfigureAwait(false); + } + + + The log event. + The cancellation token + + + + + Override this to create the actual logging task for handling batch of logevents + + A batch of logevents. + The cancellation token + + + + + Handle cleanup after failed write operation + + Exception from previous failed Task + The cancellation token + Number of retries remaining + Time to sleep before retrying + Should attempt retry + + + + Schedules the LogEventInfo for async writing + + The log event. + + + + Write to queue without locking + + + + + + Schedules notification of when all messages has been written + + + + + + Closes Target by updating CancellationToken + + + + + Releases any managed resources + + + + + + Checks the internal queue for the next to create a new task for + + Used for race-condition validation between task-completion and timeout + Signals whether previousTask completed an almost full BatchSize + + + + Generates recursive task-chain to perform retry of writing logevents with increasing retry-delay + + + + + Creates new task to handle the writing of the input + + LogEvents to write + New Task created [true / false] + + + + Handles that scheduled task has completed (successfully or failed), and starts the next pending task + + Task just completed + AsyncContinuation to notify of success or failure + + + + Timer method, that is fired when pending task fails to complete within timeout + + + + + + Sends log messages to the remote instance of Chainsaw application from log4j. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +

+ NOTE: If your receiver application is ever likely to be off-line, don't use TCP protocol + or you'll get TCP timeouts and your application will crawl. + Either switch to UDP transport or use AsyncWrapper target + so that your application threads will not be blocked by the timing-out connection attempts. +

+
+
+ + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class with a name. + + Name of the target. + + + + Color formatting for using ANSI Color Codes + + + + + Not using bold to get light colors, as it has to be cleared + + + + + Not using bold to get light colors, as it has to be cleared (And because it only works for text, and not background) + + + + + Resets both foreground and background color. + + + + + ANSI have 8 color-codes (30-37) by default. The "bright" (or "intense") color-codes (90-97) are extended values not supported by all terminals + + + + + Color formatting for using + and + + + + + Writes log messages to the console with customizable coloring. + + Documentation on NLog Wiki + + + + Should logging being paused/stopped because of the race condition bug in Console.Writeline? + + + Console.Out.Writeline / Console.Error.Writeline could throw 'IndexOutOfRangeException', which is a bug. + See https://stackoverflow.com/questions/33915790/console-out-and-console-error-race-condition-error-in-a-windows-service-written + and https://connect.microsoft.com/VisualStudio/feedback/details/2057284/console-out-probable-i-o-race-condition-issue-in-multi-threaded-windows-service + + Full error: + Error during session close: System.IndexOutOfRangeException: Probable I/ O race condition detected while copying memory. + The I/ O package is not thread safe by default.In multithreaded applications, + a stream must be accessed in a thread-safe way, such as a thread - safe wrapper returned by TextReader's or + TextWriter's Synchronized methods.This also applies to classes like StreamWriter and StreamReader. + + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + Name of the target. + + + + Gets or sets a value indicating whether the error stream (stderr) should be used instead of the output stream (stdout). + + + + + + Gets or sets a value indicating whether to use default row highlighting rules. + + + The default rules are: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ConditionForeground ColorBackground Color
level == LogLevel.FatalRedNoChange
level == LogLevel.ErrorYellowNoChange
level == LogLevel.WarnMagentaNoChange
level == LogLevel.InfoWhiteNoChange
level == LogLevel.DebugGrayNoChange
level == LogLevel.TraceDarkGrayNoChange
+
+ +
+ + + The encoding for writing messages to the . + + Has side effect + + + + + Gets or sets a value indicating whether to auto-check if the console is available. + - Disables console writing if Environment.UserInteractive = False (Windows Service) + - Disables console writing if Console Standard Input is not available (Non-Console-App) + + + + + + Gets or sets a value indicating whether to auto-check if the console has been redirected to file + - Disables coloring logic when System.Console.IsOutputRedirected = true + + + + + + Gets or sets a value indicating whether to auto-flush after + + + Normally not required as standard Console.Out will have = true, but not when pipe to file + + + + + + Enables output using ANSI Color Codes + + + + + + Gets the row highlighting rules. + + + + + + Gets the word highlighting rules. + + + + + + Initializes the target. + + + + + Closes the target and releases any unmanaged resources. + + + + + + + + Writes the specified log event to the console highlighting entries + and words based on a set of defined rules. + + Log event. + + + + Colored console output color. + + + Note that this enumeration is defined to be binary compatible with + .NET 2.0 System.ConsoleColor + some additions + + + + + Black Color (#000000). + + + + + Dark blue Color (#000080). + + + + + Dark green Color (#008000). + + + + + Dark Cyan Color (#008080). + + + + + Dark Red Color (#800000). + + + + + Dark Magenta Color (#800080). + + + + + Dark Yellow Color (#808000). + + + + + Gray Color (#C0C0C0). + + + + + Dark Gray Color (#808080). + + + + + Blue Color (#0000FF). + + + + + Green Color (#00FF00). + + + + + Cyan Color (#00FFFF). + + + + + Red Color (#FF0000). + + + + + Magenta Color (#FF00FF). + + + + + Yellow Color (#FFFF00). + + + + + White Color (#FFFFFF). + + + + + Don't change the color. + + + + + The row-highlighting condition. + + + + + Initializes static members of the ConsoleRowHighlightingRule class. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The condition. + Color of the foreground. + Color of the background. + + + + Gets the default highlighting rule. Doesn't change the color. + + + + + Gets or sets the condition that must be met in order to set the specified foreground and background color. + + + + + + Gets or sets the foreground color. + + + + + + Gets or sets the background color. + + + + + + Checks whether the specified log event matches the condition (if any). + + + Log event. + + + A value of if the condition is not defined or + if it matches, otherwise. + + + + + Writes log messages to the console. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +
+
+ + + Should logging being paused/stopped because of the race condition bug in Console.Writeline? + + + Console.Out.Writeline / Console.Error.Writeline could throw 'IndexOutOfRangeException', which is a bug. + See https://stackoverflow.com/questions/33915790/console-out-and-console-error-race-condition-error-in-a-windows-service-written + and https://connect.microsoft.com/VisualStudio/feedback/details/2057284/console-out-probable-i-o-race-condition-issue-in-multi-threaded-windows-service + + Full error: + Error during session close: System.IndexOutOfRangeException: Probable I/ O race condition detected while copying memory. + The I/ O package is not thread safe by default. In multi threaded applications, + a stream must be accessed in a thread-safe way, such as a thread - safe wrapper returned by TextReader's or + TextWriter's Synchronized methods.This also applies to classes like StreamWriter and StreamReader. + + + + + + Gets or sets a value indicating whether to send the log messages to the standard error instead of the standard output. + + + + + + The encoding for writing messages to the . + + Has side effect + + + + + Gets or sets a value indicating whether to auto-check if the console is available + - Disables console writing if Environment.UserInteractive = False (Windows Service) + - Disables console writing if Console Standard Input is not available (Non-Console-App) + + + + + + Gets or sets a value indicating whether to auto-flush after + + + Normally not required as standard Console.Out will have = true, but not when pipe to file + + + + + + Gets or sets whether to enable batch writing using char[]-buffers, instead of using + + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + Name of the target. + + + + Initializes the target. + + + + + Closes the target and releases any unmanaged resources. + + + + + + + + Writes the specified logging event to the Console.Out or + Console.Error depending on the value of the Error flag. + + The logging event. + + Note that the Error option is not supported on .NET Compact Framework. + + + + + + + + Write to output + + + + + Highlighting rule for Win32 colorful console. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The text to be matched.. + Color of the foreground. + Color of the background. + + + + Gets or sets the regular expression to be matched. You must specify either text or regex. + + + + + + Gets or sets the condition that must be met before scanning the row for highlight of words + + + + + + Compile the ? This can improve the performance, but at the costs of more memory usage. If false, the Regex Cache is used. + + + + + + Gets or sets the text to be matched. You must specify either text or regex. + + + + + + Gets or sets a value indicating whether to match whole words only. + + + + + + Gets or sets a value indicating whether to ignore case when comparing texts. + + + + + + Gets or sets the foreground color. + + + + + + Gets or sets the background color. + + + + + + Gets the compiled regular expression that matches either Text or Regex property. Only used when is true. + + + + + Information about database command + parameters. + + + + + Initializes a new instance of the class. + + + + + Gets or sets the type of the command. + + The type of the command. + + + + + Gets or sets the connection string to run the command against. If not provided, connection string from the target is used. + + + + + + Gets or sets the command text. + + + + + + Gets or sets a value indicating whether to ignore failures. + + + + + + Gets the collection of parameters. Each parameter contains a mapping + between NLog layout and a database named or positional parameter. + + + + + + Information about object-property for the database-connection-object + + + + + Initializes a new instance of the class. + + + + + Gets or sets the name for the object-property + + + + + + Gets or sets the value to assign on the object-property + + + + + + Gets or sets the type of the object-property + + + + + + Gets or sets convert format of the property value + + + + + + Gets or sets the culture used for parsing property string-value for type-conversion + + + + + + Represents a parameter to a Database target. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Name of the parameter. + The parameter layout. + + + + Gets or sets the database parameter name. + + + + + + Gets or sets the layout that should be use to calculate the value for the parameter. + + + + + + Gets or sets the database parameter DbType. + + + + + + Gets or sets the database parameter size. + + + + + + Gets or sets the database parameter precision. + + + + + + Gets or sets the database parameter scale. + + + + + + Gets or sets the type of the parameter. + + + + + + Gets or sets convert format of the database parameter value. + + + + + + Gets or sets the culture used for parsing parameter string-value for type-conversion + + + + + + Gets or sets whether empty value should translate into DbNull. Requires database column to allow NULL values. + + + + + + Writes log messages to the database using an ADO.NET provider. + + + - NETSTANDARD cannot load connectionstrings from .config + + Documentation on NLog Wiki + + + The configuration is dependent on the database type, because + there are different methods of specifying connection string, SQL + command and command parameters. + + MS SQL Server using System.Data.SqlClient: + + Oracle using System.Data.OracleClient: + + Oracle using System.Data.OleDBClient: + + To set up the log target programmatically use code like this (an equivalent of MSSQL configuration): + + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Name of the target. + + + + Gets or sets the name of the database provider. + + + + The parameter name should be a provider invariant name as registered in machine.config or app.config. Common values are: + +
    +
  • System.Data.SqlClient - SQL Sever Client
  • +
  • System.Data.SqlServerCe.3.5 - SQL Sever Compact 3.5
  • +
  • System.Data.OracleClient - Oracle Client from Microsoft (deprecated in .NET Framework 4)
  • +
  • Oracle.DataAccess.Client - ODP.NET provider from Oracle
  • +
  • System.Data.SQLite - System.Data.SQLite driver for SQLite
  • +
  • Npgsql - Npgsql driver for PostgreSQL
  • +
  • MySql.Data.MySqlClient - MySQL Connector/Net
  • +
+ (Note that provider invariant names are not supported on .NET Compact Framework). + + Alternatively the parameter value can be be a fully qualified name of the provider + connection type (class implementing ) or one of the following tokens: + +
    +
  • sqlserver, mssql, microsoft or msde - SQL Server Data Provider
  • +
  • oledb - OLEDB Data Provider
  • +
  • odbc - ODBC Data Provider
  • +
+
+ +
+ + + Gets or sets the connection string. When provided, it overrides the values + specified in DBHost, DBUserName, DBPassword, DBDatabase. + + + + + + Gets or sets the connection string using for installation and uninstallation. If not provided, regular ConnectionString is being used. + + + + + + Gets the installation DDL commands. + + + + + + Gets the uninstallation DDL commands. + + + + + + Gets or sets a value indicating whether to keep the + database connection open between the log events. + + + + + + Obsolete - value will be ignored! The logging code always runs outside of transaction. + + Gets or sets a value indicating whether to use database transactions. + Some data providers require this. + + + + This option was removed in NLog 4.0 because the logging code always runs outside of transaction. + This ensures that the log gets written to the database if you rollback the main transaction because of an error and want to log the error. + + + + + Gets or sets the database host name. If the ConnectionString is not provided + this value will be used to construct the "Server=" part of the + connection string. + + + + + + Gets or sets the database user name. If the ConnectionString is not provided + this value will be used to construct the "User ID=" part of the + connection string. + + + + + + Gets or sets the database password. If the ConnectionString is not provided + this value will be used to construct the "Password=" part of the + connection string. + + + + + + Gets or sets the database name. If the ConnectionString is not provided + this value will be used to construct the "Database=" part of the + connection string. + + + + + + Gets or sets the text of the SQL command to be run on each log level. + + + Typically this is a SQL INSERT statement or a stored procedure call. + It should use the database-specific parameters (marked as @parameter + for SQL server or :parameter for Oracle, other data providers + have their own notation) and not the layout renderers, + because the latter is prone to SQL injection attacks. + The layout renderers should be specified as <parameter /> elements instead. + + + + + + Gets or sets the type of the SQL command to be run on each log level. + + + This specifies how the command text is interpreted, as "Text" (default) or as "StoredProcedure". + When using the value StoredProcedure, the commandText-property would + normally be the name of the stored procedure. TableDirect method is not supported in this context. + + + + + + Gets the collection of parameters. Each item contains a mapping + between NLog layout and a database named or positional parameter. + + + + + + Gets the collection of properties. Each item contains a mapping + between NLog layout and a property on the DbConnection instance + + + + + + Gets the collection of properties. Each item contains a mapping + between NLog layout and a property on the DbCommand instance + + + + + + Configures isolated transaction batch writing. If supported by the database, then it will improve insert performance. + + + + + + Performs installation which requires administrative permissions. + + The installation context. + + + + Performs uninstallation which requires administrative permissions. + + The installation context. + + + + Determines whether the item is installed. + + The installation context. + + Value indicating whether the item is installed or null if it is not possible to determine. + + + + + Initializes the target. Can be used by inheriting classes + to initialize logging. + + + + + Set the to use it for opening connections to the database. + + + + + Closes the target and releases any unmanaged resources. + + + + + Writes the specified logging event to the database. It creates + a new database command, prepares parameters for it by calculating + layouts and executes the command. + + The logging event. + + + + NOTE! Obsolete, instead override Write(IList{AsyncLogEventInfo} logEvents) + + Writes an array of logging events to the log target. By default it iterates on all + events and passes them to "Write" method. Inheriting classes can use this method to + optimize batch writes. + + Logging events to be written out. + + + + Writes an array of logging events to the log target. By default it iterates on all + events and passes them to "Write" method. Inheriting classes can use this method to + optimize batch writes. + + Logging events to be written out. + + + + Write logEvent to database + + + + + Build the connectionstring from the properties. + + + Using at first, and falls back to the properties , + , and + + Event to render the layout inside the properties. + + + + + Escape quotes and semicolons. + See https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms722656(v=vs.85)#setting-values-that-use-reserved-characters + + + + + Create database parameter + + Current command. + Parameter configuration info. + + + + Extract parameter value from the logevent + + Current logevent. + Parameter configuration info. + + + + Create Default Value of Type + + + + + A descriptor for an archive created with the DateAndSequence numbering mode. + + + + + The full name of the archive file. + + + + + The parsed date contained in the file name. + + + + + The parsed sequence number contained in the file name. + + + + + Determines whether produces the same string as the current instance's date once formatted with the current instance's date format. + + The date to compare the current object's date to. + True if the formatted dates are equal, otherwise False. + + + + Initializes a new instance of the class. + + + + + Writes log messages to the attached managed debugger. + + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +
+
+ + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + Name of the target. + + + + Initializes the target. + + + + + Closes the target and releases any unmanaged resources. + + + + + Writes the specified logging event to the attached debugger. + + The logging event. + + + + Mock target - useful for testing. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +
+
+ + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + Name of the target. + + + + Gets the number of times this target has been called. + + + + + + Gets the last message rendered by this target. + + + + + + Increases the number of messages. + + The logging event. + + + + Default class for serialization of values to JSON format. + + + + + Singleton instance of the serializer. + + + + + Private. Use + + + + + Returns a serialization of an object into JSON format. + + The object to serialize to JSON. + Serialized value. + + + + Returns a serialization of an object into JSON format. + + The object to serialize to JSON. + serialisation options + Serialized value. + + + + Serialization of the object in JSON format to the destination StringBuilder + + The object to serialize to JSON. + Write the resulting JSON to this destination. + Object serialized successfully (true/false). + + + + Serialization of the object in JSON format to the destination StringBuilder + + The object to serialize to JSON. + Write the resulting JSON to this destination. + serialisation options + Object serialized successfully (true/false). + + + + Serialization of the object in JSON format to the destination StringBuilder + + The object to serialize to JSON. + Write the resulting JSON to this destination. + serialisation options + The objects in path (Avoid cyclic reference loop). + The current depth (level) of recursion. + Object serialized successfully (true/false). + + + + No quotes needed for this type? + + + + + Checks the object if it is numeric + + TypeCode for the object + Accept fractional types as numeric type. + + + + + Checks input string if it needs JSON escaping, and makes necessary conversion + + Destination Builder + Input string + all options + JSON escaped string + + + + Checks input string if it needs JSON escaping, and makes necessary conversion + + Destination Builder + Input string + Should non-ascii characters be encoded + + JSON escaped string + + + + Check if cleanup should be performed on initialize new file + + Skip cleanup when initializing new file, just after having performed archive operation + + Base archive file pattern + Maximum number of archive files that should be kept + Maximum days of archive files that should be kept + True, when archive cleanup is needed + + + + Characters determining the start of the . + + + + + Characters determining the end of the . + + + + + File name which is used as template for matching and replacements. + It is expected to contain a pattern to match. + + + + + The begging position of the + within the . -1 is returned + when no pattern can be found. + + + + + The ending position of the + within the . -1 is returned + when no pattern can be found. + + + + + Replace the pattern with the specified String. + + + + + + + Archives the log-files using a date style numbering. Archives will be stamped with the + prior period (Year, Month, Day, Hour, Minute) datetime. + + When the number of archive files exceed the obsolete archives are deleted. + When the age of archive files exceed the obsolete archives are deleted. + + + + + Archives the log-files using a date and sequence style numbering. Archives will be stamped + with the prior period (Year, Month, Day) datetime. The most recent archive has the highest number (in + combination with the date). + + When the number of archive files exceed the obsolete archives are deleted. + When the age of archive files exceed the obsolete archives are deleted. + + + + + Parse filename with date and sequence pattern + + + dateformat for archive + + the found pattern. When failed, then default + the found pattern. When failed, then default + + + + + Archives the log-files using the provided base-archive-filename. If the base-archive-filename causes + duplicate archive filenames, then sequence-style is automatically enforced. + + Example: + Base Filename trace.log + Next Filename trace.0.log + + The most recent archive has the highest number. + + When the number of archive files exceed the obsolete archives are deleted. + When the age of archive files exceed the obsolete archives are deleted. + + + + + Dynamically converts a non-template archiveFilePath into a correct archiveFilePattern. + Before called the original IFileArchiveMode, that has been wrapped by this + + + + + Determines if the file name as contains a numeric pattern i.e. {#} in it. + + Example: + trace{#}.log Contains the numeric pattern. + trace{###}.log Contains the numeric pattern. + trace{#X#}.log Contains the numeric pattern (See remarks). + trace.log Does not contain the pattern. + + Occasionally, this method can identify the existence of the {#} pattern incorrectly. + File name to be checked. + when the pattern is found; otherwise. + + + + Archives the log-files using a rolling style numbering (the most recent is always #0 then + #1, ..., #N. + + When the number of archive files exceed the obsolete archives + are deleted. + + + + + Replaces the numeric pattern i.e. {#} in a file name with the parameter value. + + File name which contains the numeric pattern. + Value which will replace the numeric pattern. + File name with the value of in the position of the numeric pattern. + + + + Archives the log-files using a sequence style numbering. The most recent archive has the highest number. + + When the number of archive files exceed the obsolete archives are deleted. + When the age of archive files exceed the obsolete archives are deleted. + + + + + Modes of archiving files based on time. + + + + + Don't archive based on time. + + + + + AddToArchive every year. + + + + + AddToArchive every month. + + + + + AddToArchive daily. + + + + + AddToArchive every hour. + + + + + AddToArchive every minute. + + + + + AddToArchive every Sunday. + + + + + AddToArchive every Monday. + + + + + AddToArchive every Tuesday. + + + + + AddToArchive every Wednesday. + + + + + AddToArchive every Thursday. + + + + + AddToArchive every Friday. + + + + + AddToArchive every Saturday. + + + + + Type of filepath + + + + + Detect of relative or absolute + + + + + Relative path + + + + + Absolute path + + Best for performance + + + + Writes log messages to one or more files. + + Documentation on NLog Wiki + + + + Default clean up period of the initialized files. When a file exceeds the clean up period is removed from the list. + + Clean up period is defined in days. + + + + The maximum number of initialized files before clean up procedures are initiated, + to keep the number of initialized files to a minimum. Chose 25 to cater for monthly rolling of log-files. + + + + + This value disables file archiving based on the size. + + + + + Holds the initialized files each given time by the instance. Against each file, the last write time is stored. + + Last write time is store in local time (no UTC). + + + + List of the associated file appenders with the instance. + + + + + The number of initialized files at any one time. + + + + + The maximum number of archive files that should be kept. + + + + + The maximum days of archive files that should be kept. + + + + + The filename as target + + + + + The archive file name as target + + + + + The date of the previous log event. + + + + + The file name of the previous log event. + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + Name of the target. + + + + Gets or sets the name of the file to write to. + + + This FileName string is a layout which may include instances of layout renderers. + This lets you use a single target to write to multiple files. + + + The following value makes NLog write logging events to files based on the log level in the directory where + the application runs. + ${basedir}/${level}.log + All Debug messages will go to Debug.log, all Info messages will go to Info.log and so on. + You can combine as many of the layout renderers as you want to produce an arbitrary log file name. + + + + + + Cleanup invalid values in a filename, e.g. slashes in a filename. If set to true, this can impact the performance of massive writes. + If set to false, nothing gets written when the filename is wrong. + + + + + + Is the an absolute or relative path? + + + + + + Gets or sets a value indicating whether to create directories if they do not exist. + + + Setting this to false may improve performance a bit, but you'll receive an error + when attempting to write to a directory that's not present. + + + + + + Gets or sets a value indicating whether to delete old log file on startup. + + + This option works only when the "FileName" parameter denotes a single file. + + + + + + Gets or sets a value indicating whether to replace file contents on each write instead of appending log message at the end. + + + + + + Gets or sets a value indicating whether to keep log file open instead of opening and closing it on each logging event. + + + Setting this property to True helps improve performance. + + + + + + Gets or sets the maximum number of log file names that should be stored as existing. + + + The bigger this number is the longer it will take to write each log record. The smaller the number is + the higher the chance that the clean function will be run when no new files have been opened. + + + + + Gets or sets a value indicating whether to enable log file(s) to be deleted. + + + + + + Gets or sets the file attributes (Windows only). + + + + + + Gets or sets the line ending mode. + + + + + + Gets or sets a value indicating whether to automatically flush the file buffers after each log message. + + + + + + Gets or sets the number of files to be kept open. Setting this to a higher value may improve performance + in a situation where a single File target is writing to many files + (such as splitting by level or by logger). + + + The files are managed on a LRU (least recently used) basis, which flushes + the files that have not been used for the longest period of time should the + cache become full. As a rule of thumb, you shouldn't set this parameter to + a very high value. A number like 10-15 shouldn't be exceeded, because you'd + be keeping a large number of files open which consumes system resources. + + + + + + Gets or sets the maximum number of seconds that files are kept open. If this number is negative the files are + not automatically closed after a period of inactivity. + + + + + + Gets or sets the maximum number of seconds before open files are flushed. If this number is negative or zero + the files are not flushed by timer. + + + + + + Gets or sets the log file buffer size in bytes. + + + + + + Gets or sets the file encoding. + + + + + + Gets or sets whether or not this target should just discard all data that its asked to write. + Mostly used for when testing NLog Stack except final write + + + + + + Gets or sets a value indicating whether concurrent writes to the log file by multiple processes on the same host. + + + This makes multi-process logging possible. NLog uses a special technique + that lets it keep the files open for writing. + + + + + + Gets or sets a value indicating whether concurrent writes to the log file by multiple processes on different network hosts. + + + This effectively prevents files from being kept open. + + + + + + Gets or sets a value indicating whether to write BOM (byte order mark) in created files + + + + + + Gets or sets the number of times the write is appended on the file before NLog + discards the log message. + + + + + + Gets or sets the delay in milliseconds to wait before attempting to write to the file again. + + + The actual delay is a random value between 0 and the value specified + in this parameter. On each failed attempt the delay base is doubled + up to times. + + + Assuming that ConcurrentWriteAttemptDelay is 10 the time to wait will be:

+ a random value between 0 and 10 milliseconds - 1st attempt
+ a random value between 0 and 20 milliseconds - 2nd attempt
+ a random value between 0 and 40 milliseconds - 3rd attempt
+ a random value between 0 and 80 milliseconds - 4th attempt
+ ...

+ and so on. + + + + +

+ Gets or sets a value indicating whether to archive old log file on startup. + + + This option works only when the "FileName" parameter denotes a single file. + After archiving the old file, the current log file will be empty. + + +
+ + + Gets or sets a value of the file size threshold to archive old log file on startup. + + + This option won't work if is set to false + Default value is 0 which means that the file is archived as soon as archival on + startup is enabled. + + + + + + Gets or sets a value specifying the date format to use when archiving files. + + + This option works only when the "ArchiveNumbering" parameter is set either to Date or DateAndSequence. + + + + + + Gets or sets the size in bytes above which log files will be automatically archived. + + Warning: combining this with isn't supported. We cannot create multiple archive files, if they should have the same name. + Choose: + + + Caution: Enabling this option can considerably slow down your file + logging in multi-process scenarios. If only one process is going to + be writing to the file, consider setting ConcurrentWrites + to false for maximum performance. + + + + + + Gets or sets a value indicating whether to automatically archive log files every time the specified time passes. + + + Files are moved to the archive as part of the write operation if the current period of time changes. For example + if the current hour changes from 10 to 11, the first write that will occur + on or after 11:00 will trigger the archiving. +

+ Caution: Enabling this option can considerably slow down your file + logging in multi-process scenarios. If only one process is going to + be writing to the file, consider setting ConcurrentWrites + to false for maximum performance. +

+
+ +
+ + + Is the an absolute or relative path? + + + + + + Gets or sets the name of the file to be used for an archive. + + + It may contain a special placeholder {#####} + that will be replaced with a sequence of numbers depending on + the archiving strategy. The number of hash characters used determines + the number of numerical digits to be used for numbering files. + + + + + + Gets or sets the maximum number of archive files that should be kept. + + + + + + Gets or sets the maximum days of archive files that should be kept. + + + + + + Gets or sets the way file archives are numbered. + + + + + + Used to compress log files during archiving. + This may be used to provide your own implementation of a zip file compressor, + on platforms other than .Net4.5. + Defaults to ZipArchiveFileCompressor on .Net4.5 and to null otherwise. + + + + + + Gets or sets a value indicating whether to compress archive files into the zip archive format. + + + + + + Gets or set a value indicating whether a managed file stream is forced, instead of using the native implementation. + + + + + + Gets or sets a value indicating whether file creation calls should be synchronized by a system global mutex. + + + + + + Gets or sets a value indicating whether the footer should be written only when the file is archived. + + + + + + Gets the characters that are appended after each line. + + + + + Refresh the ArchiveFilePatternToWatch option of the . + The log file must be watched for archiving when multiple processes are writing to the same + open file. + + + + + Removes records of initialized files that have not been + accessed in the last two days. + + + Files are marked 'initialized' for the purpose of writing footers when the logging finishes. + + + + + Removes records of initialized files that have not been + accessed after the specified date. + + The cleanup threshold. + + Files are marked 'initialized' for the purpose of writing footers when the logging finishes. + + + + + Flushes all pending file operations. + + The asynchronous continuation. + + The timeout parameter is ignored, because file APIs don't provide + the needed functionality. + + + + + Returns the suitable appender factory ( ) to be used to generate the file + appenders associated with the instance. + + The type of the file appender factory returned depends on the values of various properties. + + suitable for this instance. + + + + Initializes file logging by creating data structures that + enable efficient multi-file logging. + + + + + Closes the file(s) opened for writing. + + + + + Can be used if has been enabled. + + + + + Can be used if has been enabled. + + + + + Can be used if has been enabled. + + + + + Writes the specified logging event to a file specified in the FileName + parameter. + + The logging event. + + + + Get full filename (=absolute) and cleaned if needed. + + + + + + + NOTE! Obsolete, instead override Write(IList{AsyncLogEventInfo} logEvents) + + Writes an array of logging events to the log target. By default it iterates on all + events and passes them to "Write" method. Inheriting classes can use this method to + optimize batch writes. + + Logging events to be written out. + + + + Writes the specified array of logging events to a file specified in the FileName + parameter. + + An array of objects. + + This function makes use of the fact that the events are batched by sorting + the requests by filename. This optimizes the number of open/close calls + and can help improve performance. + + + + + Returns estimated size for memory stream, based on events count and first event size in bytes. + + Count of events + Bytes count of first event + + + + Formats the log event for write. + + The log event to be formatted. + A string representation of the log event. + + + + Gets the bytes to be written to the file. + + Log event. + Array of bytes that are ready to be written. + + + + Modifies the specified byte array before it gets sent to a file. + + The byte array. + The modified byte array. The function can do the modification in-place. + + + + Gets the bytes to be written to the file. + + The log event to be formatted. + to help format log event. + Optional temporary char-array to help format log event. + Destination for the encoded result. + + + + Formats the log event for write. + + The log event to be formatted. + for the result. + + + + Modifies the specified byte array before it gets sent to a file. + + The LogEvent being written + The byte array. + + + + Archives fileName to archiveFileName. + + File name to be archived. + Name of the archive file. + + + + Gets the correct formatting to be used based on the value of for converting values which will be inserting into file + names during archiving. + + This value will be computed only when a empty value or is passed into + + Date format to used irrespectively of value. + Formatting for dates. + + + + Calculate the DateTime of the requested day of the week. + + The DateTime of the previous log event. + The next occuring day of the week to return a DateTime for. + The DateTime of the next occuring dayOfWeek. + For example: if previousLogEventTimestamp is Thursday 2017-03-02 and dayOfWeek is Sunday, this will return + Sunday 2017-03-05. If dayOfWeek is Thursday, this will return *next* Thursday 2017-03-09. + + + + Invokes the archiving process after determining when and which type of archiving is required. + + File name to be checked and archived. + Log event that the instance is currently processing. + The DateTime of the previous log event for this file. + File has just been opened. + + + + Gets the pattern that archive files will match + + Filename of the log file + Log event that the instance is currently processing. + A string with a pattern that will match the archive file names + + + + Archives the file if it should be archived. + + The file name to check for. + Log event that the instance is currently processing. + The size in bytes of the next chunk of data to be written in the file. + The DateTime of the previous log event for this file. + File has just been opened. + True when archive operation of the file was completed (by this target or a concurrent target) + + + + Closes any active file-appenders that matches the input filenames. + File-appender is requested to invalidate/close its filehandle, but keeping its archive-mutex alive + + + + + Indicates if the automatic archiving process should be executed. + + File name to be written. + Log event that the instance is currently processing. + The size in bytes of the next chunk of data to be written in the file. + The DateTime of the previous log event for this file. + File has just been opened. + Filename to archive. If null, then nothing to archive. + + + + Returns the correct filename to archive + + + + + Gets the file name for archiving, or null if archiving should not occur based on file size. + + File name to be written. + The size in bytes of the next chunk of data to be written in the file. + File has just been opened. + Filename to archive. If null, then nothing to archive. + + + + Check if archive operation should check previous filename, because FileAppenderCache tells us current filename no longer exists + + + + + Returns the file name for archiving, or null if archiving should not occur based on date/time. + + File name to be written. + Log event that the instance is currently processing. + The DateTime of the previous log event for this file. + File has just been opened. + Filename to archive. If null, then nothing to archive. + + + + Truncates the input-time, so comparison of low resolution times (like dates) are not affected by ticks + + High resolution Time + Time Resolution Level + Truncated Low Resolution Time + + + + Evaluates which parts of a file should be written (header, content, footer) based on various properties of + instance and writes them. + + File name to be written. + Raw sequence of to be written into the content part of the file. + File has just been opened. + + + + Initialise a file to be used by the instance. Based on the number of initialized + files and the values of various instance properties clean up and/or archiving processes can be invoked. + + File name to be written. + Log event that the instance is currently processing. + The DateTime of the previous log event for this file (DateTime.MinValue if just initialized). + + + + Writes the file footer and finalizes the file in instance internal structures. + + File name to close. + Indicates if the file is being finalized for archiving. + + + + Writes the footer information to a file. + + The file path to write to. + + + + Decision logic whether to archive logfile on startup. + and properties. + + File name to be written. + Decision whether to archive or not. + + + + Invokes the archiving and clean up of older archive file based on the values of + and + properties respectively. + + File name to be written. + Log event that the instance is currently processing. + + + + Creates the file specified in and writes the file content in each entirety i.e. + Header, Content and Footer. + + The name of the file to be written. + Sequence of to be written in the content section of the file. + First attempt to write? + This method is used when the content of the log file is re-written on every write. + + + + Writes the header information and byte order mark to a file. + + File appender associated with the file. + + + + The sequence of to be written in a file after applying any formatting and any + transformations required from the . + + The layout used to render output message. + Sequence of to be written. + Usually it is used to render the header and hooter of the files. + + + + Controls the text and color formatting for + + + + + Creates a TextWriter for the console to start building a colored text message + + Active console stream + Optional StringBuilder to optimize performance + TextWriter for the console + + + + Releases the TextWriter for the console after having built a colored text message (Restores console colors) + + Colored TextWriter + Active console stream + Original foreground color for console (If changed) + Original background color for console (If changed) + Flush TextWriter + + + + Changes foreground color for the Colored TextWriter + + Colored TextWriter + New foreground color for the console + Old previous backgroundColor color for the console + Old foreground color for the console + + + + Changes backgroundColor color for the Colored TextWriter + + Colored TextWriter + New backgroundColor color for the console + Old previous backgroundColor color for the console + Old backgroundColor color for the console + + + + Restores console colors back to their original state + + Colored TextWriter + Original foregroundColor color for the console + Original backgroundColor color for the console + + + + Writes multiple characters to console in one operation (faster) + + Colored TextWriter + Output Text + Start Index + End Index + + + + Writes single character to console + + Colored TextWriter + Output Text + + + + Writes whole string and completes with newline + + Colored TextWriter + Output Text + + + + Default row highlight rules for the console printer + + + + + Check if cleanup should be performed on initialize new file + + Base archive file pattern + Maximum number of archive files that should be kept + Maximum days of archive files that should be kept + True, when archive cleanup is needed + + + + Create a wildcard file-mask that allows one to find all files belonging to the same archive. + + Base archive file pattern + Wildcard file-mask + + + + Search directory for all existing files that are part of the same archive. + + Base archive file pattern + + + + + Generate the next archive filename for the archive. + + Base archive file pattern + File date of archive + Existing files in the same archive + + + + + Return all files that should be removed from the provided archive. + + Base archive file pattern + Existing files in the same archive + Maximum number of archive files that should be kept + Maximum days of archive files that should be kept + + + + may be configured to compress archived files in a custom way + by setting before logging your first event. + + + + + Create archiveFileName by compressing fileName. + + Absolute path to the log file to compress. + Absolute path to the compressed archive file to create. + + + + Interface for serialization of values, maybe even objects to JSON format. + Useful for wrappers for existing serializers. + + + + + Returns a serialization of an object + into JSON format. + + The object to serialize to JSON. + Serialized value (null = Serialize failed). + + + + Options for JSON serialisation + + + + + Add quotes around object keys? + + + + + Format provider for value + + + + + Format string for value + + + + + Should non-ascii characters be encoded + + + + + Should forward slashes be escaped? If true, / will be converted to \/ + + + + + Serialize enum as string value + + + + + Should dictionary keys be sanitized. All characters must either be letters, numbers or underscore character (_). + + Any other characters will be converted to underscore character (_) + + + + + How far down the rabbit hole should the Json Serializer go with object-reflection before stopping + + + + Initializes a new instance of the class. + + + + Line ending mode. + + + + + Insert platform-dependent end-of-line sequence after each line. + + + + + Insert CR LF sequence (ASCII 13, ASCII 10) after each line. + + + + + Insert CR character (ASCII 13) after each line. + + + + + Insert LF character (ASCII 10) after each line. + + + + + Insert null terminator (ASCII 0) after each line. + + + + + Do not insert any line ending. + + + + + Gets the name of the LineEndingMode instance. + + + + + Gets the new line characters (value) of the LineEndingMode instance. + + + + + Initializes a new instance of . + + The mode name. + The new line characters to be used. + + + + Returns the that corresponds to the supplied . + + + The textual representation of the line ending mode, such as CRLF, LF, Default etc. + Name is not case sensitive. + + The value, that corresponds to the . + There is no line ending mode with the specified name. + + + + Compares two objects and returns a + value indicating whether the first one is equal to the second one. + + The first level. + The second level. + The value of mode1.NewLineCharacters == mode2.NewLineCharacters. + + + + Compares two objects and returns a + value indicating whether the first one is not equal to the second one. + + The first mode + The second mode + The value of mode1.NewLineCharacters != mode2.NewLineCharacters. + + + + Returns a string representation of the log level. + + Log level name. + + + + Returns a hash code for this instance. + + + A hash code for this instance, suitable for use in hashing algorithms + and data structures like a hash table. + + + + + Determines whether the specified is + equal to this instance. + + The to compare with + this instance. + + Value of true if the specified + is equal to this instance; otherwise, false. + + + The parameter is null. + + + + Indicates whether the current object is equal to another object of the same type. + true if the current object is equal to the parameter; otherwise, false. + An object to compare with this object. + + + + Provides a type converter to convert objects to and from other representations. + + + + + Returns whether this converter can convert an object of the given type to the type of this converter, using the specified context. + + + true if this converter can perform the conversion; otherwise, false. + + An that provides a format context. A that represents the type you want to convert from. + + + + Converts the given object to the type of this converter, using the specified context and culture information. + + + An that represents the converted value. + + An that provides a format context. The to use as the current culture. The to convert. The conversion cannot be performed. + + + + Sends log messages by email using SMTP protocol. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +

+ Mail target works best when used with BufferingWrapper target + which lets you send multiple log messages in single mail +

+

+ To set up the buffered mail target in the configuration file, + use the following syntax: +

+ +

+ To set up the buffered mail target programmatically use code like this: +

+ +
+
+ + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + Name of the target. + + + + Gets or sets sender's email address (e.g. joe@domain.com). + + + + + + Gets or sets recipients' email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + + Gets or sets CC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + + Gets or sets BCC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + + Gets or sets a value indicating whether to add new lines between log entries. + + A value of true if new lines should be added; otherwise, false. + + + + + Gets or sets the mail subject. + + + + + + Gets or sets mail message body (repeated for each log message send in one mail). + + Alias for the Layout property. + + + + + Gets or sets encoding to be used for sending e-mail. + + + + + + Gets or sets a value indicating whether to send message as HTML instead of plain text. + + + + + + Gets or sets SMTP Server to be used for sending. + + + + + + Gets or sets SMTP Authentication mode. + + + + + + Gets or sets the username used to connect to SMTP server (used when SmtpAuthentication is set to "basic"). + + + + + + Gets or sets the password used to authenticate against SMTP server (used when SmtpAuthentication is set to "basic"). + + + + + + Gets or sets a value indicating whether SSL (secure sockets layer) should be used when communicating with SMTP server. + + . + + + + Gets or sets the port number that SMTP Server is listening on. + + + + + + Gets or sets a value indicating whether the default Settings from System.Net.MailSettings should be used. + + + + + + Specifies how outgoing email messages will be handled. + + + + + + Gets or sets the folder where applications save mail messages to be processed by the local SMTP server. + + + + + + Gets or sets the priority used for sending mails. + + + + + + Gets or sets a value indicating whether NewLine characters in the body should be replaced with
tags. +
+ Only happens when is set to true. + +
+ + + Gets or sets a value indicating the SMTP client timeout. + + Warning: zero is not infinite waiting + + + + + Writes async log event to the mail target. + + The logging event. + + + + NOTE! Obsolete, instead override Write(IList{AsyncLogEventInfo} logEvents) + + Writes an array of logging events to the log target. By default it iterates on all + events and passes them to "Write" method. Inheriting classes can use this method to + optimize batch writes. + + Logging events to be written out. + + + + Writes log events to the mail target. + + Array of logging events. + + + + Initializes the target. Can be used by inheriting classes + to initialize logging. + + + + + Create mail and send with SMTP + + event printed in the body of the event + + + + Create buffer for body + + all events + first event for header + last event for footer + + + + + Set properties of + + last event for username/password + client to set properties on + Configure not at , as the properties could have layout renderers. + + + + Handle if it is a virtual directory. + + + + + + + Create key for grouping. Needed for multiple events in one mail message + + event for rendering layouts + string to group on + + + + Append rendered to + + append to this + event for rendering + append if not null + + + + Create the mail message with the addresses, properties and body. + + + + + Render and add the addresses to + + Addresses appended to this list + layout with addresses, ; separated + event for rendering the + added a address? + + + + Writes log messages to in memory for programmatic retrieval. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +
+
+ + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + Name of the target. + + + + Gets the list of logs gathered in the . + + + + + Gets or sets the max number of items to have in memory + + + + + + Renders the logging event message and adds to + + The logging event. + + + + A parameter to MethodCall. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The layout to use for parameter value. + + + + Initializes a new instance of the class. + + Name of the parameter. + The layout. + + + + Initializes a new instance of the class. + + The name of the parameter. + The layout. + The type of the parameter. + + + + Gets or sets the name of the parameter. + + + + + + Gets or sets the type of the parameter. Obsolete alias for + + + + + + Gets or sets the type of the parameter. + + + + + + Gets or sets the layout that should be use to calculate the value for the parameter. + + + + + + Calls the specified static method on each log message and passes contextual parameters to it. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +
+
+ + + Gets or sets the class name. + + + + + + Gets or sets the method name. The method must be public and static. + + Use the AssemblyQualifiedName , https://msdn.microsoft.com/en-us/library/system.type.assemblyqualifiedname(v=vs.110).aspx + e.g. + + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Name of the target. + + + + Initializes a new instance of the class. + + Name of the target. + Method to call on logevent. + + + + Initializes the target. + + + + + Calls the specified Method. + + Method parameters. + The logging event. + + + + Calls the specified Method. + + Method parameters. + + + + The base class for all targets which call methods (local or remote). + Manages parameters and type coercion. + + + + + Initializes a new instance of the class. + + + + + Gets the array of parameters to be passed. + + + + + + + + + Prepares an array of parameters to be passed based on the logging event and calls DoInvoke(). + + The logging event. + + + + Calls the target DoInvoke method, and handles AsyncContinuation callback + + Method call parameters. + The logging event. + + + + Calls the target DoInvoke method, and handles AsyncContinuation callback + + Method call parameters. + The continuation. + + + + Calls the target method. Must be implemented in concrete classes. + + Method call parameters. + + + + Sends log messages over the network. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +

+ To print the results, use any application that's able to receive messages over + TCP or UDP. NetCat is + a simple but very powerful command-line tool that can be used for that. This image + demonstrates the NetCat tool receiving log messages from Network target. +

+ +

+ NOTE: If your receiver application is ever likely to be off-line, don't use TCP protocol + or you'll get TCP timeouts and your application will be very slow. + Either switch to UDP transport or use AsyncWrapper target + so that your application threads will not be blocked by the timing-out connection attempts. +

+

+ There are two specialized versions of the Network target: Chainsaw + and NLogViewer which write to instances of Chainsaw log4j viewer + or NLogViewer application respectively. +

+
+
+ + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + Name of the target. + + + + Gets or sets the network address. + + + The network address can be: +
    +
  • tcp://host:port - TCP (auto select IPv4/IPv6) (not supported on Windows Phone 7.0)
  • +
  • tcp4://host:port - force TCP/IPv4 (not supported on Windows Phone 7.0)
  • +
  • tcp6://host:port - force TCP/IPv6 (not supported on Windows Phone 7.0)
  • +
  • udp://host:port - UDP (auto select IPv4/IPv6, not supported on Silverlight and on Windows Phone 7.0)
  • +
  • udp4://host:port - force UDP/IPv4 (not supported on Silverlight and on Windows Phone 7.0)
  • +
  • udp6://host:port - force UDP/IPv6 (not supported on Silverlight and on Windows Phone 7.0)
  • +
  • http://host:port/pageName - HTTP using POST verb
  • +
  • https://host:port/pageName - HTTPS using POST verb
  • +
+ For SOAP-based webservice support over HTTP use WebService target. +
+ +
+ + + Gets or sets a value indicating whether to keep connection open whenever possible. + + + + + + Gets or sets a value indicating whether to append newline at the end of log message. + + + + + + Gets or sets the end of line value if a newline is appended at the end of log message . + + + + + + Gets or sets the maximum message size in bytes. + + + + + + Gets or sets the size of the connection cache (number of connections which are kept alive). + + + + + + Gets or sets the maximum current connections. 0 = no maximum. + + + + + + Gets or sets the action that should be taken if the will be more connections than . + + + + + + Gets or sets the maximum queue size. + + + + + + Gets or sets the action that should be taken if the message is larger than + maxMessageSize. + + + + + + Gets or sets the encoding to be used. + + + + + + Get or set the SSL/TLS protocols. Default no SSL/TLS is used. Currently only implemented for TCP. + + + + + + The number of seconds a connection will remain idle before the first keep-alive probe is sent + + + + + + Flush any pending log messages asynchronously (in case of asynchronous targets). + + The asynchronous continuation. + + + + Closes the target. + + + + + Sends the + rendered logging event over the network optionally concatenating it with a newline character. + + The logging event. + + + + Try to remove. + + + + + removed something? + + + + Gets the bytes to be written. + + Log event. + Byte array. + + + + The action to be taken when there are more connections then the max. + + + + + Just allow it. + + + + + Discard the connection item. + + + + + Block until there's more room in the queue. + + + + + Action that should be taken if the message overflows. + + + + + Report an error. + + + + + Split the message into smaller pieces. + + + + + Discard the entire message. + + + + + Represents a parameter to a NLogViewer target. + + + + + Initializes a new instance of the class. + + + + + Gets or sets viewer parameter name. + + + + + + Gets or sets the layout that should be use to calculate the value for the parameter. + + + + + + Gets or sets whether an attribute with empty value should be included in the output + + + + + + Sends log messages to the remote instance of NLog Viewer. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +

+ NOTE: If your receiver application is ever likely to be off-line, don't use TCP protocol + or you'll get TCP timeouts and your application will crawl. + Either switch to UDP transport or use AsyncWrapper target + so that your application threads will not be blocked by the timing-out connection attempts. +

+
+
+ + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + Name of the target. + + + + Gets or sets a value indicating whether to include NLog-specific extensions to log4j schema. + + + + + + Gets or sets the AppInfo field. By default it's the friendly name of the current AppDomain. + + + + + + Gets or sets a value indicating whether to include call site (class and method name) in the information sent over the network. + + + + + + Gets or sets a value indicating whether to include source info (file name and line number) in the information sent over the network. + + + + + + Gets or sets a value indicating whether to include dictionary contents. + + + + + + Gets or sets a value indicating whether to include stack contents. + + + + + + Gets or sets a value indicating whether to include dictionary contents. + + + + + + Gets or sets a value indicating whether to include contents of the stack. + + + + + + Gets or sets the NDLC item separator. + + + + + + Gets or sets the option to include all properties from the log events + + + + + + Gets or sets the NDC item separator. + + + + + + Gets or sets the renderer for log4j:event logger-xml-attribute (Default ${logger}) + + + + + + Gets the collection of parameters. Each parameter contains a mapping + between NLog layout and a named parameter. + + + + + + Gets the layout renderer which produces Log4j-compatible XML events. + + + + + Gets or sets the instance of that is used to format log messages. + + + + + + Discards log messages. Used mainly for debugging and benchmarking. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +
+
+ + + Gets or sets a value indicating whether to perform layout calculation. + + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + + Does nothing. Optionally it calculates the layout text but + discards the results. + + The logging event. + + + + Outputs log messages through the OutputDebugString() Win32 API. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +
+
+ + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + Name of the target. + + + + Outputs the rendered logging event through the OutputDebugString() Win32 API. + + The logging event. + + + + SMTP authentication modes. + + + + + No authentication. + + + + + Basic - username and password. + + + + + NTLM Authentication. + + + + + Represents logging target. + + + + Are all layouts in this target thread-agnostic, if so we don't precalculate the layouts + + + + The Max StackTraceUsage of all the in this Target + + + + + Gets or sets the name of the target. + + + + + + Target supports reuse of internal buffers, and doesn't have to constantly allocate new buffers + Required for legacy NLog-targets, that expects buffers to remain stable after Write-method exit + + + + + + Gets the object which can be used to synchronize asynchronous operations that must rely on the . + + + + + Gets the logging configuration this target is part of. + + + + + Gets a value indicating whether the target has been initialized. + + + + + Can be used if has been enabled. + + + + + Initializes this instance. + + The configuration. + + + + Closes this instance. + + + + + Closes the target. + + + + + Flush any pending log messages (in case of asynchronous targets). + + The asynchronous continuation. + + + + Calls the on each volatile layout + used by this target. + This method won't prerender if all layouts in this target are thread-agnostic. + + + The log event. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Writes the log to the target. + + Log event to write. + + + + Writes the array of log events. + + The log events. + + + + Writes the array of log events. + + The log events. + + + + Initializes this instance. + + The configuration. + + + + Closes this instance. + + + + + Releases unmanaged and - optionally - managed resources. + + True to release both managed and unmanaged resources; false to release only unmanaged resources. + + + + Initializes the target. Can be used by inheriting classes + to initialize logging. + + + + + Closes the target and releases any unmanaged resources. + + + + + Flush any pending log messages asynchronously (in case of asynchronous targets). + + The asynchronous continuation. + + + + Writes logging event to the log target. Must be overridden in inheriting + classes. + + Logging event to be written out. + + + + Writes async log event to the log target. + + Async Log event to be written out. + + + + Writes a log event to the log target, in a thread safe manner. + Any override of this method has to provide their own synchronization mechanism. + + !WARNING! Custom targets should only override this method if able to provide their + own synchronization mechanism. -objects are not guaranteed to be + thread-safe, so using them without a SyncRoot-object can be dangerous. + + Log event to be written out. + + + + NOTE! Obsolete, instead override Write(IList{AsyncLogEventInfo} logEvents) + + Writes an array of logging events to the log target. By default it iterates on all + events and passes them to "Write" method. Inheriting classes can use this method to + optimize batch writes. + + Logging events to be written out. + + + + Writes an array of logging events to the log target. By default it iterates on all + events and passes them to "Write" method. Inheriting classes can use this method to + optimize batch writes. + + Logging events to be written out. + + + + NOTE! Obsolete, instead override WriteAsyncThreadSafe(IList{AsyncLogEventInfo} logEvents) + + Writes an array of logging events to the log target, in a thread safe manner. + + !WARNING! Custom targets should only override this method if able to provide their + own synchronization mechanism. -objects are not guaranteed to be + thread-safe, so using them without a SyncRoot-object can be dangerous. + + Logging events to be written out. + + + + Writes an array of logging events to the log target, in a thread safe manner. + Any override of this method has to provide their own synchronization mechanism. + + !WARNING! Custom targets should only override this method if able to provide their + own synchronization mechanism. -objects are not guaranteed to be + thread-safe, so using them without a SyncRoot-object can be dangerous. + + Logging events to be written out. + + + + Merges (copies) the event context properties from any event info object stored in + parameters of the given event info object. + + The event info object to perform the merge to. + + + + Renders the event info in layout. + + The layout. + The event info. + String representing log event. + + + + Register a custom Target. + + Short-cut for registering to default + Type of the Target. + Name of the Target. + + + + Register a custom Target. + + Short-cut for registering to default + Type of the Target. + Name of the Target. + + + + Should the exception be rethrown? + + + Upgrade to private protected when using C# 7.2 + + + + Marks class as a logging target and assigns a name to it. + + This attribute is not required when registering the target in the API. + + + + Initializes a new instance of the class. + + Name of the target. + + + + Gets or sets a value indicating whether to the target is a wrapper target (used to generate the target summary documentation page). + + + + + Gets or sets a value indicating whether to the target is a compound target (used to generate the target summary documentation page). + + + + + Attribute details for + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The name of the attribute. + The layout of the attribute's value. + + + + Gets or sets the name of the attribute. + + + + + + Gets or sets the layout that will be rendered as the attribute's value. + + + + + + Gets or sets when an empty value should cause the property to be included + + + + + Gets or sets the type of the property. + + + + + Represents target that supports context capture using MDLC, MDC, NDLC and NDC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gets or sets a value indicating whether to include contents of the dictionary + + + + + + Gets or sets a value indicating whether to include call site (class and method name) in the + + + + + + Gets or sets a value indicating whether to include source info (file name and line number) in the + + + + + + Gets the array of custom attributes to be passed into the logevent context + + + + + + Constructor + + + + + + + + Check if logevent has properties (or context properties) + + + True if properties should be included + + + + Checks if any context properties, and if any returns them as a single dictionary + + + Dictionary with any context properties for the logEvent (Null if none found) + + + + Checks if any context properties, and if any returns them as a single dictionary + + + Optional prefilled dictionary + Dictionary with any context properties for the logEvent (Null if none found) + + + + Creates combined dictionary of all configured properties for logEvent + + + Dictionary with all collected properties for logEvent + + + + Creates combined dictionary of all configured properties for logEvent + + + Optional prefilled dictionary + Dictionary with all collected properties for logEvent + + + + Generates a new unique name, when duplicate names are detected + + LogEvent that triggered the duplicate name + Duplicate item name + Item Value + Dictionary of context values + New (unique) value (or null to skip value). If the same value is used then the item will be overwritten + + + + Returns the captured snapshot of for the + + + Dictionary with MDC context if any, else null + + + + Returns the captured snapshot of for the + + + Dictionary with MDLC context if any, else null + + + + Returns the captured snapshot of for the + + + Dictionary with NDC context if any, else null + + + + Returns the captured snapshot of for the + + + Dictionary with NDLC context if any, else null + + + + Takes snapshot of for the + + + Optional pre-allocated dictionary for the snapshot + Dictionary with GDC context if any, else null + + + + Takes snapshot of for the + + + Optional pre-allocated dictionary for the snapshot + Dictionary with MDC context if any, else null + + + + Take snapshot of a single object value from + + Log event + MDC key + MDC value + Snapshot of MDC value + Include object value in snapshot + + + + Takes snapshot of for the + + + Optional pre-allocated dictionary for the snapshot + Dictionary with MDLC context if any, else null + + + + Take snapshot of a single object value from + + Log event + MDLC key + MDLC value + Snapshot of MDLC value + Include object value in snapshot + + + + Takes snapshot of for the + + + Dictionary with NDC context if any, else null + + + + Take snapshot of a single object value from + + Log event + NDC value + Snapshot of NDC value + Include object value in snapshot + + + + Takes snapshot of for the + + + Dictionary with NDLC context if any, else null + + + + Take snapshot of a single object value from + + Log event + NDLC value + Snapshot of NDLC value + Include object value in snapshot + + + + Take snapshot of a single object value + + Log event + Key Name (null when NDC / NDLC) + Object Value + Snapshot of value + Include object value in snapshot + + + Internal Layout that allows capture of MDC context + + + Internal Layout that allows capture of NDC context + + + Internal Layout that allows capture of MDLC context + + + Internal Layout that allows capture of NDLC context + + + + Represents target that supports string formatting using layouts. + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Gets or sets the layout used to format log messages. + + + + + + Represents target that supports string formatting using layouts. + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Gets or sets the text to be rendered. + + + + + + Gets or sets the footer. + + + + + + Gets or sets the header. + + + + + + Gets or sets the layout with header and footer. + + The layout with header and footer. + + + + Sends log messages through System.Diagnostics.Trace. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +
+
+ + + Always use independent of + + + + + + Forward to (Instead of ) + + + Trace.Fail can have special side-effects, and give fatal exceptions, message dialogs or Environment.FailFast + + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + Name of the target. + + + + Writes the specified logging event to the facility. + + Redirects the log message depending on and . + When is false: + - writes to + - writes to + - writes to + - writes to + - writes to + - writes to + + The logging event. + + + + Web service protocol. + + + + + Use SOAP 1.1 Protocol. + + + + + Use SOAP 1.2 Protocol. + + + + + Use HTTP POST Protocol. + + + + + Use HTTP GET Protocol. + + + + + Do an HTTP POST of a JSON document. + + + + + Do an HTTP POST of an XML document. + + + + + Web Service Proxy Configuration Type + + + + + Default proxy configuration from app.config (System.Net.WebRequest.DefaultWebProxy) + + + Example of how to configure default proxy using app.config + + <system.net> + <defaultProxy enabled = "true" useDefaultCredentials = "true" > + <proxy usesystemdefault = "True" /> + </defaultProxy> + </system.net> + + + + + + Automatic use of proxy with authentication (cached) + + + + + Disables use of proxy (fast) + + + + + Custom proxy address (cached) + + + + + Calls the specified web service on each log message. + + Documentation on NLog Wiki + + The web service must implement a method that accepts a number of string parameters. + + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ This assumes just one target and a single rule. More configuration + options are described here. +

+

+ To set up the log target programmatically use code like this: +

+ +

The example web service that works with this example is shown below

+ +
+
+ + + dictionary that maps a concrete implementation + to a specific -value. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Name of the target + + + + Gets or sets the web service URL. + + + + + + Gets or sets the Web service method name. Only used with Soap. + + + + + + Gets or sets the Web service namespace. Only used with Soap. + + + + + + Gets or sets the protocol to be used when calling web service. + + + + + + Gets or sets the proxy configuration when calling web service + + + + + + Gets or sets the custom proxy address, include port separated by a colon + + + + + + Should we include the BOM (Byte-order-mark) for UTF? Influences the property. + + This will only work for UTF-8. + + + + + + Gets or sets the encoding. + + + + + + Gets or sets a value whether escaping be done according to Rfc3986 (Supports Internationalized Resource Identifiers - IRIs) + + A value of true if Rfc3986; otherwise, false for legacy Rfc2396. + + + + + Gets or sets a value whether escaping be done according to the old NLog style (Very non-standard) + + A value of true if legacy encoding; otherwise, false for standard UTF8 encoding. + + + + + Gets or sets the name of the root XML element, + if POST of XML document chosen. + If so, this property must not be null. + (see and ). + + + + + + Gets or sets the (optional) root namespace of the XML document, + if POST of XML document chosen. + (see and ). + + + + + + Gets the array of parameters to be passed. + + + + + + Indicates whether to pre-authenticate the HttpWebRequest (Requires 'Authorization' in parameters) + + + + + + Calls the target method. Must be implemented in concrete classes. + + Method call parameters. + + + + Calls the target DoInvoke method, and handles AsyncContinuation callback + + Method call parameters. + The continuation. + + + + Invokes the web service method. + + Parameters to be passed. + The logging event. + + + + Flush any pending log messages asynchronously (in case of asynchronous targets). + + The asynchronous continuation. + + + + Closes the target. + + + + + Builds the URL to use when calling the web service for a message, depending on the WebServiceProtocol. + + + + + + + Write from input to output. Fix the UTF-8 bom + + + + + + + + + base class for POST formatters, that + implement former PrepareRequest() method, + that creates the content for + the requested kind of HTTP request + + + + + Win32 file attributes. + + + For more information see https://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/createfile.asp. + + + + + Read-only file. + + + + + Hidden file. + + + + + System file. + + + + + File should be archived. + + + + + Device file. + + + + + Normal file. + + + + + File is temporary (should be kept in cache and not + written to disk if possible). + + + + + Sparse file. + + + + + Reparse point. + + + + + Compress file contents. + + + + + File should not be indexed by the content indexing service. + + + + + Encrypted file. + + + + + The system writes through any intermediate cache and goes directly to disk. + + + + + The system opens a file with no system caching. + + + + + Delete file after it is closed. + + + + + A file is accessed according to POSIX rules. + + + + + Asynchronous request queue. + + + + + Initializes a new instance of the AsyncRequestQueue class. + + Request limit. + The overflow action. + + + + Gets the number of requests currently in the queue. + + + + + Enqueues another item. If the queue is overflown the appropriate + action is taken as specified by . + + The log event info. + Queue was empty before enqueue + + + + Dequeues a maximum of count items from the queue + and adds returns the list containing them. + + Maximum number of items to be dequeued (-1 means everything). + The array of log events. + + + + Dequeues into a preallocated array, instead of allocating a new one + + Maximum number of items to be dequeued + Preallocated list + + + + Clears the queue. + + + + + Gets or sets the request limit. + + + + + Gets or sets the action to be taken when there's no more room in + the queue and another request is enqueued. + + + + + Notifies about log event that was dropped when set to + + + + + Notifies when queue size is growing over + + + + + Raise event when queued element was dropped because of queue overflow + + Dropped queue item + + + + Raise event when RequestCount overflow + + current requests count + + + + Provides asynchronous, buffered execution of target writes. + + Documentation on NLog Wiki + +

+ Asynchronous target wrapper allows the logger code to execute more quickly, by queueing + messages and processing them in a separate thread. You should wrap targets + that spend a non-trivial amount of time in their Write() method with asynchronous + target to speed up logging. +

+

+ Because asynchronous logging is quite a common scenario, NLog supports a + shorthand notation for wrapping all targets with AsyncWrapper. Just add async="true" to + the <targets/> element in the configuration file. +

+ + + ... your targets go here ... + + ]]> +
+ +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ The above examples assume just one target and a single rule. See below for + a programmatic configuration that's equivalent to the above config file: +

+ +
+
+ + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Name of the target. + The wrapped target. + + + + Initializes a new instance of the class. + + The wrapped target. + + + + Initializes a new instance of the class. + + The wrapped target. + Maximum number of requests in the queue. + The action to be taken when the queue overflows. + + + + Gets or sets the number of log events that should be processed in a batch + by the lazy writer thread. + + + + + + Gets or sets the time in milliseconds to sleep between batches. (1 or less means trigger on new activity) + + + + + + Raise event when Target cannot store LogEvent. + Event arg contains lost LogEvents + + + + + Raises when event queue grow. + Queue can grow when was set to + + + + + Gets or sets the action to be taken when the lazy writer thread request queue count + exceeds the set limit. + + + + + + Gets or sets the limit on the number of requests in the lazy writer thread request queue. + + + + + + Gets or sets the limit of full s to write before yielding into + Performance is better when writing many small batches, than writing a single large batch + + + + + + Gets or sets whether to use the locking queue, instead of a lock-free concurrent queue + The locking queue is less concurrent when many logger threads, but reduces memory allocation + + + + + + Gets the queue of lazy writer thread requests. + + + + + Schedules a flush of pending events in the queue (if any), followed by flushing the WrappedTarget. + + The asynchronous continuation. + + + + Initializes the target by starting the lazy writer timer. + + + + + Shuts down the lazy writer timer. + + + + + Starts the lazy writer thread which periodically writes + queued log messages. + + + + + Attempts to start an instant timer-worker-thread which can write + queued log messages. + + Returns true when scheduled a timer-worker-thread + + + + Stops the lazy writer thread. + + + + + Adds the log event to asynchronous queue to be processed by + the lazy writer thread. + + The log event. + + The is called + to ensure that the log event can be processed in another thread. + + + + + Write to queue without locking + + + + + + The action to be taken when the queue overflows. + + + + + Grow the queue. + + + + + Discard the overflowing item. + + + + + Block until there's more room in the queue. + + + + + Causes a flush on a wrapped target if LogEvent satisfies the . + If condition isn't set, flushes on each write. + + Documentation on NLog Wiki + +

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ The above examples assume just one target and a single rule. See below for + a programmatic configuration that's equivalent to the above config file: +

+ +
+
+ + + Gets or sets the condition expression. Log events who meet this condition will cause + a flush on the wrapped target. + + + + + + Delay the flush until the LogEvent has been confirmed as written + + If not explicitly set, then disabled by default for and AsyncTaskTarget + + + + + + Only flush when LogEvent matches condition. Ignore explicit-flush, config-reload-flush and shutdown-flush + + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + + + + Initializes a new instance of the class. + + + The default value of the layout is: ${longdate}|${level:uppercase=true}|${logger}|${message} + + The wrapped target. + Name of the target + + + + Initializes a new instance of the class. + + The wrapped target. + + + + Initializes the target. + + + + + Forwards the call to the .Write() + and calls on it if LogEvent satisfies + the flush condition or condition is null. + + Logging event to be written out. + + + + Schedules a flush operation, that triggers when all pending flush operations are completed (in case of asynchronous targets). + + The asynchronous continuation. + + + + Closes the target. + + + + + A target that buffers log events and sends them in batches to the wrapped target. + + Documentation on NLog Wiki + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Name of the target. + The wrapped target. + + + + Initializes a new instance of the class. + + The wrapped target. + + + + Initializes a new instance of the class. + + The wrapped target. + Size of the buffer. + + + + Initializes a new instance of the class. + + The wrapped target. + Size of the buffer. + The flush timeout. + + + + Initializes a new instance of the class. + + The wrapped target. + Size of the buffer. + The flush timeout. + The action to take when the buffer overflows. + + + + Gets or sets the number of log events to be buffered. + + + + + + Gets or sets the timeout (in milliseconds) after which the contents of buffer will be flushed + if there's no write in the specified period of time. Use -1 to disable timed flushes. + + + + + + Gets or sets a value indicating whether to use sliding timeout. + + + This value determines how the inactivity period is determined. If sliding timeout is enabled, + the inactivity timer is reset after each write, if it is disabled - inactivity timer will + count from the first event written to the buffer. + + + + + + Gets or sets the action to take if the buffer overflows. + + + Setting to will replace the + oldest event with new events without sending events down to the wrapped target, and + setting to will flush the + entire buffer to the wrapped target. + + + + + + Flushes pending events in the buffer (if any), followed by flushing the WrappedTarget. + + The asynchronous continuation. + + + + Initializes the target. + + + + + Closes the target by flushing pending events in the buffer (if any). + + + + + Adds the specified log event to the buffer and flushes + the buffer in case the buffer gets full. + + The log event. + + + + The action to be taken when the buffer overflows. + + + + + Flush the content of the buffer. + + + + + Discard the oldest item. + + + + + A base class for targets which wrap other (multiple) targets + and provide various forms of target routing. + + + + + Initializes a new instance of the class. + + The targets. + + + + Gets the collection of targets managed by this compound target. + + + + + Returns the text representation of the object. Used for diagnostics. + + A string that describes the target. + + + + Writes logging event to the log target. + + Logging event to be written out. + + + + Flush any pending log messages for all wrapped targets. + + The asynchronous continuation. + + + + Concurrent Asynchronous request queue based on + + + + + Initializes a new instance of the AsyncRequestQueue class. + + Request limit. + The overflow action. + + + + Gets the number of requests currently in the queue. + + + Only for debugging purposes + + + + + Enqueues another item. If the queue is overflown the appropriate + action is taken as specified by . + + The log event info. + Queue was empty before enqueue + + + + Dequeues a maximum of count items from the queue + and adds returns the list containing them. + + Maximum number of items to be dequeued (-1 means everything). + The array of log events. + + + + Dequeues into a preallocated array, instead of allocating a new one + + Maximum number of items to be dequeued + Preallocated list + + + + Clears the queue. + + + + + Provides fallback-on-error. + + Documentation on NLog Wiki + +

This example causes the messages to be written to server1, + and if it fails, messages go to server2.

+

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ The above examples assume just one target and a single rule. See below for + a programmatic configuration that's equivalent to the above config file: +

+ +
+
+ + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Name of the target. + The targets. + + + + Initializes a new instance of the class. + + The targets. + + + + Gets or sets a value indicating whether to return to the first target after any successful write. + + + + + + + + + + + + Forwards the log event to the sub-targets until one of them succeeds. + + The log event. + + The method remembers the last-known-successful target + and starts the iteration from it. + If is set, the method + resets the target to the first target + stored in . + + + + + Filtering rule for . + + + + + Initializes a new instance of the FilteringRule class. + + + + + Initializes a new instance of the FilteringRule class. + + Condition to be tested against all events. + Filter to apply to all log events when the first condition matches any of them. + + + + Gets or sets the condition to be tested. + + + + + + Gets or sets the resulting filter to be applied when the condition matches. + + + + + + Filters log entries based on a condition. + + Documentation on NLog Wiki + +

This example causes the messages not contains the string '1' to be ignored.

+

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ The above examples assume just one target and a single rule. See below for + a programmatic configuration that's equivalent to the above config file: +

+ +
+
+ + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Name of the target. + The wrapped target. + The condition. + + + + Initializes a new instance of the class. + + The wrapped target. + The condition. + + + + Gets or sets the condition expression. Log events who meet this condition will be forwarded + to the wrapped target. + + + + + + Gets or sets the filter. Log events who evaluates to will be discarded + + + + + + + + + Checks the condition against the passed log event. + If the condition is met, the log event is forwarded to + the wrapped target. + + Log event. + + + + + + + Limits the number of messages written per timespan to the wrapped target. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The name of the target. + The wrapped target. + + + + Initializes a new instance of the class. + + The wrapped target. + + + + Initializes a new instance of the class. + + The wrapped target. + Maximum number of messages written per interval. + Interval in which the maximum number of messages can be written. + + + + Gets or sets the maximum allowed number of messages written per . + + + Messages received after has been reached in the current will be discarded. + + + + + + Gets or sets the interval in which messages will be written up to the number of messages. + + + Messages received after has been reached in the current will be discarded. + + + + + + Gets the DateTime when the current will be reset. + + + + + + Gets the number of written in the current . + + + + + + Initializes the target and resets the current Interval and . + + + + + Writes log event to the wrapped target if the current is lower than . + If the is already reached, no log event will be written to the wrapped target. + resets when the current is expired. + + Log event to be written out. + + + + Arguments for events. + + + + + + + + Instance of that was dropped by + + + + + Raises by when + queue is full + and set to + By default queue doubles it size. + + + + + Contains items count and new queue size. + + Required queue size + Current queue size + + + + New queue size + + + + + Current requests count + + + + + Filters buffered log entries based on a set of conditions that are evaluated on a group of events. + + Documentation on NLog Wiki + + PostFilteringWrapper must be used with some type of buffering target or wrapper, such as + AsyncTargetWrapper, BufferingWrapper or ASPNetBufferingWrapper. + + +

+ This example works like this. If there are no Warn,Error or Fatal messages in the buffer + only Info messages are written to the file, but if there are any warnings or errors, + the output includes detailed trace (levels >= Debug). You can plug in a different type + of buffering wrapper (such as ASPNetBufferingWrapper) to achieve different + functionality. +

+

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ The above examples assume just one target and a single rule. See below for + a programmatic configuration that's equivalent to the above config file: +

+ +
+
+ + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Name of the target. + The wrapped target. + + + + Gets or sets the default filter to be applied when no specific rule matches. + + + + + + Gets the collection of filtering rules. The rules are processed top-down + and the first rule that matches determines the filtering condition to + be applied to log events. + + + + + + + + + + + + NOTE! Obsolete, instead override Write(IList{AsyncLogEventInfo} logEvents) + + Writes an array of logging events to the log target. By default it iterates on all + events and passes them to "Write" method. Inheriting classes can use this method to + optimize batch writes. + + Logging events to be written out. + + + + Evaluates all filtering rules to find the first one that matches. + The matching rule determines the filtering condition to be applied + to all items in a buffer. If no condition matches, default filter + is applied to the array of log events. + + Array of log events to be post-filtered. + + + + Evaluate all the rules to get the filtering condition + + + + + + + Sends log messages to a randomly selected target. + + Documentation on NLog Wiki + +

This example causes the messages to be written to either file1.txt or file2.txt + chosen randomly on a per-message basis. +

+

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ The above examples assume just one target and a single rule. See below for + a programmatic configuration that's equivalent to the above config file: +

+ +
+
+ + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Name of the target. + The targets. + + + + Initializes a new instance of the class. + + The targets. + + + + Forwards the log event to one of the sub-targets. + The sub-target is randomly chosen. + + The log event. + + + + Repeats each log event the specified number of times. + + Documentation on NLog Wiki + +

This example causes each log message to be repeated 3 times.

+

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ The above examples assume just one target and a single rule. See below for + a programmatic configuration that's equivalent to the above config file: +

+ +
+
+ + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Name of the target. + The wrapped target. + The repeat count. + + + + Initializes a new instance of the class. + + The wrapped target. + The repeat count. + + + + Gets or sets the number of times to repeat each log message. + + + + + + Forwards the log message to the by calling the method times. + + The log event. + + + + Retries in case of write error. + + Documentation on NLog Wiki + +

This example causes each write attempt to be repeated 3 times, + sleeping 1 second between attempts if first one fails.

+

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ The above examples assume just one target and a single rule. See below for + a programmatic configuration that's equivalent to the above config file: +

+ +
+
+ + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Name of the target. + The wrapped target. + The retry count. + The retry delay milliseconds. + + + + Initializes a new instance of the class. + + The wrapped target. + The retry count. + The retry delay milliseconds. + + + + Gets or sets the number of retries that should be attempted on the wrapped target in case of a failure. + + + + + + Gets or sets the time to wait between retries in milliseconds. + + + + + + Special SyncObject to allow closing down Target while busy retrying + + + + + Writes the specified log event to the wrapped target, retrying and pausing in case of an error. + + The log event. + + + + Writes the specified log event to the wrapped target in a thread-safe manner. + + The log event. + + + + Writes the specified log event to the wrapped target, retrying and pausing in case of an error. + + The log event. + + + + Distributes log events to targets in a round-robin fashion. + + Documentation on NLog Wiki + +

This example causes the messages to be written to either file1.txt or file2.txt. + Each odd message is written to file2.txt, each even message goes to file1.txt. +

+

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ The above examples assume just one target and a single rule. See below for + a programmatic configuration that's equivalent to the above config file: +

+ +
+
+ + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Name of the target. + The targets. + + + + Initializes a new instance of the class. + + The targets. + + + + Ensures forwarding happens without holding lock + + + + + + Forwards the write to one of the targets from + the collection. + + The log event. + + The writes are routed in a round-robin fashion. + The first log event goes to the first target, the second + one goes to the second target and so on looping to the + first target when there are no more targets available. + In general request N goes to Targets[N % Targets.Count]. + + + + + Writes log events to all targets. + + Documentation on NLog Wiki + +

This example causes the messages to be written to both file1.txt or file2.txt +

+

+ To set up the target in the configuration file, + use the following syntax: +

+ +

+ The above examples assume just one target and a single rule. See below for + a programmatic configuration that's equivalent to the above config file: +

+ +
+
+ + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + Name of the target. + The targets. + + + + Initializes a new instance of the class. + + The targets. + + + + Forwards the specified log event to all sub-targets. + + The log event. + + + + NOTE! Obsolete, instead override Write(IList{AsyncLogEventInfo} logEvents) + + Writes an array of logging events to the log target. By default it iterates on all + events and passes them to "Write" method. Inheriting classes can use this method to + optimize batch writes. + + Logging events to be written out. + + + + Writes an array of logging events to the log target. By default it iterates on all + events and passes them to "Write" method. Inheriting classes can use this method to + optimize batch writes. + + Logging events to be written out. + + + + Base class for targets wrap other (single) targets. + + + + + Gets or sets the target that is wrapped by this target. + + + + + + Returns the text representation of the object. Used for diagnostics. + + A string that describes the target. + + + + Flush any pending log messages (in case of asynchronous targets). + + The asynchronous continuation. + + + + Writes logging event to the log target. Must be overridden in inheriting + classes. + + Logging event to be written out. + + + + Builtin IFileCompressor implementation utilizing the .Net4.5 specific + and is used as the default value for on .Net4.5. + So log files created via can be zipped when archived + w/o 3rd party zip library when run on .Net4.5 or higher. + + + + + Implements using the .Net4.5 specific + + + + + Current local time retrieved directly from DateTime.Now. + + + + + Gets current local time directly from DateTime.Now. + + + + + Converts the specified system time to the same form as the time value originated from this time source. + + The system originated time value to convert. + + The value of converted to local time. + + + + + Current UTC time retrieved directly from DateTime.UtcNow. + + + + + Gets current UTC time directly from DateTime.UtcNow. + + + + + Converts the specified system time to the same form as the time value originated from this time source. + + The system originated time value to convert. + + The value of converted to UTC time. + + + + + Fast time source that updates current time only once per tick (15.6 milliseconds). + + + + + Gets raw uncached time from derived time source. + + + + + Gets current time cached for one system tick (15.6 milliseconds). + + + + + Fast local time source that is updated once per tick (15.6 milliseconds). + + + + + Gets uncached local time directly from DateTime.Now. + + + + + Converts the specified system time to the same form as the time value originated from this time source. + + The system originated time value to convert. + + The value of converted to local time. + + + + + Fast UTC time source that is updated once per tick (15.6 milliseconds). + + + + + Gets uncached UTC time directly from DateTime.UtcNow. + + + + + Converts the specified system time to the same form as the time value originated from this time source. + + The system originated time value to convert. + + The value of converted to UTC time. + + + + + Defines source of current time. + + + + + Gets current time. + + + + + Gets or sets current global time source used in all log events. + + + Default time source is . + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Converts the specified system time to the same form as the time value originated from this time source. + + The system originated time value to convert. + + The value of converted to the same form + as time values originated from this source. + + + + There are situations when NLog have to compare the time originated from TimeSource + to the time originated externally in the system. + To be able to provide meaningful result of such comparisons the system time must be expressed in + the same form as TimeSource time. + + + Examples: + - If the TimeSource provides time values of local time, it should also convert the provided + to the local time. + - If the TimeSource shifts or skews its time values, it should also apply + the same transform to the given . + + + + + + Marks class as a time source and assigns a name to it. + + + + + Initializes a new instance of the class. + + Name of the time source. + +
+
diff --git a/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/netstandard2.0/NLog.xml.meta b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/netstandard2.0/NLog.xml.meta new file mode 100644 index 00000000..69bec242 --- /dev/null +++ b/Assets/AltTester/Runtime/3rdParty/nlog.4.7.9/netstandard2.0/NLog.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9d44ba5290ed9ed48a698c0fc997bd3e +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/3rdParty/websocket-sharp.meta b/Assets/AltTester/Runtime/3rdParty/websocket-sharp.meta new file mode 100644 index 00000000..f76b1cb6 --- /dev/null +++ b/Assets/AltTester/Runtime/3rdParty/websocket-sharp.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e76f738d8b09d4f4ebfcb04a815e54bd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/3rdParty/websocket-sharp/netstandard2.0.meta b/Assets/AltTester/Runtime/3rdParty/websocket-sharp/netstandard2.0.meta new file mode 100644 index 00000000..04de110d --- /dev/null +++ b/Assets/AltTester/Runtime/3rdParty/websocket-sharp/netstandard2.0.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 95a974f729efc6b459fa80388dd38e55 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/3rdParty/websocket-sharp/netstandard2.0/altwebsocket-sharp.dll b/Assets/AltTester/Runtime/3rdParty/websocket-sharp/netstandard2.0/altwebsocket-sharp.dll new file mode 100644 index 00000000..51f8dac8 Binary files /dev/null and b/Assets/AltTester/Runtime/3rdParty/websocket-sharp/netstandard2.0/altwebsocket-sharp.dll differ diff --git a/Assets/AltTester/Runtime/3rdParty/websocket-sharp/netstandard2.0/altwebsocket-sharp.dll.meta b/Assets/AltTester/Runtime/3rdParty/websocket-sharp/netstandard2.0/altwebsocket-sharp.dll.meta new file mode 100644 index 00000000..1b9eee55 --- /dev/null +++ b/Assets/AltTester/Runtime/3rdParty/websocket-sharp/netstandard2.0/altwebsocket-sharp.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 8d9b9747cedc90545a586ea7b9178890 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver.meta b/Assets/AltTester/Runtime/AltDriver.meta new file mode 100644 index 00000000..c1803d7f --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 5d3743396fb2d384396146fe08c6030c +folderAsset: yes +timeCreated: 1523521898 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/AltDevice.cs b/Assets/AltTester/Runtime/AltDriver/AltDevice.cs new file mode 100644 index 00000000..5348a98a --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/AltDevice.cs @@ -0,0 +1,39 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public class AltDevice + { + public string DeviceId { get; set; } + public int LocalPort { get; set; } + public int RemotePort { get; set; } + public bool Active { get; set; } + public string Platform { get; set; } + public int Pid { get; set; } + + public AltDevice(string deviceId, string platform, int localPort = 13000, int remotePort = 13000, bool active = false, int pid = 0) + { + DeviceId = deviceId; + LocalPort = localPort; + RemotePort = remotePort; + Active = active; + Platform = platform; + Pid = pid; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/AltDevice.cs.meta b/Assets/AltTester/Runtime/AltDriver/AltDevice.cs.meta new file mode 100644 index 00000000..0086bbe4 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/AltDevice.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 472c2dd7a1304c64499fd36f25f70084 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/AltDriver.cs b/Assets/AltTester/Runtime/AltDriver/AltDriver.cs new file mode 100644 index 00000000..2f3da387 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/AltDriver.cs @@ -0,0 +1,609 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Collections.Generic; +using System.Threading; +using AltTester.AltTesterUnitySDK.Driver.Commands; +using AltTester.AltTesterUnitySDK.Driver.Communication; +using AltTester.AltTesterUnitySDK.Driver.Logging; +using AltTester.AltTesterUnitySDK.Driver.Notifications; + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public enum By + { + TAG, LAYER, NAME, COMPONENT, PATH, ID, TEXT + } + + public class AltDriver + { + private static readonly NLog.Logger logger = DriverLogManager.Instance.GetCurrentClassLogger(); + private readonly IDriverCommunication communicationHandler; + private static object driverLock = new object(); + public static readonly string VERSION = "2.1.0"; + + public IDriverCommunication CommunicationHandler { get { return communicationHandler; } } + + /// + /// Initiates AltDriver and begins connection with the instrumented Unity application through to AltServer. + /// + /// The IP or hostname AltTester® Server is listening on. + /// The port AltTester® Server is listening on. + /// If true it enables driver commands logging to log file and Unity. + /// The connect timeout in seconds. + /// The name of the Unity application. + public AltDriver(string host = "127.0.0.1", int port = 13000, string appName = "__default__", bool enableLogging = false, int connectTimeout = 60, string platform = "unknown", string platformVersion = "unknown", string deviceInstanceId = "unknown", string appId = "unknown", string driverType = "SDK") + { + lock (driverLock) + { +#if UNITY_EDITOR || ALTTESTER + var defaultLevels = new Dictionary { { AltLogger.File, AltLogLevel.Debug }, { AltLogger.Unity, AltLogLevel.Debug } }; +#else + var defaultLevels = new Dictionary { { AltLogger.File, AltLogLevel.Debug }, { AltLogger.Console, AltLogLevel.Debug } }; +#endif + + DriverLogManager.SetupAltDriverLogging(defaultLevels); + + if (!enableLogging) + { + DriverLogManager.StopLogging(); + } + + logger.Debug( + "Connecting to AltTester® on host: '{0}', port: '{1}', appName: '{2}', platform: '{3}', platformVersion: '{4}', deviceInstanceId: '{5}' and driverType: '{6}'.", + host, + port, + appName, + platform, + platformVersion, + deviceInstanceId, + driverType + ); + communicationHandler = new DriverCommunicationHandler(host, port, connectTimeout, appName, platform, platformVersion, deviceInstanceId, appId, driverType); + communicationHandler.Connect(); + + checkServerVersion(); + } + } + + private void splitVersion(string version, out string major, out string minor) + { + var parts = version.Split(new[] { "." }, StringSplitOptions.None); + major = parts[0]; + minor = parts.Length > 1 ? parts[1] : string.Empty; + } + + private void checkServerVersion() + { + string serverVersion = GetServerVersion(); + + string majorServer; + string majorDriver; + string minorDriver; + string minorServer; + + splitVersion(serverVersion, out majorServer, out minorServer); + splitVersion(VERSION, out majorDriver, out minorDriver); + + if (majorServer != majorDriver || minorServer != minorDriver) + { + string message = "Version mismatch. AltDriver version is " + VERSION + ". AltTester® version is " + serverVersion + "."; + logger.Warn(message); + } + } + + public void Stop() + { + communicationHandler.Close(); + } + + public void ResetInput() + { + new AltResetInput(communicationHandler).Execute(); + } + + public void SetCommandResponseTimeout(int commandTimeout) + { + communicationHandler.SetCommandTimeout(commandTimeout); + } + + public void SetDelayAfterCommand(float delay) + { + communicationHandler.SetDelayAfterCommand(delay); + } + + public float GetDelayAfterCommand() + { + return communicationHandler.GetDelayAfterCommand(); + } + + public string GetServerVersion() + { + string serverVersion = new AltGetServerVersion(communicationHandler).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return serverVersion; + } + + public void SetLogging(bool enableLogging) + { + if (enableLogging) + DriverLogManager.ResumeLogging(); + else + DriverLogManager.StopLogging(); + } + + public void LoadScene(string scene, bool loadSingle = true) + { + new AltLoadScene(communicationHandler, scene, loadSingle).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public void UnloadScene(string scene) + { + new AltUnloadScene(communicationHandler, scene).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public List GetAllLoadedScenes() + { + var sceneList = new AltGetAllLoadedScenes(communicationHandler).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return sceneList; + } + + public List FindObjects(By by, string value, By cameraBy = By.NAME, string cameraValue = "", bool enabled = true) + { + var listOfObjects = new AltFindObjects(communicationHandler, by, value, cameraBy, cameraValue, enabled).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return listOfObjects; + } + + public List FindObjectsWhichContain(By by, string value, By cameraBy = By.NAME, string cameraValue = "", bool enabled = true) + { + var listOfObjects = new AltFindObjectsWhichContain(communicationHandler, by, value, cameraBy, cameraValue, enabled).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return listOfObjects; + } + + public AltObject FindObject(By by, string value, By cameraBy = By.NAME, string cameraValue = "", bool enabled = true) + { + var findObject = new AltFindObject(communicationHandler, by, value, cameraBy, cameraValue, enabled).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return findObject; + } + + public AltObject FindObjectWhichContains(By by, string value, By cameraBy = By.NAME, string cameraValue = "", bool enabled = true) + { + var findObject = new AltFindObjectWhichContains(communicationHandler, by, value, cameraBy, cameraValue, enabled).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return findObject; + } + + public void SetTimeScale(float timeScale) + { + new AltSetTimeScale(communicationHandler, timeScale).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public float GetTimeScale() + { + var timeScale = new AltGetTimeScale(communicationHandler).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return timeScale; + } + + public T CallStaticMethod(string typeName, string methodName, string assemblyName, + object[] parameters, string[] typeOfParameters = null) + { + var result = new AltCallStaticMethod(communicationHandler, typeName, methodName, parameters, typeOfParameters, assemblyName).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return result; + } + + public T GetStaticProperty(string componentName, string propertyName, string assemblyName, int maxDepth = 2) + { + var propertyValue = new AltGetStaticProperty(communicationHandler, componentName, propertyName, assemblyName, maxDepth).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return propertyValue; + } + + public void SetStaticProperty(string componentName, string propertyName, string assemblyName, object updatedProperty) + { + new AltSetStaticProperty(communicationHandler, componentName, propertyName, assemblyName, updatedProperty).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public void DeletePlayerPref() + { + new AltDeletePlayerPref(communicationHandler).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public void DeleteKeyPlayerPref(string keyName) + { + new AltDeleteKeyPlayerPref(communicationHandler, keyName).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public void SetKeyPlayerPref(string keyName, int valueName) + { + new AltSetKeyPLayerPref(communicationHandler, keyName, valueName).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public void SetKeyPlayerPref(string keyName, float valueName) + { + new AltSetKeyPLayerPref(communicationHandler, keyName, valueName).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public void SetKeyPlayerPref(string keyName, string valueName) + { + new AltSetKeyPLayerPref(communicationHandler, keyName, valueName).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public int GetIntKeyPlayerPref(string keyName) + { + var keyValue = new AltGetIntKeyPlayerPref(communicationHandler, keyName).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return keyValue; + } + + public float GetFloatKeyPlayerPref(string keyName) + { + var keyValue = new AltGetFloatKeyPlayerPref(communicationHandler, keyName).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return keyValue; + } + + public string GetStringKeyPlayerPref(string keyName) + { + var keyValue = new AltGetStringKeyPlayerPref(communicationHandler, keyName).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return keyValue; + } + + public string GetCurrentScene() + { + var sceneName = new AltGetCurrentScene(communicationHandler).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return sceneName; + } + + /// + /// Simulates a swipe action between two points. + /// + /// Coordinates of the screen where the swipe begins + /// Coordinates of the screen where the swipe ends + /// The time measured in seconds to move the mouse from start to end location. Defaults to 0.1. + /// If set wait for command to finish. Defaults to True. + public void Swipe(AltVector2 start, AltVector2 end, float duration = 0.1f, bool wait = true) + { + new AltSwipe(communicationHandler, start, end, duration, wait).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + /// + /// Simulates a multipoint swipe action. + /// + /// A list of positions on the screen where the swipe be made. + /// The time measured in seconds to swipe from first position to the last position. Defaults to 0.1. + /// If set wait for command to finish. Defaults to True. + public void MultipointSwipe(AltVector2[] positions, float duration = 0.1f, bool wait = true) + { + new AltMultipointSwipe(communicationHandler, positions, duration, wait).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + /// + /// Simulates holding left click button down for a specified amount of time at given coordinates. + /// + /// The coordinates where the button is held down. + /// The time measured in seconds to keep the button down. + /// If set wait for command to finish. Defaults to True. + public void HoldButton(AltVector2 coordinates, float duration, bool wait = true) + { + Swipe(coordinates, coordinates, duration, wait); + } + + /// + /// Simulates key press action in your app. + /// + /// The key code of the key simulated to be pressed. + /// A value between [-1,1] used for joysticks to indicate how hard the button was pressed. Defaults to 1. + /// The time measured in seconds from the key press to the key release. Defaults to 0.1 + /// If set wait for command to finish. Defaults to True. + public void PressKey(AltKeyCode keyCode, float power = 1, float duration = 0.1f, bool wait = true) + { + AltKeyCode[] keyCodes = { keyCode }; + PressKeys(keyCodes, power, duration, wait); + } + + /// + /// Simulates multiple keys pressed action in your app. + /// + /// The list of key codes of the keys simulated to be pressed. + /// A value between [-1,1] used for joysticks to indicate how hard the button was pressed. Defaults to 1. + /// The time measured in seconds from the key press to the key release. Defaults to 0.1 + /// If set wait for command to finish. Defaults to True. + public void PressKeys(AltKeyCode[] keyCodes, float power = 1, float duration = 0.1f, bool wait = true) + { + new AltPressKeys(communicationHandler, keyCodes, power, duration, wait).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public void KeyDown(AltKeyCode keyCode, float power = 1) + { + AltKeyCode[] keyCodes = { keyCode }; + KeysDown(keyCodes, power); + } + + /// + /// Simulates multiple keys down action in your app. + /// + /// The key codes of the keys simulated to be down. + /// A value between [-1,1] used for joysticks to indicate how hard the button was pressed. Defaults to 1. + public void KeysDown(AltKeyCode[] keyCodes, float power = 1) + { + new AltKeysDown(communicationHandler, keyCodes, power).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public void KeyUp(AltKeyCode keyCode) + { + AltKeyCode[] keyCodes = { keyCode }; + KeysUp(keyCodes); + } + + /// + /// Simulates multiple keys up action in your app. + /// + /// The key codes of the keys simulated to be up. + public void KeysUp(AltKeyCode[] keyCodes) + { + new AltKeysUp(communicationHandler, keyCodes).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + /// + /// Simulate mouse movement in your app. + /// + /// The screen coordinates + /// The time measured in seconds to move the mouse from the current mouse position to the set coordinates. Defaults to 0.1f + /// If set wait for command to finish. Defaults to True. + public void MoveMouse(AltVector2 coordinates, float duration = 0.1f, bool wait = true) + { + new AltMoveMouse(communicationHandler, coordinates, duration, wait).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + /// + /// Simulate scroll action in your app. + /// + /// Set how fast to scroll. Positive values will scroll up and negative values will scroll down. Defaults to 1 + /// The duration of the scroll in seconds. Defaults to 0.1 + /// If set wait for command to finish. Defaults to True. + public void Scroll(float speed = 1, float duration = 0.1f, bool wait = true) + { + new AltScroll(communicationHandler, speed, 0, duration, wait).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + /// + /// Simulate scroll action in your app. + /// + /// Set how fast to scroll. X is horizontal and Y is vertical. Defaults to 1 + /// The duration of the scroll in seconds. Defaults to 0.1 + /// If set wait for command to finish. Defaults to True. + public void Scroll(AltVector2 scrollValue, float duration = 0.1f, bool wait = true) + { + new AltScroll(communicationHandler, scrollValue.y, scrollValue.x, duration, wait).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + /// + /// Tap at screen coordinates + /// + /// The screen coordinates + /// Number of taps + /// Interval between taps in seconds + /// If set wait for command to finish. Defaults to True. + public void Tap(AltVector2 coordinates, int count = 1, float interval = 0.1f, bool wait = true) + { + new AltTapCoordinates(communicationHandler, coordinates, count, interval, wait).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + /// + /// Click at screen coordinates + /// + /// The screen coordinates + /// Number of clicks. + /// Interval between clicks in seconds + /// If set wait for command to finish. Defaults to True. + public void Click(AltVector2 coordinates, int count = 1, float interval = 0.1f, bool wait = true) + { + new AltClickCoordinates(communicationHandler, coordinates, count, interval, wait).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + /// + /// Simulates device rotation action in your app. + /// + /// The linear acceleration of a device. + /// How long the rotation will take in seconds. Defaults to 0.1. + /// If set wait for command to finish. Defaults to True. + public void Tilt(AltVector3 acceleration, float duration = 0.1f, bool wait = true) + { + new AltTilt(communicationHandler, acceleration, duration, wait).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public List GetAllElements(By cameraBy = By.NAME, string cameraValue = "", bool enabled = true) + { + var listOfObjects = new AltGetAllElements(communicationHandler, cameraBy, cameraValue, enabled).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return listOfObjects; + } + + public List GetAllElementsLight(By cameraBy = By.NAME, string cameraValue = "", bool enabled = true) + { + var listOfObjects = new AltGetAllElementsLight(communicationHandler, cameraBy, cameraValue, enabled).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return listOfObjects; + } + + public void WaitForCurrentSceneToBe(string sceneName, double timeout = 10, double interval = 1) + { + new AltWaitForCurrentSceneToBe(communicationHandler, sceneName, timeout, interval).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public AltObject WaitForObject(By by, string value, By cameraBy = By.NAME, string cameraValue = "", bool enabled = true, double timeout = 20, double interval = 0.5) + { + var objectFound = new AltWaitForObject(communicationHandler, by, value, cameraBy, cameraValue, enabled, timeout, interval).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return objectFound; + } + + public void WaitForObjectNotBePresent(By by, string value, By cameraBy = By.NAME, string cameraValue = "", bool enabled = true, double timeout = 20, double interval = 0.5) + { + new AltWaitForObjectNotBePresent(communicationHandler, by, value, cameraBy, cameraValue, enabled, timeout, interval).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public AltObject WaitForObjectWhichContains(By by, string value, By cameraBy = By.NAME, string cameraValue = "", bool enabled = true, double timeout = 20, double interval = 0.5) + { + var objectFound = new AltWaitForObjectWhichContains(communicationHandler, by, value, cameraBy, cameraValue, enabled, timeout, interval).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return objectFound; + } + + public List GetAllScenes() + { + var listOfScenes = new AltGetAllScenes(communicationHandler).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return listOfScenes; + } + + public List GetAllCameras() + { + var listOfCameras = new AltGetAllCameras(communicationHandler).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return listOfCameras; + } + + public List GetAllActiveCameras() + { + var listOfCameras = new AltGetAllActiveCameras(communicationHandler).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return listOfCameras; + } + + public AltVector2 GetApplicationScreenSize() + { + var screenWidth = CallStaticMethod("UnityEngine.Screen", "get_width", "UnityEngine.CoreModule", new string[] { }, null); + var screenHeight = CallStaticMethod("UnityEngine.Screen", "get_height", "UnityEngine.CoreModule", new string[] { }, null); + + return new AltVector2(screenWidth, screenHeight); + } + + public AltTextureInformation GetScreenshot(AltVector2 size = default(AltVector2), int screenShotQuality = 100) + { + var textureInformation = new AltGetScreenshot(communicationHandler, size, screenShotQuality).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return textureInformation; + } + + public AltTextureInformation GetScreenshot(int id, AltColor color, float width, AltVector2 size = default(AltVector2), int screenShotQuality = 100) + { + var textureInformation = new AltGetHighlightObjectScreenshot(communicationHandler, id, color, width, size, screenShotQuality).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return textureInformation; + } + + public AltTextureInformation GetScreenshot(AltVector2 coordinates, AltColor color, float width, out AltObject selectedObject, AltVector2 size = default(AltVector2), int screenShotQuality = 100) + { + var textureInformation = new AltGetHighlightObjectFromCoordinatesScreenshot(communicationHandler, coordinates, color, width, size, screenShotQuality).Execute(out selectedObject); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return textureInformation; + } + + public void GetPNGScreenshot(string path) + { + new AltGetPNGScreenshot(communicationHandler, path).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public List GetAllLoadedScenesAndObjects(bool enabled = true) + { + var listOfObjects = new AltGetAllLoadedScenesAndObjects(communicationHandler, enabled).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return listOfObjects; + } + + public void SetServerLogging(AltLogger logger, AltLogLevel logLevel) + { + new AltSetServerLogging(communicationHandler, logger, logLevel).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public int BeginTouch(AltVector2 screenPosition) + { + var touchId = new AltBeginTouch(communicationHandler, screenPosition).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return touchId; + } + + public void MoveTouch(int fingerId, AltVector2 screenPosition) + { + new AltMoveTouch(communicationHandler, fingerId, screenPosition).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + public void EndTouch(int fingerId) + { + new AltEndTouch(communicationHandler, fingerId).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + } + + /// + /// Retrieves the Unity object at given coordinates. + /// Uses EventSystem.RaycastAll to find object. If no object is found then it uses UnityEngine.Physics.Raycast and UnityEngine.Physics2D.Raycast and returns the one closer to the camera. + /// + /// The screen coordinates + /// The UI object hit by event system Raycast, null otherwise + public AltObject FindObjectAtCoordinates(AltVector2 coordinates) + { + var objectFound = new AltFindObjectAtCoordinates(communicationHandler, coordinates).Execute(); + communicationHandler.SleepFor(communicationHandler.GetDelayAfterCommand()); + return objectFound; + } + + public void AddNotificationListener(NotificationType notificationType, Action callback, bool overwrite) + { + new AddNotificationListener(communicationHandler, notificationType, callback, overwrite).Execute(); + } + + public void RemoveNotificationListener(NotificationType notificationType) + { + new RemoveNotificationListener(communicationHandler, notificationType).Execute(); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/AltDriver.cs.meta b/Assets/AltTester/Runtime/AltDriver/AltDriver.cs.meta new file mode 100644 index 00000000..b66077ab --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/AltDriver.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 6f07df674d08ff94295e3a35036f3fdb +timeCreated: 1522050547 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/AltErrors.cs b/Assets/AltTester/Runtime/AltDriver/AltErrors.cs new file mode 100644 index 00000000..d522f1bb --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/AltErrors.cs @@ -0,0 +1,474 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public class AltErrors + { + public const string errorNotFound = "notFound"; + public const string errorSceneNotFound = "sceneNotFound"; + public const string errorPropertyNotFound = "propertyNotFound"; + public const string errorMethodNotFound = "methodNotFound"; + public const string errorComponentNotFound = "componentNotFound"; + public const string errorAssemblyNotFound = "assemblyNotFound"; + public const string errorCouldNotPerformOperation = "couldNotPerformOperation"; + public const string errorCouldNotParseJsonString = "couldNotParseJsonString"; + public const string errorMethodWithGivenParametersNotFound = "methodWithGivenParametersNotFound"; + public const string errorInvalidParameterType = "invalidParameterType"; + public const string errorFailedToParseArguments = "failedToParseMethodArguments"; + public const string errorObjectWasNotFound = "objectNotFound"; + public const string errorPropertyNotSet = "propertyCannotBeSet"; + public const string errorNullReference = "nullReferenceException"; + public const string errorUnknownError = "unknownError"; + public const string errorFormatException = "formatException"; + public const string errorCameraNotFound = "cameraNotFound"; + public const string errorIndexOutOfRange = "indexOutOfRange"; + public const string errorInvalidCommand = "invalidCommand"; + public const string errorInvalidPath = "invalidPath"; + public const string errorInputModule = "ALTTESTERNotAddedAsDefineVariable"; + } + + /// + /// Base exception class for AltTester. + /// + public class AltException : Exception + { + public AltException() + { + } + + public AltException(string message) : base(message) + { + } + + public AltException(string message, Exception inner) : base(message, inner) + { + } + } + + /// + /// Raised when the driver can not connect to the server. + /// + public class ConnectionException : AltException + { + public ConnectionException() + { + } + + public ConnectionException(string message) : base(message) + { + } + } + + /// + /// Raised when the client connection timeouts. + /// + public class ConnectionTimeoutException : ConnectionException + { + public ConnectionTimeoutException() + { + } + + public ConnectionTimeoutException(string message) : base(message) + { + } + } + + /// + /// Raised when the client tries to connect to a server without an app. + /// + public class NoAppConnectedException : ConnectionException + { + public NoAppConnectedException() + { + } + + public NoAppConnectedException(string message) : base(message) + { + } + } + + /// + /// Raised when the app closed the connection or unexpectedly disconnected. + /// + public class AppDisconnectedException : ConnectionException + { + public AppDisconnectedException() + { + } + + public AppDisconnectedException(string message) : base(message) + { + } + } + + /// + /// Raised when the client tries to connect to a server with a driver already connected. Free accounts are limited to a single driver connection at a time. + /// + public class MultipleDriversException : ConnectionException + { + public MultipleDriversException() + { + } + + public MultipleDriversException(string message) : base(message) + { + } + } + + /// + /// Raised when the client tries to connect to a server at the same time with another driver + /// + public class MultipleDriversTryingToConnectException : ConnectionException + { + public MultipleDriversTryingToConnectException() + { + } + + public MultipleDriversTryingToConnectException(string message) : base(message) + { + } + } + + public class NotFoundException : AltException + { + public NotFoundException() + { + } + + public NotFoundException(string message) : base(message) + { + } + } + + public class CameraNotFoundException : AltException + { + public CameraNotFoundException() + { + } + + public CameraNotFoundException(string message) : base(message) + { + } + } + + public class PropertyNotFoundException : AltException + { + public PropertyNotFoundException() + { + } + + public PropertyNotFoundException(string message) : base(message) + { + } + } + + public class MethodNotFoundException : AltException + { + public MethodNotFoundException() + { + } + + public MethodNotFoundException(string message) : base(message) + { + } + } + + public class ComponentNotFoundException : AltException + { + public ComponentNotFoundException() + { + } + + public ComponentNotFoundException(string message) : base(message) + { + } + } + + public class AssemblyNotFoundException : AltException + { + public AssemblyNotFoundException() + { + } + + public AssemblyNotFoundException(string message) : base(message) + { + } + } + + public class CouldNotPerformOperationException : AltException + { + public CouldNotPerformOperationException() + { + } + + public CouldNotPerformOperationException(string message) : base(message) + { + } + } + + public class InvalidParameterTypeException : AltException + { + public InvalidParameterTypeException() + { + } + + public InvalidParameterTypeException(string message) : base(message) + { + } + } + + public class MethodWithGivenParametersNotFoundException : AltException + { + public MethodWithGivenParametersNotFoundException() + { + } + + public MethodWithGivenParametersNotFoundException(string message) : base(message) + { + } + } + + public class FailedToParseArgumentsException : AltException + { + public FailedToParseArgumentsException() + { + } + + public FailedToParseArgumentsException(string message) : base(message) + { + } + } + + public class ObjectWasNotFoundException : AltException + { + public ObjectWasNotFoundException() + { + } + + public ObjectWasNotFoundException(string message) : base(message) + { + } + } + + public class NullReferenceException : AltException + { + public NullReferenceException() + { + } + + public NullReferenceException(string message) : base(message) + { + } + } + + public class UnknownErrorException : AltException + { + public UnknownErrorException() + { + } + + public UnknownErrorException(string message) : base(message) + { + } + } + + public class FormatException : AltException + { + public FormatException() + { + } + + public FormatException(string message) : base(message) + { + } + } + + public class WaitTimeOutException : AltException + { + public WaitTimeOutException() + { + } + + public WaitTimeOutException(string message) : base(message) + { + } + } + + public class CommandResponseTimeoutException : AltException + { + public CommandResponseTimeoutException() + { + } + + public CommandResponseTimeoutException(string message) : base(message) + { + } + } + + public class CommandNotFoundException : AltException + { + public CommandNotFoundException() + { + } + + public CommandNotFoundException(string message) : base(message) + { + } + } + + public class InvalidCommandException : AltException + { + public InvalidCommandException(Exception innerException) : base(AltErrors.errorInvalidCommand, innerException) + { + } + + public InvalidCommandException(string message) : base(message) + { + } + } + + public class AltRecvallException : AltException + { + public AltRecvallException() + { + } + + public AltRecvallException(string message) : base(message) + { + } + } + + public class AltRecvallMessageIdException : AltRecvallException + { + public AltRecvallMessageIdException() + { + } + + public AltRecvallMessageIdException(string message) : base(message) + { + } + } + + public class AltRecvallMessageFormatException : AltRecvallException + { + public AltRecvallMessageFormatException() + { + } + + public AltRecvallMessageFormatException(string message) : base(message) + { + } + } + + public class ReversePortForwardingException : AltException + { + public ReversePortForwardingException() + { + } + + public ReversePortForwardingException(string message) : base(message) + { + } + + public ReversePortForwardingException(string message, Exception inner) : base(message, inner) + { + } + } + + public class AltInvalidServerResponse : AltException + { + public AltInvalidServerResponse(string expected, string received) : base(string.Format("Expected to get response '{0}'; Got '{1}'", expected, received)) + { + } + } + + public class InvalidPathException : AltException + { + public InvalidPathException() + { + } + + public InvalidPathException(string message) : base(message) + { + } + } + + public class AltInputModuleException : AltException + { + public AltInputModuleException() + { + } + + public AltInputModuleException(string message) : base(message) + { + } + } + + public class AltInnerException : AltException + { + public AltInnerException(Exception inner) : base(AltErrors.errorUnknownError, inner) + { + } + } + + public class AltCameraNotFoundException : AltException + { + public AltCameraNotFoundException() + { + } + + public AltCameraNotFoundException(string message) : base(message) + { + } + } + + public class AltPathNotFoundException : AltException + { + public AltPathNotFoundException() + { + } + + public AltPathNotFoundException(string message) : base(message) + { + } + } + + public class SceneNotFoundException : AltException + { + public SceneNotFoundException() + { + } + + public SceneNotFoundException(string message) : base(message) + { + } + } + + public class ResponseFormatException : AltException + { + public ResponseFormatException() + { + } + + public ResponseFormatException(Type t, string data) : base("Could not deserialize response data: `" + data + "` into " + t.FullName) + { + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/AltErrors.cs.meta b/Assets/AltTester/Runtime/AltDriver/AltErrors.cs.meta new file mode 100644 index 00000000..2ea9b702 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/AltErrors.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0a82f7fc0b31f2a4da45397e20d01065 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/AltReversePortForwarding.cs b/Assets/AltTester/Runtime/AltDriver/AltReversePortForwarding.cs new file mode 100644 index 00000000..d0068bc8 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/AltReversePortForwarding.cs @@ -0,0 +1,237 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using AltTester.AltTesterUnitySDK.Driver.Logging; + +namespace AltTester.AltTesterUnitySDK.Driver +{ + /// + /// API to interact with adb programmatically + /// + public class AltReversePortForwarding + { + +#if UNITY_EDITOR + private static readonly NLog.Logger logger = DriverLogManager.Instance.GetCurrentClassLogger(); +#endif + /// + /// Calls adb reverse [-s {deviceId}] tcp:{remotePort} tcp:{localPort} + /// + /// The device's port to reverse from + /// The local port to reverse to + /// The id of the device + /// + /// The adb path. + /// If no adb path is provided, it tries to use adb from ${ANDROID_SDK_ROOT}/platform-tools/adb + /// if ANDROID_SDK_ROOT env variable is not set, it tries to execute adb from path. + /// + public static string ReversePortForwardingAndroid(int remotePort = 13000, int localPort = 13000, string deviceId = "", string adbPath = "") + { + adbPath = GetAdbPath(adbPath); + string arguments; + if (deviceId.Equals("")) + arguments = "reverse tcp:" + remotePort + " tcp:" + localPort; + else + { + arguments = "-s " + deviceId + " reverse" + " tcp:" + remotePort + " tcp:" + localPort; + } + try + { + + var process = startProcess(adbPath, arguments); + + string stdout = process.StandardError.ReadToEnd(); + process.WaitForExit(); + if (stdout.Length > 0) + { + return stdout; + } + } + catch (Exception ex) + { + throw new ReversePortForwardingException("Error while running command: " + adbPath + " " + arguments, ex); + + } + return "Ok"; + } + + /// + /// Calls `adb reverse --remove-all` + /// + /// + /// The adb path. + /// If no adb path is provided, it tries to use adb from ${ANDROID_SDK_ROOT}/platform-tools/adb + /// if ANDROID_SDK_ROOT env variable is not set, it tries to execute adb from path. + /// + public static void RemoveAllReversePortForwardingsAndroid(string adbPath = "") + { + adbPath = GetAdbPath(adbPath); + string arguments = "reverse --remove-all"; + try + { + var process = startProcess(adbPath, arguments); + process.WaitForExit(); + } + catch (Exception ex) + { + throw new ReversePortForwardingException("Error while running command: " + adbPath + " " + arguments, ex); + } + } + + /// + /// Calls `adb reverse --remove [-s {deviceId}] tcp:{remotePort}` + /// + /// The device's port to be removed + /// The id of the device to be removed + /// + /// The adb path. + /// If no adb path is provided, it tries to use adb from ${ANDROID_SDK_ROOT}/platform-tools/adb + /// if ANDROID_SDK_ROOT env variable is not set, it tries to execute adb from path. + /// + public static void RemoveReversePortForwardingAndroid(int remotePort = 13000, string deviceId = "", string adbPath = "") + { + adbPath = GetAdbPath(adbPath); + string arguments = "reverse --remove tcp:" + remotePort; + + if (!string.IsNullOrEmpty(deviceId)) + { + arguments = "-s " + deviceId + " " + arguments; + } + try + { + var process = startProcess(adbPath, arguments); + process.WaitForExit(); + } + catch (System.ComponentModel.Win32Exception ex) + { + throw new ReversePortForwardingException("Error while running command: " + adbPath + " " + arguments, ex); + } + } + + /// + /// Runs `adb devices` + /// + /// + /// The adb path. + /// If no adb path is provided, it tries to use adb from ${ANDROID_SDK_ROOT}/platform-tools/adb + /// if ANDROID_SDK_ROOT env varibale is not set, it tries to execute adb from path. + /// + public static List GetDevicesAndroid(string adbPath = "") + { + adbPath = GetAdbPath(adbPath); + var arguments = "devices"; + try + { + var process = startProcess(adbPath, arguments); + var devices = new List(); + + while (!process.StandardOutput.EndOfStream) + { + string line = process.StandardOutput.ReadLine(); + if (line.Length > 0 && !line.StartsWith("List ")) + { + var parts = line.Split('\t'); + string deviceId = parts[0]; + devices.Add(new AltDevice(deviceId, "Android")); + } + } + process.WaitForExit(); + process.StandardError.ReadToEnd(); + return devices; + } + catch (Exception ex) + { + throw new ReversePortForwardingException("Error while running command: " + adbPath + " " + arguments, ex); + } + } + public static List GetReversedDevicesAndroid(string adbPath = "") + { + adbPath = GetAdbPath(adbPath); + var arguments = "reverse --list"; + try + { + var process = startProcess(adbPath, arguments); + var devices = new List(); + + while (!process.StandardOutput.EndOfStream) + { + string line = process.StandardOutput.ReadLine(); + if (line.Length > 0) + { + try + { + var parts = line.Split(' '); + string deviceId = parts[0]; + int remotePort = int.Parse(parts[1].Split(':')[1]); + int localPort = int.Parse(parts[2].Split(':')[1]); + devices.Add(new AltDevice(deviceId, "Android", remotePort, localPort, true)); + } + catch (System.FormatException) + { +#if UNITY_EDITOR + + logger.Warn("adb reverse also has: " + line + "; which was not included in the list of devices"); +#endif + } + } + } + process.WaitForExit(); + return devices; + } + catch (Exception ex) + { + throw new ReversePortForwardingException("Error while running command: " + adbPath + " " + arguments, ex); + } + } + + public static string GetAdbPath(string adbPath) + { + if (!string.IsNullOrEmpty(adbPath)) return adbPath; + var androidSdkRoot = Environment.GetEnvironmentVariable("ANDROID_SDK_ROOT"); + if (!string.IsNullOrEmpty(androidSdkRoot)) + { + return Path.Combine(androidSdkRoot, "platform-tools", "adb"); + } + return "adb"; + } + + private static Process startProcess(string processPath, string arguments) + { + var process = new Process(); + var startInfo = new ProcessStartInfo + { + CreateNoWindow = true, + WindowStyle = ProcessWindowStyle.Minimized, + UseShellExecute = false, + RedirectStandardOutput = true, + RedirectStandardError = true, + FileName = processPath, + Arguments = arguments + }; + process.StartInfo = startInfo; + process.Start(); + + return process; + } + } +} + diff --git a/Assets/AltTester/Runtime/AltDriver/AltReversePortForwarding.cs.meta b/Assets/AltTester/Runtime/AltDriver/AltReversePortForwarding.cs.meta new file mode 100644 index 00000000..373fc133 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/AltReversePortForwarding.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 64224ead00c0db444bca871fd0a2a025 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/AltTester.AltTesterUnitySDK.Driver.asmdef b/Assets/AltTester/Runtime/AltDriver/AltTester.AltTesterUnitySDK.Driver.asmdef new file mode 100644 index 00000000..8a06c5e2 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/AltTester.AltTesterUnitySDK.Driver.asmdef @@ -0,0 +1,18 @@ +{ + "name": "AltTester.AltTesterUnitySDK.Driver", + "rootNamespace": "", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "NLog.dll", + "Newtonsoft.Json.dll", + "altwebsocket-sharp.dll" + ], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/AltTester/Runtime/AltDriver/AltTester.AltTesterUnitySDK.Driver.asmdef.meta b/Assets/AltTester/Runtime/AltDriver/AltTester.AltTesterUnitySDK.Driver.asmdef.meta new file mode 100644 index 00000000..9d0cd926 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/AltTester.AltTesterUnitySDK.Driver.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 478b585cfbb242f4c977b9aec772e042 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands.meta b/Assets/AltTester/Runtime/AltDriver/Commands.meta new file mode 100644 index 00000000..ce79d7a5 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fa50d2805558da940bf60ea9b3d76faf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltBaseCommand.cs b/Assets/AltTester/Runtime/AltDriver/Commands/AltBaseCommand.cs new file mode 100644 index 00000000..58b90d96 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltBaseCommand.cs @@ -0,0 +1,50 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using AltTester.AltTesterUnitySDK.Driver.Logging; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltBaseCommand + { + readonly NLog.Logger logger = DriverLogManager.Instance.GetCurrentClassLogger(); + protected readonly JsonSerializerSettings JsonSerializerSettings = new JsonSerializerSettings + { + ContractResolver = new DefaultContractResolver(), + ReferenceLoopHandling = ReferenceLoopHandling.Ignore, + Culture = System.Globalization.CultureInfo.InvariantCulture + }; + protected IDriverCommunication CommHandler; + + public AltBaseCommand(IDriverCommunication commHandler) + { + this.CommHandler = commHandler; + } + + protected void ValidateResponse(string expected, string received) + { + if (!expected.Equals(received, StringComparison.InvariantCulture)) + { + throw new AltInvalidServerResponse(expected, received); + } + } + + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltBaseCommand.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/AltBaseCommand.cs.meta new file mode 100644 index 00000000..f4c31ec4 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltBaseCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f656f7ca3cdb47e4cb81160c3cdd3f1f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltCommandReturningAltElement.cs b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommandReturningAltElement.cs new file mode 100644 index 00000000..ac246507 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommandReturningAltElement.cs @@ -0,0 +1,48 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltCommandReturningAltElement : AltBaseCommand + { + public AltCommandReturningAltElement(IDriverCommunication commHandler) : base(commHandler) + { + } + + protected AltObject ReceiveAltObject(CommandParams cmdParams) + { + var altElement = CommHandler.Recvall(cmdParams); + if (altElement != null) altElement.CommHandler = CommHandler; + + return altElement; + } + protected List ReceiveListOfAltObjects(CommandParams cmdParams) + { + var altElements = CommHandler.Recvall>(cmdParams); + + foreach (var altElement in altElements) + { + altElement.CommHandler = CommHandler; + } + + return altElements; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltCommandReturningAltElement.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommandReturningAltElement.cs.meta new file mode 100644 index 00000000..f97a38dd --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommandReturningAltElement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 17ee0186ba0179140b827f56f1a446c5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands.meta b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands.meta new file mode 100644 index 00000000..75c7bd66 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b4fce7ea51c98cd49b0434b7d6e1f1d7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AddNotificationListener.cs b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AddNotificationListener.cs new file mode 100644 index 00000000..c777f855 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AddNotificationListener.cs @@ -0,0 +1,43 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using AltTester.AltTesterUnitySDK.Driver.Notifications; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AddNotificationListener : AltBaseCommand + { + private readonly ActivateNotification cmdParams; + private readonly Action callback; + private readonly bool overwrite; + + public AddNotificationListener(IDriverCommunication commHandler, NotificationType notificationType, Action callback, bool overwrite) : base(commHandler) + { + this.cmdParams = new ActivateNotification(notificationType); + this.callback = callback; + this.overwrite = overwrite; + } + public void Execute() + { + this.CommHandler.AddNotificationListener(cmdParams.NotificationType, callback, overwrite); + this.CommHandler.Send(this.cmdParams); + var data = this.CommHandler.Recvall(this.cmdParams); + ValidateResponse("Ok", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AddNotificationListener.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AddNotificationListener.cs.meta new file mode 100644 index 00000000..3ec5177d --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AddNotificationListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 82530a687ecb8924c89ae786a37ef8bc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltGetServerVersion.cs b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltGetServerVersion.cs new file mode 100644 index 00000000..751871a4 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltGetServerVersion.cs @@ -0,0 +1,32 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetServerVersion : AltBaseCommand + { + public AltGetServerVersion(IDriverCommunication commHandler) : base(commHandler) + { + } + public string Execute() + { + var cmdParams = new AltGetServerVersionParams(); + CommHandler.Send(cmdParams); + return CommHandler.Recvall(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltGetServerVersion.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltGetServerVersion.cs.meta new file mode 100644 index 00000000..3c65b5e5 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltGetServerVersion.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f22af261b4acc8d42b2b049af2b607cf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltResetInput.cs b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltResetInput.cs new file mode 100644 index 00000000..549fe79a --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltResetInput.cs @@ -0,0 +1,34 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using AltTester.AltTesterUnitySDK.Driver.Commands; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltResetInput : AltBaseCommand + { + + public AltResetInput(IDriverCommunication communicationHandler) : base(communicationHandler) { } + public void Execute() + { + var cmdParams = new AltResetInputParams(); + this.CommHandler.Send(cmdParams); + var data = this.CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltResetInput.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltResetInput.cs.meta new file mode 100644 index 00000000..69e93981 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltResetInput.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 61a8dcd3f9a97344891b3be2c7ea0b68 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltSetServerLogging.cs b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltSetServerLogging.cs new file mode 100644 index 00000000..a9815785 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltSetServerLogging.cs @@ -0,0 +1,37 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using AltTester.AltTesterUnitySDK.Driver.Logging; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltSetServerLogging : AltBaseCommand + { + private readonly AltSetServerLoggingParams cmdParams; + + public AltSetServerLogging(IDriverCommunication commHandler, AltLogger logger, AltLogLevel logLevel) : base(commHandler) + { + this.cmdParams = new AltSetServerLoggingParams(logger, logLevel); + } + public void Execute() + { + this.CommHandler.Send(this.cmdParams); + var data = this.CommHandler.Recvall(this.cmdParams); + ValidateResponse("Ok", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltSetServerLogging.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltSetServerLogging.cs.meta new file mode 100644 index 00000000..dd62af33 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/AltSetServerLogging.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4c8636fa32043e8448b4a1a6882f4e97 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/RemoveNotificationListener.cs b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/RemoveNotificationListener.cs new file mode 100644 index 00000000..45ed6974 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/RemoveNotificationListener.cs @@ -0,0 +1,40 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using AltTester.AltTesterUnitySDK.Driver.Notifications; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class RemoveNotificationListener : AltBaseCommand + { + private readonly DeactivateNotification cmdParams; + + public RemoveNotificationListener(IDriverCommunication commHandler, NotificationType notificationType) : base(commHandler) + { + this.cmdParams = new DeactivateNotification(notificationType); + } + + public void Execute() + { + this.CommHandler.RemoveNotificationListener(cmdParams.NotificationType); + this.CommHandler.Send(this.cmdParams); + var data = this.CommHandler.Recvall(this.cmdParams); + ValidateResponse("Ok", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/RemoveNotificationListener.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/RemoveNotificationListener.cs.meta new file mode 100644 index 00000000..94b109d3 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltCommands/RemoveNotificationListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7980ffd3b76f6fc4da084e56672ec93a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltGetStaticProperty.cs b/Assets/AltTester/Runtime/AltDriver/Commands/AltGetStaticProperty.cs new file mode 100644 index 00000000..84179a63 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltGetStaticProperty.cs @@ -0,0 +1,37 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetStaticProperty : AltBaseCommand + { + AltGetObjectComponentPropertyParams cmdParams; + public AltGetStaticProperty(IDriverCommunication commHandler, string componentName, string propertyName, string assemblyName, int maxDepth) : base(commHandler) + { + cmdParams = new AltGetObjectComponentPropertyParams(null, componentName, propertyName, assemblyName, maxDepth); + } + public T Execute() + { + CommHandler.Send(cmdParams); + T data = CommHandler.Recvall(cmdParams); + return data; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltGetStaticProperty.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/AltGetStaticProperty.cs.meta new file mode 100644 index 00000000..8ea599f4 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltGetStaticProperty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 55ccccea3ff9b504890622d19265947c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltSetStaticProperty.cs b/Assets/AltTester/Runtime/AltDriver/Commands/AltSetStaticProperty.cs new file mode 100644 index 00000000..461c58f6 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltSetStaticProperty.cs @@ -0,0 +1,39 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using AltTester.AltTesterUnitySDK.Driver.Commands; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltSetStaticProperty : AltBaseCommand + { + AltSetObjectComponentPropertyParams cmdParams; + + public AltSetStaticProperty(IDriverCommunication commHandler, string componentName, string propertyName, string assemblyName, object newValue) : base(commHandler) + { + var strValue = Newtonsoft.Json.JsonConvert.SerializeObject(newValue); + cmdParams = new AltSetObjectComponentPropertyParams(null, componentName, propertyName, assemblyName, strValue); + } + + public void Execute() + { + CommHandler.Send(cmdParams); + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("valueSet", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/AltSetStaticProperty.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/AltSetStaticProperty.cs.meta new file mode 100644 index 00000000..1ef67335 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/AltSetStaticProperty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e8c8307629cbb304984196a46ced6c1f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects.meta b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects.meta new file mode 100644 index 00000000..cc067d85 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: adf55bb3dc81cdc4ebfd07ea4700af83 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltBaseFindObjects.cs b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltBaseFindObjects.cs new file mode 100644 index 00000000..b7610e64 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltBaseFindObjects.cs @@ -0,0 +1,84 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltBaseFindObjects : AltCommandReturningAltElement + { + public AltBaseFindObjects(IDriverCommunication commHandler) : base(commHandler) + { + } + protected string SetPath(By by, string value) + { + string path = ""; + switch (by) + { + case By.TAG: + path = "//*[@tag=" + value + "]"; + break; + case By.LAYER: + path = "//*[@layer=" + value + "]"; + break; + case By.NAME: + path = "//" + value; + break; + case By.COMPONENT: + path = "//*[@component=" + value + "]"; + break; + case By.PATH: + path = value; + break; + case By.ID: + path = "//*[@id=" + value + "]"; + break; + case By.TEXT: + path = "//*[@text=" + value + "]"; + break; + } + return path; + } + protected string SetPathContains(By by, string value) + { + string path = ""; + switch (by) + { + case By.TAG: + path = "//*[contains(@tag," + value + ")]"; + break; + case By.LAYER: + path = "//*[contains(@layer," + value + ")]"; + break; + case By.NAME: + path = "//*[contains(@name," + value + ")]"; + break; + case By.COMPONENT: + path = "//*[contains(@component," + value + ")]"; + break; + case By.PATH: + path = value; + break; + case By.ID: + path = "//*[contains(@id," + value + ")]"; + break; + case By.TEXT: + path = "//*[contains(@text," + value + ")]"; + break; + } + return path; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltBaseFindObjects.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltBaseFindObjects.cs.meta new file mode 100644 index 00000000..598c61ab --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltBaseFindObjects.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e8698c0b6313d8846add8e0b91d32fd4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObject.cs b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObject.cs new file mode 100644 index 00000000..c06ce702 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObject.cs @@ -0,0 +1,39 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltFindObject : AltBaseFindObjects + { + AltFindObjectParams cmdParams; + + public AltFindObject(IDriverCommunication commHandler, By by, string value, By cameraBy, string cameraValue, bool enabled) : base(commHandler) + { + cameraValue = SetPath(cameraBy, cameraValue); + string path = SetPath(by, value); + cmdParams = new AltFindObjectParams(path, cameraBy, cameraValue, enabled); + } + + public AltObject Execute() + { + CommHandler.Send(cmdParams); + var altTesterObject = CommHandler.Recvall(cmdParams); + altTesterObject.CommHandler = CommHandler; + return altTesterObject; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObject.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObject.cs.meta new file mode 100644 index 00000000..8988c79b --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 20609111de2d46e4a92be3e5d2e9e3d3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectAtCoordinates.cs b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectAtCoordinates.cs new file mode 100644 index 00000000..83b62e0d --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectAtCoordinates.cs @@ -0,0 +1,35 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltFindObjectAtCoordinates : AltCommandReturningAltElement + { + AltFindObjectAtCoordinatesParams cmdParams; + + public AltFindObjectAtCoordinates(IDriverCommunication commHandler, AltVector2 coordinates) : base(commHandler) + { + cmdParams = new AltFindObjectAtCoordinatesParams(coordinates); + } + + public AltObject Execute() + { + CommHandler.Send(cmdParams); + return ReceiveAltObject(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectAtCoordinates.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectAtCoordinates.cs.meta new file mode 100644 index 00000000..e623295f --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectAtCoordinates.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9f5def34f9b8cbf4c8d580c51dee6626 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectWhichContains.cs b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectWhichContains.cs new file mode 100644 index 00000000..437c7bc0 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectWhichContains.cs @@ -0,0 +1,34 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltFindObjectWhichContains : AltBaseFindObjects + { + AltFindObjectParams cmdParams; + + public AltFindObjectWhichContains(IDriverCommunication commHandler, By by, string value, By cameraBy, string cameraValue, bool enabled) : base(commHandler) + { + cmdParams = new AltFindObjectParams(SetPathContains(by, value), cameraBy, SetPath(cameraBy, cameraValue), enabled); + } + public AltObject Execute() + { + CommHandler.Send(cmdParams); + return ReceiveAltObject(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectWhichContains.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectWhichContains.cs.meta new file mode 100644 index 00000000..a511ceb0 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectWhichContains.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 252989b44cd401e4ea012741b4f90147 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjects.cs b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjects.cs new file mode 100644 index 00000000..16a314bb --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjects.cs @@ -0,0 +1,34 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltFindObjects : AltBaseFindObjects + { + AltFindObjectsParams cmdParams; + + public AltFindObjects(IDriverCommunication commHandler, By by, string value, By cameraBy, string cameraValue, bool enabled) : base(commHandler) + { + cmdParams = new AltFindObjectsParams(SetPath(by, value), cameraBy, SetPath(cameraBy, cameraValue), enabled); + } + public System.Collections.Generic.List Execute() + { + CommHandler.Send(cmdParams); + return ReceiveListOfAltObjects(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjects.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjects.cs.meta new file mode 100644 index 00000000..e55a3ff8 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjects.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 83da4da175e8d514f804d40d0230985b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectsWhichContain.cs b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectsWhichContain.cs new file mode 100644 index 00000000..d4b49c66 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectsWhichContain.cs @@ -0,0 +1,35 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltFindObjectsWhichContain : AltBaseFindObjects + { + AltFindObjectsParams cmdParams; + + public AltFindObjectsWhichContain(IDriverCommunication commHandler, By by, string value, By cameraBy, string cameraValue, bool enabled) : base(commHandler) + { + cmdParams = new AltFindObjectsParams(SetPathContains(by, value), cameraBy, SetPath(cameraBy, cameraValue), enabled); + + } + public System.Collections.Generic.List Execute() + { + CommHandler.Send(cmdParams); + return ReceiveListOfAltObjects(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectsWhichContain.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectsWhichContain.cs.meta new file mode 100644 index 00000000..628af18d --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltFindObjectsWhichContain.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 86da41c646effb84bbd08a9d5b627ee9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllElements.cs b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllElements.cs new file mode 100644 index 00000000..214415d4 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllElements.cs @@ -0,0 +1,34 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetAllElements : AltBaseFindObjects + { + AltFindObjectsParams cmdParams; + + public AltGetAllElements(IDriverCommunication commHandler, By cameraBy, string cameraValue, bool enabled) : base(commHandler) + { + cmdParams = new AltFindObjectsParams("//*", cameraBy, SetPath(cameraBy, cameraValue), enabled); + } + public System.Collections.Generic.List Execute() + { + CommHandler.Send(cmdParams); + return ReceiveListOfAltObjects(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllElements.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllElements.cs.meta new file mode 100644 index 00000000..b72f16b3 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllElements.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b223f0e16faf79444b985f12c0729ebf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllElementsLight.cs b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllElementsLight.cs new file mode 100644 index 00000000..c739bc72 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllElementsLight.cs @@ -0,0 +1,36 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections.Generic; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetAllElementsLight : AltBaseFindObjects + { + AltFindObjectsLightParams cmdParams; + public AltGetAllElementsLight(IDriverCommunication commHandler, By cameraBy, string cameraValue, bool enabled) : base(commHandler) + { + cmdParams = new AltFindObjectsLightParams("//*", cameraBy, SetPath(cameraBy, cameraValue), enabled); + } + public List Execute() + { + CommHandler.Send(cmdParams); + + return CommHandler.Recvall>(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllElementsLight.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllElementsLight.cs.meta new file mode 100644 index 00000000..4091b163 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllElementsLight.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ac6782f979edaea44a0140ed3c922f61 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllLoadedScenesAndObjects.cs b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllLoadedScenesAndObjects.cs new file mode 100644 index 00000000..31dd68cc --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllLoadedScenesAndObjects.cs @@ -0,0 +1,37 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections.Generic; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetAllLoadedScenesAndObjects : AltBaseFindObjects + { + + private AltGetAllLoadedScenesAndObjectsParams cmdParams; + public AltGetAllLoadedScenesAndObjects(IDriverCommunication commHandler, bool enabled) : base(commHandler) + { + cmdParams = new AltGetAllLoadedScenesAndObjectsParams("//*", By.NAME, "", enabled); + } + public List Execute() + { + CommHandler.Send(cmdParams); + return CommHandler.Recvall>(cmdParams); + + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllLoadedScenesAndObjects.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllLoadedScenesAndObjects.cs.meta new file mode 100644 index 00000000..45420269 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltGetAllLoadedScenesAndObjects.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b11c280f784216c4393854292f55e9bb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForComponentProperty.cs b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForComponentProperty.cs new file mode 100644 index 00000000..c8c7ebdc --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForComponentProperty.cs @@ -0,0 +1,65 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Threading; +using AltTester.AltTesterUnitySDK.Driver.Logging; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltWaitForComponentProperty : AltBaseFindObjects + { + readonly NLog.Logger logger = DriverLogManager.Instance.GetCurrentClassLogger(); + AltObject altObject; + string componentName; + string propertyName; + T propertyValue; + string assembly; + double timeout; + double interval; + + public AltWaitForComponentProperty(IDriverCommunication commHandler, string componentName, string propertyName, T propertyValue, string assemblyName, double timeout, double interval, AltObject altObject) : base(commHandler) + { + this.altObject = altObject; + this.componentName = componentName; + this.propertyName = propertyName; + this.propertyValue = propertyValue; + this.assembly = assemblyName; + this.timeout = timeout; + this.interval = interval; + if (timeout <= 0) throw new ArgumentOutOfRangeException("timeout"); + if (interval <= 0) throw new ArgumentOutOfRangeException("interval"); + } + public T Execute() + { + double time = 0; + while (time < timeout) + { + logger.Debug($"Waiting for property {propertyName} to be {propertyValue}."); + T propertyFound = altObject.GetComponentProperty(componentName, propertyName, assembly); + if (propertyFound == null && propertyValue == null) //avoid null reference exception + return propertyFound; + if (propertyFound.Equals(propertyValue)) + return propertyFound; + + Thread.Sleep(System.Convert.ToInt32(interval * 1000)); + time += interval; + } + throw new WaitTimeOutException($"Property {propertyName} was not {propertyValue} after {timeout} seconds"); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForComponentProperty.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForComponentProperty.cs.meta new file mode 100644 index 00000000..f9054f9b --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForComponentProperty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c8249de1620490949b524fa42bf80b1e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObject.cs b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObject.cs new file mode 100644 index 00000000..ffba3f1c --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObject.cs @@ -0,0 +1,65 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Threading; +using AltTester.AltTesterUnitySDK.Driver.Logging; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltWaitForObject : AltBaseFindObjects + { + readonly NLog.Logger logger = DriverLogManager.Instance.GetCurrentClassLogger(); + AltFindObject findObject; + string path; + double timeout; + double interval; + + public AltWaitForObject(IDriverCommunication commHandler, By by, string value, By cameraBy, string cameraValue, bool enabled, double timeout, double interval) : base(commHandler) + { + findObject = new AltFindObject(CommHandler, by, value, cameraBy, cameraValue, enabled); + path = SetPath(by, value); + this.timeout = timeout; + this.interval = interval; + if (timeout <= 0) throw new ArgumentOutOfRangeException("timeout"); + if (interval <= 0) throw new ArgumentOutOfRangeException("interval"); + } + public AltObject Execute() + { + double time = 0; + AltObject altElement = null; + + logger.Debug("Waiting for element " + path + " to be present."); + while (time < timeout) + { + try + { + altElement = findObject.Execute(); + break; + } + catch (NotFoundException) + { + Thread.Sleep(System.Convert.ToInt32(interval * 1000)); + time += interval; + } + } + if (altElement != null) + return altElement; + throw new WaitTimeOutException("Element " + path + " not loaded after " + timeout + " seconds"); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObject.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObject.cs.meta new file mode 100644 index 00000000..b1bd1d23 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 011f054f2cd6f9749abf0aaf079389df +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObjectNotBePresent.cs b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObjectNotBePresent.cs new file mode 100644 index 00000000..27721f10 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObjectNotBePresent.cs @@ -0,0 +1,68 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Threading; +using AltTester.AltTesterUnitySDK.Driver.Logging; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltWaitForObjectNotBePresent : AltBaseFindObjects + { + readonly NLog.Logger logger = DriverLogManager.Instance.GetCurrentClassLogger(); + AltFindObject findObject; + private readonly string path; + double timeout; + double interval; + public AltWaitForObjectNotBePresent(IDriverCommunication commHandler, By by, string value, By cameraBy, string cameraValue, bool enabled, double timeout, double interval) : base(commHandler) + { + findObject = new AltFindObject(commHandler, by, value, cameraBy, cameraValue, enabled); + path = SetPath(by, value); + + this.timeout = timeout; + this.interval = interval; + if (timeout <= 0) throw new ArgumentOutOfRangeException("timeout"); + if (interval <= 0) throw new ArgumentOutOfRangeException("interval"); + } + public void Execute() + { + double time = 0; + bool found = false; + AltObject altElement; + + logger.Debug("Waiting for element " + path + " to not be present"); + while (time < timeout) + { + found = false; + try + { + altElement = findObject.Execute(); + found = true; + Thread.Sleep(System.Convert.ToInt32(interval * 1000)); + time += interval; + + } + catch (NotFoundException) + { + break; + } + } + if (found) + throw new WaitTimeOutException("Element " + path + " still found after " + timeout + " seconds"); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObjectNotBePresent.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObjectNotBePresent.cs.meta new file mode 100644 index 00000000..5649e273 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObjectNotBePresent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c8328a664360ab94faa581f0241f4587 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObjectWhichContains.cs b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObjectWhichContains.cs new file mode 100644 index 00000000..54008dc3 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObjectWhichContains.cs @@ -0,0 +1,65 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Threading; +using AltTester.AltTesterUnitySDK.Driver.Logging; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltWaitForObjectWhichContains : AltBaseFindObjects + { + readonly NLog.Logger logger = DriverLogManager.Instance.GetCurrentClassLogger(); + private AltFindObjectWhichContains findObject; + private readonly string path; + private readonly double timeout; + private readonly double interval; + + public AltWaitForObjectWhichContains(IDriverCommunication commHandler, By by, string value, By cameraBy, string cameraValue, bool enabled, double timeout, double interval) : base(commHandler) + { + path = SetPath(by, value); + if (timeout <= 0) throw new ArgumentOutOfRangeException("timeout"); + if (interval <= 0) throw new ArgumentOutOfRangeException("interval"); + this.timeout = timeout; + this.interval = interval; + findObject = new AltFindObjectWhichContains(CommHandler, by, value, cameraBy, cameraValue, enabled); + } + public AltObject Execute() + { + double time = 0; + AltObject altElement = null; + + logger.Debug("Waiting for element " + path + " to be present."); + while (time < timeout) + { + try + { + altElement = findObject.Execute(); + break; + } + catch (NotFoundException) + { + Thread.Sleep(System.Convert.ToInt32(interval * 1000)); + time += interval; + } + } + if (altElement != null) + return altElement; + throw new WaitTimeOutException("Element " + path + " not loaded after " + timeout + " seconds"); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObjectWhichContains.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObjectWhichContains.cs.meta new file mode 100644 index 00000000..7fade734 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/FindObjects/AltWaitForObjectWhichContains.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d8f58364e30311f4597103f8c7234482 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions.meta b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions.meta new file mode 100644 index 00000000..ea7bc69a --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1a3efc9a42e8e324bacb85eeb0d151ed +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltBeginTouch.cs b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltBeginTouch.cs new file mode 100644 index 00000000..6e499e3c --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltBeginTouch.cs @@ -0,0 +1,35 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltBeginTouch : AltBaseCommand + { + AltBeginTouchParams cmdParams; + + public AltBeginTouch(IDriverCommunication commHandler, AltVector2 coordinates) : base(commHandler) + { + this.cmdParams = new AltBeginTouchParams(coordinates); + } + public int Execute() + { + CommHandler.Send(cmdParams); + return CommHandler.Recvall(cmdParams); //finger id + //TODO: add handling for "Finished" + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltBeginTouch.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltBeginTouch.cs.meta new file mode 100644 index 00000000..f6860ab5 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltBeginTouch.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4d1001395eb57504c9091c3fd1345668 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltClickCoordinates.cs b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltClickCoordinates.cs new file mode 100644 index 00000000..b03e23da --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltClickCoordinates.cs @@ -0,0 +1,39 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltClickCoordinates : AltBaseCommand + { + AltClickCoordinatesParams cmdParams; + public AltClickCoordinates(IDriverCommunication commHandler, AltVector2 coordinates, int count, float interval, bool wait) : base(commHandler) + { + cmdParams = new AltClickCoordinatesParams(coordinates, count, interval, wait); + } + public void Execute() + { + CommHandler.Send(cmdParams); + string data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + if (cmdParams.wait) + { + data = CommHandler.Recvall(cmdParams); ; + ValidateResponse("Finished", data); + } + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltClickCoordinates.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltClickCoordinates.cs.meta new file mode 100644 index 00000000..9e823065 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltClickCoordinates.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 998dc5b04f647c54e87a11c19bb6cc40 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltEndTouch.cs b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltEndTouch.cs new file mode 100644 index 00000000..a39b384b --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltEndTouch.cs @@ -0,0 +1,35 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltEndTouch : AltBaseCommand + { + AltEndTouchParams cmdParams; + + public AltEndTouch(IDriverCommunication commHandler, int fingerId) : base(commHandler) + { + this.cmdParams = new AltEndTouchParams(fingerId); + } + public void Execute() + { + CommHandler.Send(cmdParams); + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltEndTouch.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltEndTouch.cs.meta new file mode 100644 index 00000000..11953ed3 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltEndTouch.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 35a6dfc77c1311049802c1a87d762ab3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltKeysDown.cs b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltKeysDown.cs new file mode 100644 index 00000000..8d13dcac --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltKeysDown.cs @@ -0,0 +1,37 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltKeysDown : AltBaseCommand + { + AltKeysDownParams cmdParams; + + public AltKeysDown(IDriverCommunication commHandler, AltKeyCode[] keyCodes, float power) : base(commHandler) + { + this.cmdParams = new AltKeysDownParams(keyCodes, power); + } + public void Execute() + { + CommHandler.Send(cmdParams); + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltKeysDown.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltKeysDown.cs.meta new file mode 100644 index 00000000..0d5bc99f --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltKeysDown.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2c5ee5c5d0a9f314fac19992f98c0927 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltKeysUp.cs b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltKeysUp.cs new file mode 100644 index 00000000..37f5a5dc --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltKeysUp.cs @@ -0,0 +1,35 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltKeysUp : AltBaseCommand + { + AltKeysUpParams cmdParams; + + public AltKeysUp(IDriverCommunication commHandler, AltKeyCode[] keyCodes) : base(commHandler) + { + this.cmdParams = new AltKeysUpParams(keyCodes); + } + public void Execute() + { + CommHandler.Send(cmdParams); + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltKeysUp.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltKeysUp.cs.meta new file mode 100644 index 00000000..282962e7 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltKeysUp.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 122317d70e9efc04fb2743690a2c6c7e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMoveMouse.cs b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMoveMouse.cs new file mode 100644 index 00000000..42ad3c9b --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMoveMouse.cs @@ -0,0 +1,39 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltMoveMouse : AltBaseCommand + { + AltMoveMouseParams cmdParams; + public AltMoveMouse(IDriverCommunication commHandler, AltVector2 coordinates, float duration, bool wait) : base(commHandler) + { + cmdParams = new AltMoveMouseParams(coordinates, duration, wait); + } + public void Execute() + { + CommHandler.Send(cmdParams); + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + if (cmdParams.wait) + { + data = CommHandler.Recvall(cmdParams); + ValidateResponse("Finished", data); + } + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMoveMouse.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMoveMouse.cs.meta new file mode 100644 index 00000000..50f82c81 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMoveMouse.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5fe75ad0d59b7db41a9d4acf20643188 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMoveTouch.cs b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMoveTouch.cs new file mode 100644 index 00000000..8ac72ca7 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMoveTouch.cs @@ -0,0 +1,35 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltMoveTouch : AltBaseCommand + { + AltMoveTouchParams cmdParams; + + public AltMoveTouch(IDriverCommunication commHandler, int fingerId, AltVector2 coordinates) : base(commHandler) + { + this.cmdParams = new AltMoveTouchParams(fingerId, coordinates); + } + public void Execute() + { + CommHandler.Send(cmdParams); + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMoveTouch.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMoveTouch.cs.meta new file mode 100644 index 00000000..c8d03066 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMoveTouch.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5695d196ff25b1a41a49576b996f1545 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMultipointSwipe.cs b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMultipointSwipe.cs new file mode 100644 index 00000000..70c4147a --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMultipointSwipe.cs @@ -0,0 +1,42 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltMultipointSwipe : AltBaseCommand + { + AltMultipointSwipeParams cmdParams; + + public AltMultipointSwipe(IDriverCommunication commHandler, AltVector2[] positions, float duration, bool wait) : base(commHandler) + { + cmdParams = new AltMultipointSwipeParams(positions, duration, wait); + } + + public void Execute() + { + CommHandler.Send(cmdParams); + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + + if (cmdParams.wait) + { + data = CommHandler.Recvall(cmdParams); + ValidateResponse("Finished", data); + } + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMultipointSwipe.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMultipointSwipe.cs.meta new file mode 100644 index 00000000..0a47dfe4 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltMultipointSwipe.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d858b045ca21be746b1a37c9764ba9d1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltPressKeys.cs b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltPressKeys.cs new file mode 100644 index 00000000..010af713 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltPressKeys.cs @@ -0,0 +1,43 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltPressKeys : AltBaseCommand + { + AltPressKeyboardKeysParams cmdParams; + public AltPressKeys(IDriverCommunication commHandler, AltKeyCode[] keyCodes, float power, float duration, bool wait) : base(commHandler) + { + cmdParams = new AltPressKeyboardKeysParams(keyCodes, power, duration, wait); + } + public void Execute() + { + CommHandler.Send(cmdParams); + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + + if (cmdParams.wait) + { + foreach (AltKeyCode key in cmdParams.keyCodes) + { + data = CommHandler.Recvall(cmdParams); + ValidateResponse("Finished", data); + } + } + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltPressKeys.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltPressKeys.cs.meta new file mode 100644 index 00000000..c90b3426 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltPressKeys.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4b3df944b98272b4a8afd6d5740dfc9d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltScroll.cs b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltScroll.cs new file mode 100644 index 00000000..d4ff6358 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltScroll.cs @@ -0,0 +1,40 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltScroll : AltBaseCommand + { + AltScrollParams cmdParams; + public AltScroll(IDriverCommunication commHandler, float speed, float speedHorizontal, float duration, bool wait) : base(commHandler) + { + cmdParams = new AltScrollParams(speed, duration, wait, speedHorizontal); + } + public void Execute() + { + CommHandler.Send(cmdParams); + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + + if (cmdParams.wait) + { + data = CommHandler.Recvall(cmdParams); + ValidateResponse("Finished", data); + } + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltScroll.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltScroll.cs.meta new file mode 100644 index 00000000..74ba78d5 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltScroll.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 14547a94cbb15844e9e156a7a427461d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltSwipe.cs b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltSwipe.cs new file mode 100644 index 00000000..94274d8d --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltSwipe.cs @@ -0,0 +1,40 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltSwipe : AltBaseCommand + { + AltSwipeParams cmdParams; + public AltSwipe(IDriverCommunication commHandler, AltVector2 start, AltVector2 end, float duration, bool wait) : base(commHandler) + { + cmdParams = new AltSwipeParams(start, end, duration, wait); + } + public void Execute() + { + CommHandler.Send(cmdParams); + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + + if (cmdParams.wait) + { + data = CommHandler.Recvall(cmdParams); + ValidateResponse("Finished", data); + } + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltSwipe.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltSwipe.cs.meta new file mode 100644 index 00000000..a9720ecc --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltSwipe.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3197f8554d7a6d74ab3e2f7974e80af2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltTapCoordinates.cs b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltTapCoordinates.cs new file mode 100644 index 00000000..ebb41cfe --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltTapCoordinates.cs @@ -0,0 +1,39 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltTapCoordinates : AltBaseCommand + { + AltTapCoordinatesParams cmdParams; + public AltTapCoordinates(IDriverCommunication commHandler, AltVector2 coordinates, int count, float interval, bool wait) : base(commHandler) + { + cmdParams = new AltTapCoordinatesParams(coordinates, count, interval, wait); + } + public void Execute() + { + CommHandler.Send(cmdParams); + string data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + if (cmdParams.wait) + { + data = CommHandler.Recvall(cmdParams); ; + ValidateResponse("Finished", data); + } + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltTapCoordinates.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltTapCoordinates.cs.meta new file mode 100644 index 00000000..aea8209c --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltTapCoordinates.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 33b142d3e1ae84944b98aad11e9c7a44 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltTilt.cs b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltTilt.cs new file mode 100644 index 00000000..3a681510 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltTilt.cs @@ -0,0 +1,39 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltTilt : AltBaseCommand + { + AltTiltParams cmdParams; + public AltTilt(IDriverCommunication commHandler, AltVector3 acceleration, float duration, bool wait) : base(commHandler) + { + cmdParams = new AltTiltParams(acceleration, duration, wait); + } + public void Execute() + { + CommHandler.Send(cmdParams); + string data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + if (cmdParams.wait) + { + data = CommHandler.Recvall(cmdParams); + ValidateResponse("Finished", data); + } + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltTilt.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltTilt.cs.meta new file mode 100644 index 00000000..fbadecf7 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/InputActions/AltTilt.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ab4e07ef0ca377c4fa78439bee68cacd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands.meta new file mode 100644 index 00000000..b74b501b --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dd5cc0b7d8cb05a48ac3912f5d2331f1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltCallComponentMethod.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltCallComponentMethod.cs new file mode 100644 index 00000000..2bdd58f0 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltCallComponentMethod.cs @@ -0,0 +1,38 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Linq; +using Newtonsoft.Json; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltCallComponentMethod : AltBaseCommand + { + AltCallComponentMethodForObjectParams cmdParams; + + public AltCallComponentMethod(IDriverCommunication commHandler, string componentName, string methodName, object[] parameters, string[] typeOfParameters, string assembly, AltObject altObject) : base(commHandler) + { + cmdParams = new AltCallComponentMethodForObjectParams(altObject, componentName, methodName, parameters.Select(p => JsonConvert.SerializeObject(p, JsonSerializerSettings)).ToArray(), typeOfParameters, assembly); + } + public T Execute() + { + CommHandler.Send(cmdParams); + T data = CommHandler.Recvall(cmdParams); + return data; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltCallComponentMethod.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltCallComponentMethod.cs.meta new file mode 100644 index 00000000..bfc5da05 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltCallComponentMethod.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6a5c266c9891070449ed054c49372565 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltCallStaticMethod.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltCallStaticMethod.cs new file mode 100644 index 00000000..6251e203 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltCallStaticMethod.cs @@ -0,0 +1,37 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Linq; +using Newtonsoft.Json; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltCallStaticMethod : AltBaseCommand + { + AltCallComponentMethodForObjectParams cmdParams; + + public AltCallStaticMethod(IDriverCommunication commHandler, string typeName, string methodName, object[] parameters, string[] typeOfParameters, string assemblyName) : base(commHandler) + { + cmdParams = new AltCallComponentMethodForObjectParams(null, typeName, methodName, parameters.Select(p => JsonConvert.SerializeObject(p, JsonSerializerSettings)).ToArray(), typeOfParameters, assemblyName); + } + public T Execute() + { + CommHandler.Send(cmdParams); + return CommHandler.Recvall(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltCallStaticMethod.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltCallStaticMethod.cs.meta new file mode 100644 index 00000000..0bb1d398 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltCallStaticMethod.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ccb58990b540a3247a1c486ff89a249b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltClickElement.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltClickElement.cs new file mode 100644 index 00000000..35b155c0 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltClickElement.cs @@ -0,0 +1,45 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltClickElement : AltCommandReturningAltElement + { + AltClickElementParams cmdParams; + + public AltClickElement(IDriverCommunication commHandler, AltObject altObject, int count, float interval, bool wait) : base(commHandler) + { + cmdParams = new AltClickElementParams( + altObject, + count, + interval, + wait); + } + public AltObject Execute() + { + CommHandler.Send(cmdParams); + var element = ReceiveAltObject(cmdParams); + + if (cmdParams.wait) + { + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Finished", data); + } + return element; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltClickElement.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltClickElement.cs.meta new file mode 100644 index 00000000..2f4a7902 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltClickElement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d016a33b5d5ed3744bf62e3fba329898 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltDragObject.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltDragObject.cs new file mode 100644 index 00000000..47a900b8 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltDragObject.cs @@ -0,0 +1,33 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltDragObject : AltCommandReturningAltElement + { + AltDragObjectParams cmdParams; + public AltDragObject(IDriverCommunication commHandler, AltVector2 position, AltObject altObject) : base(commHandler) + { + cmdParams = new AltDragObjectParams(altObject, position); + } + public AltObject Execute() + { + CommHandler.Send(cmdParams); + return ReceiveAltObject(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltDragObject.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltDragObject.cs.meta new file mode 100644 index 00000000..c2621a1b --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltDragObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 408615ce07cf9de47a78b58a0c05c145 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllComponents.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllComponents.cs new file mode 100644 index 00000000..872a78d6 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllComponents.cs @@ -0,0 +1,37 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetAllComponents : AltBaseCommand + { + AltGetAllComponentsParams cmdParams; + public AltGetAllComponents(IDriverCommunication commHandler, AltObject altObject) : base(commHandler) + { + cmdParams = new AltGetAllComponentsParams(altObject.id); + } + public List Execute() + { + CommHandler.Send(cmdParams); + return CommHandler.Recvall>(cmdParams); + + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllComponents.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllComponents.cs.meta new file mode 100644 index 00000000..109b79bb --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllComponents.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8eb5ec8724d079b49b5ddea23b30d42c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllFields.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllFields.cs new file mode 100644 index 00000000..1660ef56 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllFields.cs @@ -0,0 +1,36 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetAllFields : AltBaseCommand + { + AltGetAllFieldsParams cmdParams; + public AltGetAllFields(IDriverCommunication commHandler, AltComponent altComponent, AltObject altObject, AltFieldsSelections altFieldsSelections = AltFieldsSelections.ALLFIELDS) : base(commHandler) + { + cmdParams = new AltGetAllFieldsParams(altObject.id, altComponent, altFieldsSelections); + } + public List Execute() + { + CommHandler.Send(cmdParams); + return CommHandler.Recvall>(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllFields.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllFields.cs.meta new file mode 100644 index 00000000..47862508 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllFields.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2f98c13876abd67458b52d800d12e1a6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllMethods.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllMethods.cs new file mode 100644 index 00000000..5418e337 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllMethods.cs @@ -0,0 +1,36 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetAllMethods : AltBaseCommand + { + AltGetAllMethodsParams cmdParams; + public AltGetAllMethods(IDriverCommunication commHandler, AltComponent altComponent, AltMethodSelection methodSelection = AltMethodSelection.ALLMETHODS) : base(commHandler) + { + cmdParams = new AltGetAllMethodsParams(altComponent, methodSelection); + } + public List Execute() + { + CommHandler.Send(cmdParams); + return CommHandler.Recvall>(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllMethods.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllMethods.cs.meta new file mode 100644 index 00000000..e13a66a7 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllMethods.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8b4e4a0a7c524ff4d8c33f9e584d251b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllProperties.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllProperties.cs new file mode 100644 index 00000000..d9d74346 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllProperties.cs @@ -0,0 +1,37 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections.Generic; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetAllProperties : AltBaseCommand + { + AltGetAllPropertiesParams cmdParams; + + public AltGetAllProperties(IDriverCommunication commHandler, AltComponent altComponent, AltObject altObject, AltPropertiesSelections altPropertiesSelections = AltPropertiesSelections.ALLPROPERTIES) : base(commHandler) + { + cmdParams = new AltGetAllPropertiesParams(altObject.id, altComponent, altPropertiesSelections); + + } + public List Execute() + { + CommHandler.Send(cmdParams); + return CommHandler.Recvall>(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllProperties.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllProperties.cs.meta new file mode 100644 index 00000000..9d3880d8 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetAllProperties.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ad81492830c03ac40a20a9043fbfd272 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetComponentProperty.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetComponentProperty.cs new file mode 100644 index 00000000..c5f724ff --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetComponentProperty.cs @@ -0,0 +1,33 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetComponentProperty : AltBaseCommand + { + AltGetObjectComponentPropertyParams cmdParams; + public AltGetComponentProperty(IDriverCommunication commHandler, string componentName, string propertyName, string assemblyName, int maxDepth, AltObject altObject) : base(commHandler) + { + cmdParams = new AltGetObjectComponentPropertyParams(altObject, componentName, propertyName, assemblyName, maxDepth); + } + public T Execute() + { + CommHandler.Send(cmdParams); + return CommHandler.Recvall(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetComponentProperty.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetComponentProperty.cs.meta new file mode 100644 index 00000000..0c998b1f --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetComponentProperty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c0d56111594ec8e46986eb611d6aacb4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetText.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetText.cs new file mode 100644 index 00000000..3ce3dda5 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetText.cs @@ -0,0 +1,35 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetText : AltBaseCommand + { + readonly AltGetTextParams cmdParams; + + public AltGetText(IDriverCommunication commHandler, AltObject altObject) : base(commHandler) + { + cmdParams = new AltGetTextParams(altObject); + } + + public string Execute() + { + CommHandler.Send(cmdParams); + return CommHandler.Recvall(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetText.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetText.cs.meta new file mode 100644 index 00000000..a5628d0b --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltGetText.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eafe717585cdcfe43a00b085de50c554 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltObjectAction.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltObjectAction.cs new file mode 100644 index 00000000..6ef7c3af --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltObjectAction.cs @@ -0,0 +1,42 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + [Obsolete] + public struct AltObjectAction + { + public string Component; + public string Method; + public string Parameters; + public string TypeOfParameters; + + public AltObjectAction(string component = "", string method = "", string parameters = "", string typeOfParameters = "", string assembly = "") + { + Component = component; + Method = method; + Parameters = parameters; + TypeOfParameters = typeOfParameters; + Assembly = assembly; + } + + + public string Assembly; + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltObjectAction.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltObjectAction.cs.meta new file mode 100644 index 00000000..8ad0d25e --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltObjectAction.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: b0674894021154b2884d5894d4bccf69 +timeCreated: 1518694471 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerDownFromObject.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerDownFromObject.cs new file mode 100644 index 00000000..495e892b --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerDownFromObject.cs @@ -0,0 +1,33 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltPointerDownFromObject : AltCommandReturningAltElement + { + AltPointerDownFromObjectParams cmdParams; + public AltPointerDownFromObject(IDriverCommunication commHandler, AltObject altObject) : base(commHandler) + { + this.cmdParams = new AltPointerDownFromObjectParams(altObject); + } + public AltObject Execute() + { + CommHandler.Send(cmdParams); + return ReceiveAltObject(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerDownFromObject.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerDownFromObject.cs.meta new file mode 100644 index 00000000..98ef8a61 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerDownFromObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c8f3c78f3e705374c9eb0eebfe5ed89d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerEnterObject.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerEnterObject.cs new file mode 100644 index 00000000..dd078f2c --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerEnterObject.cs @@ -0,0 +1,33 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltPointerEnterObject : AltCommandReturningAltElement + { + AltPointerEnterObjectParams cmdParams; + public AltPointerEnterObject(IDriverCommunication commHandler, AltObject altObject) : base(commHandler) + { + cmdParams = new AltPointerEnterObjectParams(altObject); + } + public AltObject Execute() + { + CommHandler.Send(cmdParams); + return ReceiveAltObject(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerEnterObject.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerEnterObject.cs.meta new file mode 100644 index 00000000..0e21d492 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerEnterObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 53ebd0c92649a774dafa60de538b7f44 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerExitObject.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerExitObject.cs new file mode 100644 index 00000000..af98539a --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerExitObject.cs @@ -0,0 +1,34 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltPointerExitObject : AltCommandReturningAltElement + { + AltPointerExitObjectParams cmdParams; + + public AltPointerExitObject(IDriverCommunication commHandler, AltObject altObject) : base(commHandler) + { + this.cmdParams = new AltPointerExitObjectParams(altObject); + } + public AltObject Execute() + { + CommHandler.Send(cmdParams); + return ReceiveAltObject(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerExitObject.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerExitObject.cs.meta new file mode 100644 index 00000000..923d4c04 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerExitObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dbea7ca9fbab77546a7c97c1efe9947e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerUpFromObject.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerUpFromObject.cs new file mode 100644 index 00000000..445c4e88 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerUpFromObject.cs @@ -0,0 +1,34 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltPointerUpFromObject : AltCommandReturningAltElement + { + AltPointerUpFromObjectParams cmdParams; + + public AltPointerUpFromObject(IDriverCommunication commHandler, AltObject altObject) : base(commHandler) + { + this.cmdParams = new AltPointerUpFromObjectParams(altObject); + } + public AltObject Execute() + { + CommHandler.Send(cmdParams); + return ReceiveAltObject(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerUpFromObject.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerUpFromObject.cs.meta new file mode 100644 index 00000000..cd643305 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltPointerUpFromObject.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c4f245ef4d88c9042931dbe3a124ad94 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltSetComponentProperty.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltSetComponentProperty.cs new file mode 100644 index 00000000..0680ee3c --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltSetComponentProperty.cs @@ -0,0 +1,37 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltSetComponentProperty : AltBaseCommand + { + AltSetObjectComponentPropertyParams cmdParams; + + public AltSetComponentProperty(IDriverCommunication commHandler, string componentName, string propertyName, object value, string assemblyName, AltObject altObject) : base(commHandler) + { + var strValue = Newtonsoft.Json.JsonConvert.SerializeObject(value); + cmdParams = new AltSetObjectComponentPropertyParams(altObject, componentName, propertyName, assemblyName, strValue); + } + public void Execute() + { + CommHandler.Send(cmdParams); + var data = CommHandler.Recvall(cmdParams); + + ValidateResponse("valueSet", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltSetComponentProperty.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltSetComponentProperty.cs.meta new file mode 100644 index 00000000..341d0d40 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltSetComponentProperty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5c2de27eac9db15489c52d560efd8ac2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltSetText.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltSetText.cs new file mode 100644 index 00000000..9c3aa3fb --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltSetText.cs @@ -0,0 +1,35 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltSetText : AltCommandReturningAltElement + { + AltSetTextParams cmdParams; + + public AltSetText(IDriverCommunication commHandler, AltObject altObject, string text, bool submit) : base(commHandler) + { + cmdParams = new AltSetTextParams(altObject, text, submit); + } + + public AltObject Execute() + { + CommHandler.Send(cmdParams); + return ReceiveAltObject(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltSetText.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltSetText.cs.meta new file mode 100644 index 00000000..2f62e8a2 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltSetText.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: af694b5963536a04aae093693cbd3aa4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltTapElement.cs b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltTapElement.cs new file mode 100644 index 00000000..2aa44880 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltTapElement.cs @@ -0,0 +1,45 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltTapElement : AltCommandReturningAltElement + { + AltTapElementParams cmdParams; + + public AltTapElement(IDriverCommunication commHandler, AltObject altObject, int count, float interval, bool wait) : base(commHandler) + { + cmdParams = new AltTapElementParams( + altObject, + count, + interval, + wait); + } + public AltObject Execute() + { + CommHandler.Send(cmdParams); + var element = ReceiveAltObject(cmdParams); + + if (cmdParams.wait) + { + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Finished", data); + } + return element; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltTapElement.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltTapElement.cs.meta new file mode 100644 index 00000000..25b644f2 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/ObjectCommands/AltTapElement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 549fd86b0f9dc474685b5e06c8b564ad +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/Parameters.meta b/Assets/AltTester/Runtime/AltDriver/Commands/Parameters.meta new file mode 100644 index 00000000..2aff4164 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/Parameters.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 55de954649570ad47a2154021e11db07 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/Parameters/CommandParams.cs b/Assets/AltTester/Runtime/AltDriver/Commands/Parameters/CommandParams.cs new file mode 100644 index 00000000..0937be98 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/Parameters/CommandParams.cs @@ -0,0 +1,779 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using AltTester.AltTesterUnitySDK.Driver.Logging; +using AltTester.AltTesterUnitySDK.Driver.Notifications; +using Newtonsoft.Json; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class CommandParams + { + public string messageId; + public string driverId; + public string commandName; + public bool isNotification; + + public CommandParams() + { + CommandAttribute cmdAttribute = + (CommandAttribute)Attribute.GetCustomAttribute(this.GetType(), typeof(CommandAttribute)); + if (cmdAttribute == null) + throw new Exception("No CommandAttribute found on type " + this.GetType()); + this.commandName = cmdAttribute.Name; + } + + [JsonConstructor] + public CommandParams(string commandName, string messageId) + { + this.commandName = commandName; + this.messageId = messageId; + } + } + + public class CommandAttribute : Attribute + { + private string name; + + public string Name { get { return name; } } + + public CommandAttribute(string name) + { + this.name = name; + } + } + + public class CommandError + { + public string type; + public string message; + public string trace; + } + + public class CommandResponse + { + public string messageId; + public string driverId; + public string commandName; + public CommandError error; + public String data; + public bool isNotification; + } + + public class BaseFindObjectsParams : CommandParams + { + public string path; + public By cameraBy { get; protected set; } + public string cameraPath { get; protected set; } + public bool enabled { get; protected set; } + + public BaseFindObjectsParams(string path, By cameraBy, string cameraPath, bool enabled) : base() + { + this.path = path; + this.cameraBy = cameraBy; + this.cameraPath = cameraPath; + this.enabled = enabled; + } + } + + [Command("findObjects")] + public class AltFindObjectsParams : BaseFindObjectsParams + { + public AltFindObjectsParams(string path, By cameraBy, string cameraPath, bool enabled) : base(path, cameraBy, cameraPath, enabled) + { + } + } + + [Command("findObject")] + public class AltFindObjectParams : BaseFindObjectsParams + { + public AltFindObjectParams(string path, By cameraBy, string cameraPath, bool enabled) : base(path, cameraBy, cameraPath, enabled) + { + } + } + + [Command("findObjectsLight")] + public class AltFindObjectsLightParams : BaseFindObjectsParams + { + public AltFindObjectsLightParams(string path, By cameraBy, string cameraPath, bool enabled) : base(path, cameraBy, cameraPath, enabled) + { + } + } + + [Command("getAllLoadedScenesAndObjects")] + public class AltGetAllLoadedScenesAndObjectsParams : BaseFindObjectsParams + { + public AltGetAllLoadedScenesAndObjectsParams(string path, By cameraBy, string cameraPath, bool enabled) : base(path, cameraBy, cameraPath, enabled) + { + + } + } + + [Command("getServerVersion")] + public class AltGetServerVersionParams : CommandParams + { + public AltGetServerVersionParams() : base() + { + } + } + + [Command("resetInput")] + public class AltResetInputParams : CommandParams + { + public AltResetInputParams() : base() { } + } + + [Command("moveMouse")] + public class AltMoveMouseParams : CommandParams + { + public AltVector2 coordinates; + public float duration; + public bool wait; + + public AltMoveMouseParams(AltVector2 coordinates, float duration, bool wait) : base() + { + this.coordinates = coordinates; + this.duration = duration; + this.wait = wait; + } + } + + [Command("multipointSwipe")] + public class AltMultipointSwipeParams : CommandParams + { + public AltVector2[] positions; + public float duration; + public bool wait; + + public AltMultipointSwipeParams(AltVector2[] positions, float duration, bool wait) : base() + { + this.positions = positions; + this.duration = duration; + this.wait = wait; + } + } + + [Command("pressKeyboardKeys")] + public class AltPressKeyboardKeysParams : CommandParams + { + public AltKeyCode[] keyCodes; + public float power; + public float duration; + public bool wait; + + public AltPressKeyboardKeysParams(AltKeyCode[] keyCodes, float power, float duration, bool wait) : base() + { + this.keyCodes = keyCodes; + this.power = power; + this.duration = duration; + this.wait = wait; + } + } + + [Command("scroll")] + public class AltScrollParams : CommandParams + { + public float speed; //TODO: Change to AltVector2 + public float speedHorizontal; + public float duration; + public bool wait; + + public AltScrollParams(float speed, float duration, bool wait, float speedHorizontal = 0) : base() + { + this.speed = speed; + this.duration = duration; + this.wait = wait; + this.speedHorizontal = speedHorizontal; + } + } + + [Command("swipe")] + public class AltSwipeParams : CommandParams + { + public AltVector2 start; + public AltVector2 end; + public float duration; + public bool wait; + + public AltSwipeParams(AltVector2 start, AltVector2 end, float duration, bool wait) : base() + { + this.start = start; + this.end = end; + this.duration = duration; + this.wait = wait; + } + } + + [Command("tilt")] + public class AltTiltParams : CommandParams + { + public AltVector3 acceleration; + public float duration; + public bool wait; + + public AltTiltParams(AltVector3 acceleration, float duration, bool wait) : base() + { + this.acceleration = acceleration; + this.duration = duration; + this.wait = wait; + } + } + + public class BaseAltObjectParams : CommandParams + { + public AltObject altObject; + public BaseAltObjectParams(AltObject altObject) : base() + { + this.altObject = altObject; + } + } + + [Command("callComponentMethodForObject")] + public class AltCallComponentMethodForObjectParams : BaseAltObjectParams + { + public string component; + public string method; + public string[] parameters; + public string[] typeOfParameters; + public string assembly; + + public AltCallComponentMethodForObjectParams(AltObject altObject, string component, string method, string[] parameters, string[] typeOfParameters, string assembly) : base(altObject) + { + this.component = component; + this.method = method; + this.parameters = parameters; + this.typeOfParameters = typeOfParameters; + this.assembly = assembly; + } + } + + [Command("getObjectComponentProperty")] + public class AltGetObjectComponentPropertyParams : BaseAltObjectParams + { + public string component; + public string property; + public string assembly; + public int maxDepth; + + public AltGetObjectComponentPropertyParams(AltObject altObject, string component, string property, string assembly, int maxDepth) : base(altObject) + { + this.component = component; + this.property = property; + this.assembly = assembly; + this.maxDepth = maxDepth; + } + } + + [Command("setObjectComponentProperty")] + public class AltSetObjectComponentPropertyParams : BaseAltObjectParams + { + public string component; + public string property; + public string assembly; + public string value; + + public AltSetObjectComponentPropertyParams(AltObject altObject, string component, string property, string assembly, string value) : base(altObject) + { + this.component = component; + this.property = property; + this.assembly = assembly; + this.value = value; + } + } + + [Command("dragObject")] + public class AltDragObjectParams : BaseAltObjectParams + { + public AltVector2 position; + public AltDragObjectParams(AltObject altObject, AltVector2 position) : base(altObject) + { + this.altObject = altObject; + this.position = position; + } + } + + [Command("getAllComponents")] + public class AltGetAllComponentsParams : CommandParams + { + public int altObjectId; + public AltGetAllComponentsParams(int altObjectId) : base() + { + this.altObjectId = altObjectId; + } + } + + [Command("getAllFields")] + public class AltGetAllFieldsParams : CommandParams + { + public int altObjectId; + public AltComponent altComponent; + public AltFieldsSelections altFieldsSelections; + + public AltGetAllFieldsParams(int altObjectId, AltComponent altComponent, AltFieldsSelections altFieldsSelections) : base() + { + this.altObjectId = altObjectId; + this.altComponent = altComponent; + this.altFieldsSelections = altFieldsSelections; + } + } + + [Command("getAllProperties")] + public class AltGetAllPropertiesParams : CommandParams + { + public int altObjectId; + public AltComponent altComponent; + public AltPropertiesSelections altPropertiesSelections; + + public AltGetAllPropertiesParams(int altObjectId, AltComponent altComponent, AltPropertiesSelections altPropertiesSelections) : base() + { + this.altObjectId = altObjectId; + this.altComponent = altComponent; + this.altPropertiesSelections = altPropertiesSelections; + } + } + + [Command("getAllMethods")] + public class AltGetAllMethodsParams : CommandParams + { + public AltComponent altComponent; + public AltMethodSelection methodSelection; + + public AltGetAllMethodsParams(AltComponent altComponent, AltMethodSelection methodSelection) : base() + { + this.altComponent = altComponent; + this.methodSelection = methodSelection; + } + } + + [Command("getText")] + public class AltGetTextParams : BaseAltObjectParams + { + public AltGetTextParams(AltObject altObject) : base(altObject) + { + } + } + + [Command("setText")] + public class AltSetTextParams : BaseAltObjectParams + { + public string value; + public bool submit; + + public AltSetTextParams(AltObject altObject, string value, bool submit) : base(altObject) + { + this.value = value; + this.submit = submit; + } + } + + [Command("pointerDownFromObject")] + public class AltPointerDownFromObjectParams : BaseAltObjectParams + { + public AltPointerDownFromObjectParams(AltObject altObject) : base(altObject) + { + } + } + + [Command("pointerEnterObject")] + public class AltPointerEnterObjectParams : BaseAltObjectParams + { + public AltPointerEnterObjectParams(AltObject altObject) : base(altObject) + { + } + } + + [Command("pointerExitObject")] + public class AltPointerExitObjectParams : BaseAltObjectParams + { + public AltPointerExitObjectParams(AltObject altObject) : base(altObject) + { + } + } + + [Command("pointerUpFromObject")] + public class AltPointerUpFromObjectParams : BaseAltObjectParams + { + public AltPointerUpFromObjectParams(AltObject altObject) : base(altObject) + { + } + } + + [Command("getPNGScreenshot")] + public class AltGetPNGScreenshotParams : CommandParams + { + public AltGetPNGScreenshotParams() : base() + { + } + } + + [Command("getScreenshot")] + public class AltGetScreenshotParams : CommandParams + { + public AltVector2 size; + public int quality; + + public AltGetScreenshotParams(AltVector2 size, int quality) : base() + { + this.size = size; + this.quality = quality; + } + } + + [Command("hightlightObjectScreenshot")] + public class AltHighlightObjectScreenshotParams : CommandParams + { + public int altObjectId; + public AltColor color; + public float width; + public AltVector2 size; + public int quality; + + public AltHighlightObjectScreenshotParams(int altObjectId, AltColor color, float width, AltVector2 size, int quality) : base() + { + this.altObjectId = altObjectId; + this.color = color; + this.width = width; + this.size = size; + this.quality = quality; + } + } + + [Command("hightlightObjectFromCoordinatesScreenshot")] + public class AltHighlightObjectFromCoordinatesScreenshotParams : CommandParams + { + public AltVector2 coordinates; + public AltColor color; + public float width; + public AltVector2 size; + public int quality; + + public AltHighlightObjectFromCoordinatesScreenshotParams(AltVector2 coordinates, AltColor color, float width, AltVector2 size, int quality) : base() + { + this.coordinates = coordinates; + this.color = color; + this.width = width; + this.size = size; + this.quality = quality; + } + } + + [Command("deleteKeyPlayerPref")] + public class AltDeleteKeyPlayerPrefParams : CommandParams + { + public string keyName; + public AltDeleteKeyPlayerPrefParams(string keyName) : base() + { + this.keyName = keyName; + } + } + + [Command("getKeyPlayerPref")] + public class AltGetKeyPlayerPrefParams : CommandParams + { + public string keyName; + public PlayerPrefKeyType keyType; + + public AltGetKeyPlayerPrefParams() : base() + { + } + + public AltGetKeyPlayerPrefParams(string keyName, PlayerPrefKeyType keyType) : base() + { + this.keyName = keyName; + this.keyType = keyType; + } + } + + [Command("setKeyPlayerPref")] + public class AltSetKeyPlayerPrefParams : CommandParams + { + public string keyName; + public PlayerPrefKeyType keyType; + public string stringValue; + public float floatValue; + public int intValue; + + public AltSetKeyPlayerPrefParams() : base() { } + + public AltSetKeyPlayerPrefParams(string keyName, int value) : base() + { + this.keyName = keyName; + this.intValue = value; + keyType = PlayerPrefKeyType.Int; + } + + public AltSetKeyPlayerPrefParams(string keyName, float value) : base() + { + this.keyName = keyName; + this.floatValue = value; + keyType = PlayerPrefKeyType.Float; + } + + public AltSetKeyPlayerPrefParams(string keyName, string value) : base() + { + this.keyName = keyName; + this.stringValue = value; + keyType = PlayerPrefKeyType.String; + } + } + + [Command("deletePlayerPref")] + public class AltDeletePlayerPrefParams : CommandParams + { + public AltDeletePlayerPrefParams() : base() + { + } + } + + [Command("getAllActiveCameras")] + public class AltGetAllActiveCamerasParams : CommandParams + { + public AltGetAllActiveCamerasParams() : base() + { + } + } + + [Command("getAllCameras")] + public class AltGetAllCamerasParams : CommandParams + { + } + + [Command("getAllLoadedScenes")] + public class AltGetAllLoadedScenesParams : CommandParams + { + } + + [Command("getAllScenes")] + public class AltGetAllScenesParams : CommandParams + { + } + + [Command("getCurrentScene")] + public class AltGetCurrentSceneParams : CommandParams + { + } + + [Command("loadScene")] + public class AltLoadSceneParams : CommandParams + { + public string sceneName; + public bool loadSingle; + + public AltLoadSceneParams(string sceneName, bool loadSingle) : base() + { + this.sceneName = sceneName; + this.loadSingle = loadSingle; + } + } + + [Command("unloadScene")] + public class AltUnloadSceneParams : CommandParams + { + public string sceneName; + + public AltUnloadSceneParams(string sceneName) : base() + { + this.sceneName = sceneName; + } + } + + [Command("getTimeScale")] + public class AltGetTimeScaleParams : CommandParams + { + } + + [Command("setTimeScale")] + public class AltSetTimeScaleParams : CommandParams + { + public float timeScale; + + public AltSetTimeScaleParams(float timeScale) : base() + { + this.timeScale = timeScale; + } + } + + [Command("setServerLogging")] + public class AltSetServerLoggingParams : CommandParams + { + public AltLogger logger; + public AltLogLevel logLevel; + + public AltSetServerLoggingParams(AltLogger logger, AltLogLevel logLevel) : base() + { + this.logger = logger; + this.logLevel = logLevel; + } + } + + [Command("tapElement")] + public class AltTapElementParams : BaseAltObjectParams + { + public int count; + public float interval; + public bool wait; + + public AltTapElementParams(AltObject altObject, int count, float interval, bool wait) : base(altObject) + { + this.count = count; + this.interval = interval; + this.wait = wait; + } + } + + [Command("clickElement")] + public class AltClickElementParams : BaseAltObjectParams + { + public int count; + public float interval; + public bool wait; + + public AltClickElementParams(AltObject altObject, int count, float interval, bool wait) : base(altObject) + { + this.count = count; + this.interval = interval; + this.wait = wait; + } + } + + [Command("clickCoordinates")] + public class AltClickCoordinatesParams : CommandParams + { + public AltVector2 coordinates; + public int count; + public float interval; + public bool wait; + + public AltClickCoordinatesParams(AltVector2 coordinates, int count, float interval, bool wait) + { + this.coordinates = coordinates; + this.count = count; + this.interval = interval; + this.wait = wait; + } + } + + [Command("tapCoordinates")] + public class AltTapCoordinatesParams : CommandParams + { + public AltVector2 coordinates; + public int count; + public float interval; + public bool wait; + + public AltTapCoordinatesParams(AltVector2 coordinates, int count, float interval, bool wait) + { + this.coordinates = coordinates; + this.count = count; + this.interval = interval; + this.wait = wait; + } + } + + [Command("keysUp")] + public class AltKeysUpParams : CommandParams + { + public AltKeyCode[] keyCodes; + + public AltKeysUpParams(AltKeyCode[] keyCodes) + { + this.keyCodes = keyCodes; + } + } + + [Command("keysDown")] + public class AltKeysDownParams : CommandParams + { + public AltKeyCode[] keyCodes; + public float power; + + public AltKeysDownParams(AltKeyCode[] keyCodes, float power) + { + this.keyCodes = keyCodes; + this.power = power; + } + } + + [Command("beginTouch")] + public class AltBeginTouchParams : CommandParams + { + public AltVector2 coordinates; + + public AltBeginTouchParams(AltVector2 coordinates) + { + this.coordinates = coordinates; + } + } + + [Command("moveTouch")] + public class AltMoveTouchParams : CommandParams + { + public int fingerId; + public AltVector2 coordinates; + + public AltMoveTouchParams(int fingerId, AltVector2 coordinates) + { + this.coordinates = coordinates; + this.fingerId = fingerId; + } + } + + [Command("endTouch")] + public class AltEndTouchParams : CommandParams + { + public int fingerId; + + public AltEndTouchParams(int fingerId) + { + this.fingerId = fingerId; + } + } + + [Command("activateNotification")] + public class ActivateNotification : CommandParams + { + public NotificationType NotificationType; + + public ActivateNotification(NotificationType notificationType) + { + NotificationType = notificationType; + } + } + + [Command("deactivateNotification")] + public class DeactivateNotification : CommandParams + { + public NotificationType NotificationType; + + public DeactivateNotification(NotificationType notificationType) + { + NotificationType = notificationType; + } + } + + [Command("findObjectAtCoordinates")] + public class AltFindObjectAtCoordinatesParams : CommandParams + { + public AltVector2 coordinates; + + public AltFindObjectAtCoordinatesParams(AltVector2 coordinates) + { + this.coordinates = coordinates; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/Parameters/CommandParams.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/Parameters/CommandParams.cs.meta new file mode 100644 index 00000000..887a4b12 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/Parameters/CommandParams.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4817c9f45c1133244b43c8ff50bdce4c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/Screenshot.meta b/Assets/AltTester/Runtime/AltDriver/Commands/Screenshot.meta new file mode 100644 index 00000000..839cc1a6 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/Screenshot.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: adaea1f290ce4a647b76cb028ac9503e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/Screenshot/AltGetPNGScreenshot.cs b/Assets/AltTester/Runtime/AltDriver/Commands/Screenshot/AltGetPNGScreenshot.cs new file mode 100644 index 00000000..6d73d819 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/Screenshot/AltGetPNGScreenshot.cs @@ -0,0 +1,40 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetPNGScreenshot : AltBaseCommand + { + string path; + AltGetPNGScreenshotParams cmdParams; + + public AltGetPNGScreenshot(IDriverCommunication commHandler, string path) : base(commHandler) + { + this.path = path; + this.cmdParams = new AltGetPNGScreenshotParams(); + } + + public void Execute() + { + CommHandler.Send(cmdParams); + var message = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", message); + string screenshotData = CommHandler.Recvall(cmdParams); + System.IO.File.WriteAllBytes(path, System.Convert.FromBase64String(screenshotData)); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/Screenshot/AltGetPNGScreenshot.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/Screenshot/AltGetPNGScreenshot.cs.meta new file mode 100644 index 00000000..d3df1d19 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/Screenshot/AltGetPNGScreenshot.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 021be954918627849b27ac8e56fc30c1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/Screenshot/AltGetScreenshot.cs b/Assets/AltTester/Runtime/AltDriver/Commands/Screenshot/AltGetScreenshot.cs new file mode 100644 index 00000000..1f6eee52 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/Screenshot/AltGetScreenshot.cs @@ -0,0 +1,93 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetScreenshotResponse + { + public AltVector2 scaleDifference; + public AltVector3 textureSize; + public byte[] compressedImage; + + } + public class AltGetScreenshot : AltCommandReturningAltElement + { + AltGetScreenshotParams cmdParams; + + + public AltGetScreenshot(IDriverCommunication commHandler, AltVector2 size, int screenShotQuality) : base(commHandler) + { + cmdParams = new AltGetScreenshotParams(size, screenShotQuality); + } + public virtual AltTextureInformation Execute() + { + CommHandler.Send(cmdParams); + return ReceiveScreenshot(cmdParams); + } + + protected AltTextureInformation ReceiveScreenshot(CommandParams commandParams) + { + var data = CommHandler.Recvall(commandParams); + ValidateResponse("Ok", data); + + var imageData = CommHandler.Recvall(commandParams); + return new AltTextureInformation(imageData.compressedImage, imageData.scaleDifference, imageData.textureSize); + } + } + + + public class AltGetHighlightObjectScreenshot : AltGetScreenshot + { + + AltHighlightObjectScreenshotParams cmdParams; + + public AltGetHighlightObjectScreenshot(IDriverCommunication commHandler, int id, AltColor color, float width, AltVector2 size, int screenShotQuality) : base(commHandler, size, screenShotQuality) + { + cmdParams = new AltHighlightObjectScreenshotParams(id, color, width, size, screenShotQuality); + } + + public override AltTextureInformation Execute() + { + CommHandler.Send(cmdParams); + return ReceiveScreenshot(cmdParams); + } + } + + + public class AltGetHighlightObjectFromCoordinatesScreenshot : AltGetScreenshot + { + AltHighlightObjectFromCoordinatesScreenshotParams cmdParams; + + public AltGetHighlightObjectFromCoordinatesScreenshot(IDriverCommunication commHandler, AltVector2 coordinates, AltColor color, float width, AltVector2 size, int screenShotQuality) : base(commHandler, size, screenShotQuality) + { + cmdParams = new AltHighlightObjectFromCoordinatesScreenshotParams(coordinates, color, width, size, screenShotQuality); + } + public AltTextureInformation Execute(out AltObject selectedObject) + { + CommHandler.Send(cmdParams); + + selectedObject = ReceiveAltObject(cmdParams); + if (selectedObject != null && selectedObject.name.Equals("Null") && selectedObject.id == 0) + { + selectedObject = null; + } + return ReceiveScreenshot(cmdParams); + + } + } + +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/Screenshot/AltGetScreenshot.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/Screenshot/AltGetScreenshot.cs.meta new file mode 100644 index 00000000..b2b7ffd0 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/Screenshot/AltGetScreenshot.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 39b1a1f3b6d4bf344b2218a592117bb5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands.meta new file mode 100644 index 00000000..12b7deb4 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fc1e9720d302ded4d9d1e2214791fad4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltDeleteKeyPlayerPref.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltDeleteKeyPlayerPref.cs new file mode 100644 index 00000000..afc94b17 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltDeleteKeyPlayerPref.cs @@ -0,0 +1,34 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltDeleteKeyPlayerPref : AltBaseCommand + { + AltDeleteKeyPlayerPrefParams cmdParams; + public AltDeleteKeyPlayerPref(IDriverCommunication commHandler, string keyName) : base(commHandler) + { + this.cmdParams = new AltDeleteKeyPlayerPrefParams(keyName); + } + public void Execute() + { + CommHandler.Send(cmdParams); + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltDeleteKeyPlayerPref.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltDeleteKeyPlayerPref.cs.meta new file mode 100644 index 00000000..c693e978 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltDeleteKeyPlayerPref.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fbf4da61b5051eb4db291637f1d99db8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltDeletePlayerPref.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltDeletePlayerPref.cs new file mode 100644 index 00000000..aeda4400 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltDeletePlayerPref.cs @@ -0,0 +1,34 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltDeletePlayerPref : AltBaseCommand + { + AltDeletePlayerPrefParams cmdParams; + public AltDeletePlayerPref(IDriverCommunication commHandler) : base(commHandler) + { + this.cmdParams = new AltDeletePlayerPrefParams(); + } + public void Execute() + { + CommHandler.Send(cmdParams); + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltDeletePlayerPref.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltDeletePlayerPref.cs.meta new file mode 100644 index 00000000..cc3809f3 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltDeletePlayerPref.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2bd330e584e872243a42637d2f154a4b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllActiveCameras.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllActiveCameras.cs new file mode 100644 index 00000000..35ae1f4f --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllActiveCameras.cs @@ -0,0 +1,34 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetAllActiveCameras : AltBaseFindObjects + { + private readonly AltGetAllActiveCamerasParams cmdParams; + public AltGetAllActiveCameras(IDriverCommunication commHandler) : base(commHandler) + { + + cmdParams = new AltGetAllActiveCamerasParams(); + } + public System.Collections.Generic.List Execute() + { + CommHandler.Send(cmdParams); + return ReceiveListOfAltObjects(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllActiveCameras.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllActiveCameras.cs.meta new file mode 100644 index 00000000..b030dd16 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllActiveCameras.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fce46b5b6f181cd40a094fd37bd8be3f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllCameras.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllCameras.cs new file mode 100644 index 00000000..d90b44c4 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllCameras.cs @@ -0,0 +1,33 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetAllCameras : AltBaseFindObjects + { + private readonly AltGetAllCamerasParams cmdParams; + public AltGetAllCameras(IDriverCommunication commHandler) : base(commHandler) + { + cmdParams = new AltGetAllCamerasParams(); + } + public System.Collections.Generic.List Execute() + { + CommHandler.Send(cmdParams); + return ReceiveListOfAltObjects(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllCameras.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllCameras.cs.meta new file mode 100644 index 00000000..6c8bdcad --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllCameras.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5ee39bcd41c95ea489c6b3c9ed771624 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllLoadedScenes.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllLoadedScenes.cs new file mode 100644 index 00000000..0f91d64d --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllLoadedScenes.cs @@ -0,0 +1,35 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections.Generic; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + internal class AltGetAllLoadedScenes : AltBaseCommand + { + private readonly AltGetAllLoadedScenesParams cmdParams; + public AltGetAllLoadedScenes(IDriverCommunication commHandler) : base(commHandler) + { + cmdParams = new AltGetAllLoadedScenesParams(); + } + public List Execute() + { + CommHandler.Send(cmdParams); + return CommHandler.Recvall>(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllLoadedScenes.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllLoadedScenes.cs.meta new file mode 100644 index 00000000..c23baf17 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllLoadedScenes.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2f4c3877502432e44955dd68aecf8771 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllScenes.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllScenes.cs new file mode 100644 index 00000000..e078f965 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllScenes.cs @@ -0,0 +1,36 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetAllScenes : AltBaseCommand + { + private readonly AltGetAllScenesParams cmdParams; + public AltGetAllScenes(IDriverCommunication commHandler) : base(commHandler) + { + cmdParams = new AltGetAllScenesParams(); + } + public List Execute() + { + CommHandler.Send(cmdParams); + return CommHandler.Recvall>(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllScenes.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllScenes.cs.meta new file mode 100644 index 00000000..47e496bc --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetAllScenes.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c15ac11ddfd98374d910fc7b366a3087 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetCurrentScene.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetCurrentScene.cs new file mode 100644 index 00000000..f0d22618 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetCurrentScene.cs @@ -0,0 +1,35 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using Newtonsoft.Json; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetCurrentScene : AltBaseFindObjects + { + private readonly AltGetCurrentSceneParams cmdParams; + public AltGetCurrentScene(IDriverCommunication commHandler) : base(commHandler) + { + cmdParams = new AltGetCurrentSceneParams(); + } + public string Execute() + { + CommHandler.Send(cmdParams); + return ReceiveAltObject(cmdParams).name; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetCurrentScene.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetCurrentScene.cs.meta new file mode 100644 index 00000000..0f954ad2 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetCurrentScene.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 009e6b8df2b0cd14d8f1b5b3e8d9819c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetFloatKeyPlayerPref.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetFloatKeyPlayerPref.cs new file mode 100644 index 00000000..1b9fee8d --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetFloatKeyPlayerPref.cs @@ -0,0 +1,33 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetFloatKeyPlayerPref : AltBaseCommand + { + readonly AltGetKeyPlayerPrefParams cmdParams; + public AltGetFloatKeyPlayerPref(IDriverCommunication commHandler, string keyName) : base(commHandler) + { + cmdParams = new AltGetKeyPlayerPrefParams(keyName, PlayerPrefKeyType.Float); + } + public float Execute() + { + CommHandler.Send(cmdParams); + return CommHandler.Recvall(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetFloatKeyPlayerPref.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetFloatKeyPlayerPref.cs.meta new file mode 100644 index 00000000..85a1c985 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetFloatKeyPlayerPref.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ca359135cf227ce4bac7f68da41b5e0b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetIntKeyPlayerPref.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetIntKeyPlayerPref.cs new file mode 100644 index 00000000..fdead1d5 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetIntKeyPlayerPref.cs @@ -0,0 +1,33 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetIntKeyPlayerPref : AltBaseCommand + { + readonly AltGetKeyPlayerPrefParams cmdParams; + public AltGetIntKeyPlayerPref(IDriverCommunication commHandler, string keyName) : base(commHandler) + { + cmdParams = new AltGetKeyPlayerPrefParams(keyName, PlayerPrefKeyType.Int); + } + public int Execute() + { + CommHandler.Send(cmdParams); + return CommHandler.Recvall(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetIntKeyPlayerPref.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetIntKeyPlayerPref.cs.meta new file mode 100644 index 00000000..efa5bcf8 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetIntKeyPlayerPref.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4600ed3f03238ad4690b2012bcea1c5d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetStringKeyPlayerPref.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetStringKeyPlayerPref.cs new file mode 100644 index 00000000..9070e191 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetStringKeyPlayerPref.cs @@ -0,0 +1,33 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetStringKeyPlayerPref : AltBaseCommand + { + readonly AltGetKeyPlayerPrefParams cmdParams; + public AltGetStringKeyPlayerPref(IDriverCommunication commHandler, string keyName) : base(commHandler) + { + cmdParams = new AltGetKeyPlayerPrefParams(keyName, PlayerPrefKeyType.String); + } + public string Execute() + { + CommHandler.Send(cmdParams); + return CommHandler.Recvall(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetStringKeyPlayerPref.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetStringKeyPlayerPref.cs.meta new file mode 100644 index 00000000..6c7a0008 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetStringKeyPlayerPref.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 98d3fa36acfaece45b8e436b14c31c4a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetTimeScale.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetTimeScale.cs new file mode 100644 index 00000000..32cef054 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetTimeScale.cs @@ -0,0 +1,35 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using Newtonsoft.Json; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltGetTimeScale : AltBaseCommand + { + AltGetTimeScaleParams cmdParams; + public AltGetTimeScale(IDriverCommunication commHandler) : base(commHandler) + { + cmdParams = new AltGetTimeScaleParams(); + } + public float Execute() + { + CommHandler.Send(cmdParams); + return CommHandler.Recvall(cmdParams); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetTimeScale.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetTimeScale.cs.meta new file mode 100644 index 00000000..a10a026d --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltGetTimeScale.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b34041e6794e98247b8013cbc1b32074 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltLoadScene.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltLoadScene.cs new file mode 100644 index 00000000..f55049aa --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltLoadScene.cs @@ -0,0 +1,40 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using Newtonsoft.Json; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltLoadScene : AltBaseCommand + { + AltLoadSceneParams cmdParams; + public AltLoadScene(IDriverCommunication commHandler, string sceneName, bool loadSingle) : base(commHandler) + { + cmdParams = new AltLoadSceneParams(sceneName, loadSingle); + } + public void Execute() + { + CommHandler.Send(cmdParams); + + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + + data = CommHandler.Recvall(cmdParams); + ValidateResponse("Scene Loaded", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltLoadScene.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltLoadScene.cs.meta new file mode 100644 index 00000000..bbca231e --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltLoadScene.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5c7d3b895b851c6468a9cf32d65c4f85 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltSetKeyPLayerPref.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltSetKeyPLayerPref.cs new file mode 100644 index 00000000..1f6bf46a --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltSetKeyPLayerPref.cs @@ -0,0 +1,42 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltSetKeyPLayerPref : AltBaseCommand + { + AltSetKeyPlayerPrefParams cmdParams; + public AltSetKeyPLayerPref(IDriverCommunication commHandler, string keyName, int intValue) : base(commHandler) + { + cmdParams = new AltSetKeyPlayerPrefParams(keyName, intValue); + } + public AltSetKeyPLayerPref(IDriverCommunication commHandler, string keyName, float floatValue) : base(commHandler) + { + cmdParams = new AltSetKeyPlayerPrefParams(keyName, floatValue); + } + public AltSetKeyPLayerPref(IDriverCommunication commHandler, string keyName, string stringValue) : base(commHandler) + { + cmdParams = new AltSetKeyPlayerPrefParams(keyName, stringValue); + } + public void Execute() + { + CommHandler.Send(cmdParams); + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltSetKeyPLayerPref.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltSetKeyPLayerPref.cs.meta new file mode 100644 index 00000000..6c1061be --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltSetKeyPLayerPref.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b2de68bf3d017424c91c7816183d156b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltSetTimeScale.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltSetTimeScale.cs new file mode 100644 index 00000000..c964394f --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltSetTimeScale.cs @@ -0,0 +1,37 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using Newtonsoft.Json; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltSetTimeScale : AltBaseCommand + { + AltSetTimeScaleParams cmdParams; + + public AltSetTimeScale(IDriverCommunication commHandler, float timeScale) : base(commHandler) + { + cmdParams = new AltSetTimeScaleParams(timeScale); + } + public void Execute() + { + CommHandler.Send(cmdParams); + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltSetTimeScale.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltSetTimeScale.cs.meta new file mode 100644 index 00000000..597b1349 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltSetTimeScale.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2c0b509d5ef08454589b2c4fa01091b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltUnloadScene.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltUnloadScene.cs new file mode 100644 index 00000000..7aba1f0e --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltUnloadScene.cs @@ -0,0 +1,38 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltUnloadScene : AltBaseCommand + { + AltUnloadSceneParams cmdParams; + public AltUnloadScene(IDriverCommunication commHandler, string sceneName) : base(commHandler) + { + cmdParams = new AltUnloadSceneParams(sceneName); + } + public void Execute() + { + CommHandler.Send(cmdParams); + + var data = CommHandler.Recvall(cmdParams); + ValidateResponse("Ok", data); + + data = CommHandler.Recvall(cmdParams); + ValidateResponse("Scene Unloaded", data); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltUnloadScene.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltUnloadScene.cs.meta new file mode 100644 index 00000000..ed27daf0 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltUnloadScene.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3e7291f8ab9d8e348a481f040cb087b9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltWaitForCurrentSceneToBe.cs b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltWaitForCurrentSceneToBe.cs new file mode 100644 index 00000000..dfba1265 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltWaitForCurrentSceneToBe.cs @@ -0,0 +1,58 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Threading; +using AltTester.AltTesterUnitySDK.Driver.Logging; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public class AltWaitForCurrentSceneToBe : AltBaseCommand + { + readonly NLog.Logger logger = DriverLogManager.Instance.GetCurrentClassLogger(); + string sceneName; + double timeout; + double interval; + public AltWaitForCurrentSceneToBe(IDriverCommunication commHandler, string sceneName, double timeout, double interval) : base(commHandler) + { + this.sceneName = sceneName; + this.timeout = timeout; + this.interval = interval; + } + public void Execute() + { + double time = 0; + string currentScene = ""; + while (time < timeout) + { + currentScene = new AltGetCurrentScene(CommHandler).Execute(); + if (currentScene.Equals(sceneName)) + { + return; + } + + logger.Debug("Waiting for scene to be " + sceneName + "..."); + Thread.Sleep(System.Convert.ToInt32(interval * 1000)); + time += interval; + } + + if (sceneName.Equals(currentScene)) + return; + throw new WaitTimeOutException("Scene " + sceneName + " not loaded after " + timeout + " seconds"); + + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltWaitForCurrentSceneToBe.cs.meta b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltWaitForCurrentSceneToBe.cs.meta new file mode 100644 index 00000000..3c6b11d4 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Commands/UnityCommands/AltWaitForCurrentSceneToBe.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 49c58b3f447fabc4cabad1e093b463d2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Common.meta b/Assets/AltTester/Runtime/AltDriver/Common.meta new file mode 100644 index 00000000..284399fd --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 64b015cfc961e445c926dd271792d19f +folderAsset: yes +timeCreated: 1516878881 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltAxis.cs b/Assets/AltTester/Runtime/AltDriver/Common/AltAxis.cs new file mode 100644 index 00000000..a04febe2 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltAxis.cs @@ -0,0 +1,48 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public enum InputType + { + KeyOrMouseButton, + MouseMovement, + JoystickAxis, + }; + [System.Serializable] + public class AltAxis + { + public string name; + public string negativeButton; + public string positiveButton; + public string altPositiveButton; + public string altNegativeButton; + public InputType type; + public int axisDirection; + + public AltAxis(string name, InputType type, string negativeButton, string positiveButton, string altPositiveButton, string altNegativeButton, int axisDirection) + { + this.name = name; + this.type = type; + this.negativeButton = negativeButton; + this.positiveButton = positiveButton; + this.altPositiveButton = altPositiveButton; + this.altNegativeButton = altNegativeButton; + this.axisDirection = axisDirection; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltAxis.cs.meta b/Assets/AltTester/Runtime/AltDriver/Common/AltAxis.cs.meta new file mode 100644 index 00000000..f2d0c957 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltAxis.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 252fc802f6d1d68499fc8f5c26a9159d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltComponent.cs b/Assets/AltTester/Runtime/AltDriver/Common/AltComponent.cs new file mode 100644 index 00000000..a5e64e72 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltComponent.cs @@ -0,0 +1,31 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public struct AltComponent + { + public string componentName; + public string assemblyName; + + public AltComponent(string componentName, string assemblyName) + { + this.componentName = componentName; + this.assemblyName = assemblyName; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltComponent.cs.meta b/Assets/AltTester/Runtime/AltDriver/Common/AltComponent.cs.meta new file mode 100644 index 00000000..15271e43 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1ec8e9cb80110bb43a42eb358c46dbcc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltFieldsSelections.cs b/Assets/AltTester/Runtime/AltDriver/Common/AltFieldsSelections.cs new file mode 100644 index 00000000..d0b91202 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltFieldsSelections.cs @@ -0,0 +1,26 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public enum AltFieldsSelections + { + CLASSFIELDS, + INHERITEDFIELDS, + ALLFIELDS + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltFieldsSelections.cs.meta b/Assets/AltTester/Runtime/AltDriver/Common/AltFieldsSelections.cs.meta new file mode 100644 index 00000000..1772bfe6 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltFieldsSelections.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 428b9e960cfa04b44bc5b91cc1cbce26 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltMethodSelection.cs b/Assets/AltTester/Runtime/AltDriver/Common/AltMethodSelection.cs new file mode 100644 index 00000000..58980b61 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltMethodSelection.cs @@ -0,0 +1,26 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public enum AltMethodSelection + { + CLASSMETHODS, + INHERITEDMETHODS, + ALLMETHODS + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltMethodSelection.cs.meta b/Assets/AltTester/Runtime/AltDriver/Common/AltMethodSelection.cs.meta new file mode 100644 index 00000000..d191fbe0 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltMethodSelection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1b278932954527a42b69a4d553772a71 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltObject.cs b/Assets/AltTester/Runtime/AltDriver/Common/AltObject.cs new file mode 100644 index 00000000..65510b15 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltObject.cs @@ -0,0 +1,239 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Threading; +using AltTester.AltTesterUnitySDK.Driver.Commands; + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public class AltObject + { + public string name; + public int id; + public int x; + public int y; + public int z; + public int mobileY; + public string type; + public bool enabled; + public float worldX; + public float worldY; + public float worldZ; + public int idCamera; + public int transformParentId; + public int transformId; + [Newtonsoft.Json.JsonIgnore] + public IDriverCommunication CommHandler; + + public AltObject(string name, int id = 0, int x = 0, int y = 0, int z = 0, int mobileY = 0, string type = "", bool enabled = true, float worldX = 0, float worldY = 0, float worldZ = 0, int idCamera = 0, int transformParentId = 0, int transformId = 0) + { + this.name = name; + this.id = id; + this.x = x; + this.y = y; + this.z = z; + this.mobileY = mobileY; + this.type = type; + this.enabled = enabled; + this.worldX = worldX; + this.worldY = worldY; + this.worldZ = worldZ; + this.idCamera = idCamera; + this.transformParentId = transformParentId; + this.transformId = transformId; + } + + public AltObject UpdateObject() + { + var altObject = new AltFindObject(CommHandler, By.ID, this.id.ToString(), By.NAME, "", this.enabled).Execute(); + x = altObject.x; + y = altObject.y; + z = altObject.z; + id = altObject.id; + name = altObject.name; + mobileY = altObject.mobileY; + type = altObject.type; + enabled = altObject.enabled; + worldX = altObject.worldX; + worldY = altObject.worldY; + worldZ = altObject.worldZ; + idCamera = altObject.idCamera; + transformParentId = altObject.transformParentId; + transformId = altObject.transformId; + + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return this; + } + public AltObject GetParent() + { + var altObject = new AltFindObject(CommHandler, By.PATH, "//*[@id=" + this.id + "]/..", By.NAME, "", true).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return altObject; + } + + [Obsolete("getParent is deprecated, please use GetParent instead.")] + public AltObject getParent() + { + var altObject = new AltFindObject(CommHandler, By.PATH, "//*[@id=" + this.id + "]/..", By.NAME, "", true).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return altObject; + } + public AltVector2 GetScreenPosition() + { + return new AltVector2(x, y); + } + + [Obsolete("getScreenPosition is deprecated, please use GetScreenPosition instead.")] + public AltVector2 getScreenPosition() + { + return new AltVector2(x, y); + } + public AltVector3 GetWorldPosition() + { + return new AltVector3(worldX, worldY, worldZ); + } + + [Obsolete("getWorldPosition is deprecated, please use GetWorldPosition instead.")] + public AltVector3 getWorldPosition() + { + return new AltVector3(worldX, worldY, worldZ); + } + public T GetComponentProperty(string componentName, string propertyName, string assemblyName, int maxDepth = 2) + { + var propertyValue = new AltGetComponentProperty(CommHandler, componentName, propertyName, assemblyName, maxDepth, this).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return propertyValue; + } + public T WaitForComponentProperty(string componentName, string propertyName, T propertyValue, string assemblyName, double timeout = 20, double interval = 0.5) + { + var propertyFound = new AltWaitForComponentProperty(CommHandler, componentName, propertyName, propertyValue, assemblyName, timeout, interval, this).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return propertyFound; + } + public void SetComponentProperty(string componentName, string propertyName, object value, string assemblyName) + { + new AltSetComponentProperty(CommHandler, componentName, propertyName, value, assemblyName, this).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + } + + public T CallComponentMethod(string componentName, string methodName, string assemblyName, object[] parameters, string[] typeOfParameters = null) + { + var result = new AltCallComponentMethod(CommHandler, componentName, methodName, parameters, typeOfParameters, assemblyName, this).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return result; + } + + public string GetText() + { + var text = new AltGetText(CommHandler, this).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return text; + } + + public AltObject SetText(string text, bool submit = false) + { + var altObject = new AltSetText(CommHandler, this, text, submit).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return altObject; + } + + /// + /// Click current object + /// + /// Number of times to click + /// Interval between clicks in seconds + /// Wait for command to finish + /// The clicked object + public AltObject Click(int count = 1, float interval = 0.1f, bool wait = true) + { + var altObject = new AltClickElement(CommHandler, this, count, interval, wait).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return altObject; + } + + public AltObject PointerUpFromObject() + { + var altObject = new AltPointerUpFromObject(CommHandler, this).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return altObject; + } + + public AltObject PointerDownFromObject() + { + var altObject = new AltPointerDownFromObject(CommHandler, this).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return altObject; + } + + public AltObject PointerEnterObject() + { + var altObject = new AltPointerEnterObject(CommHandler, this).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return altObject; + } + + public AltObject PointerExitObject() + { + var altObject = new AltPointerExitObject(CommHandler, this).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return altObject; + } + + /// + /// Tap current object + /// + /// Number of taps + /// Interval in seconds + /// Wait for command to finish + /// The tapped object + public AltObject Tap(int count = 1, float interval = 0.1f, bool wait = true) + { + var altObject = new AltTapElement(CommHandler, this, count, interval, wait).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return altObject; + } + + public System.Collections.Generic.List GetAllComponents() + { + var altObject = new AltGetAllComponents(CommHandler, this).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return altObject; + } + + public System.Collections.Generic.List GetAllProperties(AltComponent altComponent, AltPropertiesSelections altPropertiesSelections = AltPropertiesSelections.ALLPROPERTIES) + { + var altObject = new AltGetAllProperties(CommHandler, altComponent, this, altPropertiesSelections).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return altObject; + } + + public System.Collections.Generic.List GetAllFields(AltComponent altComponent, AltFieldsSelections altFieldsSelections = AltFieldsSelections.ALLFIELDS) + { + var altObject = new AltGetAllFields(CommHandler, altComponent, this, altFieldsSelections).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return altObject; + } + + public System.Collections.Generic.List GetAllMethods(AltComponent altComponent, AltMethodSelection methodSelection = AltMethodSelection.ALLMETHODS) + { + var altObject = new AltGetAllMethods(CommHandler, altComponent, methodSelection).Execute(); + CommHandler.SleepFor(CommHandler.GetDelayAfterCommand()); + return altObject; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltObject.cs.meta b/Assets/AltTester/Runtime/AltDriver/Common/AltObject.cs.meta new file mode 100644 index 00000000..ca51350d --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltObject.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: fe75b462096664ca89da36caea8cacdb +timeCreated: 1516878909 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltObjectLight.cs b/Assets/AltTester/Runtime/AltDriver/Common/AltObjectLight.cs new file mode 100644 index 00000000..3dd7af5e --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltObjectLight.cs @@ -0,0 +1,39 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public class AltObjectLight + { + public string name; + public int id; + public bool enabled; + public int idCamera; + public int transformParentId; + public int transformId; + + public AltObjectLight(string name, int id = 0, bool enabled = true, int idCamera = 0, int transformParentId = 0, int transformId = 0) + { + this.name = name; + this.id = id; + this.enabled = enabled; + this.idCamera = idCamera; + this.transformParentId = transformParentId; + this.transformId = transformId; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltObjectLight.cs.meta b/Assets/AltTester/Runtime/AltDriver/Common/AltObjectLight.cs.meta new file mode 100644 index 00000000..47ab4848 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltObjectLight.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 431e3a3312cc2cd46b8855597a2b9e95 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltObjectProperty.cs b/Assets/AltTester/Runtime/AltDriver/Common/AltObjectProperty.cs new file mode 100644 index 00000000..2bac1b21 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltObjectProperty.cs @@ -0,0 +1,37 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public struct AltObjectProperty + { + public string Component; + public string Property; + public string Assembly; + + public AltObjectProperty(string component = "", string property = "") : + this(component, property, null) + { } + + public AltObjectProperty(string component, string property, string assembly) + { + Component = component; + Property = property; + Assembly = assembly; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltObjectProperty.cs.meta b/Assets/AltTester/Runtime/AltDriver/Common/AltObjectProperty.cs.meta new file mode 100644 index 00000000..6b715662 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltObjectProperty.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: cd59071dbb33a40bfbfcaf97fe45b0bb +timeCreated: 1518696264 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltPropertiesSelections.cs b/Assets/AltTester/Runtime/AltDriver/Common/AltPropertiesSelections.cs new file mode 100644 index 00000000..85e8b630 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltPropertiesSelections.cs @@ -0,0 +1,26 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public enum AltPropertiesSelections + { + CLASSPROPERTIES, + INHERITEDPROPERTIES, + ALLPROPERTIES + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltPropertiesSelections.cs.meta b/Assets/AltTester/Runtime/AltDriver/Common/AltPropertiesSelections.cs.meta new file mode 100644 index 00000000..bb76700e --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltPropertiesSelections.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 03bc7362e2cb51542bd50e3234883d00 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltProperty.cs b/Assets/AltTester/Runtime/AltDriver/Common/AltProperty.cs new file mode 100644 index 00000000..b1b094d7 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltProperty.cs @@ -0,0 +1,33 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public struct AltProperty + { + public string name; + public string value; + public AltType type; + + public AltProperty(string name, string value, AltType type) + { + this.name = name; + this.value = value; + this.type = type; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltProperty.cs.meta b/Assets/AltTester/Runtime/AltDriver/Common/AltProperty.cs.meta new file mode 100644 index 00000000..08261e3f --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltProperty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e8db748a79f1818478d15c36379b9cc4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltTextureInformation.cs b/Assets/AltTester/Runtime/AltDriver/Common/AltTextureInformation.cs new file mode 100644 index 00000000..abb5ee28 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltTextureInformation.cs @@ -0,0 +1,33 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public struct AltTextureInformation + { + public byte[] imageData; + public AltVector2 scaleDifference; + public AltVector3 textureSize; + + public AltTextureInformation(byte[] imageData, AltVector2 scaleDifference, AltVector3 textureSize) + { + this.imageData = imageData; + this.scaleDifference = scaleDifference; + this.textureSize = textureSize; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltTextureInformation.cs.meta b/Assets/AltTester/Runtime/AltDriver/Common/AltTextureInformation.cs.meta new file mode 100644 index 00000000..1cd45448 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltTextureInformation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 27bb07222f850a94b9ddb8b6bdc7cf3b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltType.cs b/Assets/AltTester/Runtime/AltDriver/Common/AltType.cs new file mode 100644 index 00000000..b612e3cb --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltType.cs @@ -0,0 +1,26 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public enum AltType + { + PRIMITIVE, + OBJECT, + ARRAY + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Common/AltType.cs.meta b/Assets/AltTester/Runtime/AltDriver/Common/AltType.cs.meta new file mode 100644 index 00000000..c13852e2 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Common/AltType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 632aee6667ab7de4491c355f9b5350bc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Communication.meta b/Assets/AltTester/Runtime/AltDriver/Communication.meta new file mode 100644 index 00000000..e9893a6e --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Communication.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 783070ce1051949e5b0896aae6e2fd33 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/BaseDriver.cs b/Assets/AltTester/Runtime/AltDriver/Communication/BaseDriver.cs new file mode 100644 index 00000000..5c3c1547 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Communication/BaseDriver.cs @@ -0,0 +1,82 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Diagnostics; +using AltTester.AltTesterUnitySDK.Driver.Logging; +using AltWebSocketSharp; + +namespace AltTester.AltTesterUnitySDK.Driver.Communication +{ + public class BaseDriver + { + protected static readonly NLog.Logger Logger = DriverLogManager.Instance.GetCurrentClassLogger(); + + protected DriverWebSocketClient WsClient = null; + + protected bool isRunning = false; + + public bool IsRunning { get { return this.isRunning; } } + public bool IsAlive { get { return this.WsClient != null && this.WsClient.IsAlive; } } + + public event EventHandler OnMessage; + public event EventHandler OnMessageData; + public event EventHandler OnCloseEvent; + protected string path; + + public BaseDriver(string path) + { + this.path = path; + } + + public void Close() + { + Logger.Info(string.Format("Closing connection to AltTester® on: '{0}'.", this.WsClient.URI)); + + this.isRunning = false; + this.WsClient.Close(); + } + + public void Connect(string host, int port, int connectTimeout = 60, string appName = "__default__", string platform = "unknown", string platformVersion = "unknown", string deviceInstanceId = "unknown", string appId = "unknown", string driverType = "unknown") + { + this.isRunning = false; + this.WsClient = new DriverWebSocketClient(host, port, path, appName, connectTimeout, platform, platformVersion, deviceInstanceId, appId, driverType); + this.WsClient.OnMessage += (sender, e) => + { + if (e.IsText) + { + if (e.Data.Contains("driverRegistered")) + { + WsClient.DriverRegisteredCalled = true; + return; + } + OnMessageData.Invoke(this, e.Data); + return; + } + this.OnMessage.Invoke(this, e.RawData); + }; + this.WsClient.OnCloseEvent += (sender, data) => + { + OnCloseEvent.Invoke(this, data); + }; + this.WsClient.Connect(); + } + + + + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/BaseDriver.cs.meta b/Assets/AltTester/Runtime/AltDriver/Communication/BaseDriver.cs.meta new file mode 100644 index 00000000..867087dd --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Communication/BaseDriver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: aa0c3af707b57bb4e9954f886eac3a74 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/DriverCommunicationHandler.cs b/Assets/AltTester/Runtime/AltDriver/Communication/DriverCommunicationHandler.cs new file mode 100644 index 00000000..dd20287a --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Communication/DriverCommunicationHandler.cs @@ -0,0 +1,380 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Threading; +using AltTester.AltTesterUnitySDK.Driver.Commands; +using AltTester.AltTesterUnitySDK.Driver.Logging; +using AltTester.AltTesterUnitySDK.Driver.Notifications; +using AltWebSocketSharp; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace AltTester.AltTesterUnitySDK.Driver.Communication +{ + public class DriverCommunicationHandler : IDriverCommunication + { + private static readonly NLog.Logger logger = DriverLogManager.Instance.GetCurrentClassLogger(); + + private readonly JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings + { + ContractResolver = new DefaultContractResolver(), + ReferenceLoopHandling = ReferenceLoopHandling.Ignore, + Culture = CultureInfo.InvariantCulture + }; + + private DriverWebSocketClient wsClient = null; + + private readonly string host; + private readonly int port; + private readonly string appName; + private readonly int connectTimeout; + private readonly string platform; + private readonly string platformVersion; + private readonly string deviceInstanceId; + private readonly string appId; + private readonly string driverType; + + private int commandTimeout = 60; + private float delayAfterCommand = 0; + private bool websocketClosedCalled = false; + private bool driverRegisteredCalled = false; + + private List messageIdTimeouts = new List(); + + private Dictionary> messages; + + private List> loadSceneCallbacks = new List>(); + private List> unloadSceneCallbacks = new List>(); + private List> logCallbacks = new List>(); + private List> applicationPausedCallbacks = new List>(); + + public DriverCommunicationHandler(string host, int port, int connectTimeout, string appName, string platform, string platformVersion, string deviceInstanceId, string appId, string driverType = "SDK") + { + this.host = host; + this.port = port; + this.appName = appName; + this.connectTimeout = connectTimeout; + this.platform = platform; + this.platformVersion = platformVersion; + this.deviceInstanceId = deviceInstanceId; + this.appId = appId; + this.driverType = driverType; + + this.messages = new Dictionary>(); + } + + public void Connect() + { + this.wsClient = new DriverWebSocketClient(this.host, this.port, "/altws", this.appName, this.connectTimeout, this.platform, this.platformVersion, this.deviceInstanceId, this.appId, this.driverType); + this.wsClient.OnMessage += (sender, e) => + { + OnMessage(sender, e.Data); + }; + this.wsClient.OnCloseEvent += (sender, e) => + { + websocketClosedCalled = true; + }; + + this.wsClient.Connect(); + websocketClosedCalled = false; + + } + + public T Recvall(CommandParams param) + { + Stopwatch watch = Stopwatch.StartNew(); + while (true) + { + while (!messages.ContainsKey(param.messageId) && commandTimeout >= watch.Elapsed.TotalSeconds && !websocketClosedCalled) + { + Thread.Sleep(10); + } + + if (websocketClosedCalled) + { + throw new AltException("Driver disconnected"); + } + if (commandTimeout < watch.Elapsed.TotalSeconds) + { + + messageIdTimeouts.Add(param.messageId); + throw new CommandResponseTimeoutException(); + } + Queue queue; + messages.TryGetValue(param.messageId, out queue); + if (queue == null) + { + throw new AltException(" Could not find the message"); + } + var message = queue.Dequeue(); + + if (queue.Count == 0) + { + messages.Remove(param.messageId); + } + + if (messageIdTimeouts.Contains(message.messageId)) + { + continue; + } + + if ((message.error == null || message.error.type != AltErrors.errorInvalidCommand) && (message.messageId != param.messageId || message.commandName != param.commandName)) + { + throw new AltRecvallMessageIdException(string.Format("Response received does not match command send. Expected {0}:{1}. Got {2}:{3}", param.commandName, param.messageId, message.commandName, message.messageId)); + } + + handleErrors(message.error); + if (message.data == null) + { + return default(T); + } + + try + { + return JsonConvert.DeserializeObject(message.data, jsonSerializerSettings); + } + catch (JsonReaderException) + { + throw new ResponseFormatException(typeof(T), message.data); + } + } + } + + public void Send(CommandParams param) + { + param.messageId = DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString(); + string message = JsonConvert.SerializeObject(param, jsonSerializerSettings); + this.wsClient.Send(message); + } + + public void Close() + { + + logger.Info(string.Format("Closing connection to AltTester® on: {0}", this.wsClient.URI)); + websocketClosedCalled = true; + this.wsClient.Close(); + } + + public void SetCommandTimeout(int timeout) + { + commandTimeout = timeout; + } + + protected void OnMessage(object sender, string data) + { + var message = JsonConvert.DeserializeObject(data, jsonSerializerSettings); + + if (message.isNotification) + { + handleNotification(message); + } + else + { + if (messages.ContainsKey(message.messageId)) + { + + Queue queue; + messages.TryGetValue(message.messageId, out queue); + queue.Enqueue(message); + } + else + { + var queue = new Queue(); + queue.Enqueue(message); + messages.Add(message.messageId, queue); + } + } + } + + private void handleNotification(CommandResponse message) + { + handleErrors(message.error); + + switch (message.commandName) + { + case "loadSceneNotification": + AltLoadSceneNotificationResultParams data = JsonConvert.DeserializeObject(message.data, jsonSerializerSettings); + foreach (var callback in loadSceneCallbacks) + { + callback(data); + } + break; + case "unloadSceneNotification": + string sceneName = JsonConvert.DeserializeObject(message.data, jsonSerializerSettings); + foreach (var callback in unloadSceneCallbacks) + { + callback(sceneName); + } + break; + case "logNotification": + AltLogNotificationResultParams data1 = JsonConvert.DeserializeObject(message.data, jsonSerializerSettings); + foreach (var callback in logCallbacks) + { + callback(data1); + } + break; + case "applicationPausedNotification": + bool data2 = JsonConvert.DeserializeObject(message.data, jsonSerializerSettings); + foreach (var callback in applicationPausedCallbacks) + { + callback(data2); + } + break; + case "driverRegistered": + wsClient.DriverRegisteredCalled = true; + break; + } + } + + private void handleErrors(CommandError error) + { + if (error == null) + { + return; + } + + logger.Debug(error.type + ": " + error.message); + logger.Debug(error.trace); + + switch (error.type) + { + case AltErrors.errorNotFound: + throw new NotFoundException(error.message); + case AltErrors.errorSceneNotFound: + throw new SceneNotFoundException(error.message); + case AltErrors.errorPropertyNotFound: + throw new PropertyNotFoundException(error.message); + case AltErrors.errorMethodNotFound: + throw new MethodNotFoundException(error.message); + case AltErrors.errorComponentNotFound: + throw new ComponentNotFoundException(error.message); + case AltErrors.errorAssemblyNotFound: + throw new AssemblyNotFoundException(error.message); + case AltErrors.errorCouldNotPerformOperation: + throw new CouldNotPerformOperationException(error.message); + case AltErrors.errorMethodWithGivenParametersNotFound: + throw new MethodWithGivenParametersNotFoundException(error.message); + case AltErrors.errorFailedToParseArguments: + throw new FailedToParseArgumentsException(error.message); + case AltErrors.errorInvalidParameterType: + throw new InvalidParameterTypeException(error.message); + case AltErrors.errorObjectWasNotFound: + throw new ObjectWasNotFoundException(error.message); + case AltErrors.errorPropertyNotSet: + throw new PropertyNotFoundException(error.message); + case AltErrors.errorNullReference: + throw new NullReferenceException(error.message); + case AltErrors.errorUnknownError: + throw new UnknownErrorException(error.message); + case AltErrors.errorFormatException: + throw new FormatException(error.message); + case AltErrors.errorInvalidPath: + throw new InvalidPathException(error.message); + case AltErrors.errorInvalidCommand: + throw new InvalidCommandException(error.message); + case AltErrors.errorInputModule: + throw new AltInputModuleException(error.message); + case AltErrors.errorCameraNotFound: + throw new AltCameraNotFoundException(error.message); + } + + logger.Debug(error.type + " is not handled by driver."); + throw new UnknownErrorException(error.message); + } + + public void AddNotificationListener(NotificationType notificationType, Action callback, bool overwrite) + { + switch (notificationType) + { + case NotificationType.LOADSCENE: + if (callback.GetType() != typeof(Action)) + { + throw new InvalidCastException(String.Format("callback must be of type: {0} and not {1}", typeof(Action), callback.GetType())); + } + if (overwrite) + loadSceneCallbacks.Clear(); + loadSceneCallbacks.Add(callback as Action); + break; + case NotificationType.UNLOADSCENE: + if (callback.GetType() != typeof(Action)) + { + throw new InvalidCastException(String.Format("callback must be of type: {0} and not {1}", typeof(Action), callback.GetType())); + } + if (overwrite) + unloadSceneCallbacks.Clear(); + unloadSceneCallbacks.Add(callback as Action); + break; + case NotificationType.LOG: + if (callback.GetType() != typeof(Action)) + { + throw new InvalidCastException(String.Format("callback must be of type: {0} and not {1}", typeof(Action), callback.GetType())); + } + if (overwrite) + logCallbacks.Clear(); + logCallbacks.Add(callback as Action); + break; + case NotificationType.APPLICATION_PAUSED: + if (callback.GetType() != typeof(Action)) + { + throw new InvalidCastException(String.Format("callback must be of type: {0} and not {1}", typeof(Action), callback.GetType())); + } + if (overwrite) + applicationPausedCallbacks.Clear(); + applicationPausedCallbacks.Add(callback as Action); + break; + } + } + + public void RemoveNotificationListener(NotificationType notificationType) + { + switch (notificationType) + { + case NotificationType.LOADSCENE: + loadSceneCallbacks.Clear(); + break; + case NotificationType.UNLOADSCENE: + unloadSceneCallbacks.Clear(); + break; + case NotificationType.LOG: + logCallbacks.Clear(); + break; + case NotificationType.APPLICATION_PAUSED: + applicationPausedCallbacks.Clear(); + break; + } + } + + public void SetDelayAfterCommand(float delay) + { + delayAfterCommand = delay; + } + + public float GetDelayAfterCommand() + { + return delayAfterCommand; + } + + public void SleepFor(float time) + { + Utils.SleepFor(time); + } + } +} \ No newline at end of file diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/DriverCommunicationHandler.cs.meta b/Assets/AltTester/Runtime/AltDriver/Communication/DriverCommunicationHandler.cs.meta new file mode 100644 index 00000000..81855cb2 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Communication/DriverCommunicationHandler.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8bb318bb4fff545f2bf135e7caf8dba6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/DriverWebSocketClient.cs b/Assets/AltTester/Runtime/AltDriver/Communication/DriverWebSocketClient.cs new file mode 100644 index 00000000..e5419365 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Communication/DriverWebSocketClient.cs @@ -0,0 +1,221 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Diagnostics; +using System.Threading; +using AltTester.AltTesterUnitySDK.Driver; +using AltTester.AltTesterUnitySDK.Driver.Logging; +using AltTester.AltTesterUnitySDK.Driver.Proxy; +using AltWebSocketSharp; + +namespace AltTester.AltTesterUnitySDK.Driver.Communication +{ + public class DriverWebSocketClient + { + private static readonly NLog.Logger logger = DriverLogManager.Instance.GetCurrentClassLogger(); + + private readonly string host; + private readonly int port; + private readonly string uri; + private readonly string appName; + private readonly int connectTimeout; + private readonly string platform; + private readonly string platformVersion; + private readonly string deviceInstanceId; + private string appId; + private string driverType; + + private String error = null; + + private int closeCode = 0; + private string closeReason = null; + + private ClientWebSocket wsClient = null; + public event EventHandler OnMessage; + public event EventHandler OnCloseEvent; + + public bool IsAlive { get { return this.wsClient != null && this.wsClient.IsAlive; } } + public string URI { get { return this.uri; } } + public bool DriverRegisteredCalled = false; + + public DriverWebSocketClient(string host, int port, string path, string appName, int connectTimeout, string platform, string platformVersion, string deviceInstanceId, string appId, string driverType) + { + this.host = host; + this.port = port; + this.appName = appName; + this.connectTimeout = connectTimeout; + this.platform = platform; + this.platformVersion = platformVersion; + this.deviceInstanceId = deviceInstanceId; + this.appId = appId; + this.driverType = driverType; + + this.error = null; + this.closeCode = 0; + this.closeReason = null; + + this.uri = Utils.CreateURI(host, port, path, appName, platform, platformVersion, deviceInstanceId, appId, driverType).ToString(); + } + + private void CheckCloseMessage() + { + if (this.closeCode != 0 && this.closeReason != null) + { + if (this.closeCode == 4001) + { + throw new NoAppConnectedException(this.closeReason); + } + + if (this.closeCode == 4002) + { + throw new AppDisconnectedException(this.closeReason); + } + + if (this.closeCode == 4005) + { + throw new MultipleDriversException(this.closeReason); + } + if (closeCode == 4007) + { + throw new MultipleDriversTryingToConnectException(closeReason); + } + + throw new ConnectionException(string.Format("Connection closed by AltTester® Server with reason: {0}.", this.closeReason)); + } + } + + private void CheckError() + { + if (this.error != null) + { + throw new ConnectionException(this.error); + } + } + + protected void OnError(object sender, AltWebSocketSharp.ErrorEventArgs e) + { + logger.Error(e.Message); + if (e.Exception != null) + { + logger.Error(e.Exception); + } + + this.error = e.Message; + } + + protected void OnClose(object sender, CloseEventArgs e) + { + logger.Debug("Connection to AltTester® Server closed: [Code:{0}, Reason:{1}].", e.Code, e.Reason); + OnCloseEvent.Invoke(this, e); + DriverRegisteredCalled = false; + this.closeCode = e.Code; + this.closeReason = e.Reason; + } + + public void Connect() + { + logger.Info("Connecting to: '{0}'.", this.uri); + + int delay = 100; + + this.wsClient = new ClientWebSocket(this.uri); + + string proxyUri = new ProxyFinder().GetProxy(string.Format("http://{0}:{1}", this.host, this.port), this.host); + if (proxyUri != null) + { + wsClient.SetProxy(proxyUri, null, null); + } + + this.wsClient.OnError += OnError; + this.wsClient.OnClose += OnClose; + this.wsClient.OnMessage += (sender, message) => this.OnMessage.Invoke(this, message); + + Stopwatch watch = Stopwatch.StartNew(); + int retries = 0; + + while (this.connectTimeout > watch.Elapsed.TotalSeconds) + { + this.error = null; + this.closeCode = 0; + this.closeReason = null; + + if (retries > 0) + { + logger.Debug(string.Format("Retrying #{0} to connect to: '{1}'.", retries, this.uri)); + } + + try + { + wsClient.Connect(); + } + catch (Exception e) + { + logger.Debug(string.Format("Connection error: {0}", e.Message)); + } + float waitForNotification = 0; + try + { + while (waitForNotification < 5000) + { + if (DriverRegisteredCalled) + { + logger.Debug(string.Format("Connected to: '{0}'.", this.uri)); + return; + } + Thread.Sleep(delay); + waitForNotification += delay; + this.CheckCloseMessage(); + } + } + catch (Exception e) + { + logger.Debug($"Closed connection because {e}"); + } + retries++; + } + + this.CheckCloseMessage(); + this.CheckError(); + + if (watch.Elapsed.TotalSeconds > this.connectTimeout && !wsClient.IsAlive) + { + throw new ConnectionTimeoutException(string.Format("Failed to connect to AltTester® Server on host: {0} port: {1}.", this.host, this.port)); + } + logger.Debug(string.Format("Connected to: '{0}'.", this.uri)); + + } + + public void Close() + { + logger.Info(string.Format("Closing connection to AltTester® Server on: '{0}'.", this.uri)); + DriverRegisteredCalled = false; + this.wsClient.Close(); + } + + public void Send(string message) + { + if (!this.IsAlive) + { + logger.Warn("The connection is already closed."); + return; + } + + this.wsClient.Send(message); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/DriverWebSocketClient.cs.meta b/Assets/AltTester/Runtime/AltDriver/Communication/DriverWebSocketClient.cs.meta new file mode 100644 index 00000000..2489eec1 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Communication/DriverWebSocketClient.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a55337c82961c4d2b958e866037fea94 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/GetConnectedAppDriver.cs b/Assets/AltTester/Runtime/AltDriver/Communication/GetConnectedAppDriver.cs new file mode 100644 index 00000000..45295020 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Communication/GetConnectedAppDriver.cs @@ -0,0 +1,32 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Communication +{ + public class GetConnectedAppDriver : BaseDriver + { + private new string path = "/altws/connected-app"; + + public GetConnectedAppDriver(string path) : base(path) + { + } + public void Send() + { + WsClient.Send("GetApps"); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/GetConnectedAppDriver.cs.meta b/Assets/AltTester/Runtime/AltDriver/Communication/GetConnectedAppDriver.cs.meta new file mode 100644 index 00000000..afe152ab --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Communication/GetConnectedAppDriver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2f6f70059484361488cd6a8686d1ac37 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/IDriverCommunication.cs b/Assets/AltTester/Runtime/AltDriver/Communication/IDriverCommunication.cs new file mode 100644 index 00000000..8fc62460 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Communication/IDriverCommunication.cs @@ -0,0 +1,36 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using AltTester.AltTesterUnitySDK.Driver.Notifications; + +namespace AltTester.AltTesterUnitySDK.Driver.Commands +{ + public interface IDriverCommunication + { + void Send(CommandParams param); + T Recvall(CommandParams param); + void AddNotificationListener(NotificationType notificationType, Action callback, bool overwrite); + void RemoveNotificationListener(NotificationType notificationType); + void Connect(); + void Close(); + void SetCommandTimeout(int timeout); + void SetDelayAfterCommand(float delay); + float GetDelayAfterCommand(); + void SleepFor(float time); + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/IDriverCommunication.cs.meta b/Assets/AltTester/Runtime/AltDriver/Communication/IDriverCommunication.cs.meta new file mode 100644 index 00000000..f62ef54a --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Communication/IDriverCommunication.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 14340a274d45041cfad7c0ba43c90471 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/LiveUpdateDriver.cs b/Assets/AltTester/Runtime/AltDriver/Communication/LiveUpdateDriver.cs new file mode 100644 index 00000000..dd0d87c2 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Communication/LiveUpdateDriver.cs @@ -0,0 +1,54 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Threading; +using Newtonsoft.Json; + +namespace AltTester.AltTesterUnitySDK.Driver.Communication +{ + + public class LiveUpdateDriver : BaseDriver + { + public LiveUpdateDriver(string path) : base(path) + { + } + public void Start() + { + this.WsClient.Send("Start"); + this.isRunning = true; + } + + public void Stop() + { + this.WsClient.Send("Stop"); + this.isRunning = false; + } + + public void UpdateFrameRate(int frameRate) + { + this.WsClient.Send(string.Format("FrameRate:{0}", frameRate)); + } + + public void UpdateQuality(int quality) + { + this.WsClient.Send(string.Format("Quality:{0}", quality)); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/LiveUpdateDriver.cs.meta b/Assets/AltTester/Runtime/AltDriver/Communication/LiveUpdateDriver.cs.meta new file mode 100644 index 00000000..c0b97b59 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Communication/LiveUpdateDriver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 09fdd6df051f140d3a078418b423d84e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/Utils.cs b/Assets/AltTester/Runtime/AltDriver/Communication/Utils.cs new file mode 100644 index 00000000..fd86cb7d --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Communication/Utils.cs @@ -0,0 +1,67 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Threading; + +namespace AltTester.AltTesterUnitySDK.Driver.Communication +{ + public class Utils + { + public static Uri CreateURI(string host, int port, string path, string appName, string platform, string platformVersion, string deviceInstanceId, string appId = null, string driverType = "SDK") + { + Uri uri; + if (string.IsNullOrEmpty(appId)) + { + if (!Uri.TryCreate(string.Format("ws://{0}:{1}{2}?appName={3}&platform={4}&platformVersion={5}&deviceInstanceId={6}&driverType={7}", host, port, path, Uri.EscapeDataString(appName), Uri.EscapeDataString(platform), Uri.EscapeDataString(platformVersion), Uri.EscapeDataString(deviceInstanceId), Uri.EscapeDataString(driverType)), UriKind.Absolute, out uri)) + { + throw new Exception(String.Format("Invalid host or port {0}:{1}{2}", host, port, path)); + } + } + else + { + if (!Uri.TryCreate(string.Format("ws://{0}:{1}{2}?appName={3}&platform={4}&platformVersion={5}&deviceInstanceId={6}&appId={7}&driverType={8}", host, port, path, Uri.EscapeDataString(appName), Uri.EscapeDataString(platform), Uri.EscapeDataString(platformVersion), Uri.EscapeDataString(deviceInstanceId), Uri.EscapeDataString(appId), Uri.EscapeDataString(driverType)), UriKind.Absolute, out uri)) + { + throw new Exception(String.Format("Invalid host or port {0}:{1}{2}", host, port, path)); + } + } + + + return uri; + } + + public static void SleepFor(float time) + { + Thread.Sleep(System.Convert.ToInt32(time * 1000)); + } + + public static string TrimLog(string log, int maxLogLength = 1000) + { + if (string.IsNullOrEmpty(log)) + { + return log; + } + + if (log.Length <= maxLogLength) + { + return log; + } + + return log.Substring(0, maxLogLength) + "[...]"; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Communication/Utils.cs.meta b/Assets/AltTester/Runtime/AltDriver/Communication/Utils.cs.meta new file mode 100644 index 00000000..35cca4b1 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Communication/Utils.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c22ac1cc9e1a442e0b283b3d62280a3d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Logging.meta b/Assets/AltTester/Runtime/AltDriver/Logging.meta new file mode 100644 index 00000000..938c5dcd --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Logging.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fd5544f1a9587764ab347b3609eeb29c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Logging/AltLogLevel.cs b/Assets/AltTester/Runtime/AltDriver/Logging/AltLogLevel.cs new file mode 100644 index 00000000..bebf46ea --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Logging/AltLogLevel.cs @@ -0,0 +1,33 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + + +namespace AltTester.AltTesterUnitySDK.Driver.Logging +{ + public enum AltLogLevel + { + Trace = 0, + Debug = 1, + Info = 2, + Warn = 3, + Error = 4, + Fatal = 5, + Off = 6, + } + + +} diff --git a/Assets/AltTester/Runtime/AltDriver/Logging/AltLogLevel.cs.meta b/Assets/AltTester/Runtime/AltDriver/Logging/AltLogLevel.cs.meta new file mode 100644 index 00000000..10e75fb3 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Logging/AltLogLevel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6c7ac9af279a526469a40314ed29348b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Logging/AltLogLevelExtensions.cs b/Assets/AltTester/Runtime/AltDriver/Logging/AltLogLevelExtensions.cs new file mode 100644 index 00000000..a914ad20 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Logging/AltLogLevelExtensions.cs @@ -0,0 +1,29 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using NLog; + +namespace AltTester.AltTesterUnitySDK.Driver.Logging +{ + public static class AltLogLevelExtensions + { + public static LogLevel ToNLogLevel(this AltLogLevel logLevel) + { + return LogLevel.FromOrdinal((int)logLevel); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Logging/AltLogLevelExtensions.cs.meta b/Assets/AltTester/Runtime/AltDriver/Logging/AltLogLevelExtensions.cs.meta new file mode 100644 index 00000000..6e7110c3 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Logging/AltLogLevelExtensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6b326f421fcdb704fb0056beac04cae7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Logging/AltLogger.cs b/Assets/AltTester/Runtime/AltDriver/Logging/AltLogger.cs new file mode 100644 index 00000000..3c398b6e --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Logging/AltLogger.cs @@ -0,0 +1,26 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Logging +{ + public enum AltLogger + { + File = 0, + Unity = 1, + Console = 2 + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Logging/AltLogger.cs.meta b/Assets/AltTester/Runtime/AltDriver/Logging/AltLogger.cs.meta new file mode 100644 index 00000000..f80712ea --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Logging/AltLogger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 98d68279c8de207448a374786fef4263 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Logging/DriverLogManager.cs b/Assets/AltTester/Runtime/AltDriver/Logging/DriverLogManager.cs new file mode 100644 index 00000000..bc8afa63 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Logging/DriverLogManager.cs @@ -0,0 +1,134 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Collections.Generic; +using System.IO; +using NLog; +using NLog.Config; +using NLog.Layouts; +using NLog.Targets; + +namespace AltTester.AltTesterUnitySDK.Driver.Logging +{ + public class DriverLogManager + { + const string LOGSFILEPATH = "AltTester.log"; + + public static LogFactory Instance { get { return instance.Value; } } + + private static readonly Lazy instance = new Lazy(buildLogFactory); + + internal static void SetupAltDriverLogging(Dictionary minLogLevels) + { + foreach (var key in minLogLevels.Keys) + { + SetMinLogLevel(key, minLogLevels[key]); + } + + Instance.GetCurrentClassLogger().Info(AltLogLevel.Info.ToNLogLevel()); + AltLogLevel level; + if (minLogLevels.TryGetValue(AltLogger.File, out level) && level != AltLogLevel.Off) + Instance.GetCurrentClassLogger().Info("AltTester® logs are saved at: " + Path.Combine(System.Environment.CurrentDirectory, LOGSFILEPATH)); + } + + /// + /// Reconfigures the NLog logging level. + /// + /// The to be set. + public static void SetMinLogLevel(AltLogger loggerType, AltLogLevel minLogLevel) + { + + foreach (var rule in Instance.Configuration.LoggingRules) + { + if (rule.Targets[0].Name == string.Format("AltDriver{0}Target", loggerType)) + { + if (minLogLevel == AltLogLevel.Off) + { + rule.SetLoggingLevels(LogLevel.Off, LogLevel.Off); + } + else + { + rule.SetLoggingLevels(minLogLevel.ToNLogLevel(), LogLevel.Fatal); + } + } + } + + Instance.ReconfigExistingLoggers(); + } + + public static void ResumeLogging() + { + Instance.ResumeLogging(); + } + + public static void SuspendLogging() + { + Instance.SuspendLogging(); + } + + public static bool IsLoggingEnabled() + { + return Instance.IsLoggingEnabled(); + } + + public static void StopLogging() + { + while (IsLoggingEnabled()) + SuspendLogging(); + } + + private static LogFactory buildLogFactory() + { + var config = new LoggingConfiguration(); + +#if UNITY_EDITOR || ALTTESTER + var unityTarget = new UnityTarget("AltDriverUnityTarget") + { + Layout = Layout.FromString("${longdate}|Driver|${level:uppercase=true}|${message}"), + }; + config.AddRuleForOneLevel(LogLevel.Off, unityTarget); + config.LoggingRules[config.LoggingRules.Count - 1].RuleName = "AltServerUnityRule"; +#else + var consoleTarget = new ConsoleTarget("AltDriverConsoleTarget") + { + Layout = Layout.FromString("${longdate}|${level:uppercase=true}|${message}") + }; + config.AddRuleForOneLevel(LogLevel.Off, consoleTarget); + config.LoggingRules[config.LoggingRules.Count - 1].RuleName = "AltServerConsoleRule"; +#endif + var path = Path.Combine(System.Environment.CurrentDirectory, LOGSFILEPATH); + var logfile = new FileTarget("AltDriverFileTarget") + { + FileName = path, + Layout = Layout.FromString("${longdate}|${level:uppercase=true}|${message}"), + DeleteOldFileOnStartup = true, //overwrite existing log file. + KeepFileOpen = true, + ConcurrentWrites = false + }; + config.AddRuleForOneLevel(LogLevel.Debug, logfile); + config.LoggingRules[config.LoggingRules.Count - 1].RuleName = "AltServerFileRule"; + + LogFactory logFactory = new LogFactory + { + Configuration = config, + AutoShutdown = true + }; + return logFactory; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Logging/DriverLogManager.cs.meta b/Assets/AltTester/Runtime/AltDriver/Logging/DriverLogManager.cs.meta new file mode 100644 index 00000000..88a0511d --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Logging/DriverLogManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 03790dc916ec7224fae16cdc174d9c90 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Logging/UnityTarget.cs b/Assets/AltTester/Runtime/AltDriver/Logging/UnityTarget.cs new file mode 100644 index 00000000..8bfca207 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Logging/UnityTarget.cs @@ -0,0 +1,57 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#if UNITY_EDITOR || ALTTESTER +using NLog; +using NLog.Targets; +using UnityEngine; + +namespace AltTester.AltTesterUnitySDK.Driver.Logging +{ + /// An appender which logs to the unity console. + public class UnityTarget : TargetWithLayout + { + public UnityTarget(string name) + { + this.Name = name; + } + /// + protected override void Write(LogEventInfo logEvent) + { + string message = this.Layout.Render(logEvent); + + if (logEvent.Level >= LogLevel.Error) + { + // everything above or equal to error is an error + Debug.LogError(message); + } + else if (logEvent.Level >= LogLevel.Warn) + { + // everything that is a warning up to error is logged as warning + Debug.LogWarning(message); + } + else + { + // everything else we'll just log normally + Debug.Log(message); + } + } + + } + +} +#endif diff --git a/Assets/AltTester/Runtime/AltDriver/Logging/UnityTarget.cs.meta b/Assets/AltTester/Runtime/AltDriver/Logging/UnityTarget.cs.meta new file mode 100644 index 00000000..8b743980 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Logging/UnityTarget.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 41bd57b20af2391448d8d511d8e89b18 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Notifications.meta b/Assets/AltTester/Runtime/AltDriver/Notifications.meta new file mode 100644 index 00000000..3c0b33f2 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Notifications.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5361c82b649b1164f94152d5d865c3ad +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Notifications/AltLoadSceneMode.cs b/Assets/AltTester/Runtime/AltDriver/Notifications/AltLoadSceneMode.cs new file mode 100644 index 00000000..33823314 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Notifications/AltLoadSceneMode.cs @@ -0,0 +1,27 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver.Notifications +{ + public enum AltLoadSceneMode + { + + Single = 0, + + Additive = 1 + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Notifications/AltLoadSceneMode.cs.meta b/Assets/AltTester/Runtime/AltDriver/Notifications/AltLoadSceneMode.cs.meta new file mode 100644 index 00000000..86a95307 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Notifications/AltLoadSceneMode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0677ab2eea893a844a563fe86e52664b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Notifications/AltLoadSceneNotificationResultParams.cs b/Assets/AltTester/Runtime/AltDriver/Notifications/AltLoadSceneNotificationResultParams.cs new file mode 100644 index 00000000..22d29cc3 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Notifications/AltLoadSceneNotificationResultParams.cs @@ -0,0 +1,32 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + + +namespace AltTester.AltTesterUnitySDK.Driver.Notifications +{ + public class AltLoadSceneNotificationResultParams + { + public string sceneName; + public AltLoadSceneMode loadSceneMode; + + public AltLoadSceneNotificationResultParams(string sceneName, AltLoadSceneMode loadSceneMode) + { + this.sceneName = sceneName; + this.loadSceneMode = loadSceneMode; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Notifications/AltLoadSceneNotificationResultParams.cs.meta b/Assets/AltTester/Runtime/AltDriver/Notifications/AltLoadSceneNotificationResultParams.cs.meta new file mode 100644 index 00000000..0d923bee --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Notifications/AltLoadSceneNotificationResultParams.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b926785747e84384fad93ecd29684558 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Notifications/AltLogNotificationResultParams.cs b/Assets/AltTester/Runtime/AltDriver/Notifications/AltLogNotificationResultParams.cs new file mode 100644 index 00000000..6f568916 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Notifications/AltLogNotificationResultParams.cs @@ -0,0 +1,35 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using AltTester.AltTesterUnitySDK.Driver.Logging; + +namespace AltTester.AltTesterUnitySDK.Driver.Notifications +{ + public class AltLogNotificationResultParams + { + public string message; + public string stackTrace; + public AltLogLevel level; + + public AltLogNotificationResultParams(string message, string stackTrace, AltLogLevel level) + { + this.message = message; + this.stackTrace = stackTrace; + this.level = level; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Notifications/AltLogNotificationResultParams.cs.meta b/Assets/AltTester/Runtime/AltDriver/Notifications/AltLogNotificationResultParams.cs.meta new file mode 100644 index 00000000..413849b8 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Notifications/AltLogNotificationResultParams.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 59ddd3c86241c0041b6b69985f9a0a8c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Notifications/BaseNotificationCallBacks.cs b/Assets/AltTester/Runtime/AltDriver/Notifications/BaseNotificationCallBacks.cs new file mode 100644 index 00000000..9176d7e9 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Notifications/BaseNotificationCallBacks.cs @@ -0,0 +1,43 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using AltTester.AltTesterUnitySDK.Driver.Logging; + +namespace AltTester.AltTesterUnitySDK.Driver.Notifications +{ + public class BaseNotificationCallBacks : INotificationCallbacks + { + private static readonly NLog.Logger logger = DriverLogManager.Instance.GetCurrentClassLogger(); + public void SceneLoadedCallback(AltLoadSceneNotificationResultParams altLoadSceneNotificationResultParams) + { + logger.Log(NLog.LogLevel.Info, String.Format("Scene {0} was loaded {1}", altLoadSceneNotificationResultParams.sceneName, altLoadSceneNotificationResultParams.loadSceneMode.ToString())); + } + public void SceneUnloadedCallback(string sceneName) + { + logger.Log(NLog.LogLevel.Info, String.Format("Scene {0} was unloaded", sceneName)); + } + public void LogCallback(AltLogNotificationResultParams altLogNotificationResultParams) + { + logger.Log(NLog.LogLevel.Info, String.Format("Log of type {0} with message {1} was received", altLogNotificationResultParams.level, altLogNotificationResultParams.message)); + } + public void ApplicationPausedCallback(bool applicationPaused) + { + logger.Log(NLog.LogLevel.Info, String.Format("Application paused: {0}", applicationPaused)); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Notifications/BaseNotificationCallBacks.cs.meta b/Assets/AltTester/Runtime/AltDriver/Notifications/BaseNotificationCallBacks.cs.meta new file mode 100644 index 00000000..90446b65 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Notifications/BaseNotificationCallBacks.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 029a368c1a5369a4ea1a987251e07767 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Notifications/INotificationCallbacks.cs b/Assets/AltTester/Runtime/AltDriver/Notifications/INotificationCallbacks.cs new file mode 100644 index 00000000..6dc1964a --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Notifications/INotificationCallbacks.cs @@ -0,0 +1,28 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + + +namespace AltTester.AltTesterUnitySDK.Driver.Notifications +{ + public interface INotificationCallbacks + { + void SceneLoadedCallback(AltLoadSceneNotificationResultParams altLoadSceneNotificationResultParams); + void SceneUnloadedCallback(string sceneName); + void LogCallback(AltLogNotificationResultParams altLogNotificationResultParams); + void ApplicationPausedCallback(bool applicationPaused); + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Notifications/INotificationCallbacks.cs.meta b/Assets/AltTester/Runtime/AltDriver/Notifications/INotificationCallbacks.cs.meta new file mode 100644 index 00000000..8f5f67d5 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Notifications/INotificationCallbacks.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 521b3bf8eda103846ba186978c73589e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Notifications/NotificationType.cs b/Assets/AltTester/Runtime/AltDriver/Notifications/NotificationType.cs new file mode 100644 index 00000000..028b70a8 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Notifications/NotificationType.cs @@ -0,0 +1,28 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +namespace AltTester.AltTesterUnitySDK.Driver.Notifications +{ + public enum NotificationType + { + LOADSCENE = 0, + UNLOADSCENE = 1, + LOG = 2, + APPLICATION_PAUSED = 3 + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Notifications/NotificationType.cs.meta b/Assets/AltTester/Runtime/AltDriver/Notifications/NotificationType.cs.meta new file mode 100644 index 00000000..94723539 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Notifications/NotificationType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3d7b8b7e5da248f4995d7474935a085b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy.meta b/Assets/AltTester/Runtime/AltDriver/Proxy.meta new file mode 100644 index 00000000..70d28808 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 806bb1d231a4a4e09b8234580da084d4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/AndroidProxyFinder.cs b/Assets/AltTester/Runtime/AltDriver/Proxy/AndroidProxyFinder.cs new file mode 100644 index 00000000..65146e04 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/AndroidProxyFinder.cs @@ -0,0 +1,39 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#if !UNITY_EDITOR && UNITY_ANDROID +using System; +using UnityEngine; + +namespace AltTester.AltTesterUnitySDK.Driver.Proxy +{ + public class AndroidProxyFinder : IProxyFinder + { + public string GetProxy(string uri, string host) + { + return CallJavaGetProxy(uri); + } + + private string CallJavaGetProxy(string uri) + { + using (var JavaClass = new AndroidJavaClass("com.alttester.utils.AltProxyFinder")) { + return JavaClass.CallStatic("getProxy", uri); + } + } + } +} +#endif diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/AndroidProxyFinder.cs.meta b/Assets/AltTester/Runtime/AltDriver/Proxy/AndroidProxyFinder.cs.meta new file mode 100644 index 00000000..1a61b31e --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/AndroidProxyFinder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a5181063236cb4e7db9bfdea22ebef41 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/DotnetProxyFinder.cs b/Assets/AltTester/Runtime/AltDriver/Proxy/DotnetProxyFinder.cs new file mode 100644 index 00000000..4ec0b84e --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/DotnetProxyFinder.cs @@ -0,0 +1,40 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; + +namespace AltTester.AltTesterUnitySDK.Driver.Proxy +{ + public class DotnetProxyFinder : IProxyFinder + { + public string GetProxy(string uri, string host) + { + var Proxy = System.Net.WebRequest.GetSystemWebProxy() as System.Net.WebProxy; + if (Proxy != null && Proxy.Address != null) + { + string proxyUri = Proxy.GetProxy(new Uri(uri)).ToString(); + + if (proxyUri != uri) + { + return proxyUri; + } + } + + return null; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/DotnetProxyFinder.cs.meta b/Assets/AltTester/Runtime/AltDriver/Proxy/DotnetProxyFinder.cs.meta new file mode 100644 index 00000000..e9ae07fa --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/DotnetProxyFinder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 45ae63197f1314b6387d0a5291cb3f98 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/EnvironmentProxyFinder.cs b/Assets/AltTester/Runtime/AltDriver/Proxy/EnvironmentProxyFinder.cs new file mode 100644 index 00000000..d66be4d8 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/EnvironmentProxyFinder.cs @@ -0,0 +1,58 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Linq; + +namespace AltTester.AltTesterUnitySDK.Driver.Proxy +{ + public class EnvironmentProxyFinder : IProxyFinder + { + public string GetProxy(string uri, string host) + { + // TODO: Check HTTPS_PROXY if we use wss + string proxyUrl = GetEnv("HTTP_PROXY"); + + if (proxyUrl == null) + { + proxyUrl = GetEnv("ALL_PROXY"); + } + + if (proxyUrl != null) + { + string exceptions = GetEnv("NO_PROXY"); + + if (!string.IsNullOrEmpty(exceptions)) + { + var exceptionsList = exceptions.Split(';').ToList(); + + if (exceptionsList.Contains(proxyUrl)) + { + return null; + } + } + } + + return proxyUrl; + } + + private string GetEnv(string key) + { + return System.Environment.GetEnvironmentVariable(key) ?? System.Environment.GetEnvironmentVariable(key.ToLowerInvariant()); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/EnvironmentProxyFinder.cs.meta b/Assets/AltTester/Runtime/AltDriver/Proxy/EnvironmentProxyFinder.cs.meta new file mode 100644 index 00000000..f55d9b06 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/EnvironmentProxyFinder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3722f2d5e04e8433290b974303d42fba +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/IOSProxyFinder.cs b/Assets/AltTester/Runtime/AltDriver/Proxy/IOSProxyFinder.cs new file mode 100644 index 00000000..450c6e2b --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/IOSProxyFinder.cs @@ -0,0 +1,44 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#if !UNITY_EDITOR && UNITY_IOS +using System; +using System.Runtime.InteropServices; +using System.Globalization; +using UnityEngine; + +namespace AltTester.AltTesterUnitySDK.Driver.Proxy +{ + public class IOSProxyFinder : IProxyFinder + { + [DllImport("__Internal")] + private static extern string _getProxy(string uri, string host); + + public string GetProxy(string uri, string host) + { + var result = _getProxy(uri, host); + + if (string.IsNullOrEmpty(result)) + { + return null; + } + + return result; + } + } +} +#endif diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/IOSProxyFinder.cs.meta b/Assets/AltTester/Runtime/AltDriver/Proxy/IOSProxyFinder.cs.meta new file mode 100644 index 00000000..5f875251 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/IOSProxyFinder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 92aaab98d3302482788bc01317279dc0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/IProxyFinder.cs b/Assets/AltTester/Runtime/AltDriver/Proxy/IProxyFinder.cs new file mode 100644 index 00000000..14e2795b --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/IProxyFinder.cs @@ -0,0 +1,32 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; + +namespace AltTester.AltTesterUnitySDK.Driver.Proxy +{ + public interface IProxyFinder + { + /// + /// Finds the appropriate proxy server for the specified URL and host. + /// + /// The URL for which the proxy server needs to be determined. + /// The host associated with the URL. This is only for convenience; it is the same string as between :// and the first : or / after that. + /// The proxy server uri. If the string is null, no proxies should be used. + string GetProxy(string uri, string host); + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/IProxyFinder.cs.meta b/Assets/AltTester/Runtime/AltDriver/Proxy/IProxyFinder.cs.meta new file mode 100644 index 00000000..8b8e19fd --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/IProxyFinder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 78a3e3e03bed1486498869a8a5a53b39 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins.meta b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins.meta new file mode 100644 index 00000000..7373841d --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 943b305c1d8ae4002ad56193b298a62f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/Android.meta b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/Android.meta new file mode 100644 index 00000000..1567b5e2 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/Android.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ec3a4eff9376a49068b43d3bd46437ee +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/Android/AltProxyFinder.java b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/Android/AltProxyFinder.java new file mode 100644 index 00000000..14fc7040 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/Android/AltProxyFinder.java @@ -0,0 +1,31 @@ +package com.alttester.utils; + +import java.util.Iterator; +import java.util.List; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.ProxySelector; +import java.net.URI; + +public class AltProxyFinder { + public static String getProxy(String uri) { + try { + System.setProperty("java.net.useSystemProxies", "true"); + + List proxies = ProxySelector.getDefault().select(new URI(uri)); + + for (Iterator iter = proxies.iterator(); iter.hasNext(); ) { + Proxy proxy = iter.next(); + InetSocketAddress address = (InetSocketAddress) proxy.address(); + + if (address != null) { + return String.format("%s://%s:%s", proxy.type(), address.getHostName(), address.getPort()); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + + return null; + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/Android/AltProxyFinder.java.meta b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/Android/AltProxyFinder.java.meta new file mode 100644 index 00000000..f59f1d40 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/Android/AltProxyFinder.java.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 48a641762d28c47ee820456c2f267ad7 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Android: Android + second: + enabled: 1 + settings: {} + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS.meta b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS.meta new file mode 100644 index 00000000..b4ba9f2e --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 648c3ae1151bd4c79a9facafbd0e04bc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder.meta b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder.meta new file mode 100644 index 00000000..a1149425 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2f254fb3492834e74bda677f9c718065 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source.meta b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source.meta new file mode 100644 index 00000000..87a8d13e --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 290cbebab177c421ab69ec9b36d9ebbf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/AltProxyFinder.swift b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/AltProxyFinder.swift new file mode 100644 index 00000000..283909e9 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/AltProxyFinder.swift @@ -0,0 +1,84 @@ +import Foundation +import JavaScriptCore + +@objc public class AltProxyFinder: NSObject { + @objc public static let shared = AltProxyFinder() + + @objc public func swiftGetProxy(_ destinationUrl: String, destinationHost: String) -> String { + guard let systemProxySettings = CFNetworkCopySystemProxySettings()?.takeUnretainedValue() as? [String: Any] else { + return "" + } + + let proxyAutoConfigEnable = systemProxySettings["ProxyAutoConfigEnable"] as? Int ?? 0 + + if proxyAutoConfigEnable == 1 { + guard let pacUrl = systemProxySettings["ProxyAutoConfigURLString"] as? String, + let url = URL(string: pacUrl) else { + return "" + } + + var proxyUrl = "" + + let semaphore = DispatchSemaphore(value: 0) + + let task = URLSession.shared.dataTask(with: url) { data, response, error in + defer { + semaphore.signal() + } + + if let data = data { + if var pacContent = String(data: data, encoding: .utf8) { + // Workaround for BrowserStack with Forced Local mode. + // An issue arises where, instead of receiving the expected PAC file, an error page is returned, + // parsing which would lead to a crash in the application. + pacContent = pacContent.trimmingCharacters(in: .whitespacesAndNewlines) + if (pacContent.starts(with:"")) { + return + } + + let proxies = CFNetworkCopyProxiesForAutoConfigurationScript(pacContent as CFString, CFURLCreateWithString(kCFAllocatorDefault, destinationUrl as CFString, nil), nil)!.takeUnretainedValue() as? [[AnyHashable: Any]] ?? []; + + if (proxies.count > 0) { + let proxy = proxies[0] + + if(proxy[kCFProxyTypeKey] as! CFString == kCFProxyTypeHTTP || proxy[kCFProxyTypeKey] as! CFString == kCFProxyTypeHTTPS) { + let host = proxy[kCFProxyHostNameKey] as? String ?? "null" + let port = proxy[kCFProxyPortNumberKey] as? Int ?? 0 + + if (host == "null" || port == 0) { + return + } + + proxyUrl = "http://" + host + ":" + String(port) + } + } + } + } else if let error = error { + // Handle Error + } + } + + task.resume() + semaphore.wait() + + return proxyUrl + } + + if let httpSEnable = systemProxySettings["HTTPSEnable"] as? Int, httpSEnable == 1, + destinationUrl.starts(with: "https") { + if let host = systemProxySettings["HTTPSProxy"] as? String, + let port = systemProxySettings["HTTPSPort"] as? Int { + return "https://\(host):\(port)" + } + } + + if let httpEnable = systemProxySettings["HTTPEnable"] as? Int, httpEnable == 1 { + if let host = systemProxySettings["HTTPProxy"] as? String, + let port = systemProxySettings["HTTPPort"] as? Int { + return "http://\(host):\(port)" + } + } + + return "" + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/AltProxyFinder.swift.meta b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/AltProxyFinder.swift.meta new file mode 100644 index 00000000..041802f2 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/AltProxyFinder.swift.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: 78ce82ea9c40b481086fa13e91195a2c +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/AltProxyFinderBridge.mm b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/AltProxyFinderBridge.mm new file mode 100644 index 00000000..b7b036eb --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/AltProxyFinderBridge.mm @@ -0,0 +1,21 @@ +#import + +extern "C" +{ + char* cStringCopy(const char* string) { + if (string == NULL){ + return NULL; + } + + char* res = (char*) malloc(strlen(string) + 1); + strcpy(res, string); + + return res; + } + + char* _getProxy(const char* uri, const char* host) + { + NSString *returnString = [[AltProxyFinder shared] swiftGetProxy:[NSString stringWithUTF8String:uri] destinationHost:[NSString stringWithUTF8String:host]]; + return cStringCopy([returnString UTF8String]); + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/AltProxyFinderBridge.mm.meta b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/AltProxyFinderBridge.mm.meta new file mode 100644 index 00000000..987e012c --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/AltProxyFinderBridge.mm.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: 9c9a0eb9f288d4254876a814fd12a940 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/UnityFramework.modulemap b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/UnityFramework.modulemap new file mode 100644 index 00000000..b6b3441a --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/UnityFramework.modulemap @@ -0,0 +1,12 @@ +framework module UnityFramework { + umbrella header "UnityFramework.h" + + export * + module * { export * } + + module UnityInterface { + header "UnityInterface.h" + + export * + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/UnityFramework.modulemap.meta b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/UnityFramework.modulemap.meta new file mode 100644 index 00000000..75c42759 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/Plugins/iOS/AltProxyFinder/Source/UnityFramework.modulemap.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 93747aeecd6b340f291794279fbba5a5 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/ProxyFinder.cs b/Assets/AltTester/Runtime/AltDriver/Proxy/ProxyFinder.cs new file mode 100644 index 00000000..abb7ff6f --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/ProxyFinder.cs @@ -0,0 +1,83 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; + +namespace AltTester.AltTesterUnitySDK.Driver.Proxy +{ + public class ProxyFinder : IProxyFinder + { + public string GetProxy(string uri, string host) + { +#if !UNITY_EDITOR && UNITY_WEBGL + // On WebGL Proxies are detected and managed by the browser. + return null; +#endif + + IProxyFinder Finder = null; + string ProxyUri = null; + +#if !UNITY_EDITOR && UNITY_ANDROID + try + { + Finder = new AndroidProxyFinder(); + ProxyUri = Finder.GetProxy(uri, host); + } + catch (Exception) + { + } +#endif + +#if !UNITY_EDITOR && UNITY_IOS + try + { + Finder = new IOSProxyFinder(); + ProxyUri = Finder.GetProxy(uri, host); + } + catch (Exception) + { + } +#endif + + if (ProxyUri == null) + { + try + { + Finder = new EnvironmentProxyFinder(); + ProxyUri = Finder.GetProxy(uri, host); + } + catch (Exception) + { + } + } + + if (ProxyUri == null) + { + try + { + Finder = new DotnetProxyFinder(); + ProxyUri = Finder.GetProxy(uri, host); + } + catch (Exception) + { + } + } + + return ProxyUri; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/Proxy/ProxyFinder.cs.meta b/Assets/AltTester/Runtime/AltDriver/Proxy/ProxyFinder.cs.meta new file mode 100644 index 00000000..bb98575b --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/Proxy/ProxyFinder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5e31842f1235f470391dd7b9819cfc19 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/UnityStruct.meta b/Assets/AltTester/Runtime/AltDriver/UnityStruct.meta new file mode 100644 index 00000000..7b8189e7 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/UnityStruct.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5f1221ad68ee2a5419a3afdd4268c210 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltColor.cs b/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltColor.cs new file mode 100644 index 00000000..511ee1a3 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltColor.cs @@ -0,0 +1,64 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public struct AltColor + { + public float r; + public float g; + public float b; + public float a; + public AltColor(float r, float g, float b) + { + this.r = r; + this.g = g; + this.b = b; + this.a = 1; + + } + public AltColor(float r, float g, float b, float a) + { + this.r = r; + this.g = g; + this.b = b; + this.a = a; + } + + public override bool Equals(object obj) + { + if (!(obj is AltColor)) + return false; + var other = (AltColor)obj; + return + other.r == this.r && + other.g == this.g && + other.b == this.b && + other.a == this.a; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + public override string ToString() + { + return string.Format("RGBA({0},{1},{2},{3})", this.r, this.g, this.b, this.a); + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltColor.cs.meta b/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltColor.cs.meta new file mode 100644 index 00000000..f6133b0b --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltColor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0ee77dbdbbb076c458674b50a45bf715 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltKeyCode.cs b/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltKeyCode.cs new file mode 100644 index 00000000..8b646eb7 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltKeyCode.cs @@ -0,0 +1,343 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public enum AltKeyCode + { + NoKey = 0, + Backspace = 8, + Tab = 9, + Clear = 12, + Return = 13, + Pause = 19, + Escape = 27, + Space = 32, + Exclaim = 33, + DoubleQuote = 34, + Hash = 35, + Dollar = 36, + Ampersand = 38, + Quote = 39, + LeftParen = 40, + RightParen = 41, + Asterisk = 42, + Plus = 43, + Comma = 44, + Minus = 45, + Period = 46, + Slash = 47, + Alpha0 = 48, + Alpha1 = 49, + Alpha2 = 50, + Alpha3 = 51, + Alpha4 = 52, + Alpha5 = 53, + Alpha6 = 54, + Alpha7 = 55, + Alpha8 = 56, + Alpha9 = 57, + Colon = 58, + Semicolon = 59, + Less = 60, + Equals = 61, + Greater = 62, + Question = 63, + At = 64, + LeftBracket = 91, + Backslash = 92, + RightBracket = 93, + Caret = 94, + Underscore = 95, + BackQuote = 96, + A = 97, + B = 98, + C = 99, + D = 100, + E = 101, + F = 102, + G = 103, + H = 104, + I = 105, + J = 106, + K = 107, + L = 108, + M = 109, + N = 110, + O = 111, + P = 112, + Q = 113, + R = 114, + S = 115, + T = 116, + U = 117, + V = 118, + W = 119, + X = 120, + Y = 121, + Z = 122, + LeftCurlyBracket = 123, + Pipe = 124, + RightCurlyBracket = 125, + Tilde = 126, + Delete = 127, + Keypad0 = 256, + Keypad1 = 257, + Keypad2 = 258, + Keypad3 = 259, + Keypad4 = 260, + Keypad5 = 261, + Keypad6 = 262, + Keypad7 = 263, + Keypad8 = 264, + Keypad9 = 265, + KeypadPeriod = 266, + KeypadDivide = 267, + KeypadMultiply = 268, + KeypadMinus = 269, + KeypadPlus = 270, + KeypadEnter = 271, + KeypadEquals = 272, + UpArrow = 273, + DownArrow = 274, + RightArrow = 275, + LeftArrow = 276, + Insert = 277, + Home = 278, + End = 279, + PageUp = 280, + PageDown = 281, + F1 = 282, + F2 = 283, + F3 = 284, + F4 = 285, + F5 = 286, + F6 = 287, + F7 = 288, + F8 = 289, + F9 = 290, + F10 = 291, + F11 = 292, + F12 = 293, + Numlock = 300, + CapsLock = 301, + ScrollLock = 302, + RightShift = 303, + LeftShift = 304, + RightControl = 305, + LeftControl = 306, + RightAlt = 307, + LeftAlt = 308, + RightCommand = 309, + RightApple = 309, + LeftCommand = 310, + LeftApple = 310, + LeftWindows = 311, + RightWindows = 312, + AltGr = 313, + Help = 315, + Print = 316, + SysReq = 317, + Break = 318, + Menu = 319, + Mouse0 = 323, + Mouse1 = 324, + Mouse2 = 325, + Mouse3 = 326, + Mouse4 = 327, + JoystickButton0 = 330, + JoystickButton1 = 331, + JoystickButton2 = 332, + JoystickButton3 = 333, + JoystickButton4 = 334, + JoystickButton5 = 335, + JoystickButton6 = 336, + JoystickButton7 = 337, + JoystickButton8 = 338, + JoystickButton9 = 339, + JoystickButton10 = 340, + JoystickButton11 = 341, + JoystickButton12 = 342, + JoystickButton13 = 343, + JoystickButton14 = 344, + JoystickButton15 = 345, + JoystickButton16 = 346, + JoystickButton17 = 347, + JoystickButton18 = 348, + JoystickButton19 = 349, + Joystick1Button0 = 350, + Joystick1Button1 = 351, + Joystick1Button2 = 352, + Joystick1Button3 = 353, + Joystick1Button4 = 354, + Joystick1Button5 = 355, + Joystick1Button6 = 356, + Joystick1Button7 = 357, + Joystick1Button8 = 358, + Joystick1Button9 = 359, + Joystick1Button10 = 360, + Joystick1Button11 = 361, + Joystick1Button12 = 362, + Joystick1Button13 = 363, + Joystick1Button14 = 364, + Joystick1Button15 = 365, + Joystick1Button16 = 366, + Joystick1Button17 = 367, + Joystick1Button18 = 368, + Joystick1Button19 = 369, + Joystick2Button0 = 370, + Joystick2Button1 = 371, + Joystick2Button2 = 372, + Joystick2Button3 = 373, + Joystick2Button4 = 374, + Joystick2Button5 = 375, + Joystick2Button6 = 376, + Joystick2Button7 = 377, + Joystick2Button8 = 378, + Joystick2Button9 = 379, + Joystick2Button10 = 380, + Joystick2Button11 = 381, + Joystick2Button12 = 382, + Joystick2Button13 = 383, + Joystick2Button14 = 384, + Joystick2Button15 = 385, + Joystick2Button16 = 386, + Joystick2Button17 = 387, + Joystick2Button18 = 388, + Joystick2Button19 = 389, + Joystick3Button0 = 390, + Joystick3Button1 = 391, + Joystick3Button2 = 392, + Joystick3Button3 = 393, + Joystick3Button4 = 394, + Joystick3Button5 = 395, + Joystick3Button6 = 396, + Joystick3Button7 = 397, + Joystick3Button8 = 398, + Joystick3Button9 = 399, + Joystick3Button10 = 400, + Joystick3Button11 = 401, + Joystick3Button12 = 402, + Joystick3Button13 = 403, + Joystick3Button14 = 404, + Joystick3Button15 = 405, + Joystick3Button16 = 406, + Joystick3Button17 = 407, + Joystick3Button18 = 408, + Joystick3Button19 = 409, + Joystick4Button0 = 410, + Joystick4Button1 = 411, + Joystick4Button2 = 412, + Joystick4Button3 = 413, + Joystick4Button4 = 414, + Joystick4Button5 = 415, + Joystick4Button6 = 416, + Joystick4Button7 = 417, + Joystick4Button8 = 418, + Joystick4Button9 = 419, + Joystick4Button10 = 420, + Joystick4Button11 = 421, + Joystick4Button12 = 422, + Joystick4Button13 = 423, + Joystick4Button14 = 424, + Joystick4Button15 = 425, + Joystick4Button16 = 426, + Joystick4Button17 = 427, + Joystick4Button18 = 428, + Joystick4Button19 = 429, + Joystick5Button0 = 430, + Joystick5Button1 = 431, + Joystick5Button2 = 432, + Joystick5Button3 = 433, + Joystick5Button4 = 434, + Joystick5Button5 = 435, + Joystick5Button6 = 436, + Joystick5Button7 = 437, + Joystick5Button8 = 438, + Joystick5Button9 = 439, + Joystick5Button10 = 440, + Joystick5Button11 = 441, + Joystick5Button12 = 442, + Joystick5Button13 = 443, + Joystick5Button14 = 444, + Joystick5Button15 = 445, + Joystick5Button16 = 446, + Joystick5Button17 = 447, + Joystick5Button18 = 448, + Joystick5Button19 = 449, + Joystick6Button0 = 450, + Joystick6Button1 = 451, + Joystick6Button2 = 452, + Joystick6Button3 = 453, + Joystick6Button4 = 454, + Joystick6Button5 = 455, + Joystick6Button6 = 456, + Joystick6Button7 = 457, + Joystick6Button8 = 458, + Joystick6Button9 = 459, + Joystick6Button10 = 460, + Joystick6Button11 = 461, + Joystick6Button12 = 462, + Joystick6Button13 = 463, + Joystick6Button14 = 464, + Joystick6Button15 = 465, + Joystick6Button16 = 466, + Joystick6Button17 = 467, + Joystick6Button18 = 468, + Joystick6Button19 = 469, + Joystick7Button0 = 470, + Joystick7Button1 = 471, + Joystick7Button2 = 472, + Joystick7Button3 = 473, + Joystick7Button4 = 474, + Joystick7Button5 = 475, + Joystick7Button6 = 476, + Joystick7Button7 = 477, + Joystick7Button8 = 478, + Joystick7Button9 = 479, + Joystick7Button10 = 480, + Joystick7Button11 = 481, + Joystick7Button12 = 482, + Joystick7Button13 = 483, + Joystick7Button14 = 484, + Joystick7Button15 = 485, + Joystick7Button16 = 486, + Joystick7Button17 = 487, + Joystick7Button18 = 488, + Joystick7Button19 = 489, + Joystick8Button0 = 490, + Joystick8Button1 = 491, + Joystick8Button2 = 492, + Joystick8Button3 = 493, + Joystick8Button4 = 494, + Joystick8Button5 = 495, + Joystick8Button6 = 496, + Joystick8Button7 = 497, + Joystick8Button8 = 498, + Joystick8Button9 = 499, + Joystick8Button10 = 500, + Joystick8Button11 = 501, + Joystick8Button12 = 502, + Joystick8Button13 = 503, + Joystick8Button14 = 504, + Joystick8Button15 = 505, + Joystick8Button16 = 506, + Joystick8Button17 = 507, + Joystick8Button18 = 508, + Joystick8Button19 = 509 + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltKeyCode.cs.meta b/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltKeyCode.cs.meta new file mode 100644 index 00000000..b9767d2c --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltKeyCode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4b769726bceecd84fa1f2c7714895267 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltVector.cs b/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltVector.cs new file mode 100644 index 00000000..dd8f0d5c --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltVector.cs @@ -0,0 +1,129 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public struct AltVector2 + { + public float x; + public float y; + + public AltVector2(float x, float y) + { + this.x = x; + this.y = y; + } + public override bool Equals(object obj) + { + if (!(obj is AltVector2)) + return false; + var other = (AltVector2)obj; + return + other.x == this.x && + other.y == this.y; + } + public static AltVector2 operator +(AltVector2 v1, AltVector2 v2) + { + return new AltVector2(v1.x + v2.x, v1.y + v2.y); + } + + public static AltVector2 operator *(AltVector2 v1, AltVector2 v2) + { + return new AltVector2(v1.x * v2.x, v1.y * v2.y); + } + public static AltVector2 operator *(AltVector2 v1, float number) + { + return new AltVector2(v1.x * number, v1.y * number); + } + public static AltVector2 operator /(AltVector2 v1, AltVector2 v2) + { + return new AltVector2(v1.x / v2.x, v1.y / v2.y); + } + public static AltVector2 operator /(AltVector2 v1, float number) + { + return new AltVector2(v1.x / number, v1.y / number); + } + public override int GetHashCode() + { + return base.GetHashCode(); + } + + public override string ToString() + { + return $"AltVector2{{ x : {x}, y : {y} }}"; + } + } + public struct AltVector3 + { + public float x; + public float y; + public float z; + + public AltVector3(float x, float y, float z) + { + this.x = x; + this.y = y; + this.z = z; + } + + public AltVector3(float x, float y) : this(x, y, 0) + { + } + + public override bool Equals(object obj) + { + if (!(obj is AltVector3)) + return false; + var other = (AltVector3)obj; + return + other.x == this.x && + other.y == this.y && + other.z == this.z; + } + + public static AltVector3 operator +(AltVector3 v1, AltVector3 v2) + { + return new AltVector3(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z); + } + + public static AltVector3 operator *(AltVector3 v1, AltVector3 v2) + { + return new AltVector3(v1.x * v2.x, v1.y * v2.y, v1.z * v2.z); + } + public static AltVector3 operator *(AltVector3 v1, float number) + { + return new AltVector3(v1.x * number, v1.y * number, v1.z * number); + } + public static AltVector3 operator /(AltVector3 v1, AltVector3 v2) + { + return new AltVector3(v1.x / v2.x, v1.y / v2.y, v1.z / v2.z); + } + public static AltVector3 operator /(AltVector3 v1, float number) + { + return new AltVector3(v1.x / number, v1.y / number, v1.z / number); + } + public override int GetHashCode() + { + return base.GetHashCode(); + } + + public override string ToString() + { + return $"AltVector3{{ x : {x}, y : {y}, z : {z} }}"; + } + } +} diff --git a/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltVector.cs.meta b/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltVector.cs.meta new file mode 100644 index 00000000..06f3012c --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/UnityStruct/AltVector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2b73df7b3acc7dc41b2433cd63268f87 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltDriver/UnityStruct/PLayerPrefKeyType.cs b/Assets/AltTester/Runtime/AltDriver/UnityStruct/PLayerPrefKeyType.cs new file mode 100644 index 00000000..3d901dc9 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/UnityStruct/PLayerPrefKeyType.cs @@ -0,0 +1,22 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +namespace AltTester.AltTesterUnitySDK.Driver +{ + public enum PlayerPrefKeyType { Int = 1, String, Float } + +} diff --git a/Assets/AltTester/Runtime/AltDriver/UnityStruct/PLayerPrefKeyType.cs.meta b/Assets/AltTester/Runtime/AltDriver/UnityStruct/PLayerPrefKeyType.cs.meta new file mode 100644 index 00000000..d894d077 --- /dev/null +++ b/Assets/AltTester/Runtime/AltDriver/UnityStruct/PLayerPrefKeyType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bdb016b3bb859ca408f138c5c7a1fa4d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltId.cs b/Assets/AltTester/Runtime/AltId.cs new file mode 100644 index 00000000..d9b23a2a --- /dev/null +++ b/Assets/AltTester/Runtime/AltId.cs @@ -0,0 +1,35 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using UnityEngine; + +namespace AltTester.AltTesterUnitySDK +{ + [DisallowMultipleComponent] + public class AltId : MonoBehaviour + { + public string altID; + + protected void OnValidate() + { + if (altID == null) + { + altID = System.Guid.NewGuid().ToString(); + } + } + } +} diff --git a/Assets/AltTester/Runtime/AltId.cs.meta b/Assets/AltTester/Runtime/AltId.cs.meta new file mode 100644 index 00000000..dbfbd7d8 --- /dev/null +++ b/Assets/AltTester/Runtime/AltId.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0ea1b65aaa149fa438425d71fd8122ab +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltInstrumentationSettings.cs b/Assets/AltTester/Runtime/AltInstrumentationSettings.cs new file mode 100644 index 00000000..20d20941 --- /dev/null +++ b/Assets/AltTester/Runtime/AltInstrumentationSettings.cs @@ -0,0 +1,50 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; + +namespace AltTester.AltTesterUnitySDK +{ + /// + /// Settings for AltTester® Unity App instrumentation. + /// + [Serializable] + public class AltInstrumentationSettings + { + /// + /// Gets or sets the host that the instrumented Unity App will connect to. + /// + public string AltServerHost = "127.0.0.1"; + + /// + /// Gets or sets the port that the instrumented Unity App will connect to. + /// + public int AltServerPort = 13000; + + /// + /// Gets or sets the name of the app that the instrumented Unity App will use as a unique identifier. + /// + public string AppName = "__default__"; + + /// + /// Gets or sets a value indicating whether to display the AltTester® popup in the instrumented Unity App. + /// + public bool ShowPopUp = true; + public bool ResetConnectionData = false; + public string UID = ""; + } +} diff --git a/Assets/AltTester/Runtime/AltInstrumentationSettings.cs.meta b/Assets/AltTester/Runtime/AltInstrumentationSettings.cs.meta new file mode 100644 index 00000000..fdbd3dec --- /dev/null +++ b/Assets/AltTester/Runtime/AltInstrumentationSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 040e47c28f6eaaa4986d7636fe294c6c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltKeyMapping.cs b/Assets/AltTester/Runtime/AltKeyMapping.cs new file mode 100644 index 00000000..a9121261 --- /dev/null +++ b/Assets/AltTester/Runtime/AltKeyMapping.cs @@ -0,0 +1,373 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#if ALTTESTER && ENABLE_INPUT_SYSTEM +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.InputSystem; +using UnityEngine.InputSystem.Controls; + +namespace AltTester.AltTesterUnitySDK +{ + public class AltKeyMapping + { + public static Dictionary StringToKeyCode = new Dictionary() + { + + //Letters + {"a", KeyCode.A}, + {"b", KeyCode.B}, + {"c", KeyCode.C}, + {"d", KeyCode.D}, + {"e", KeyCode.E}, + {"f", KeyCode.F}, + {"g", KeyCode.G}, + {"h", KeyCode.H}, + {"i", KeyCode.I}, + {"j", KeyCode.J}, + {"k", KeyCode.K}, + {"l", KeyCode.L}, + {"m", KeyCode.M}, + {"n", KeyCode.N}, + {"o", KeyCode.O}, + {"p", KeyCode.P}, + {"q", KeyCode.Q}, + {"r", KeyCode.R}, + {"s", KeyCode.S}, + {"t", KeyCode.T}, + {"u", KeyCode.U}, + {"v", KeyCode.V}, + {"w", KeyCode.W}, + {"x", KeyCode.X}, + {"y", KeyCode.Y}, + {"z", KeyCode.Z}, + + //KeyPad Numbers + {"1", KeyCode.Keypad1}, + {"2", KeyCode.Keypad2}, + {"3", KeyCode.Keypad3}, + {"4", KeyCode.Keypad4}, + {"5", KeyCode.Keypad5}, + {"6", KeyCode.Keypad6}, + {"7", KeyCode.Keypad7}, + {"8", KeyCode.Keypad8}, + {"9", KeyCode.Keypad9}, + {"0", KeyCode.Keypad0}, + + //Fs + {"F1", KeyCode.F1}, + {"F2", KeyCode.F2}, + {"F3", KeyCode.F3}, + {"F4", KeyCode.F4}, + {"F5", KeyCode.F5}, + {"F6", KeyCode.F6}, + {"F7", KeyCode.F7}, + {"F8", KeyCode.F8}, + {"F9", KeyCode.F9}, + {"F10", KeyCode.F10}, + {"F11", KeyCode.F11}, + {"F12", KeyCode.F12}, + + //Other Symbols + {"!", KeyCode.Exclaim}, //1 + {"\"", KeyCode.DoubleQuote}, + {"#", KeyCode.Hash}, //3 + {"$", KeyCode.Dollar}, //4 + {"&", KeyCode.Ampersand}, //7 + {"\'", KeyCode.Quote}, //remember the special forward slash rule... this isnt wrong + {"(", KeyCode.LeftParen}, //9 + {")", KeyCode.RightParen}, //0 + {"*", KeyCode.Asterisk}, //8 + {"+", KeyCode.Plus}, + {",", KeyCode.Comma}, + {"-", KeyCode.Minus}, + {".", KeyCode.Period}, + {"/", KeyCode.Slash}, + {":", KeyCode.Colon}, + {";", KeyCode.Semicolon}, + {"<", KeyCode.Less}, + {"=", KeyCode.Equals}, + {">", KeyCode.Greater}, + {"?", KeyCode.Question}, + {"@", KeyCode.At}, //2 + {"[", KeyCode.LeftBracket}, + {"\\", KeyCode.Backslash}, //remember the special forward slash rule... this isnt wrong + {"]", KeyCode.RightBracket}, + {"^", KeyCode.Caret}, //6 + {"_", KeyCode.Underscore}, + {"`", KeyCode.BackQuote}, + + //Alpha Numbers + //NOTE: we are using the UPPER CASE LETTERS Q -> P because they are nearest to the Alpha Numbers + {"Q", KeyCode.Alpha1}, + {"W", KeyCode.Alpha2}, + {"E", KeyCode.Alpha3}, + {"R", KeyCode.Alpha4}, + {"T", KeyCode.Alpha5}, + {"Y", KeyCode.Alpha6}, + {"U", KeyCode.Alpha7}, + {"I", KeyCode.Alpha8}, + {"O", KeyCode.Alpha9}, + {"P", KeyCode.Alpha0}, + + {"k.", KeyCode.KeypadPeriod}, + {"k/", KeyCode.KeypadDivide}, + {"k*", KeyCode.KeypadMultiply}, + {"k-", KeyCode.KeypadMinus}, + {"k+", KeyCode.KeypadPlus}, + {"k=", KeyCode.KeypadEquals}, + {"kenter", KeyCode.KeypadEnter}, + + {"~", KeyCode.Tilde}, + {"{", KeyCode.LeftCurlyBracket}, + {"}", KeyCode.RightCurlyBracket}, + {"|", KeyCode.Pipe}, + {"%", KeyCode.Percent}, + {"bsp", KeyCode.Backspace}, + {"tab", KeyCode.Tab}, + {"clr", KeyCode.Clear}, + {"return", KeyCode.Return}, + {"pause", KeyCode.Pause}, + {"esc", KeyCode.Escape}, + {"space", KeyCode.Space}, + {"del", KeyCode.Delete}, + {"upArrow", KeyCode.UpArrow}, + {"downArrow", KeyCode.DownArrow}, + {"rightArrow", KeyCode.RightArrow}, + {"leftArrow", KeyCode.LeftArrow}, + {"ins", KeyCode.Insert}, + {"home", KeyCode.Home}, + {"end", KeyCode.End}, + {"pageUp", KeyCode.PageUp}, + {"pageDown", KeyCode.PageDown}, + {"Numlock", KeyCode.Numlock}, + {"CapsLock", KeyCode.CapsLock}, + {"ScrollLock", KeyCode.ScrollLock}, + {"RightShift", KeyCode.RightShift}, + {"LeftShift", KeyCode.LeftShift}, + {"RightControl", KeyCode.RightControl}, + {"LeftControl", KeyCode.LeftControl}, + {"RightAlt", KeyCode.RightAlt}, + {"LeftAlt", KeyCode.LeftAlt}, + {"RightCommand", KeyCode.RightCommand}, + {"RightApple", KeyCode.RightApple}, + {"LeftCommand", KeyCode.LeftCommand}, + {"LeftApple", KeyCode.LeftApple}, + {"LeftWindows", KeyCode.LeftWindows}, + {"RightWindows", KeyCode.RightWindows}, + {"AltGr", KeyCode.AltGr}, + {"Help", KeyCode.Help}, + {"Print", KeyCode.Print}, + {"SysReq", KeyCode.SysReq}, + {"Break", KeyCode.Break}, + {"Menu", KeyCode.Menu} + }; + + public static Dictionary StringToKey = new Dictionary() + { + + //Letters + {"a", Key.A}, + {"b", Key.B}, + {"c", Key.C}, + {"d", Key.D}, + {"e", Key.E}, + {"f", Key.F}, + {"g", Key.G}, + {"h", Key.H}, + {"i", Key.I}, + {"j", Key.J}, + {"k", Key.K}, + {"l", Key.L}, + {"m", Key.M}, + {"n", Key.N}, + {"o", Key.O}, + {"p", Key.P}, + {"q", Key.Q}, + {"r", Key.R}, + {"s", Key.S}, + {"t", Key.T}, + {"u", Key.U}, + {"v", Key.V}, + {"w", Key.W}, + {"x", Key.X}, + {"y", Key.Y}, + {"z", Key.Z}, + + //KeyPad Numbers + {"1", Key.Numpad1}, + {"2", Key.Numpad2}, + {"3", Key.Numpad3}, + {"4", Key.Numpad4}, + {"5", Key.Numpad5}, + {"6", Key.Numpad6}, + {"7", Key.Numpad7}, + {"8", Key.Numpad8}, + {"9", Key.Numpad9}, + {"0", Key.Numpad0}, + + //Fs + {"F1", Key.F1}, + {"F2", Key.F2}, + {"F3", Key.F3}, + {"F4", Key.F4}, + {"F5", Key.F5}, + {"F6", Key.F6}, + {"F7", Key.F7}, + {"F8", Key.F8}, + {"F9", Key.F9}, + {"F10", Key.F10}, + {"F11", Key.F11}, + {"F12", Key.F12}, + + //Other Symbols + {"!", Key.Digit1}, //Exclaim + {"\"", Key.Quote}, //DoubleQuote + {"#", Key.Digit3}, //Hash + {"$", Key.Digit4}, //Dollar + {"&", Key.Digit7}, //Ampersand + {"\'", Key.Quote}, //remember the special forward slash rule... this isnt wrong + {"(", Key.Digit9}, //LeftParen + {")", Key.Digit0}, //RightParen + {"*", Key.Digit8}, //Asterisk + {"+", Key.NumpadPlus}, //Plus + {",", Key.Comma}, + {"-", Key.Minus}, + {".", Key.Period}, + {"/", Key.Slash}, + {":", Key.Semicolon}, //Colon + {";", Key.Semicolon}, + {"<", Key.Comma}, //Less + {"=", Key.Equals}, + {">", Key.Period}, //Greater + {"?", Key.Slash}, //Question + {"@", Key.Digit2}, //At + {"[", Key.LeftBracket}, + {"\\", Key.Backslash}, //remember the special forward slash rule... this isnt wrong + {"]", Key.RightBracket}, + {"^", Key.Digit6}, //Caret + {"_", Key.Minus}, //Underscore + {"`", Key.Backquote}, + + //Alpha Numbers + //NOTE: we are using the UPPER CASE LETTERS Q -> P because they are nearest to the Alpha Numbers + {"Q", Key.Digit1}, + {"W", Key.Digit2}, + {"E", Key.Digit3}, + {"R", Key.Digit4}, + {"T", Key.Digit5}, + {"Y", Key.Digit6}, + {"U", Key.Digit7}, + {"I", Key.Digit8}, + {"O", Key.Digit9}, + {"P", Key.Digit0}, + + {"k.", Key.NumpadPeriod}, + {"k/", Key.NumpadDivide}, + {"k*", Key.NumpadMultiply}, + {"k-", Key.NumpadMinus}, + {"k+", Key.NumpadPlus}, + {"k=", Key.NumpadEquals}, + {"kenter", Key.NumpadEnter}, + + {"~", Key.Backquote}, //Tilde + {"{", Key.LeftBracket}, //LeftCurlyBracket + {"}", Key.RightBracket}, //RightCurlyBracket + {"|", Key.Backslash}, //Pipe + {"%", Key.Digit5}, //Percent + {"bsp", Key.Backspace}, + {"tab", Key.Tab}, + {"clr", Key.Delete}, //clear + {"return", Key.Enter}, + {"pause", Key.Pause}, + {"esc", Key.Escape}, + {"space", Key.Space}, + {"del", Key.Delete}, + {"upArrow", Key.UpArrow}, + {"downArrow", Key.DownArrow}, + {"rightArrow", Key.RightArrow}, + {"leftArrow", Key.LeftArrow}, + {"ins", Key.Insert}, + {"home", Key.Home}, + {"end", Key.End}, + {"pageUp", Key.PageUp}, + {"pageDown", Key.PageDown}, + {"Numlock", Key.NumLock}, + {"CapsLock", Key.CapsLock}, + {"ScrollLock", Key.ScrollLock}, + {"RightShift", Key.RightShift}, + {"LeftShift", Key.LeftShift}, + {"RightControl", Key.RightCtrl}, + {"LeftControl", Key.LeftCtrl}, + {"RightAlt", Key.RightAlt}, + {"LeftAlt", Key.LeftAlt}, + {"RightCommand", Key.RightCommand}, + {"RightApple", Key.RightApple}, + {"LeftCommand", Key.LeftCommand}, + {"LeftApple", Key.LeftApple}, + {"LeftWindows", Key.LeftWindows}, + {"RightWindows", Key.RightWindows}, + {"AltGr", Key.AltGr}, + {"Help", Key.Enter}, + {"Print", Key.PrintScreen}, + {"SysReq", Key.PrintScreen}, //same button as above + {"Break", Key.Pause}, + {"Menu", Key.RightCtrl} + }; + + public Dictionary mouseKeyCodeToButtonControl; + + public Dictionary joystickKeyCodeToGamepad; + + public AltKeyMapping(float power) + { + joystickKeyCodeToGamepad = new Dictionary() + { + {KeyCode.JoystickButton0, NewInputSystem.Gamepad.aButton}, + {KeyCode.JoystickButton1, NewInputSystem.Gamepad.bButton}, + {KeyCode.JoystickButton2, NewInputSystem.Gamepad.xButton}, + {KeyCode.JoystickButton3, NewInputSystem.Gamepad.yButton}, + {KeyCode.JoystickButton4, NewInputSystem.Gamepad.leftShoulder}, + {KeyCode.JoystickButton5, NewInputSystem.Gamepad.rightShoulder}, + {KeyCode.JoystickButton6, NewInputSystem.Gamepad.leftTrigger}, + {KeyCode.JoystickButton7, NewInputSystem.Gamepad.rightTrigger}, + {KeyCode.JoystickButton8, NewInputSystem.Gamepad.selectButton}, + {KeyCode.JoystickButton9, NewInputSystem.Gamepad.startButton}, + {KeyCode.JoystickButton10, NewInputSystem.Gamepad.leftStickButton}, + {KeyCode.JoystickButton11, NewInputSystem.Gamepad.rightStickButton}, + {KeyCode.JoystickButton12, NewInputSystem.Gamepad.dpad.up}, + {KeyCode.JoystickButton13, NewInputSystem.Gamepad.dpad.down}, + {KeyCode.JoystickButton14, NewInputSystem.Gamepad.dpad.left}, + {KeyCode.JoystickButton15, NewInputSystem.Gamepad.dpad.right}, + {KeyCode.JoystickButton16, power > 0 ? NewInputSystem.Gamepad.leftStick.right : NewInputSystem.Gamepad.leftStick.left}, + {KeyCode.JoystickButton17, power > 0 ? NewInputSystem.Gamepad.leftStick.up : NewInputSystem.Gamepad.leftStick.down}, + {KeyCode.JoystickButton18, power > 0 ? NewInputSystem.Gamepad.rightStick.right: NewInputSystem.Gamepad.rightStick.left}, + {KeyCode.JoystickButton19, power > 0 ? NewInputSystem.Gamepad.rightStick.up : NewInputSystem.Gamepad.rightStick.down} + }; + mouseKeyCodeToButtonControl = new Dictionary() + { + // in Mouse class there are only 5 buttons thus KeyCode.Mouse5, KeyCode.Mouse6 are not mapped + {KeyCode.Mouse0, NewInputSystem.Mouse.leftButton}, + {KeyCode.Mouse1, NewInputSystem.Mouse.rightButton}, + {KeyCode.Mouse2, NewInputSystem.Mouse.middleButton}, + {KeyCode.Mouse3, NewInputSystem.Mouse.forwardButton}, + {KeyCode.Mouse4, NewInputSystem.Mouse.backButton} + }; + } + } +} +#endif diff --git a/Assets/AltTester/Runtime/AltKeyMapping.cs.meta b/Assets/AltTester/Runtime/AltKeyMapping.cs.meta new file mode 100644 index 00000000..2f3273ef --- /dev/null +++ b/Assets/AltTester/Runtime/AltKeyMapping.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b6bef16d817033c4481f5c67ac651d9f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltMockUpPointerInputModule.cs b/Assets/AltTester/Runtime/AltMockUpPointerInputModule.cs new file mode 100644 index 00000000..d0dec56d --- /dev/null +++ b/Assets/AltTester/Runtime/AltMockUpPointerInputModule.cs @@ -0,0 +1,278 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Linq; +using UnityEngine; +using UnityEngine.EventSystems; +#if ENABLE_INPUT_SYSTEM +using UnityEngine.InputSystem.UI; +#endif +using static UnityEngine.EventSystems.ExecuteEvents; + +namespace AltTester.AltTesterUnitySDK +{ + public class AltMockUpPointerInputModule : StandaloneInputModule + { + public UnityEngine.GameObject GameObjectHit; + public PointerEventData ExecuteTouchEvent(UnityEngine.Touch touch, PointerEventData previousData = null) + { + if (EventSystem.current != null) + { + RaycastResult raycastResult; + switch (touch.phase) + { + case UnityEngine.TouchPhase.Began: + var pointerEventData = + new PointerEventData(EventSystem.current) + { + position = touch.position, + delta = touch.deltaPosition, + button = PointerEventData.InputButton.Left, + pointerId = touch.fingerId, + eligibleForClick = true, + pressPosition = touch.position + }; + + GameObjectHit = getGameObjectHit(touch); + GetFirstRaycastResult(pointerEventData, out raycastResult); + pointerEventData.pointerCurrentRaycast = raycastResult; + pointerEventData.pointerPressRaycast = pointerEventData.pointerCurrentRaycast; +#if ENABLE_INPUT_SYSTEM + if (EventSystem.current.currentInputModule.GetType().Name != typeof(InputSystemUIInputModule).Name) + { +#endif + if (raycastResult.gameObject ?? false) pointerEventData.pointerEnter = ExecuteEvents.ExecuteHierarchy(raycastResult.gameObject, pointerEventData, + ExecuteEvents.pointerEnterHandler); + if (raycastResult.gameObject ?? false) pointerEventData.pointerPress = ExecuteEvents.ExecuteHierarchy(raycastResult.gameObject, pointerEventData, + ExecuteEvents.pointerDownHandler); + pointerEventData.selectedObject = pointerEventData.pointerPress; + if (raycastResult.gameObject ?? false) pointerEventData.pointerDrag = ExecuteEvents.ExecuteHierarchy(raycastResult.gameObject, pointerEventData, + ExecuteEvents.dragHandler); +#if ENABLE_INPUT_SYSTEM + } +#endif + + + var monoBehaviourTarget = FindObjectViaRayCast.FindMonoBehaviourObject(pointerEventData.position); + if (monoBehaviourTarget ?? false) monoBehaviourTarget.SendMessage("OnMouseDown", UnityEngine.SendMessageOptions.DontRequireReceiver); + return pointerEventData; + case UnityEngine.TouchPhase.Moved: + if (previousData != null) + { + if (previousData.pointerDrag != null) + { + previousData.pointerPress = null; + previousData.eligibleForClick = false; + } + ExecuteDragPointerEvents(previousData); + + GetFirstRaycastResult(previousData, out raycastResult); + previousData.pointerCurrentRaycast = raycastResult; + previousData.delta = touch.deltaPosition; + previousData.position = touch.position; + + + if (previousData.pointerEnter != previousData.pointerCurrentRaycast.gameObject) + { +#if ENABLE_INPUT_SYSTEM + if (EventSystem.current.currentInputModule.GetType().Name != typeof(InputSystemUIInputModule).Name) + { +#endif + + if (previousData.pointerEnter ?? false) ExecuteEvents.ExecuteHierarchy(previousData.pointerEnter, previousData, + ExecuteEvents.pointerExitHandler); + if (previousData.pointerCurrentRaycast.gameObject ?? false) ExecuteEvents.ExecuteHierarchy(previousData.pointerCurrentRaycast.gameObject, previousData, + ExecuteEvents.pointerEnterHandler); +#if ENABLE_INPUT_SYSTEM + } +#endif + previousData.pointerEnter = previousData.pointerCurrentRaycast.gameObject; + } + + if (previousData.delta != UnityEngine.Vector2.zero) + { +#if ENABLE_INPUT_SYSTEM + if (EventSystem.current.currentInputModule.GetType().Name != typeof(InputSystemUIInputModule).Name) +#endif + if (previousData.pointerDrag ?? false) ExecuteEvents.ExecuteHierarchy(previousData.pointerDrag, previousData, + ExecuteEvents.dragHandler); + } + + return previousData; + } + break; + + case UnityEngine.TouchPhase.Ended: + if (previousData != null) + { + GameObjectHit = getGameObjectHit(touch); + GetFirstRaycastResult(previousData, out raycastResult); + previousData.pointerCurrentRaycast = raycastResult; +#if ENABLE_INPUT_SYSTEM + if (EventSystem.current.currentInputModule.GetType().Name != typeof(InputSystemUIInputModule).Name) +#endif + if (previousData.pointerPress ?? false) ExecuteEvents.ExecuteHierarchy(previousData.pointerPress, previousData, + ExecuteEvents.pointerUpHandler); + var currentOverGo = previousData.pointerCurrentRaycast.gameObject; + var pointerUpHandler = ExecuteEvents.GetEventHandler(currentOverGo); + + ; + if (previousData.pointerPress == pointerUpHandler && previousData.eligibleForClick) + { +#if ENABLE_INPUT_SYSTEM + if (EventSystem.current.currentInputModule.GetType().Name != typeof(InputSystemUIInputModule).Name) +#endif + if (previousData.pointerPress ?? false) ExecuteEvents.ExecuteHierarchy(previousData.pointerPress, previousData, + ExecuteEvents.pointerClickHandler); + previousData.eligibleForClick = false; + } + + + ExecuteEndDragPointerEvents(previousData); +#if ENABLE_INPUT_SYSTEM + if (EventSystem.current.currentInputModule.GetType().Name != typeof(InputSystemUIInputModule).Name) +#endif + if (previousData.pointerCurrentRaycast.gameObject ?? false) ExecuteEvents.ExecuteHierarchy(previousData.pointerCurrentRaycast.gameObject, previousData, + ExecuteEvents.pointerExitHandler); + return previousData; + } + break; + } + + return previousData; + } + return null; + } + + public void ExecuteDragPointerEvents(PointerEventData previousData) + { +#if ALTTESTER && ENABLE_LEGACY_INPUT_MANAGER + if (Input.monoBehaviourTargetMouseDown != null) + { + Input.monoBehaviourTargetMouseDown.SendMessage("OnMouseDrag", UnityEngine.SendMessageOptions.DontRequireReceiver); + } +#endif + if (previousData.pointerDrag == null) + { + previousData.dragging = true; +#if ENABLE_INPUT_SYSTEM + if (EventSystem.current.currentInputModule.GetType().Name != typeof(InputSystemUIInputModule).Name) + { +#endif + if (previousData.pointerCurrentRaycast.gameObject ?? false) previousData.pointerDrag = ExecuteEvents.ExecuteHierarchy(previousData.pointerCurrentRaycast.gameObject, previousData, + ExecuteEvents.beginDragHandler); + if (previousData.pointerDrag != null) + { + if (previousData.pointerDrag ?? false) ExecuteEvents.Execute(previousData.pointerDrag, previousData, + ExecuteEvents.dragHandler); + } + else + + if (previousData.pointerCurrentRaycast.gameObject ?? false) previousData.pointerDrag = ExecuteEvents.ExecuteHierarchy(previousData.pointerCurrentRaycast.gameObject, previousData, + ExecuteEvents.dragHandler); +#if ENABLE_INPUT_SYSTEM + } +#endif + } + else + { +#if ENABLE_INPUT_SYSTEM + if (EventSystem.current.currentInputModule.GetType().Name != typeof(InputSystemUIInputModule).Name) + { +#endif + + if (!previousData.dragging) + { + if (previousData.pointerDrag ?? false) ExecuteEvents.Execute(previousData.pointerDrag, previousData, + ExecuteEvents.beginDragHandler); + previousData.dragging = true; + } + if (previousData.pointerDrag ?? false) ExecuteEvents.Execute(previousData.pointerDrag, previousData, ExecuteEvents.dragHandler); +#if ENABLE_INPUT_SYSTEM + } +#endif + } + } + + public void ExecuteEndDragPointerEvents(PointerEventData previousData) + { +#if ALTTESTER && ENABLE_LEGACY_INPUT_MANAGER + + if (Input.monoBehaviourTargetMouseDown != null) + { + Input.monoBehaviourTargetMouseDown.SendMessage("OnMouseUpAsButton", UnityEngine.SendMessageOptions.DontRequireReceiver); + Input.monoBehaviourTargetMouseDown.SendMessage("OnMouseUp", UnityEngine.SendMessageOptions.DontRequireReceiver); + Input.monoBehaviourTargetMouseDown = null; + } +#endif + if (previousData.pointerDrag != null) + { +#if ENABLE_INPUT_SYSTEM + if (EventSystem.current.currentInputModule.GetType().Name != typeof(InputSystemUIInputModule).Name) + { +#endif + if (previousData.pointerDrag ?? false) ExecuteEvents.ExecuteHierarchy(previousData.pointerDrag, previousData, + ExecuteEvents.endDragHandler); + if (previousData.pointerCurrentRaycast.gameObject ?? false) ExecuteEvents.ExecuteHierarchy(previousData.pointerCurrentRaycast.gameObject, previousData, + ExecuteEvents.dropHandler); +#if ENABLE_INPUT_SYSTEM + } +#endif + previousData.dragging = false; + } + } + + public void GetFirstRaycastResult(PointerEventData pointerEventData, out RaycastResult raycastResult) + { + System.Collections.Generic.List raycastResults; + raycastResults = new System.Collections.Generic.List(); + if (EventSystem.current != null) + { + EventSystem.current.RaycastAll(pointerEventData, raycastResults); + } + raycastResult = FindFirstRaycast(raycastResults); + } + public void GetAllRaycastResults(PointerEventData pointerEventData, out System.Collections.Generic.List raycastResults) + { + raycastResults = new System.Collections.Generic.List(); + if (EventSystem.current != null) + { + EventSystem.current.RaycastAll(pointerEventData, raycastResults); + } + } + + private UnityEngine.GameObject getGameObjectHit(UnityEngine.Touch touch) + { + + foreach (var camera in UnityEngine.Camera.allCameras.OrderByDescending(c => c.depth)) + { + UnityEngine.Ray ray = camera.ScreenPointToRay(touch.position); + UnityEngine.RaycastHit hit; + if (UnityEngine.Physics.Raycast(ray, out hit)) + { + return hit.transform.gameObject; + } + UnityEngine.RaycastHit2D hit2d = UnityEngine.Physics2D.GetRayIntersection(camera.ScreenPointToRay(touch.position)); + if (hit2d.collider != null) + { + return hit2d.transform.gameObject; + } + } + return null; + } + } +} diff --git a/Assets/AltTester/Runtime/AltMockUpPointerInputModule.cs.meta b/Assets/AltTester/Runtime/AltMockUpPointerInputModule.cs.meta new file mode 100644 index 00000000..a6076849 --- /dev/null +++ b/Assets/AltTester/Runtime/AltMockUpPointerInputModule.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fd22cbab732c76a42a9449ca3910ab2e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltPrefabDrag.cs b/Assets/AltTester/Runtime/AltPrefabDrag.cs new file mode 100644 index 00000000..93ebbf13 --- /dev/null +++ b/Assets/AltTester/Runtime/AltPrefabDrag.cs @@ -0,0 +1,80 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.EventSystems; + +namespace AltTester.AltTesterUnitySDK.UI +{ + + public class AltPrefabDrag : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler + { + + public void OnBeginDrag(PointerEventData eventData) + { + if (eventData.pointerDrag != null) + { + var group = eventData.pointerDrag.AddComponent(); + group.blocksRaycasts = false; + + } + } + + public void OnDrag(PointerEventData eventData) + { + if (eventData.pointerDrag != null) + { +#if ENABLE_LEGACY_INPUT_MANAGER + eventData.pointerDrag.transform.position = Input.mousePosition; +#else + eventData.pointerDrag.gameObject.transform.position = UnityEngine.InputSystem.Mouse.current.position.ReadValue(); +#endif + var objectTranform = (RectTransform)eventData.pointerDrag.transform; + if (objectTranform.position.x < objectTranform.rect.width) + { + objectTranform.position = new Vector3(objectTranform.rect.width, objectTranform.position.y, objectTranform.position.z); + } + else if (objectTranform.position.x > Screen.width) + { + objectTranform.position = new Vector3(Screen.width, objectTranform.position.y, objectTranform.position.z); + } + if (objectTranform.position.y < 0) + { + objectTranform.position = new Vector3(objectTranform.position.x, 0, objectTranform.position.z); + } + else if (objectTranform.position.y > Screen.height - objectTranform.rect.height) + { + objectTranform.position = new Vector3(objectTranform.position.x, Screen.height - objectTranform.rect.height, objectTranform.position.z); + } + + } + } + + public void OnEndDrag(PointerEventData eventData) + { + if (eventData.pointerDrag != null) + { + var canvasGroup = eventData.pointerDrag.GetComponent(); + Destroy(canvasGroup); + } + } + + } + +} diff --git a/Assets/AltTester/Runtime/AltPrefabDrag.cs.meta b/Assets/AltTester/Runtime/AltPrefabDrag.cs.meta new file mode 100644 index 00000000..91e9c7f0 --- /dev/null +++ b/Assets/AltTester/Runtime/AltPrefabDrag.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d187692c75363b842b0a863dfac6d44e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltRunner.cs b/Assets/AltTester/Runtime/AltRunner.cs new file mode 100644 index 00000000..05688a05 --- /dev/null +++ b/Assets/AltTester/Runtime/AltRunner.cs @@ -0,0 +1,279 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System; +using System.Collections.Generic; +using AltTester.AltTesterUnitySDK.Communication; +using AltTester.AltTesterUnitySDK.Driver; +using AltTester.AltTesterUnitySDK.Driver.Logging; +using AltTester.AltTesterUnitySDK.Logging; +using AltTester.AltTesterUnitySDK.Notification; +using UnityEngine; + +namespace AltTester.AltTesterUnitySDK +{ + public class AltRunner : UnityEngine.MonoBehaviour + { + private static readonly NLog.Logger logger = ServerLogManager.Instance.GetCurrentClassLogger(); + + public static readonly string VERSION = "2.1.0"; + public static AltRunner _altRunner; + public static AltResponseQueue _responseQueue; + public AltInstrumentationSettings InstrumentationSettings = null; + + + [UnityEngine.Space] + public bool RunOnlyInDebugMode = true; + public UnityEngine.Shader outlineShader; + public UnityEngine.GameObject panelHightlightPrefab; + + + #region MonoBehaviour + + protected void Awake() + { +#if !ALTTESTER + logger.Error("ALTTESTER needs to be added to 'Scripting Define Symbols'"); + Destroy(this.gameObject); + return; + +#else + if (_altRunner != null) + { + Destroy(this.gameObject); + return; + } + + if (RunOnlyInDebugMode && !UnityEngine.Debug.isDebugBuild) + { + logger.Error("AltTester® runs only on Debug build"); + Destroy(this.gameObject); + return; + } + + ServerLogManager.SetupAltServerLogging(new Dictionary { { AltLogger.File, AltLogLevel.Debug }, { AltLogger.Unity, AltLogLevel.Debug } }); + + _altRunner = this; + DontDestroyOnLoad(this); +#endif + } + protected void Start() + { + _responseQueue = new AltResponseQueue(); + + } + + protected void Update() + { + _responseQueue.Cycle(); + } + + #endregion + #region public methods + + public void OnApplicationPause(bool pauseStatus) + { + AltTesterApplicationPausedNotification.OnPause(pauseStatus); + } + + public AltObject GameObjectToAltObject(UnityEngine.GameObject altGameObject, UnityEngine.Camera camera = null) + { + UnityEngine.Vector3 position; + + int cameraId; + //if no camera is given it will iterate through all cameras until found one that sees the object if no camera sees the object it will return the position from the last camera + // if there is no camera in the scene it will return as screen position x:-1 y=-1, z=-1 and cameraId=-1 + try + { + if (camera == null) + { + cameraId = FindCameraThatSeesObject(altGameObject, out position); + } + else + { + position = getObjectScreenPosition(altGameObject, camera); + cameraId = camera.GetInstanceID(); + } + } + catch (Exception) + { + position = UnityEngine.Vector3.one * -1; + cameraId = -1; + } + + int transformParentId = altGameObject.transform.parent == null ? 0 : altGameObject.transform.parent.GetInstanceID(); + + var altObject = new AltObject( + name: altGameObject.name, + id: altGameObject.GetInstanceID(), + x: Convert.ToInt32(UnityEngine.Mathf.Round(position.x)), + y: Convert.ToInt32(UnityEngine.Mathf.Round(position.y)), + z: Convert.ToInt32(UnityEngine.Mathf.Round(position.z)),//if z is negative object is behind the camera + mobileY: Convert.ToInt32(UnityEngine.Mathf.Round(UnityEngine.Screen.height - position.y)), + type: "", + enabled: altGameObject.activeSelf, + worldX: altGameObject.transform.position.x, + worldY: altGameObject.transform.position.y, + worldZ: altGameObject.transform.position.z, + idCamera: cameraId, + transformId: altGameObject.transform.GetInstanceID(), + transformParentId: transformParentId); + return altObject; + } + + public AltObjectLight GameObjectToAltObjectLight(UnityEngine.GameObject altGameObject) + { + int transformParentId = altGameObject.transform.parent == null ? 0 : altGameObject.transform.parent.GetInstanceID(); + AltObjectLight altObject = new AltObjectLight( + name: altGameObject.name, + id: altGameObject.GetInstanceID(), + enabled: altGameObject.activeSelf, + idCamera: 0, + transformId: altGameObject.transform.GetInstanceID(), + transformParentId: transformParentId); + + return altObject; + } + + public static UnityEngine.GameObject[] GetDontDestroyOnLoadObjects() + { + UnityEngine.GameObject temp = null; + try + { + temp = new UnityEngine.GameObject(); + DontDestroyOnLoad(temp); + UnityEngine.SceneManagement.Scene dontDestroyOnLoad = temp.scene; + DestroyImmediate(temp); + temp = null; + + return dontDestroyOnLoad.GetRootGameObjects(); + } + finally + { + if (temp != null) + DestroyImmediate(temp); + } + } + + public static UnityEngine.GameObject GetGameObject(int objectId) + { + foreach (UnityEngine.GameObject gameObject in UnityEngine.Resources.FindObjectsOfTypeAll()) + { + if (gameObject.GetInstanceID() == objectId) + return gameObject; + } + throw new NotFoundException("Object not found"); + } + + public UnityEngine.Camera FoundCameraById(int id) + { + foreach (var camera in UnityEngine.Camera.allCameras) + { + if (camera.GetInstanceID() == id) + return camera; + } + + return null; + } + + public System.Collections.IEnumerator RunActionAfterEndOfFrame(Action action) + { +#if UNITY_EDITOR + if (Application.isBatchMode) + { + yield return null; + } + else +#endif + yield return new UnityEngine.WaitForEndOfFrame(); + action(); + } + + + #endregion + #region private methods + private UnityEngine.Vector3 getObjectScreenPosition(UnityEngine.GameObject gameObject, UnityEngine.Camera camera) + { + var selectedCamera = camera; + var position = gameObject.transform.position; + UnityEngine.Canvas canvas = gameObject.GetComponentInParent(); + if (canvas != null) + { + if (gameObject.GetComponent() == null) + return camera.WorldToScreenPoint(gameObject.transform.position); + + UnityEngine.Vector3[] vector3S = new UnityEngine.Vector3[4]; + gameObject.GetComponent().GetWorldCorners(vector3S); + position = new UnityEngine.Vector3((vector3S[0].x + vector3S[2].x) / 2, (vector3S[0].y + vector3S[2].y) / 2, (vector3S[0].z + vector3S[2].z) / 2); + + if (canvas.renderMode == UnityEngine.RenderMode.ScreenSpaceOverlay) + { + return position; + } + if (canvas.worldCamera != null) + { + selectedCamera = canvas.worldCamera; + } + return selectedCamera.WorldToScreenPoint(position); + + } + + var collider = gameObject.GetComponent(); + if (collider != null) + { + position = collider.bounds.center; + } + + return camera.WorldToScreenPoint(position); + } + /// + /// Iterate through all cameras until finds one that sees the object. + /// If no camera sees the object return the position from the last camera + /// + public int FindCameraThatSeesObject(UnityEngine.GameObject gameObject, out UnityEngine.Vector3 position) + { + position = UnityEngine.Vector3.one * -1; + int cameraId = -1; + if (UnityEngine.Camera.allCamerasCount == 0) + { + var rectTransform = gameObject.GetComponent(); + if (rectTransform != null) + { + var canvas = rectTransform.GetComponentInParent(); + if (canvas != null) + position = UnityEngine.RectTransformUtility.PixelAdjustPoint(rectTransform.position, rectTransform, canvas.rootCanvas); + } + return cameraId; + } + foreach (var camera1 in UnityEngine.Camera.allCameras) + { + position = getObjectScreenPosition(gameObject, camera1); + cameraId = camera1.GetInstanceID(); + if (position.x > 0 && + position.y > 0 && + position.x < UnityEngine.Screen.width && + position.y < UnityEngine.Screen.height && + position.z >= 0)//Check if camera sees the object + { + break; + } + } + return cameraId; + } + #endregion + } +} diff --git a/Assets/AltTester/Runtime/AltRunner.cs.meta b/Assets/AltTester/Runtime/AltRunner.cs.meta new file mode 100644 index 00000000..db2bd73a --- /dev/null +++ b/Assets/AltTester/Runtime/AltRunner.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d19d5afb9a9fc1b4082566f125895057 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: -1300 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/AltTester/Runtime/AltScrollViewButtonController.cs b/Assets/AltTester/Runtime/AltScrollViewButtonController.cs new file mode 100644 index 00000000..879fce94 --- /dev/null +++ b/Assets/AltTester/Runtime/AltScrollViewButtonController.cs @@ -0,0 +1,39 @@ +/* + Copyright(C) 2023 Altom Consulting + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class AltScrollViewButtonController : MonoBehaviour +{ + // Start is called before the first frame update + public static int Counter = 0; + void Start() + { + Counter = 0; + GetComponent