content
stringlengths
5
1.04M
avg_line_length
float64
1.75
12.9k
max_line_length
int64
2
244k
alphanum_fraction
float64
0
0.98
licenses
list
repository_name
stringlengths
7
92
path
stringlengths
3
249
size
int64
5
1.04M
lang
stringclasses
2 values
using Genbox.WolframAlpha.Enums; namespace Genbox.WolframAlpha.Objects { public class DidYouMean { public double Score { get; set; } public Level Level { get; set; } public string Value { get; set; } } }
21.909091
41
0.626556
[ "MIT" ]
Genbox/WolframAlpha
src/WolframAlpha/Objects/DidYouMean.cs
243
C#
namespace MassTransit.RabbitMqTransport.Tests { using System.Threading.Tasks; using NUnit.Framework; using Serialization; using TestFramework; using TestFramework.Messages; [TestFixture] public class Publishing_an_encrypted_message_to_an_endpoint_with_a_symmetric_key : RabbitMqTestFixture { [Test] public async Task Should_succeed() { await Bus.Publish(new PingMessage()); ConsumeContext<PingMessage> received = await _handler; Assert.AreEqual(EncryptedMessageSerializerV2.EncryptedContentType, received.ReceiveContext.ContentType); } Task<ConsumeContext<PingMessage>> _handler; protected override void ConfigureRabbitMqReceiveEndpoint(IRabbitMqReceiveEndpointConfigurator configurator) { _handler = Handled<PingMessage>(configurator); } protected override void ConfigureRabbitMqBus(IRabbitMqBusFactoryConfigurator configurator) { var key = new byte[] { 31, 182, 254, 29, 98, 114, 85, 168, 176, 48, 113, 206, 198, 176, 181, 125, 106, 134, 98, 217, 113, 158, 88, 75, 118, 223, 117, 160, 224, 1, 47, 162 }; configurator.UseEncryption(key); base.ConfigureRabbitMqBus(configurator); } } [TestFixture] public class Publishing_an_encrypted_message_to_an_endpoint_with_a_specific_key : RabbitMqTestFixture { [Test] public async Task Should_succeed() { await Bus.Publish(new PingMessage(), context => context.SetEncryptionKeyId("secure")); ConsumeContext<PingMessage> received = await _handler; Assert.AreEqual(EncryptedMessageSerializer.EncryptedContentType, received.ReceiveContext.ContentType); } Task<ConsumeContext<PingMessage>> _handler; protected override void ConfigureRabbitMqReceiveEndpoint(IRabbitMqReceiveEndpointConfigurator configurator) { _handler = Handled<PingMessage>(configurator); } protected override void ConfigureRabbitMqBus(IRabbitMqBusFactoryConfigurator configurator) { ISymmetricKeyProvider keyProvider = new TestSymmetricKeyProvider("secure"); var streamProvider = new AesCryptoStreamProvider(keyProvider, "default"); configurator.UseEncryptedSerializer(streamProvider); base.ConfigureRabbitMqBus(configurator); } } }
27.944444
116
0.562293
[ "ECL-2.0", "Apache-2.0" ]
MathiasZander/ServiceFabricPerfomanceTest
tests/MassTransit.RabbitMqTransport.Tests/Encrypted_Specs.cs
3,020
C#
using UnityEditor; using UnityEngine; using UnityEngine.SceneManagement; namespace Shork { public class PlayerManager : MonoBehaviour { #region Player Postion & Physics Referencing public Rigidbody rb; public LayerMask groundMask; public Transform playerTransform; public GameObject player; public static float life = 1000; #endregion #region Movement Stats [Header("Movement Stats")] [HideInInspector] public float currentSpeed = 0f; public float baseSpeed = 10f; public float boostSpeed = 1.7f; float horizontalMove; float verticalMove; #endregion #region Jump Stats [Header("Jump Settings")] public Vector3 jump; public float jumpForce = 2.0f; public bool isGrounded = true; public bool canJump = true; public bool hadJumped; #endregion private void Start() { playerTransform = GetComponent<Transform>(); rb = GetComponent<Rigidbody>(); } private void Update() { PlayerInputs(); PlayerRespawn(); } // Handling physics in FixedUpdate for accuracy. Aka less jank because Update makes stuff fucking suck. private void FixedUpdate() { Movement(); } private void Movement() { jump = new Vector3(0.0f, jumpForce, 0.0f); Vector3 movement = transform.forward * verticalMove + transform.right * horizontalMove; movement = movement.normalized; rb.MovePosition(Vector3.MoveTowards(transform.position, transform.position + movement, currentSpeed * Time.deltaTime)); // Handles getting sprint input and executing if (Input.GetKey(KeyCode.LeftShift)) { currentSpeed = baseSpeed * boostSpeed; } else { currentSpeed = baseSpeed; } // Handles getting jump input and executing isGrounded = Physics.Raycast(transform.position, Vector3.down, 0.1f, groundMask); if (!hadJumped) { if (isGrounded && canJump) { rb.AddForce(jump * jumpForce, ForceMode.Impulse); isGrounded = false; canJump = false; } } hadJumped = canJump; } private void PlayerRespawn() { if (playerTransform.position.y < -1) { FindObjectOfType<AudioManager>().Play("PlayerDeath"); Scene scene = SceneManager.GetActiveScene(); SceneManager.LoadScene(scene.name); } } private void PlayerInputs() { verticalMove = Input.GetAxisRaw("Vertical"); horizontalMove = Input.GetAxisRaw("Horizontal"); canJump = Input.GetKeyDown(KeyCode.Space); } } }
28.311927
131
0.549255
[ "MIT" ]
WaifuShork/cube-shooter
Assets/Scripts/PlayerManager.cs
3,088
C#
namespace Dragonfly.PeekabooProperties.Extensions { using Umbraco.Core.Models; public static class ContentExtensions { public static string GetPropertyValueAsString(this IContent Content, string PropertyName) { string result = string.Empty; if (Content.HasProperty(PropertyName) && Content.GetValue(PropertyName) != null) { result = Content.GetValue(PropertyName).ToString(); } return result; } } }
27.263158
97
0.617761
[ "MIT" ]
hfloyd/Dragonfly.Umbraco8PeekabooProperties
src/Dragonfly/PeekabooProperties/Extensions/IContentExtensions.cs
520
C#
using System; using System.Diagnostics.CodeAnalysis; namespace Gapotchenko.FX { partial class Fn { /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action? Delegate(Action? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T">The type of the parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T>? Delegate<T>(Action<T>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T1, T2>? Delegate<T1, T2>(Action<T1, T2>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T1, T2, T3>? Delegate<T1, T2, T3>(Action<T1, T2, T3>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T1, T2, T3, T4>? Delegate<T1, T2, T3, T4>(Action<T1, T2, T3, T4>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T1, T2, T3, T4, T5>? Delegate<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T1, T2, T3, T4, T5, T6>? Delegate<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T1, T2, T3, T4, T5, T6, T7>? Delegate<T1, T2, T3, T4, T5, T6, T7>(Action<T1, T2, T3, T4, T5, T6, T7>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T1, T2, T3, T4, T5, T6, T7, T8>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8>(Action<T1, T2, T3, T4, T5, T6, T7, T8>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <typeparam name="T10">The type of the tenth parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <typeparam name="T10">The type of the tenth parameter of a lambda function.</typeparam> /// <typeparam name="T11">The type of the eleventh parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <typeparam name="T10">The type of the tenth parameter of a lambda function.</typeparam> /// <typeparam name="T11">The type of the eleventh parameter of a lambda function.</typeparam> /// <typeparam name="T12">The type of the twelveth parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <typeparam name="T10">The type of the tenth parameter of a lambda function.</typeparam> /// <typeparam name="T11">The type of the eleventh parameter of a lambda function.</typeparam> /// <typeparam name="T12">The type of the twelveth parameter of a lambda function.</typeparam> /// <typeparam name="T13">The type of the thirteenth parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <typeparam name="T10">The type of the tenth parameter of a lambda function.</typeparam> /// <typeparam name="T11">The type of the eleventh parameter of a lambda function.</typeparam> /// <typeparam name="T12">The type of the twelveth parameter of a lambda function.</typeparam> /// <typeparam name="T13">The type of the thirteenth parameter of a lambda function.</typeparam> /// <typeparam name="T14">The type of the fourteenth parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <typeparam name="T10">The type of the tenth parameter of a lambda function.</typeparam> /// <typeparam name="T11">The type of the eleventh parameter of a lambda function.</typeparam> /// <typeparam name="T12">The type of the twelveth parameter of a lambda function.</typeparam> /// <typeparam name="T13">The type of the thirteenth parameter of a lambda function.</typeparam> /// <typeparam name="T14">The type of the fourteenth parameter of a lambda function.</typeparam> /// <typeparam name="T15">The type of the fifteenth parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <typeparam name="T10">The type of the tenth parameter of a lambda function.</typeparam> /// <typeparam name="T11">The type of the eleventh parameter of a lambda function.</typeparam> /// <typeparam name="T12">The type of the twelveth parameter of a lambda function.</typeparam> /// <typeparam name="T13">The type of the thirteenth parameter of a lambda function.</typeparam> /// <typeparam name="T14">The type of the fourteenth parameter of a lambda function.</typeparam> /// <typeparam name="T15">The type of the fifteenth parameter of a lambda function.</typeparam> /// <typeparam name="T16">The type of the sixteenth parameter of a lambda function.</typeparam> /// <param name="action">The lambda function.</param> /// <returns>The lambda function specified by an <paramref name="action"/> parameter.</returns> [return: NotNullIfNotNull("action")] public static Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>? action) => action; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<TResult>? Delegate<TResult>(Func<TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T">The type of the parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T, TResult>? Delegate<T, TResult>(Func<T, TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T1, T2, TResult>? Delegate<T1, T2, TResult>(Func<T1, T2, TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T1, T2, T3, TResult>? Delegate<T1, T2, T3, TResult>(Func<T1, T2, T3, TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T1, T2, T3, T4, TResult>? Delegate<T1, T2, T3, T4, TResult>(Func<T1, T2, T3, T4, TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T1, T2, T3, T4, T5, TResult>? Delegate<T1, T2, T3, T4, T5, TResult>(Func<T1, T2, T3, T4, T5, TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T1, T2, T3, T4, T5, T6, TResult>? Delegate<T1, T2, T3, T4, T5, T6, TResult>(Func<T1, T2, T3, T4, T5, T6, TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T1, T2, T3, T4, T5, T6, T7, TResult>? Delegate<T1, T2, T3, T4, T5, T6, T7, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <typeparam name="T10">The type of the tenth parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <typeparam name="T10">The type of the tenth parameter of a lambda function.</typeparam> /// <typeparam name="T11">The type of the eleventh parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <typeparam name="T10">The type of the tenth parameter of a lambda function.</typeparam> /// <typeparam name="T11">The type of the eleventh parameter of a lambda function.</typeparam> /// <typeparam name="T12">The type of the twelveth parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <typeparam name="T10">The type of the tenth parameter of a lambda function.</typeparam> /// <typeparam name="T11">The type of the eleventh parameter of a lambda function.</typeparam> /// <typeparam name="T12">The type of the twelveth parameter of a lambda function.</typeparam> /// <typeparam name="T13">The type of the thirteenth parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <typeparam name="T10">The type of the tenth parameter of a lambda function.</typeparam> /// <typeparam name="T11">The type of the eleventh parameter of a lambda function.</typeparam> /// <typeparam name="T12">The type of the twelveth parameter of a lambda function.</typeparam> /// <typeparam name="T13">The type of the thirteenth parameter of a lambda function.</typeparam> /// <typeparam name="T14">The type of the fourteenth parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <typeparam name="T10">The type of the tenth parameter of a lambda function.</typeparam> /// <typeparam name="T11">The type of the eleventh parameter of a lambda function.</typeparam> /// <typeparam name="T12">The type of the twelveth parameter of a lambda function.</typeparam> /// <typeparam name="T13">The type of the thirteenth parameter of a lambda function.</typeparam> /// <typeparam name="T14">The type of the fourteenth parameter of a lambda function.</typeparam> /// <typeparam name="T15">The type of the fifteenth parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>? func) => func; /// <summary> /// Infers the delegate type of a specified lambda function. /// </summary> /// <typeparam name="T1">The type of the first parameter of a lambda function.</typeparam> /// <typeparam name="T2">The type of the second parameter of a lambda function.</typeparam> /// <typeparam name="T3">The type of the third parameter of a lambda function.</typeparam> /// <typeparam name="T4">The type of the fourth parameter of a lambda function.</typeparam> /// <typeparam name="T5">The type of the fifth parameter of a lambda function.</typeparam> /// <typeparam name="T6">The type of the sixth parameter of a lambda function.</typeparam> /// <typeparam name="T7">The type of the seventh parameter of a lambda function.</typeparam> /// <typeparam name="T8">The type of the eighth parameter of a lambda function.</typeparam> /// <typeparam name="T9">The type of the ninth parameter of a lambda function.</typeparam> /// <typeparam name="T10">The type of the tenth parameter of a lambda function.</typeparam> /// <typeparam name="T11">The type of the eleventh parameter of a lambda function.</typeparam> /// <typeparam name="T12">The type of the twelveth parameter of a lambda function.</typeparam> /// <typeparam name="T13">The type of the thirteenth parameter of a lambda function.</typeparam> /// <typeparam name="T14">The type of the fourteenth parameter of a lambda function.</typeparam> /// <typeparam name="T15">The type of the fifteenth parameter of a lambda function.</typeparam> /// <typeparam name="T16">The type of the sixteenth parameter of a lambda function.</typeparam> /// <typeparam name="TResult">The type of the result of a lambda function.</typeparam> /// <param name="func">The lambda function.</param> /// <returns>The lambda function specified by a <paramref name="func"/> parameter.</returns> [return: NotNullIfNotNull("func")] public static Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>? Delegate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>? func) => func; } }
80.584211
297
0.648793
[ "MIT" ]
gapotchenko/Gapotchenko.FX
Source/Gapotchenko.FX/Fn.Delegate.cs
45,935
C#
using Newtonsoft.Json; namespace Elements.Geometry.Solids { /// <summary> /// The base class for all operations which create solids. /// </summary> [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] public abstract class SolidOperation { internal Solid _solid; /// <summary> /// The local transform of the operation. /// </summary> public Transform LocalTransform { get; set; } /// <summary> /// The solid operation's solid. /// </summary> [JsonIgnore] public Solid Solid { get { return _solid; } } /// <summary>Is the solid operation a void operation?</summary> [JsonProperty("IsVoid", Required = Required.Always)] public bool IsVoid { get; set; } = false; /// <summary> /// Construct a solid operation. /// </summary> /// <param name="isVoid"></param> [JsonConstructor] public SolidOperation(bool @isVoid) { this.IsVoid = @isVoid; } /// <summary> /// An event raised when a property is changed. /// </summary> public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; /// <summary> /// Raise a property change event. /// </summary> /// <param name="propertyName">The name of the property.</param> protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null) { var handler = PropertyChanged; if (handler != null) handler(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); } } }
31.561404
130
0.586437
[ "MIT" ]
hypar-io/elements
Elements/src/Geometry/Solids/SolidOperation.cs
1,799
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Reflection; namespace CodeBuilder.WinForm.UI { public partial class AboutBox : Form { public AboutBox() { InitializeComponent(); this.SetAboutInfo(); } private void OkButton_Click(object sender, EventArgs e) { this.Close(); } private void infoLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { System.Diagnostics.Process.Start(this.infoLinkLabel.Text); infoLinkLabel.LinkVisited = true; } private void SetAboutInfo() { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string versionText = executingAssembly.GetName().Version.ToString(); this.versionLabel.Text = versionText; dotNetVersionLabel.Text = string.Format(".Net Framework {0}", Environment.Version); } } }
26.619048
95
0.644007
[ "MIT" ]
ijlynivfhp/CodeBuilder
CodeBuilder.WinForm/UI/Forms/AboutBox.cs
1,120
C#
namespace Eventi.Contracts.V1.Requests { public class OrganizerSearchRequest { public string Name { get; set; } public string PhoneNumber { get; set; } public string Username { get; set; } public string Email { get; set; } public int? AccountID { get; set; } } }
24.384615
47
0.602524
[ "MIT" ]
EnisMulic/Even
Eventi.Contracts/V1/Requests/OrganizerSearchRequest.cs
319
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Huerate.Configuration")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Huerate.Configuration")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4d53cd45-06ec-4c1a-9190-2883e65a068a")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
39.216216
85
0.728463
[ "MIT" ]
jakubka/Huerate
Huerate.Configuration/Properties/AssemblyInfo.cs
1,454
C#
using System.IO; using Newtonsoft.Json; namespace CDR.DataRecipient.SDK.Extensions { public static class JsonExtensions { public static string ToPrettyJson(this string json) { dynamic parsedJson = JsonConvert.DeserializeObject(json); return JsonConvert.SerializeObject(parsedJson, Formatting.Indented); //using (var stringReader = new StringReader(json)) //using (var stringWriter = new StringWriter()) //{ // var jsonReader = new JsonTextReader(stringReader); // var jsonWriter = new JsonTextWriter(stringWriter) { Formatting = Formatting.Indented }; // jsonWriter.WriteToken(jsonReader); // return stringWriter.ToString(); //} } } }
33.583333
105
0.615385
[ "MIT" ]
CDR-DavidR/mock-data-recipient
Source/CDR.DataRecipient.SDK/Extensions/JsonExtensions.cs
808
C#
using MicBeach.Develop.CQuery; using MicBeach.Util.Paging; using MicBeach.Develop.Domain.Repository; using MicBeach.Domain.Sys.Model; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MicBeach.Domain.Sys.Repository { /// <summary> /// 角色权限存储 /// </summary> public interface IRoleAuthorizeRepository { #region 保存角色授权 /// <summary> /// 保存角色授权 /// </summary> /// <param name="roleAuths">角色权限信息</param> void Save(IEnumerable<Tuple<Role, Authority>> roleAuths); #endregion #region 移除角色授权 /// <summary> /// 移除角色授权 /// </summary> /// <param name="roleAuths">角色权限信息</param> void Remove(IEnumerable<Tuple<Role, Authority>> roleAuths); #endregion #region 删除权限数据并删除相应的角色授权 /// <summary> /// 删除权限数据并删除相应的角色授权 /// </summary> /// <param name="authoritys">授权信息</param> void RemoveRoleAuthorizeByAuthority(IEnumerable<Authority> authoritys); #endregion #region 删除角色数据删除相应的角色授权 /// <summary> /// 删除角色数据删除相应的角色授权 /// </summary> /// <param name="roles">用户信息</param> void RemoveRoleAuthorizeByRole(IEnumerable<Role> roles); #endregion } }
22.983051
79
0.60472
[ "MIT" ]
Rottener/MicBeach.Framework.Core
src/Application/Logic/Business/Domain/MicBeach.Domain.Sys/Repository/IRoleAuthorizeRepository.cs
1,582
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Runtime.InteropServices.WindowsRuntime; using System.Threading.Tasks; using Microsoft.UI.Dispatching; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls.Primitives; using Microsoft.UI.Xaml.Data; using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Navigation; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Notifications; using WinUIEx; namespace WinUIExSample { /// <summary> /// An empty window that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class MainWindow : WindowEx { private readonly Queue<string> windowEvents = new Queue<string>(); #if EXPERIMENTAL private readonly WindowMessageMonitor monitor; #endif public MainWindow() { this.InitializeComponent(); this.PresenterChanged += (s, e) => Log("PresenterChanged"); this.PositionChanged += (s, e) => Log("PositionChanged"); this.SetTitleBarBackgroundColors(Microsoft.UI.Colors.CornflowerBlue); #if EXPERIMENTAL monitor = new WindowMessageMonitor(this); monitor.WindowMessageRecieved += Monitor_WindowMessageRecieved; #endif var monitors = MonitorInfo.GetDisplayMonitors(); foreach (var monitor in monitors.Reverse()) Log(" - " + monitor.ToString()); Log($"{monitors.Count} monitors detected"); } private void Log(string message) { if (!DispatcherQueue.HasThreadAccess) { DispatcherQueue.TryEnqueue(() => { Log(message); }); return; } windowEvents.Enqueue(message); if (windowEvents.Count > 100) windowEvents.Dequeue(); WindowEventLog.Text = string.Join('\n', windowEvents.Reverse()); } #if EXPERIMENTAL private void Monitor_WindowMessageRecieved(object sender, WindowMessageEventArgs e) { Log($"{e.MessageType}: w={e.WParam}, l={e.LParam}"); } #endif private void Center_Click(object sender, RoutedEventArgs e) => this.CenterOnScreen(); private void MaximizeWindow_Click(object sender, RoutedEventArgs e) => this.Maximize(); private void RestoreWindow_Click(object sender, RoutedEventArgs e) => this.Restore(); private async void MinimizeWindow_Click(object sender, RoutedEventArgs e) { this.Minimize(); await Task.Delay(2000); this.Restore(); } private async void HideWindow_Click(object sender, RoutedEventArgs e) { this.Hide(); await Task.Delay(2000); this.Restore(); } private TrayIcon tray; private void ToggleTrayIcon_Click(object sender, RoutedEventArgs e) { if (tray is null) { var icon = Icon.FromFile("Images/WindowIcon.ico"); tray = new TrayIcon(icon); tray.TrayIconLeftMouseDown += (s, e) => this.BringToFront(); } else { tray.Dispose(); tray = null; } } private void MinimizeTrayIcon_Click(object sender, RoutedEventArgs e) { tray?.Dispose(); var icon = Icon.FromFile("Images/WindowIcon.ico"); tray = new TrayIcon(icon); tray.TrayIconLeftMouseDown += (s, e) => { this.Show(); tray.Dispose(); tray = null; }; this.Hide(); } private async void BringToFront_Click(object sender, RoutedEventArgs e) { await Task.Delay(2000); this.BringToFront(); } private void CustomTitleBar_Toggled(object sender, RoutedEventArgs e) { if (((ToggleSwitch)sender).IsOn) { #if EXPERIMENTAL StackPanel stackPanel = new StackPanel() { Orientation = Orientation.Horizontal }; stackPanel.Children.Add(new TextBlock() { Text = Title, FontSize = 24, Foreground = new SolidColorBrush(Microsoft.UI.Colors.Red) }); stackPanel.Children.Add(new TextBox() { PlaceholderText = "Search", Width = 150, Margin = new Thickness(50,0,20,0), VerticalAlignment = VerticalAlignment.Center } ); stackPanel.Children.Add(new Button() { Content = "OK", VerticalAlignment = VerticalAlignment.Center }); TitleBar = stackPanel; #else TitleBar = new TextBlock() { Text = Title, FontSize = 24, Foreground = new SolidColorBrush(Microsoft.UI.Colors.Red) }; #endif } else { TitleBar = null; } } private void Presenter_SelectionChanged(object sender, SelectionChangedEventArgs e) { var index = ((ComboBox)sender).SelectedIndex; if (index == 0) PresenterKind = Microsoft.UI.Windowing.AppWindowPresenterKind.Overlapped; else if (index == 1) PresenterKind = Microsoft.UI.Windowing.AppWindowPresenterKind.CompactOverlay; else if (index == 2) PresenterKind = Microsoft.UI.Windowing.AppWindowPresenterKind.FullScreen; } private async void ShowDialog_Click(object sender, RoutedEventArgs e) { var commands = new List<Windows.UI.Popups.IUICommand>(); commands.Add(new Windows.UI.Popups.UICommand("OK")); commands.Add(new Windows.UI.Popups.UICommand("Maybe")); commands.Add(new Windows.UI.Popups.UICommand("Cancel")); var result = await ShowMessageDialogAsync("This is a simple message dialog", commands, cancelCommandIndex: 2, title: "Dialog title"); Log("You clicked: " + result.Label); } } }
36.169591
181
0.597736
[ "MIT" ]
dotMorten/WinUIEx
src/WinUIExSample/MainWindow.xaml.cs
6,187
C#
using Catalog.Domain.Entities; using Microsoft.EntityFrameworkCore; namespace Catalog.Infrastructure.Persistence { public class CatalogContext : DbContext { public CatalogContext(DbContextOptions<CatalogContext> options) : base(options) { } public DbSet<Product> Products { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity<Product>() .Property(p => p.Price) .HasColumnType("decimal(18,4)"); } } }
25.583333
87
0.631922
[ "MIT" ]
caohoangtg/HUEThoMicroservices
src/Services/Catalog/Catalog.Infrastructure/Persistence/CatalogContext.cs
616
C#
using nevermore.ui.windows; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; namespace nevermore.ui.wpfcontrols { public class TaskMonitorFileUploadDataContext : INotifyPropertyChanged,ITaskMonitorDataContext { public ITaskMonitorContext taskMonitorContext; private bool isRunning = false; private Func<ITaskItemContext, object[],Task> TaskExcuteHandler; private object[] commonParams; private ObservableCollection<ITaskItemContext> taskCollection; public ObservableCollection<ITaskItemContext> TaskCollection { get { return taskCollection; } set { if (Equals(value, taskCollection)) return; taskCollection = value; OnPropertyChanged(); } } private Visibility nullTaskNoteVisibility; public Visibility NullTaskNoteVisibility { get { return nullTaskNoteVisibility; } set { if (Equals(nullTaskNoteVisibility, value)) return; nullTaskNoteVisibility = value; OnPropertyChanged(); } } public Action<ITaskItemContext> OnRetryTask { get { return OnRetryTaskExecute; } } public Action<ITaskItemContext> OnCancelTask { get { return OnCancelTaskExecute; } } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } public TaskMonitorFileUploadDataContext() { NullTaskNoteVisibility = Visibility.Visible; } public void RunTaskMonitor(ITaskMonitorContext aTaskMonitorContext,IEnumerable<ITaskItemContext> aTaskItem, Func<ITaskItemContext, object[], Task> aTaskExcuteDelegate, params object[] optionalParams) { taskMonitorContext = aTaskMonitorContext; if (TaskCollection == null) { TaskCollection = new ObservableCollection<ITaskItemContext>(); } TaskExcuteHandler = aTaskExcuteDelegate; aTaskItem.ToList().ForEach(x => { x.TaskId = new Random().Next(); x.TaskProgressRatio = 0; x.TaskStatus = TaskStatusEnum.Ready; x.TaskCancellationTokenSource = new CancellationTokenSource(); if (new FileInfo(x.FilePath).Length > 104857600) { x.TaskStatus = TaskStatusEnum.Error; x.TaskMessage = "文件大小超过100M,暂不支持"; } else if (new FileInfo(x.FilePath).Length >= 1048576) { x.FileLength = System.Math.Ceiling(new FileInfo(x.FilePath).Length / 1048576.0) + "MB"; } else if (new FileInfo(x.FilePath).Length == 0) { x.TaskStatus = TaskStatusEnum.Error; x.TaskMessage = "禁止上传0KB文件"; } else { x.FileLength = System.Math.Ceiling(new FileInfo(x.FilePath).Length / 1024.0) + "KB"; } TaskCollection.Add((TaskItemFileUpload)x); }); commonParams = optionalParams; RunTaskCollection(); } private void OnRetryTaskExecute(ITaskItemContext obj) { obj.TaskStatus = TaskStatusEnum.Hangup; if (!obj.TaskCancellationTokenSource.IsCancellationRequested) { obj.TaskCancellationTokenSource.Cancel(); } RunTaskCollection(); } private void OnCancelTaskExecute(ITaskItemContext obj) { obj.TaskStatus = TaskStatusEnum.Cancel; if (!obj.TaskCancellationTokenSource.IsCancellationRequested) { obj.TaskCancellationTokenSource.Cancel(); } } private void RunTaskCollection() { if (!isRunning) { TaskCollectionOnRun(); } } private async void TaskCollectionOnRun() { isRunning = true; taskMonitorContext?.OnWhenAllTaskComplete(false); NullTaskNoteVisibility = Visibility.Collapsed; await Task.Run(async () => { await Task.Delay(500); TaskCollection = new ObservableCollection<ITaskItemContext>(TaskCollection.Where(x => x.TaskStatus != TaskStatusEnum.Completed)); if (TaskCollection.FirstOrDefault(x => x.TaskStatus == TaskStatusEnum.InProgress) != null) { await Task.Delay(100); TaskCollectionOnRun(); } else { var task = TaskCollection.FirstOrDefault(t => t.TaskStatus == TaskStatusEnum.Ready || t.TaskStatus == TaskStatusEnum.Hangup); if (task != null) { if (task.TaskStatus == TaskStatusEnum.Hangup) { task.TaskCancellationTokenSource = new CancellationTokenSource(); } task.TaskInstance = TaskExcuteHandler?.Invoke(task, commonParams); await Task.Delay(100); await task.TaskInstance.ContinueWith(_ => TaskCollectionOnRun()); } else { isRunning = false; if (TaskCollection.Count() == 0) { NullTaskNoteVisibility = Visibility.Visible; taskMonitorContext?.OnWhenAllTaskComplete(true); } } } }); } } }
38.969512
207
0.546393
[ "MIT" ]
NeverMorewd/nevermore
nevermore.ui/wpfcontrols/TaskMonitorControl/abstractfactory/TaskMonitorFileUploadDataContext.cs
6,427
C#
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the chime-2018-05-01.normal.json service model. */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; using System.IO; using System.Net; using Amazon.Runtime; using Amazon.Runtime.Internal; namespace Amazon.Chime.Model { /// <summary> /// Container for the parameters to the UpdateVoiceConnectorGroup operation. /// Updates details for the specified Amazon Chime Voice Connector group, such as the /// name and Amazon Chime Voice Connector priority ranking. /// </summary> public partial class UpdateVoiceConnectorGroupRequest : AmazonChimeRequest { private string _name; private string _voiceConnectorGroupId; private List<VoiceConnectorItem> _voiceConnectorItems = new List<VoiceConnectorItem>(); /// <summary> /// Gets and sets the property Name. /// <para> /// The name of the Amazon Chime Voice Connector group. /// </para> /// </summary> [AWSProperty(Required=true, Min=1, Max=256)] public string Name { get { return this._name; } set { this._name = value; } } // Check to see if Name property is set internal bool IsSetName() { return this._name != null; } /// <summary> /// Gets and sets the property VoiceConnectorGroupId. /// <para> /// The Amazon Chime Voice Connector group ID. /// </para> /// </summary> [AWSProperty(Required=true)] public string VoiceConnectorGroupId { get { return this._voiceConnectorGroupId; } set { this._voiceConnectorGroupId = value; } } // Check to see if VoiceConnectorGroupId property is set internal bool IsSetVoiceConnectorGroupId() { return this._voiceConnectorGroupId != null; } /// <summary> /// Gets and sets the property VoiceConnectorItems. /// <para> /// The <code>VoiceConnectorItems</code> to associate with the group. /// </para> /// </summary> [AWSProperty(Required=true)] public List<VoiceConnectorItem> VoiceConnectorItems { get { return this._voiceConnectorItems; } set { this._voiceConnectorItems = value; } } // Check to see if VoiceConnectorItems property is set internal bool IsSetVoiceConnectorItems() { return this._voiceConnectorItems != null && this._voiceConnectorItems.Count > 0; } } }
32.51
103
0.630575
[ "Apache-2.0" ]
Singh400/aws-sdk-net
sdk/src/Services/Chime/Generated/Model/UpdateVoiceConnectorGroupRequest.cs
3,251
C#
namespace SoftUni.Models { using System.Collections.Generic; public partial class Address { public Address() { Employees = new HashSet<Employee>(); } public int AddressId { get; set; } public string AddressText { get; set; } public int? TownId { get; set; } public virtual Town Town { get; set; } public virtual ICollection<Employee> Employees { get; set; } } }
20
68
0.573913
[ "MIT" ]
GeorgenaGeorgieva/DB-EntityFramework
03.EF Core-Introduction/10. Departments with More Than 5 Employees/Models/Address.cs
460
C#
using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace WhoAmI.Controllers { [ApiController] [Route("[controller]")] public class WeatherForecastController : ControllerBase { private static readonly string[] Summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" }; private readonly ILogger<WeatherForecastController> _logger; public WeatherForecastController(ILogger<WeatherForecastController> logger) { _logger = logger; } [HttpGet] public IEnumerable<WeatherForecast> Get() { var rng = new Random(); return Enumerable.Range(1, 5).Select(index => new WeatherForecast { Date = DateTime.Now.AddDays(index), TemperatureC = rng.Next(-20, 55), Summary = Summaries[rng.Next(Summaries.Length)] }) .ToArray(); } } }
28.45
110
0.598418
[ "Apache-2.0" ]
guoshengcc/WhoAmI
WhoAmI/WhoAmI/Controllers/WeatherForecastController.cs
1,140
C#
// Copyright (c) Microsoft Corporation. All rights reserved. using FastSerialization; using Microsoft.Diagnostics.Tracing.Utilities; using System; using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; using Address = System.UInt64; #pragma warning disable 1591 // disable warnings on XML comments not being present /* This file was generated with the command */ // traceParserGen /merge CLREtwAll.man CLRTraceEventParser.cs /* And then modified by hand to add functionality (handle to name lookup, fixup of evenMethodLoadUnloadTraceDMOatats ...) */ // The version before any hand modifications is kept as KernelTraceEventParser.base.cs, and a 3 // way diff is done when traceParserGen is rerun. This allows the 'by-hand' modifications to be // applied again if the mof or the traceParserGen transformation changes. // // See traceParserGen /usersGuide for more on the /merge option namespace Microsoft.Diagnostics.Tracing.Parsers { using Microsoft.Diagnostics.Tracing.Parsers.Clr; /* Parsers defined in this file */ // ClrTraceEventParser, ClrRundownTraceEventParser, ClrStressTraceEventParser /* ClrPrivateTraceEventParser #ClrPrivateProvider */ // [SecuritySafeCritical] [System.CodeDom.Compiler.GeneratedCode("traceparsergen", "1.0")] public sealed class ClrTraceEventParser : TraceEventParser { public static readonly string ProviderName = "Microsoft-Windows-DotNETRuntime"; public static readonly Guid ProviderGuid = new Guid(unchecked((int)0xe13c0d23), unchecked((short)0xccbc), unchecked((short)0x4e12), 0x93, 0x1b, 0xd9, 0xcc, 0x2e, 0xee, 0x27, 0xe4); // Project N and the Desktop have separate guids. public static readonly Guid NativeProviderGuid = new Guid(0x47c3ba0c, 0x77f1, 0x4eb0, 0x8d, 0x4d, 0xae, 0xf4, 0x47, 0xf1, 0x6a, 0x85); /// <summary> /// Keywords are passed to TraceEventSession.EnableProvider to enable particular sets of /// </summary> [Flags] public enum Keywords : long { None = 0, All = ~StartEnumeration, // All does not include start-enumeration. It just is not that useful. /// <summary> /// Logging when garbage collections and finalization happen. /// </summary> GC = 0x1, /// <summary> /// Events when GC handles are set or destroyed. /// </summary> GCHandle = 0x2, Binder = 0x4, /// <summary> /// Logging when modules actually get loaded and unloaded. /// </summary> Loader = 0x8, /// <summary> /// Logging when Just in time (JIT) compilation occurs. /// </summary> Jit = 0x10, /// <summary> /// Logging when precompiled native (NGEN) images are loaded. /// </summary> NGen = 0x20, /// <summary> /// Indicates that on attach or module load , a rundown of all existing methods should be done /// </summary> StartEnumeration = 0x40, /// <summary> /// Indicates that on detach or process shutdown, a rundown of all existing methods should be done /// </summary> StopEnumeration = 0x80, /// <summary> /// Events associated with validating security restrictions. /// </summary> Security = 0x400, /// <summary> /// Events for logging resource consumption on an app-domain level granularity /// </summary> AppDomainResourceManagement = 0x800, /// <summary> /// Logging of the internal workings of the Just In Time compiler. This is fairly verbose. /// It details decisions about interesting optimization (like inlining and tail call) /// </summary> JitTracing = 0x1000, /// <summary> /// Log information about code thunks that transition between managed and unmanaged code. /// </summary> Interop = 0x2000, /// <summary> /// Log when lock contention occurs. (Monitor.Enters actually blocks) /// </summary> Contention = 0x4000, /// <summary> /// Log exception processing. /// </summary> Exception = 0x8000, /// <summary> /// Log events associated with the threadpool, and other threading events. /// </summary> Threading = 0x10000, /// <summary> /// Dump the native to IL mapping of any method that is JIT compiled. (V4.5 runtimes and above). /// </summary> JittedMethodILToNativeMap = 0x20000, /// <summary> /// If enabled will suppress the rundown of NGEN events on V4.0 runtime (has no effect on Pre-V4.0 runtimes). /// </summary> OverrideAndSuppressNGenEvents = 0x40000, /// <summary> /// Enables the 'BulkType' event /// </summary> Type = 0x80000, /// <summary> /// Enables the events associated with dumping the GC heap /// </summary> GCHeapDump = 0x100000, /// <summary> /// Enables allocation sampling with the 'fast'. Sample to limit to 100 allocations per second per type. /// This is good for most detailed performance investigations. Note that this DOES update the allocation /// path to be slower and only works if the process start with this on. /// </summary> GCSampledObjectAllocationHigh = 0x200000, /// <summary> /// Enables events associate with object movement or survival with each GC. /// </summary> GCHeapSurvivalAndMovement = 0x400000, /// <summary> /// Triggers a GC. Can pass a 64 bit value that will be logged with the GC Start event so you know which GC you actually triggered. /// </summary> GCHeapCollect = 0x800000, /// <summary> /// Indicates that you want type names looked up and put into the events (not just meta-data tokens). /// </summary> GCHeapAndTypeNames = 0x1000000, /// <summary> /// Enables allocation sampling with the 'slow' rate, Sample to limit to 5 allocations per second per type. /// This is reasonable for monitoring. Note that this DOES update the allocation path to be slower /// and only works if the process start with this on. /// </summary> GCSampledObjectAllocationLow = 0x2000000, /// <summary> /// Turns on capturing the stack and type of object allocation made by the .NET Runtime. This is only /// supported after V4.5.3 (Late 2014) This can be very verbose and you should seriously using GCSampledObjectAllocationHigh /// instead (and GCSampledObjectAllocationLow for production scenarios). /// </summary> GCAllObjectAllocation = GCSampledObjectAllocationHigh | GCSampledObjectAllocationLow, /// <summary> /// This suppresses NGEN events on V4.0 (where you have NGEN PDBs), but not on V2.0 (which does not know about this /// bit and also does not have NGEN PDBS). /// </summary> SupressNGen = 0x40000, /// <summary> /// TODO document /// </summary> PerfTrack = 0x20000000, /// <summary> /// Also log the stack trace of events for which this is valuable. /// </summary> Stack = 0x40000000, /// <summary> /// This allows tracing work item transfer events (thread pool enqueue/dequeue/ioenqueue/iodequeue/a.o.) /// </summary> ThreadTransfer = 0x80000000L, /// <summary> /// .NET Debugger events /// </summary> Debugger = 0x100000000, /// <summary> /// Events intended for monitoring on an ongoing basis. /// </summary> Monitoring = 0x200000000, /// <summary> /// Events that will dump PDBs of dynamically generated assemblies to the ETW stream. /// </summary> Codesymbols = 0x400000000, /// <summary> /// Recommend default flags (good compromise on verbosity). /// </summary> Default = GC | Type | GCHeapSurvivalAndMovement | Binder | Loader | Jit | NGen | SupressNGen | StopEnumeration | Security | AppDomainResourceManagement | Exception | Threading | Contention | Stack | JittedMethodILToNativeMap | ThreadTransfer | GCHeapAndTypeNames | Codesymbols, /// <summary> /// What is needed to get symbols for JIT compiled code. /// </summary> JITSymbols = Jit | StopEnumeration | JittedMethodILToNativeMap | SupressNGen | Loader, /// <summary> /// This provides the flags commonly needed to take a heap .NET Heap snapshot with ETW. /// </summary> GCHeapSnapshot = GC | GCHeapCollect | GCHeapDump | GCHeapAndTypeNames | Type, }; public ClrTraceEventParser(TraceEventSource source) : base(source) { // Subscribe to the GCBulkType events and remember the TypeID -> TypeName mapping. ClrTraceEventParserState state = State; AddCallbackForEvents<GCBulkTypeTraceData>(delegate (GCBulkTypeTraceData data) { for (int i = 0; i < data.Count; i++) { GCBulkTypeValues value = data.Values(i); string typeName = value.TypeName; // The GCBulkType events are logged after the event that needed it. It really // should be before, but we compensate by setting the startTime to 0 // Ideally the CLR logs the types before they are used. state.SetTypeIDToName(data.ProcessID, value.TypeID, 0, typeName); } }); } /// <summary> /// Fetch the state object associated with this parser and cast it to /// the ClrTraceEventParserState type. This state object contains any /// informtion that you need from one event to another to decode events. /// (typically ID->Name tables). /// </summary> internal ClrTraceEventParserState State { get { ClrTraceEventParserState ret = (ClrTraceEventParserState)StateObject; if (ret == null) { ret = new ClrTraceEventParserState(); StateObject = ret; } return ret; } } public event Action<GCStartTraceData> GCStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCStartTraceData(value, 1, 1, "GC", GCTaskGuid, 1, "Start", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 1, ProviderGuid); source.UnregisterEventTemplate(value, 1, GCTaskGuid); } } public event Action<GCEndTraceData> GCStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCEndTraceData(value, 2, 1, "GC", GCTaskGuid, 2, "Stop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 2, ProviderGuid); source.UnregisterEventTemplate(value, 2, GCTaskGuid); } } public event Action<GCNoUserDataTraceData> GCRestartEEStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCNoUserDataTraceData(value, 3, 1, "GC", GCTaskGuid, 132, "RestartEEStop", ProviderGuid, ProviderName)); // Added for V2 Runtime compatibility (Classic ETW only) RegisterTemplate(new GCNoUserDataTraceData(value, 0xFFFF, 1, "GC", GCTaskGuid, 8, "RestartEEStop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 3, ProviderGuid); source.UnregisterEventTemplate(value, 132, GCTaskGuid); } } public event Action<GCHeapStatsTraceData> GCHeapStats { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCHeapStatsTraceData(value, 4, 1, "GC", GCTaskGuid, 133, "HeapStats", ProviderGuid, ProviderName)); // Added for V2 Runtime compatibility (Classic ETW only) RegisterTemplate(new GCHeapStatsTraceData(value, 0xFFFF, 1, "GC", GCTaskGuid, 5, "HeapStats", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 4, ProviderGuid); source.UnregisterEventTemplate(value, 133, GCTaskGuid); } } public event Action<GCCreateSegmentTraceData> GCCreateSegment { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCCreateSegmentTraceData(value, 5, 1, "GC", GCTaskGuid, 134, "CreateSegment", ProviderGuid, ProviderName)); // Added for V2 Runtime compatibility (Classic ETW only) RegisterTemplate(new GCCreateSegmentTraceData(value, 0xFFFF, 1, "GC", GCTaskGuid, 6, "CreateSegment", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 5, ProviderGuid); source.UnregisterEventTemplate(value, 134, GCTaskGuid); } } public event Action<GCFreeSegmentTraceData> GCFreeSegment { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCFreeSegmentTraceData(value, 6, 1, "GC", GCTaskGuid, 135, "FreeSegment", ProviderGuid, ProviderName)); // Added for V2 Runtime compatibility (Classic ETW only) RegisterTemplate(new GCFreeSegmentTraceData(value, 0xFFFF, 1, "GC", GCTaskGuid, 7, "FreeSegment", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 6, ProviderGuid); source.UnregisterEventTemplate(value, 135, GCTaskGuid); } } public event Action<GCNoUserDataTraceData> GCRestartEEStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCNoUserDataTraceData(value, 7, 1, "GC", GCTaskGuid, 136, "RestartEEStart", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 7, ProviderGuid); source.UnregisterEventTemplate(value, 136, GCTaskGuid); } } public event Action<GCNoUserDataTraceData> GCSuspendEEStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCNoUserDataTraceData(value, 8, 1, "GC", GCTaskGuid, 137, "SuspendEEStop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 8, ProviderGuid); source.UnregisterEventTemplate(value, 137, GCTaskGuid); } } public event Action<GCSuspendEETraceData> GCSuspendEEStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCSuspendEETraceData(value, 9, 1, "GC", GCTaskGuid, 10, "SuspendEEStart", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 9, ProviderGuid); source.UnregisterEventTemplate(value, 10, GCTaskGuid); } } public event Action<GCAllocationTickTraceData> GCAllocationTick { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCAllocationTickTraceData(value, 10, 1, "GC", GCTaskGuid, 11, "AllocationTick", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 10, ProviderGuid); source.UnregisterEventTemplate(value, 11, GCTaskGuid); } } public event Action<GCCreateConcurrentThreadTraceData> GCCreateConcurrentThread { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCCreateConcurrentThreadTraceData(value, 11, 1, "GC", GCTaskGuid, 12, "CreateConcurrentThread", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 11, ProviderGuid); source.UnregisterEventTemplate(value, 12, GCTaskGuid); } } public event Action<GCTerminateConcurrentThreadTraceData> GCTerminateConcurrentThread { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCTerminateConcurrentThreadTraceData(value, 12, 1, "GC", GCTaskGuid, 13, "TerminateConcurrentThread", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 12, ProviderGuid); source.UnregisterEventTemplate(value, 13, GCTaskGuid); } } public event Action<GCFinalizersEndTraceData> GCFinalizersStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCFinalizersEndTraceData(value, 13, 1, "GC", GCTaskGuid, 15, "FinalizersStop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 13, ProviderGuid); source.UnregisterEventTemplate(value, 15, GCTaskGuid); } } public event Action<GCNoUserDataTraceData> GCFinalizersStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCNoUserDataTraceData(value, 14, 1, "GC", GCTaskGuid, 19, "FinalizersStart", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 14, ProviderGuid); source.UnregisterEventTemplate(value, 19, GCTaskGuid); } } public event Action<GCBulkTypeTraceData> TypeBulkType { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCBulkTypeTraceData(value, 15, 21, "Type", TypeTaskGuid, 10, "BulkType", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 15, ProviderGuid); source.UnregisterEventTemplate(value, 10, TypeTaskGuid); } } public event Action<GCBulkRootEdgeTraceData> GCBulkRootEdge { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCBulkRootEdgeTraceData(value, 16, 1, "GC", GCTaskGuid, 20, "BulkRootEdge", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 16, ProviderGuid); source.UnregisterEventTemplate(value, 20, GCTaskGuid); } } public event Action<GCBulkRootConditionalWeakTableElementEdgeTraceData> GCBulkRootConditionalWeakTableElementEdge { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCBulkRootConditionalWeakTableElementEdgeTraceData(value, 17, 1, "GC", GCTaskGuid, 21, "BulkRootConditionalWeakTableElementEdge", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 17, ProviderGuid); source.UnregisterEventTemplate(value, 21, GCTaskGuid); } } public event Action<GCBulkNodeTraceData> GCBulkNode { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCBulkNodeTraceData(value, 18, 1, "GC", GCTaskGuid, 22, "BulkNode", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 18, ProviderGuid); source.UnregisterEventTemplate(value, 22, GCTaskGuid); } } public event Action<GCBulkEdgeTraceData> GCBulkEdge { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCBulkEdgeTraceData(value, 19, 1, "GC", GCTaskGuid, 23, "BulkEdge", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 19, ProviderGuid); source.UnregisterEventTemplate(value, 23, GCTaskGuid); } } public event Action<GCSampledObjectAllocationTraceData> GCSampledObjectAllocation { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCSampledObjectAllocationTraceData(value, 20, 1, "GC", GCTaskGuid, 24, "SampledObjectAllocation", ProviderGuid, ProviderName)); RegisterTemplate(new GCSampledObjectAllocationTraceData(value, 32, 1, "GC", GCTaskGuid, 24, "SampledObjectAllocation", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 20, ProviderGuid); source.UnregisterEventTemplate(value, 24, GCTaskGuid); source.UnregisterEventTemplate(value, 32, ProviderGuid); source.UnregisterEventTemplate(value, 24, GCTaskGuid); } } public event Action<GCBulkSurvivingObjectRangesTraceData> GCBulkSurvivingObjectRanges { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCBulkSurvivingObjectRangesTraceData(value, 21, 1, "GC", GCTaskGuid, 25, "BulkSurvivingObjectRanges", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 21, ProviderGuid); source.UnregisterEventTemplate(value, 25, GCTaskGuid); } } public event Action<GCBulkMovedObjectRangesTraceData> GCBulkMovedObjectRanges { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCBulkMovedObjectRangesTraceData(value, 22, 1, "GC", GCTaskGuid, 26, "BulkMovedObjectRanges", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 22, ProviderGuid); source.UnregisterEventTemplate(value, 26, GCTaskGuid); } } public event Action<GCGenerationRangeTraceData> GCGenerationRange { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCGenerationRangeTraceData(value, 23, 1, "GC", GCTaskGuid, 27, "GenerationRange", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 23, ProviderGuid); source.UnregisterEventTemplate(value, 27, GCTaskGuid); } } public event Action<GCMarkTraceData> GCMarkStackRoots { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCMarkTraceData(value, 25, 1, "GC", GCTaskGuid, 28, "MarkStackRoots", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 25, ProviderGuid); source.UnregisterEventTemplate(value, 28, GCTaskGuid); } } public event Action<GCMarkTraceData> GCMarkFinalizeQueueRoots { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCMarkTraceData(value, 26, 1, "GC", GCTaskGuid, 29, "MarkFinalizeQueueRoots", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 26, ProviderGuid); source.UnregisterEventTemplate(value, 29, GCTaskGuid); } } public event Action<GCMarkTraceData> GCMarkHandles { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCMarkTraceData(value, 27, 1, "GC", GCTaskGuid, 30, "MarkHandles", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 27, ProviderGuid); source.UnregisterEventTemplate(value, 30, GCTaskGuid); } } public event Action<GCMarkTraceData> GCMarkCards { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCMarkTraceData(value, 28, 1, "GC", GCTaskGuid, 31, "MarkCards", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 28, ProviderGuid); source.UnregisterEventTemplate(value, 31, GCTaskGuid); } } public event Action<GCMarkWithTypeTraceData> GCMarkWithType { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCMarkWithTypeTraceData(value, 202, 1, "GC", GCTaskGuid, 202, "Mark", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 202, ProviderGuid); source.UnregisterEventTemplate(value, 202, GCTaskGuid); } } public event Action<GCPerHeapHistoryTraceData> GCPerHeapHistory { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCPerHeapHistoryTraceData(value, 204, 1, "GC", GCTaskGuid, 204, "PerHeapHistory", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 204, ProviderGuid); source.UnregisterEventTemplate(value, 204, GCTaskGuid); } } public event Action<GCGlobalHeapHistoryTraceData> GCGlobalHeapHistory { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCGlobalHeapHistoryTraceData(value, 205, 1, "GC", GCTaskGuid, 205, "GlobalHeapHistory", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 205, ProviderGuid); source.UnregisterEventTemplate(value, 205, GCTaskGuid); } } public event Action<GCJoinTraceData> GCJoin { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCJoinTraceData(value, 203, 1, "GC", GCTaskGuid, 203, "Join", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 203, ProviderGuid); source.UnregisterEventTemplate(value, 203, GCTaskGuid); } } public event Action<FinalizeObjectTraceData> GCFinalizeObject { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new FinalizeObjectTraceData(value, 29, 1, "GC", GCTaskGuid, 32, "FinalizeObject", ProviderGuid, ProviderName, State)); } remove { source.UnregisterEventTemplate(value, 29, ProviderGuid); source.UnregisterEventTemplate(value, 32, GCTaskGuid); } } public event Action<SetGCHandleTraceData> GCSetGCHandle { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new SetGCHandleTraceData(value, 30, 1, "GC", GCTaskGuid, 33, "SetGCHandle", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 30, ProviderGuid); source.UnregisterEventTemplate(value, 33, GCTaskGuid); } } public event Action<DestroyGCHandleTraceData> GCDestoryGCHandle { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new DestroyGCHandleTraceData(value, 31, 1, "GC", GCTaskGuid, 34, "DestoryGCHandle", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 31, ProviderGuid); source.UnregisterEventTemplate(value, 34, GCTaskGuid); } } public event Action<PinObjectAtGCTimeTraceData> GCPinObjectAtGCTime { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new PinObjectAtGCTimeTraceData(value, 33, 1, "GC", GCTaskGuid, 36, "PinObjectAtGCTime", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 33, ProviderGuid); source.UnregisterEventTemplate(value, 36, GCTaskGuid); } } public event Action<PinPlugAtGCTimeTraceData> GCPinPlugAtGCTime { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new PinPlugAtGCTimeTraceData(value, 34, 1, "GC", GCTaskGuid, 37, "PinPlugAtGCTime", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 34, ProviderGuid); source.UnregisterEventTemplate(value, 37, GCTaskGuid); } } public event Action<GCTriggeredTraceData> GCTriggered { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCTriggeredTraceData(value, 35, 1, "GC", GCTaskGuid, 35, "Triggered", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 35, ProviderGuid); source.UnregisterEventTemplate(value, 35, GCTaskGuid); } } public event Action<GCBulkRootCCWTraceData> GCBulkRootCCW { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCBulkRootCCWTraceData(value, 36, 1, "GC", GCTaskGuid, 38, "BulkRootCCW", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 36, ProviderGuid); } } public event Action<GCBulkRCWTraceData> GCBulkRCW { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCBulkRCWTraceData(value, 37, 1, "GC", GCTaskGuid, 39, "BulkRCW", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 37, ProviderGuid); } } public event Action<GCBulkRootStaticVarTraceData> GCBulkRootStaticVar { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new GCBulkRootStaticVarTraceData(value, 38, 1, "GC", GCTaskGuid, 40, "BulkRootStaticVar", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 38, ProviderGuid); } } public event Action<IOThreadTraceData> IOThreadCreationStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new IOThreadTraceData(value, 44, 3, "IOThreadCreation", IOThreadCreationTaskGuid, 1, "Start", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 44, ProviderGuid); source.UnregisterEventTemplate(value, 1, IOThreadCreationTaskGuid); } } public event Action<IOThreadTraceData> IOThreadCreationStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new IOThreadTraceData(value, 45, 3, "IOThreadCreation", IOThreadCreationTaskGuid, 2, "Stop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 45, ProviderGuid); source.UnregisterEventTemplate(value, 2, IOThreadCreationTaskGuid); } } public event Action<IOThreadTraceData> IOThreadRetirementStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new IOThreadTraceData(value, 46, 5, "IOThreadRetirement", IOThreadRetirementTaskGuid, 1, "Start", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 46, ProviderGuid); source.UnregisterEventTemplate(value, 1, IOThreadRetirementTaskGuid); } } public event Action<IOThreadTraceData> IOThreadRetirementStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new IOThreadTraceData(value, 47, 5, "IOThreadRetirement", IOThreadRetirementTaskGuid, 2, "Stop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 47, ProviderGuid); source.UnregisterEventTemplate(value, 2, IOThreadRetirementTaskGuid); } } public event Action<ThreadPoolWorkerThreadTraceData> ThreadPoolWorkerThreadStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadPoolWorkerThreadTraceData(value, 50, 16, "ThreadPoolWorkerThread", ThreadPoolWorkerThreadTaskGuid, 1, "Start", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 50, ProviderGuid); source.UnregisterEventTemplate(value, 1, ThreadPoolWorkerThreadTaskGuid); } } public event Action<ThreadPoolWorkerThreadTraceData> ThreadPoolWorkerThreadStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadPoolWorkerThreadTraceData(value, 51, 16, "ThreadPoolWorkerThread", ThreadPoolWorkerThreadTaskGuid, 2, "Stop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 51, ProviderGuid); source.UnregisterEventTemplate(value, 2, ThreadPoolWorkerThreadTaskGuid); } } public event Action<ThreadPoolWorkerThreadTraceData> ThreadPoolWorkerThreadWait { add { RegisterTemplate(new ThreadPoolWorkerThreadTraceData(value, 57, 16, "ThreadPoolWorkerThread", Guid.Empty, 90, "Wait", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 57, ProviderGuid); } } public event Action<ThreadPoolWorkerThreadTraceData> ThreadPoolWorkerThreadRetirementStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadPoolWorkerThreadTraceData(value, 52, 17, "ThreadPoolWorkerThreadRetirement", ThreadPoolWorkerThreadRetirementTaskGuid, 1, "Start", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 52, ProviderGuid); source.UnregisterEventTemplate(value, 1, ThreadPoolWorkerThreadRetirementTaskGuid); } } public event Action<ThreadPoolWorkerThreadTraceData> ThreadPoolWorkerThreadRetirementStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadPoolWorkerThreadTraceData(value, 53, 17, "ThreadPoolWorkerThreadRetirement", ThreadPoolWorkerThreadRetirementTaskGuid, 2, "Stop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 53, ProviderGuid); source.UnregisterEventTemplate(value, 2, ThreadPoolWorkerThreadRetirementTaskGuid); } } public event Action<ThreadPoolWorkerThreadAdjustmentSampleTraceData> ThreadPoolWorkerThreadAdjustmentSample { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadPoolWorkerThreadAdjustmentSampleTraceData(value, 54, 18, "ThreadPoolWorkerThreadAdjustment", ThreadPoolWorkerThreadAdjustmentTaskGuid, 100, "Sample", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 54, ProviderGuid); source.UnregisterEventTemplate(value, 100, ThreadPoolWorkerThreadAdjustmentTaskGuid); } } public event Action<ThreadPoolWorkerThreadAdjustmentTraceData> ThreadPoolWorkerThreadAdjustmentAdjustment { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadPoolWorkerThreadAdjustmentTraceData(value, 55, 18, "ThreadPoolWorkerThreadAdjustment", ThreadPoolWorkerThreadAdjustmentTaskGuid, 101, "Adjustment", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 55, ProviderGuid); source.UnregisterEventTemplate(value, 101, ThreadPoolWorkerThreadAdjustmentTaskGuid); } } public event Action<ThreadPoolWorkerThreadAdjustmentStatsTraceData> ThreadPoolWorkerThreadAdjustmentStats { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadPoolWorkerThreadAdjustmentStatsTraceData(value, 56, 18, "ThreadPoolWorkerThreadAdjustment", ThreadPoolWorkerThreadAdjustmentTaskGuid, 102, "Stats", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 56, ProviderGuid); source.UnregisterEventTemplate(value, 102, ThreadPoolWorkerThreadAdjustmentTaskGuid); } } public event Action<ThreadPoolWorkingThreadCountTraceData> ThreadPoolWorkingThreadCountStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadPoolWorkingThreadCountTraceData(value, 60, 22, "ThreadPoolWorkingThreadCount", ThreadPoolWorkingThreadCountTaskGuid, 1, "Start", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 60, ProviderGuid); source.UnregisterEventTemplate(value, 1, ThreadPoolWorkingThreadCountTaskGuid); } } public event Action<ThreadPoolWorkTraceData> ThreadPoolEnqueue { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadPoolWorkTraceData(value, 61, 23, "ThreadPool", ThreadPoolTaskGuid, 11, "Enqueue", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 61, ProviderGuid); source.UnregisterEventTemplate(value, 11, ThreadPoolTaskGuid); } } public event Action<ThreadPoolWorkTraceData> ThreadPoolDequeue { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadPoolWorkTraceData(value, 62, 23, "ThreadPool", ThreadPoolTaskGuid, 12, "Dequeue", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 62, ProviderGuid); source.UnregisterEventTemplate(value, 12, ThreadPoolTaskGuid); } } public event Action<ThreadPoolIOWorkEnqueueTraceData> ThreadPoolIOEnqueue { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadPoolIOWorkEnqueueTraceData(value, 63, 23, "ThreadPool", ThreadPoolTaskGuid, 13, "IOEnqueue", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 63, ProviderGuid); source.UnregisterEventTemplate(value, 13, ThreadPoolTaskGuid); } } public event Action<ThreadPoolIOWorkTraceData> ThreadPoolIODequeue { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadPoolIOWorkTraceData(value, 64, 23, "ThreadPool", ThreadPoolTaskGuid, 14, "IODequeue", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 64, ProviderGuid); source.UnregisterEventTemplate(value, 14, ThreadPoolTaskGuid); } } public event Action<ThreadPoolIOWorkTraceData> ThreadPoolIOPack { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadPoolIOWorkTraceData(value, 65, 23, "ThreadPool", ThreadPoolTaskGuid, 15, "IOPack", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 65, ProviderGuid); source.UnregisterEventTemplate(value, 15, ThreadPoolTaskGuid); } } public event Action<ThreadStartWorkTraceData> ThreadCreating { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadStartWorkTraceData(value, 70, 24, "Thread", ThreadTaskGuid, 11, "Creating", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 70, ProviderGuid); source.UnregisterEventTemplate(value, 11, ThreadTaskGuid); } } public event Action<ThreadStartWorkTraceData> ThreadRunning { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadStartWorkTraceData(value, 71, 24, "Thread", ThreadTaskGuid, 12, "Running", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 71, ProviderGuid); source.UnregisterEventTemplate(value, 12, ThreadTaskGuid); } } public event Action<ExceptionHandlingTraceData> ExceptionCatchStart { add { RegisterTemplate(ExceptionCatchStartTemplate(value)); } remove { source.UnregisterEventTemplate(value, 250, ProviderGuid); } } public event Action<EmptyTraceData> ExceptionCatchStop { add { RegisterTemplate(ExceptionCatchStopTemplate(value)); } remove { source.UnregisterEventTemplate(value, 251, ProviderGuid); } } public event Action<ExceptionHandlingTraceData> ExceptionFilterStart { add { RegisterTemplate(ExceptionFilterStartTemplate(value)); } remove { source.UnregisterEventTemplate(value, 254, ProviderGuid); } } public event Action<EmptyTraceData> ExceptionFilterStop { add { RegisterTemplate(ExceptionFilterStopTemplate(value)); } remove { source.UnregisterEventTemplate(value, 255, ProviderGuid); } } public event Action<ExceptionHandlingTraceData> ExceptionFinallyStart { add { RegisterTemplate(ExceptionFinallyStartTemplate(value)); } remove { source.UnregisterEventTemplate(value, 252, ProviderGuid); } } public event Action<EmptyTraceData> ExceptionFinallyStop { add { RegisterTemplate(ExceptionFinallyStopTemplate(value)); } remove { source.UnregisterEventTemplate(value, 253, ProviderGuid); } } public event Action<ExceptionTraceData> ExceptionStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ExceptionTraceData(value, 80, 7, "Exception", ExceptionTaskGuid, 1, "Start", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 80, ProviderGuid); source.UnregisterEventTemplate(value, 1, ExceptionTaskGuid); } } public event Action<EmptyTraceData> ExceptionStop { add { RegisterTemplate(ExceptionStopTemplate(value)); } remove { source.UnregisterEventTemplate(value, 256, ProviderGuid); } } public event Action<ContentionTraceData> ContentionStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ContentionTraceData(value, 81, 8, "Contention", ContentionTaskGuid, 1, "Start", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 81, ProviderGuid); source.UnregisterEventTemplate(value, 1, ContentionTaskGuid); } } public event Action<MethodILToNativeMapTraceData> MethodILToNativeMap { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodILToNativeMapTraceData(value, 190, 9, "Method", MethodTaskGuid, 87, "ILToNativeMap", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 190, ProviderGuid); source.UnregisterEventTemplate(value, 87, MethodTaskGuid); } } public event Action<ClrStackWalkTraceData> ClrStackWalk { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ClrStackWalkTraceData(value, 82, 11, "ClrStack", ClrStackTaskGuid, 82, "Walk", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 82, ProviderGuid); source.UnregisterEventTemplate(value, 82, ClrStackTaskGuid); } } public event Action<CodeSymbolsTraceData> CodeSymbolsStart { add { RegisterTemplate(CodeSymbolsStartTemplate(value)); } remove { source.UnregisterEventTemplate(value, 260, ProviderGuid); source.UnregisterEventTemplate(value, 1, CodeSymbolsTaskGuid); } } public event Action<AppDomainMemAllocatedTraceData> AppDomainResourceManagementMemAllocated { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new AppDomainMemAllocatedTraceData(value, 83, 14, "AppDomainResourceManagement", AppDomainResourceManagementTaskGuid, 48, "MemAllocated", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 83, ProviderGuid); source.UnregisterEventTemplate(value, 48, AppDomainResourceManagementTaskGuid); } } public event Action<AppDomainMemSurvivedTraceData> AppDomainResourceManagementMemSurvived { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new AppDomainMemSurvivedTraceData(value, 84, 14, "AppDomainResourceManagement", AppDomainResourceManagementTaskGuid, 49, "MemSurvived", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 84, ProviderGuid); source.UnregisterEventTemplate(value, 49, AppDomainResourceManagementTaskGuid); } } public event Action<ThreadCreatedTraceData> AppDomainResourceManagementThreadCreated { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadCreatedTraceData(value, 85, 14, "AppDomainResourceManagement", AppDomainResourceManagementTaskGuid, 50, "ThreadCreated", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 85, ProviderGuid); source.UnregisterEventTemplate(value, 50, AppDomainResourceManagementTaskGuid); } } public event Action<EventSourceTraceData> EventSourceEvent { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new EventSourceTraceData(value, 270, 0, "EventSourceEvent", Guid.Empty, 0, "", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 270, ProviderGuid); } } public event Action<ThreadTerminatedOrTransitionTraceData> AppDomainResourceManagementThreadTerminated { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadTerminatedOrTransitionTraceData(value, 86, 14, "AppDomainResourceManagement", AppDomainResourceManagementTaskGuid, 51, "ThreadTerminated", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 86, ProviderGuid); source.UnregisterEventTemplate(value, 51, AppDomainResourceManagementTaskGuid); } } public event Action<ThreadTerminatedOrTransitionTraceData> AppDomainResourceManagementDomainEnter { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ThreadTerminatedOrTransitionTraceData(value, 87, 14, "AppDomainResourceManagement", AppDomainResourceManagementTaskGuid, 52, "DomainEnter", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 87, ProviderGuid); source.UnregisterEventTemplate(value, 52, AppDomainResourceManagementTaskGuid); } } public event Action<ILStubGeneratedTraceData> ILStubStubGenerated { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ILStubGeneratedTraceData(value, 88, 15, "ILStub", ILStubTaskGuid, 88, "StubGenerated", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 88, ProviderGuid); source.UnregisterEventTemplate(value, 88, ILStubTaskGuid); } } public event Action<ILStubCacheHitTraceData> ILStubStubCacheHit { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ILStubCacheHitTraceData(value, 89, 15, "ILStub", ILStubTaskGuid, 89, "StubCacheHit", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 89, ProviderGuid); source.UnregisterEventTemplate(value, 89, ILStubTaskGuid); } } public event Action<ContentionTraceData> ContentionStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ContentionTraceData(value, 91, 8, "Contention", ContentionTaskGuid, 2, "Stop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 91, ProviderGuid); source.UnregisterEventTemplate(value, 2, ContentionTaskGuid); } } public event Action<EmptyTraceData> MethodDCStartCompleteV2 { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new EmptyTraceData(value, 135, 9, "Method", MethodTaskGuid, 14, "DCStartCompleteV2", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 135, ProviderGuid); source.UnregisterEventTemplate(value, 14, MethodTaskGuid); } } public event Action<EmptyTraceData> MethodDCStopCompleteV2 { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new EmptyTraceData(value, 136, 9, "Method", MethodTaskGuid, 15, "DCStopCompleteV2", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 136, ProviderGuid); source.UnregisterEventTemplate(value, 15, MethodTaskGuid); } } public event Action<MethodLoadUnloadTraceData> MethodDCStartV2 { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodLoadUnloadTraceData(value, 137, 9, "Method", MethodTaskGuid, 35, "DCStartV2", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 137, ProviderGuid); source.UnregisterEventTemplate(value, 35, MethodTaskGuid); } } public event Action<MethodLoadUnloadTraceData> MethodDCStopV2 { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodLoadUnloadTraceData(value, 138, 9, "Method", MethodTaskGuid, 36, "DCStopV2", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 138, ProviderGuid); source.UnregisterEventTemplate(value, 36, MethodTaskGuid); } } public event Action<MethodLoadUnloadVerboseTraceData> MethodDCStartVerboseV2 { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodLoadUnloadVerboseTraceData(value, 139, 9, "Method", MethodTaskGuid, 39, "DCStartVerboseV2", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 139, ProviderGuid); source.UnregisterEventTemplate(value, 39, MethodTaskGuid); } } public event Action<MethodLoadUnloadVerboseTraceData> MethodDCStopVerboseV2 { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodLoadUnloadVerboseTraceData(value, 140, 9, "Method", MethodTaskGuid, 40, "DCStopVerboseV2", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 140, ProviderGuid); source.UnregisterEventTemplate(value, 40, MethodTaskGuid); } } public event Action<MethodLoadUnloadTraceData> MethodLoad { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodLoadUnloadTraceData(value, 141, 9, "Method", MethodTaskGuid, 33, "Load", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 141, ProviderGuid); source.UnregisterEventTemplate(value, 33, MethodTaskGuid); } } public event Action<MethodLoadUnloadTraceData> MethodUnload { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodLoadUnloadTraceData(value, 142, 9, "Method", MethodTaskGuid, 34, "Unload", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 142, ProviderGuid); source.UnregisterEventTemplate(value, 34, MethodTaskGuid); } } public event Action<MethodLoadUnloadVerboseTraceData> MethodLoadVerbose { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodLoadUnloadVerboseTraceData(value, 143, 9, "Method", MethodTaskGuid, 37, "LoadVerbose", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 143, ProviderGuid); source.UnregisterEventTemplate(value, 37, MethodTaskGuid); } } public event Action<MethodLoadUnloadVerboseTraceData> MethodUnloadVerbose { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodLoadUnloadVerboseTraceData(value, 144, 9, "Method", MethodTaskGuid, 38, "UnloadVerbose", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 144, ProviderGuid); source.UnregisterEventTemplate(value, 38, MethodTaskGuid); } } public event Action<R2RGetEntryPointTraceData> MethodR2RGetEntryPoint { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new R2RGetEntryPointTraceData(value, 159, 9, "Method", MethodTaskGuid, 33, "R2RGetEntryPoint", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 159, ProviderGuid); source.UnregisterEventTemplate(value, 33, MethodTaskGuid); } } public event Action<MethodJittingStartedTraceData> MethodJittingStarted { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodJittingStartedTraceData(value, 145, 9, "Method", MethodTaskGuid, 42, "JittingStarted", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 145, ProviderGuid); source.UnregisterEventTemplate(value, 42, MethodTaskGuid); } } public event Action<ModuleLoadUnloadTraceData> LoaderModuleDCStartV2 { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ModuleLoadUnloadTraceData(value, 149, 10, "Loader", LoaderTaskGuid, 35, "ModuleDCStartV2", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 149, ProviderGuid); source.UnregisterEventTemplate(value, 35, LoaderTaskGuid); } } public event Action<ModuleLoadUnloadTraceData> LoaderModuleDCStopV2 { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ModuleLoadUnloadTraceData(value, 150, 10, "Loader", LoaderTaskGuid, 36, "ModuleDCStopV2", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 150, ProviderGuid); source.UnregisterEventTemplate(value, 36, LoaderTaskGuid); } } public event Action<DomainModuleLoadUnloadTraceData> LoaderDomainModuleLoad { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new DomainModuleLoadUnloadTraceData(value, 151, 10, "Loader", LoaderTaskGuid, 45, "DomainModuleLoad", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 151, ProviderGuid); source.UnregisterEventTemplate(value, 45, LoaderTaskGuid); } } public event Action<ModuleLoadUnloadTraceData> LoaderModuleLoad { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ModuleLoadUnloadTraceData(value, 152, 10, "Loader", LoaderTaskGuid, 33, "ModuleLoad", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 152, ProviderGuid); source.UnregisterEventTemplate(value, 33, LoaderTaskGuid); } } public event Action<ModuleLoadUnloadTraceData> LoaderModuleUnload { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new ModuleLoadUnloadTraceData(value, 153, 10, "Loader", LoaderTaskGuid, 34, "ModuleUnload", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 153, ProviderGuid); source.UnregisterEventTemplate(value, 34, LoaderTaskGuid); } } public event Action<AssemblyLoadUnloadTraceData> LoaderAssemblyLoad { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new AssemblyLoadUnloadTraceData(value, 154, 10, "Loader", LoaderTaskGuid, 37, "AssemblyLoad", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 154, ProviderGuid); source.UnregisterEventTemplate(value, 37, LoaderTaskGuid); } } public event Action<AssemblyLoadUnloadTraceData> LoaderAssemblyUnload { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new AssemblyLoadUnloadTraceData(value, 155, 10, "Loader", LoaderTaskGuid, 38, "AssemblyUnload", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 155, ProviderGuid); source.UnregisterEventTemplate(value, 38, LoaderTaskGuid); } } public event Action<AppDomainLoadUnloadTraceData> LoaderAppDomainLoad { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new AppDomainLoadUnloadTraceData(value, 156, 10, "Loader", LoaderTaskGuid, 41, "AppDomainLoad", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 156, ProviderGuid); source.UnregisterEventTemplate(value, 41, LoaderTaskGuid); } } public event Action<AppDomainLoadUnloadTraceData> LoaderAppDomainUnload { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new AppDomainLoadUnloadTraceData(value, 157, 10, "Loader", LoaderTaskGuid, 42, "AppDomainUnload", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 157, ProviderGuid); source.UnregisterEventTemplate(value, 42, LoaderTaskGuid); } } public event Action<StrongNameVerificationTraceData> StrongNameVerificationStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new StrongNameVerificationTraceData(value, 181, 12, "StrongNameVerification", StrongNameVerificationTaskGuid, 1, "Start", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 181, ProviderGuid); source.UnregisterEventTemplate(value, 1, StrongNameVerificationTaskGuid); } } public event Action<StrongNameVerificationTraceData> StrongNameVerificationStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new StrongNameVerificationTraceData(value, 182, 12, "StrongNameVerification", StrongNameVerificationTaskGuid, 2, "Stop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 182, ProviderGuid); source.UnregisterEventTemplate(value, 2, StrongNameVerificationTaskGuid); } } public event Action<AuthenticodeVerificationTraceData> AuthenticodeVerificationStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new AuthenticodeVerificationTraceData(value, 183, 13, "AuthenticodeVerification", AuthenticodeVerificationTaskGuid, 1, "Start", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 183, ProviderGuid); source.UnregisterEventTemplate(value, 1, AuthenticodeVerificationTaskGuid); } } public event Action<AuthenticodeVerificationTraceData> AuthenticodeVerificationStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new AuthenticodeVerificationTraceData(value, 184, 13, "AuthenticodeVerification", AuthenticodeVerificationTaskGuid, 2, "Stop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 184, ProviderGuid); source.UnregisterEventTemplate(value, 2, AuthenticodeVerificationTaskGuid); } } public event Action<MethodJitInliningSucceededTraceData> MethodInliningSucceeded { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodJitInliningSucceededTraceData(value, 185, 9, "Method", MethodTaskGuid, 83, "InliningSucceeded", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 185, ProviderGuid); source.UnregisterEventTemplate(value, 83, MethodTaskGuid); } } public event Action<MethodJitInliningFailedTraceData> MethodInliningFailed { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodJitInliningFailedTraceData(value, 192, 9, "Method", MethodTaskGuid, 84, "InliningFailed", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 192, ProviderGuid); } } public event Action<MethodJitInliningFailedAnsiTraceData> MethodInliningFailedAnsi { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodJitInliningFailedAnsiTraceData(value, 186, 9, "Method", MethodTaskGuid, 84, "InliningFailedAnsi", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 186, ProviderGuid); source.UnregisterEventTemplate(value, 84, MethodTaskGuid); } } public event Action<RuntimeInformationTraceData> RuntimeStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new RuntimeInformationTraceData(value, 187, 19, "Runtime", RuntimeTaskGuid, 1, "Start", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 187, ProviderGuid); source.UnregisterEventTemplate(value, 1, RuntimeTaskGuid); } } public event Action<MethodJitTailCallSucceededTraceData> MethodTailCallSucceeded { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodJitTailCallSucceededTraceData(value, 188, 9, "Method", MethodTaskGuid, 85, "TailCallSucceeded", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 188, ProviderGuid); source.UnregisterEventTemplate(value, 85, MethodTaskGuid); } } public event Action<MethodJitTailCallFailedAnsiTraceData> MethodTailCallFailedAnsi { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodJitTailCallFailedAnsiTraceData(value, 189, 9, "Method", MethodTaskGuid, 86, "TailCallFailedAnsi", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 189, ProviderGuid); source.UnregisterEventTemplate(value, 86, MethodTaskGuid); } } public event Action<MethodJitTailCallFailedTraceData> MethodTailCallFailed { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName RegisterTemplate(new MethodJitTailCallFailedTraceData(value, 192, 9, "Method", MethodTaskGuid, 86, "TailCallFailed", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 192, ProviderGuid); } } #region private protected override string GetProviderName() { return ProviderName; } static private CodeSymbolsTraceData CodeSymbolsStartTemplate(Action<CodeSymbolsTraceData> action) { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName return new CodeSymbolsTraceData(action, 260, 30, "CodeSymbols", Guid.Empty, 1, "Start", ProviderGuid, ProviderName); } static private ExceptionHandlingTraceData ExceptionCatchStartTemplate(Action<ExceptionHandlingTraceData> action) { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName return new ExceptionHandlingTraceData(action, 250, 27, "ExceptionCatch", Guid.Empty, 1, "Start", ProviderGuid, ProviderName); } static private EmptyTraceData ExceptionCatchStopTemplate(Action<EmptyTraceData> action) { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName return new EmptyTraceData(action, 251, 27, "ExceptionCatch", Guid.Empty, 2, "Stop", ProviderGuid, ProviderName); } static private ExceptionHandlingTraceData ExceptionFilterStartTemplate(Action<ExceptionHandlingTraceData> action) { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName return new ExceptionHandlingTraceData(action, 254, 29, "ExceptionFilter", Guid.Empty, 1, "Start", ProviderGuid, ProviderName); } static private EmptyTraceData ExceptionFilterStopTemplate(Action<EmptyTraceData> action) { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName return new EmptyTraceData(action, 255, 29, "ExceptionFilter", Guid.Empty, 2, "Stop", ProviderGuid, ProviderName); } static private ExceptionHandlingTraceData ExceptionFinallyStartTemplate(Action<ExceptionHandlingTraceData> action) { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName return new ExceptionHandlingTraceData(action, 252, 28, "ExceptionFinally", Guid.Empty, 1, "Start", ProviderGuid, ProviderName); } static private EmptyTraceData ExceptionFinallyStopTemplate(Action<EmptyTraceData> action) { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName return new EmptyTraceData(action, 253, 28, "ExceptionFinally", Guid.Empty, 2, "Stop", ProviderGuid, ProviderName); } static private EmptyTraceData ExceptionStopTemplate(Action<EmptyTraceData> action) { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName return new EmptyTraceData(action, 256, 7, "Exception", Guid.Empty, 2, "Stop", ProviderGuid, ProviderName); } static private volatile TraceEvent[] s_templates; protected internal override void EnumerateTemplates(Func<string, string, EventFilterResponse> eventsToObserve, Action<TraceEvent> callback) { if (s_templates == null) { var templates = new TraceEvent[118]; templates[0] = new GCStartTraceData(null, 1, 1, "GC", GCTaskGuid, 1, "Start", ProviderGuid, ProviderName); templates[1] = new GCEndTraceData(null, 2, 1, "GC", GCTaskGuid, 2, "Stop", ProviderGuid, ProviderName); templates[2] = new GCNoUserDataTraceData(null, 3, 1, "GC", GCTaskGuid, 132, "RestartEEStop", ProviderGuid, ProviderName); templates[3] = new GCNoUserDataTraceData(null, 0xFFFF, 1, "GC", GCTaskGuid, 8, "RestartEEStop", ProviderGuid, ProviderName); templates[4] = new GCHeapStatsTraceData(null, 4, 1, "GC", GCTaskGuid, 133, "HeapStats", ProviderGuid, ProviderName); templates[5] = new GCHeapStatsTraceData(null, 0xFFFF, 1, "GC", GCTaskGuid, 5, "HeapStats", ProviderGuid, ProviderName); templates[6] = new GCCreateSegmentTraceData(null, 5, 1, "GC", GCTaskGuid, 134, "CreateSegment", ProviderGuid, ProviderName); templates[7] = new GCCreateSegmentTraceData(null, 0xFFFF, 1, "GC", GCTaskGuid, 6, "CreateSegment", ProviderGuid, ProviderName); templates[8] = new GCFreeSegmentTraceData(null, 6, 1, "GC", GCTaskGuid, 135, "FreeSegment", ProviderGuid, ProviderName); templates[9] = new GCFreeSegmentTraceData(null, 0xFFFF, 1, "GC", GCTaskGuid, 7, "FreeSegment", ProviderGuid, ProviderName); templates[10] = new GCNoUserDataTraceData(null, 7, 1, "GC", GCTaskGuid, 136, "RestartEEStart", ProviderGuid, ProviderName); templates[11] = new GCNoUserDataTraceData(null, 8, 1, "GC", GCTaskGuid, 137, "SuspendEEStop", ProviderGuid, ProviderName); templates[12] = new GCSuspendEETraceData(null, 9, 1, "GC", GCTaskGuid, 10, "SuspendEEStart", ProviderGuid, ProviderName); templates[13] = new GCAllocationTickTraceData(null, 10, 1, "GC", GCTaskGuid, 11, "AllocationTick", ProviderGuid, ProviderName); templates[14] = new GCCreateConcurrentThreadTraceData(null, 11, 1, "GC", GCTaskGuid, 12, "CreateConcurrentThread", ProviderGuid, ProviderName); templates[15] = new GCTerminateConcurrentThreadTraceData(null, 12, 1, "GC", GCTaskGuid, 13, "TerminateConcurrentThread", ProviderGuid, ProviderName); templates[16] = new GCFinalizersEndTraceData(null, 13, 1, "GC", GCTaskGuid, 15, "FinalizersStop", ProviderGuid, ProviderName); templates[17] = new GCNoUserDataTraceData(null, 14, 1, "GC", GCTaskGuid, 19, "FinalizersStart", ProviderGuid, ProviderName); templates[18] = new GCBulkTypeTraceData(null, 15, 21, "Type", TypeTaskGuid, 10, "BulkType", ProviderGuid, ProviderName); templates[19] = new GCBulkRootEdgeTraceData(null, 16, 1, "GC", GCTaskGuid, 20, "BulkRootEdge", ProviderGuid, ProviderName); templates[20] = new GCBulkRootConditionalWeakTableElementEdgeTraceData(null, 17, 1, "GC", GCTaskGuid, 21, "BulkRootConditionalWeakTableElementEdge", ProviderGuid, ProviderName); templates[21] = new GCBulkNodeTraceData(null, 18, 1, "GC", GCTaskGuid, 22, "BulkNode", ProviderGuid, ProviderName); templates[22] = new GCBulkEdgeTraceData(null, 19, 1, "GC", GCTaskGuid, 23, "BulkEdge", ProviderGuid, ProviderName); templates[23] = new GCSampledObjectAllocationTraceData(null, 20, 1, "GC", GCTaskGuid, 24, "SampledObjectAllocation", ProviderGuid, ProviderName); templates[24] = new GCSampledObjectAllocationTraceData(null, 32, 1, "GC", GCTaskGuid, 24, "SampledObjectAllocation", ProviderGuid, ProviderName); templates[25] = new GCBulkSurvivingObjectRangesTraceData(null, 21, 1, "GC", GCTaskGuid, 25, "BulkSurvivingObjectRanges", ProviderGuid, ProviderName); templates[26] = new GCBulkMovedObjectRangesTraceData(null, 22, 1, "GC", GCTaskGuid, 26, "BulkMovedObjectRanges", ProviderGuid, ProviderName); templates[27] = new GCGenerationRangeTraceData(null, 23, 1, "GC", GCTaskGuid, 27, "GenerationRange", ProviderGuid, ProviderName); templates[28] = new GCMarkTraceData(null, 25, 1, "GC", GCTaskGuid, 28, "MarkStackRoots", ProviderGuid, ProviderName); templates[29] = new GCMarkTraceData(null, 26, 1, "GC", GCTaskGuid, 29, "MarkFinalizeQueueRoots", ProviderGuid, ProviderName); templates[30] = new GCMarkTraceData(null, 27, 1, "GC", GCTaskGuid, 30, "MarkHandles", ProviderGuid, ProviderName); templates[31] = new GCMarkTraceData(null, 28, 1, "GC", GCTaskGuid, 31, "MarkCards", ProviderGuid, ProviderName); templates[32] = new FinalizeObjectTraceData(null, 29, 1, "GC", GCTaskGuid, 32, "FinalizeObject", ProviderGuid, ProviderName, state: null); templates[33] = new SetGCHandleTraceData(null, 30, 1, "GC", GCTaskGuid, 33, "SetGCHandle", ProviderGuid, ProviderName); templates[34] = new DestroyGCHandleTraceData(null, 31, 1, "GC", GCTaskGuid, 34, "DestoryGCHandle", ProviderGuid, ProviderName); templates[35] = new PinObjectAtGCTimeTraceData(null, 33, 1, "GC", GCTaskGuid, 36, "PinObjectAtGCTime", ProviderGuid, ProviderName); templates[36] = new PinPlugAtGCTimeTraceData(null, 34, 1, "GC", GCTaskGuid, 37, "PinPlugAtGCTime", ProviderGuid, ProviderName); templates[37] = new GCTriggeredTraceData(null, 35, 1, "GC", GCTaskGuid, 35, "Triggered", ProviderGuid, ProviderName); templates[38] = new IOThreadTraceData(null, 44, 3, "IOThreadCreation", IOThreadCreationTaskGuid, 1, "Start", ProviderGuid, ProviderName); templates[39] = new IOThreadTraceData(null, 45, 3, "IOThreadCreation", IOThreadCreationTaskGuid, 2, "Stop", ProviderGuid, ProviderName); templates[40] = new IOThreadTraceData(null, 46, 5, "IOThreadRetirement", IOThreadRetirementTaskGuid, 1, "Start", ProviderGuid, ProviderName); templates[41] = new IOThreadTraceData(null, 47, 5, "IOThreadRetirement", IOThreadRetirementTaskGuid, 2, "Stop", ProviderGuid, ProviderName); templates[42] = new ThreadPoolWorkerThreadTraceData(null, 50, 16, "ThreadPoolWorkerThread", ThreadPoolWorkerThreadTaskGuid, 1, "Start", ProviderGuid, ProviderName); templates[43] = new ThreadPoolWorkerThreadTraceData(null, 51, 16, "ThreadPoolWorkerThread", ThreadPoolWorkerThreadTaskGuid, 2, "Stop", ProviderGuid, ProviderName); templates[44] = new ThreadPoolWorkerThreadTraceData(null, 52, 17, "ThreadPoolWorkerThreadRetirement", ThreadPoolWorkerThreadRetirementTaskGuid, 1, "Start", ProviderGuid, ProviderName); templates[45] = new ThreadPoolWorkerThreadTraceData(null, 53, 17, "ThreadPoolWorkerThreadRetirement", ThreadPoolWorkerThreadRetirementTaskGuid, 2, "Stop", ProviderGuid, ProviderName); templates[46] = new ThreadPoolWorkerThreadAdjustmentSampleTraceData(null, 54, 18, "ThreadPoolWorkerThreadAdjustment", ThreadPoolWorkerThreadAdjustmentTaskGuid, 100, "Sample", ProviderGuid, ProviderName); templates[47] = new ThreadPoolWorkerThreadAdjustmentTraceData(null, 55, 18, "ThreadPoolWorkerThreadAdjustment", ThreadPoolWorkerThreadAdjustmentTaskGuid, 101, "Adjustment", ProviderGuid, ProviderName); templates[48] = new ThreadPoolWorkerThreadAdjustmentStatsTraceData(null, 56, 18, "ThreadPoolWorkerThreadAdjustment", ThreadPoolWorkerThreadAdjustmentTaskGuid, 102, "Stats", ProviderGuid, ProviderName); templates[49] = new ExceptionTraceData(null, 80, 7, "Exception", ExceptionTaskGuid, 1, "Start", ProviderGuid, ProviderName); templates[50] = new ContentionTraceData(null, 81, 8, "Contention", ContentionTaskGuid, 1, "Start", ProviderGuid, ProviderName); templates[51] = new MethodILToNativeMapTraceData(null, 190, 9, "Method", MethodTaskGuid, 87, "ILToNativeMap", ProviderGuid, ProviderName); templates[52] = new ClrStackWalkTraceData(null, 82, 11, "ClrStack", ClrStackTaskGuid, 82, "Walk", ProviderGuid, ProviderName); templates[53] = new AppDomainMemAllocatedTraceData(null, 83, 14, "AppDomainResourceManagement", AppDomainResourceManagementTaskGuid, 48, "MemAllocated", ProviderGuid, ProviderName); templates[54] = new AppDomainMemSurvivedTraceData(null, 84, 14, "AppDomainResourceManagement", AppDomainResourceManagementTaskGuid, 49, "MemSurvived", ProviderGuid, ProviderName); templates[55] = new ThreadCreatedTraceData(null, 85, 14, "AppDomainResourceManagement", AppDomainResourceManagementTaskGuid, 50, "ThreadCreated", ProviderGuid, ProviderName); templates[56] = new ThreadTerminatedOrTransitionTraceData(null, 86, 14, "AppDomainResourceManagement", AppDomainResourceManagementTaskGuid, 51, "ThreadTerminated", ProviderGuid, ProviderName); templates[57] = new ThreadTerminatedOrTransitionTraceData(null, 87, 14, "AppDomainResourceManagement", AppDomainResourceManagementTaskGuid, 52, "DomainEnter", ProviderGuid, ProviderName); templates[58] = new ILStubGeneratedTraceData(null, 88, 15, "ILStub", ILStubTaskGuid, 88, "StubGenerated", ProviderGuid, ProviderName); templates[59] = new ILStubCacheHitTraceData(null, 89, 15, "ILStub", ILStubTaskGuid, 89, "StubCacheHit", ProviderGuid, ProviderName); templates[60] = new ContentionTraceData(null, 91, 8, "Contention", ContentionTaskGuid, 2, "Stop", ProviderGuid, ProviderName); templates[61] = new EmptyTraceData(null, 135, 9, "Method", MethodTaskGuid, 14, "DCStartCompleteV2", ProviderGuid, ProviderName); templates[62] = new EmptyTraceData(null, 136, 9, "Method", MethodTaskGuid, 15, "DCStopCompleteV2", ProviderGuid, ProviderName); templates[63] = new MethodLoadUnloadTraceData(null, 137, 9, "Method", MethodTaskGuid, 35, "DCStartV2", ProviderGuid, ProviderName); templates[64] = new MethodLoadUnloadTraceData(null, 138, 9, "Method", MethodTaskGuid, 36, "DCStopV2", ProviderGuid, ProviderName); templates[65] = new MethodLoadUnloadVerboseTraceData(null, 139, 9, "Method", MethodTaskGuid, 39, "DCStartVerboseV2", ProviderGuid, ProviderName); templates[66] = new MethodLoadUnloadVerboseTraceData(null, 140, 9, "Method", MethodTaskGuid, 40, "DCStopVerboseV2", ProviderGuid, ProviderName); templates[67] = new MethodLoadUnloadTraceData(null, 141, 9, "Method", MethodTaskGuid, 33, "Load", ProviderGuid, ProviderName); templates[68] = new MethodLoadUnloadTraceData(null, 142, 9, "Method", MethodTaskGuid, 34, "Unload", ProviderGuid, ProviderName); templates[69] = new MethodLoadUnloadVerboseTraceData(null, 143, 9, "Method", MethodTaskGuid, 37, "LoadVerbose", ProviderGuid, ProviderName); templates[70] = new MethodLoadUnloadVerboseTraceData(null, 144, 9, "Method", MethodTaskGuid, 38, "UnloadVerbose", ProviderGuid, ProviderName); templates[71] = new MethodJittingStartedTraceData(null, 145, 9, "Method", MethodTaskGuid, 42, "JittingStarted", ProviderGuid, ProviderName); templates[72] = new ModuleLoadUnloadTraceData(null, 149, 10, "Loader", LoaderTaskGuid, 35, "ModuleDCStartV2", ProviderGuid, ProviderName); templates[73] = new ModuleLoadUnloadTraceData(null, 150, 10, "Loader", LoaderTaskGuid, 36, "ModuleDCStopV2", ProviderGuid, ProviderName); templates[74] = new DomainModuleLoadUnloadTraceData(null, 151, 10, "Loader", LoaderTaskGuid, 45, "DomainModuleLoad", ProviderGuid, ProviderName); templates[75] = new ModuleLoadUnloadTraceData(null, 152, 10, "Loader", LoaderTaskGuid, 33, "ModuleLoad", ProviderGuid, ProviderName); templates[76] = new ModuleLoadUnloadTraceData(null, 153, 10, "Loader", LoaderTaskGuid, 34, "ModuleUnload", ProviderGuid, ProviderName); templates[77] = new AssemblyLoadUnloadTraceData(null, 154, 10, "Loader", LoaderTaskGuid, 37, "AssemblyLoad", ProviderGuid, ProviderName); templates[78] = new AssemblyLoadUnloadTraceData(null, 155, 10, "Loader", LoaderTaskGuid, 38, "AssemblyUnload", ProviderGuid, ProviderName); templates[79] = new AppDomainLoadUnloadTraceData(null, 156, 10, "Loader", LoaderTaskGuid, 41, "AppDomainLoad", ProviderGuid, ProviderName); templates[80] = new AppDomainLoadUnloadTraceData(null, 157, 10, "Loader", LoaderTaskGuid, 42, "AppDomainUnload", ProviderGuid, ProviderName); templates[81] = new StrongNameVerificationTraceData(null, 181, 12, "StrongNameVerification", StrongNameVerificationTaskGuid, 1, "Start", ProviderGuid, ProviderName); templates[82] = new StrongNameVerificationTraceData(null, 182, 12, "StrongNameVerification", StrongNameVerificationTaskGuid, 2, "Stop", ProviderGuid, ProviderName); templates[83] = new AuthenticodeVerificationTraceData(null, 183, 13, "AuthenticodeVerification", AuthenticodeVerificationTaskGuid, 1, "Start", ProviderGuid, ProviderName); templates[84] = new AuthenticodeVerificationTraceData(null, 184, 13, "AuthenticodeVerification", AuthenticodeVerificationTaskGuid, 2, "Stop", ProviderGuid, ProviderName); templates[85] = new MethodJitInliningSucceededTraceData(null, 185, 9, "Method", MethodTaskGuid, 83, "InliningSucceeded", ProviderGuid, ProviderName); templates[86] = new MethodJitInliningFailedTraceData(null, 192, 9, "Method", MethodTaskGuid, 84, "InliningFailed", ProviderGuid, ProviderName); templates[87] = new RuntimeInformationTraceData(null, 187, 19, "Runtime", RuntimeTaskGuid, 1, "Start", ProviderGuid, ProviderName); templates[88] = new MethodJitTailCallSucceededTraceData(null, 188, 9, "Method", MethodTaskGuid, 85, "TailCallSucceeded", ProviderGuid, ProviderName); templates[89] = new MethodJitTailCallFailedTraceData(null, 189, 9, "Method", MethodTaskGuid, 86, "TailCallFailed", ProviderGuid, ProviderName); templates[90] = new GCBulkRootCCWTraceData(null, 36, 1, "GC", GCTaskGuid, 38, "BulkRootCCW", ProviderGuid, ProviderName); templates[91] = new GCBulkRCWTraceData(null, 37, 1, "GC", GCTaskGuid, 39, "BulkRCW", ProviderGuid, ProviderName); templates[92] = new GCBulkRootStaticVarTraceData(null, 38, 1, "GC", GCTaskGuid, 40, "BulkRootStaticVar", ProviderGuid, ProviderName); templates[93] = new ThreadPoolWorkerThreadTraceData(null, 57, 16, "ThreadPoolWorkerThread", Guid.Empty, 90, "Wait", ProviderGuid, ProviderName); templates[94] = new GCMarkWithTypeTraceData(null, 202, 1, "GC", GCTaskGuid, 202, "MarkWithType", ProviderGuid, ProviderName); templates[95] = new GCJoinTraceData(null, 203, 1, "GC", GCTaskGuid, 203, "Join", ProviderGuid, ProviderName); templates[96] = new GCPerHeapHistoryTraceData(null, 204, 1, "GC", GCTaskGuid, 204, "PerHeapHistory", ProviderGuid, ProviderName); templates[97] = new GCGlobalHeapHistoryTraceData(null, 205, 1, "GC", GCTaskGuid, 205, "GlobalHeapHistory", ProviderGuid, ProviderName); // New style templates[98] = ExceptionCatchStartTemplate(null); templates[99] = ExceptionCatchStopTemplate(null); templates[100] = ExceptionFinallyStartTemplate(null); templates[101] = ExceptionFinallyStopTemplate(null); templates[102] = ExceptionFilterStartTemplate(null); templates[103] = ExceptionFilterStopTemplate(null); templates[104] = ExceptionStopTemplate(null); templates[105] = CodeSymbolsStartTemplate(null); // Some more old style templates[106] = new ThreadStartWorkTraceData(null, 70, 24, "Thread", ThreadTaskGuid, 11, "Creating", ProviderGuid, ProviderName); templates[107] = new ThreadStartWorkTraceData(null, 71, 24, "Thread", ThreadTaskGuid, 12, "Running", ProviderGuid, ProviderName); templates[108] = new ThreadPoolWorkingThreadCountTraceData(null, 60, 22, "ThreadPoolWorkingThreadCount", ThreadPoolWorkingThreadCountTaskGuid, 1, "Start", ProviderGuid, ProviderName); templates[109] = new ThreadPoolWorkTraceData(null, 61, 23, "ThreadPool", ThreadPoolTaskGuid, 11, "Enqueue", ProviderGuid, ProviderName); templates[110] = new ThreadPoolWorkTraceData(null, 62, 23, "ThreadPool", ThreadPoolTaskGuid, 12, "Dequeue", ProviderGuid, ProviderName); templates[111] = new ThreadPoolIOWorkEnqueueTraceData(null, 63, 23, "ThreadPool", ThreadPoolTaskGuid, 13, "IOEnqueue", ProviderGuid, ProviderName); templates[112] = new ThreadPoolIOWorkTraceData(null, 64, 23, "ThreadPool", ThreadPoolTaskGuid, 14, "IODequeue", ProviderGuid, ProviderName); templates[113] = new ThreadPoolIOWorkTraceData(null, 65, 23, "ThreadPool", ThreadPoolTaskGuid, 15, "IOPack", ProviderGuid, ProviderName); templates[114] = new MethodJitInliningFailedAnsiTraceData(null, 186, 9, "Method", MethodTaskGuid, 84, "InliningFailedAnsi", ProviderGuid, ProviderName); templates[115] = new MethodJitTailCallFailedAnsiTraceData(null, 189, 9, "Method", MethodTaskGuid, 86, "TailCallFailedAnsi", ProviderGuid, ProviderName); templates[116] = new EventSourceTraceData(null, 270, 0, "EventSourceEvent", Guid.Empty, 0, "", ProviderGuid, ProviderName); templates[117] = new R2RGetEntryPointTraceData(null, 159, 9, "Method", MethodTaskGuid, 33, "R2RGetEntryPoint", ProviderGuid, ProviderName); s_templates = templates; } foreach (var template in s_templates) { if (eventsToObserve == null || eventsToObserve(template.ProviderName, template.EventName) == EventFilterResponse.AcceptEvent) { callback(template); // Project N support. If this is not a classic event, then also register with project N if (template.ID != TraceEventID.Illegal) { var projectNTemplate = template.Clone(); projectNTemplate.providerGuid = ClrTraceEventParser.NativeProviderGuid; callback(projectNTemplate); } } } } private static readonly Guid GCTaskGuid = new Guid(unchecked((int)0x044973cd), unchecked((short)0x251f), unchecked((short)0x4dff), 0xa3, 0xe9, 0x9d, 0x63, 0x07, 0x28, 0x6b, 0x05); private static readonly Guid WorkerThreadCreationV2TaskGuid = new Guid(unchecked((int)0xcfc4ba53), unchecked((short)0xfb42), unchecked((short)0x4757), 0x8b, 0x70, 0x5f, 0x5d, 0x51, 0xfe, 0xe2, 0xf4); private static readonly Guid IOThreadCreationTaskGuid = new Guid(unchecked((int)0xc71408de), unchecked((short)0x42cc), unchecked((short)0x4f81), 0x9c, 0x93, 0xb8, 0x91, 0x2a, 0xbf, 0x2a, 0x0f); private static readonly Guid WorkerThreadRetirementV2TaskGuid = new Guid(unchecked((int)0xefdf1eac), unchecked((short)0x1d5d), unchecked((short)0x4e84), 0x89, 0x3a, 0x19, 0xb8, 0x0f, 0x69, 0x21, 0x76); private static readonly Guid IOThreadRetirementTaskGuid = new Guid(unchecked((int)0x840c8456), unchecked((short)0x6457), unchecked((short)0x4eb7), 0x9c, 0xd0, 0xd2, 0x8f, 0x01, 0xc6, 0x4f, 0x5e); private static readonly Guid ThreadpoolSuspensionV2TaskGuid = new Guid(unchecked((int)0xc424b3e3), unchecked((short)0x2ae0), unchecked((short)0x416e), 0xa0, 0x39, 0x41, 0x0c, 0x5d, 0x8e, 0x5f, 0x14); private static readonly Guid ExceptionTaskGuid = new Guid(unchecked((int)0x300ce105), unchecked((short)0x86d1), unchecked((short)0x41f8), 0xb9, 0xd2, 0x83, 0xfc, 0xbf, 0xf3, 0x2d, 0x99); private static readonly Guid ContentionTaskGuid = new Guid(unchecked((int)0x561410f5), unchecked((short)0xa138), unchecked((short)0x4ab3), 0x94, 0x5e, 0x51, 0x64, 0x83, 0xcd, 0xdf, 0xbc); private static readonly Guid MethodTaskGuid = new Guid(unchecked((int)0x3044f61a), unchecked((short)0x99b0), unchecked((short)0x4c21), 0xb2, 0x03, 0xd3, 0x94, 0x23, 0xc7, 0x3b, 0x00); private static readonly Guid LoaderTaskGuid = new Guid(unchecked((int)0xd00792da), unchecked((short)0x07b7), unchecked((short)0x40f5), 0x97, 0xeb, 0x5d, 0x97, 0x4e, 0x05, 0x47, 0x40); private static readonly Guid ClrStackTaskGuid = new Guid(unchecked((int)0xd3363dc0), unchecked((short)0x243a), unchecked((short)0x4620), 0xa4, 0xd0, 0x8a, 0x07, 0xd7, 0x72, 0xf5, 0x33); private static readonly Guid StrongNameVerificationTaskGuid = new Guid(unchecked((int)0x15447a14), unchecked((short)0xb523), unchecked((short)0x46ae), 0xb7, 0x5b, 0x02, 0x3f, 0x90, 0x0b, 0x43, 0x93); private static readonly Guid AuthenticodeVerificationTaskGuid = new Guid(unchecked((int)0xb17304d9), unchecked((short)0x5afa), unchecked((short)0x4da6), 0x9f, 0x7b, 0x5a, 0x4f, 0xa7, 0x31, 0x29, 0xb6); private static readonly Guid AppDomainResourceManagementTaskGuid = new Guid(unchecked((int)0x88e83959), unchecked((short)0x6185), unchecked((short)0x4e0b), 0x95, 0xb8, 0x0e, 0x4a, 0x35, 0xdf, 0x61, 0x22); private static readonly Guid ILStubTaskGuid = new Guid(unchecked((int)0xd00792da), unchecked((short)0x07b7), unchecked((short)0x40f5), 0x00, 0x00, 0x5d, 0x97, 0x4e, 0x05, 0x47, 0x40); private static readonly Guid ThreadPoolWorkerThreadTaskGuid = new Guid(unchecked((int)0x8a9a44ab), unchecked((short)0xf681), unchecked((short)0x4271), 0x88, 0x10, 0x83, 0x0d, 0xab, 0x9f, 0x56, 0x21); private static readonly Guid ThreadPoolWorkerThreadRetirementTaskGuid = new Guid(unchecked((int)0x402ee399), unchecked((short)0xc137), unchecked((short)0x4dc0), 0xa5, 0xab, 0x3c, 0x2d, 0xea, 0x64, 0xac, 0x9c); private static readonly Guid ThreadPoolWorkerThreadAdjustmentTaskGuid = new Guid(unchecked((int)0x94179831), unchecked((short)0xe99a), unchecked((short)0x4625), 0x88, 0x24, 0x23, 0xca, 0x5e, 0x00, 0xca, 0x7d); private static readonly Guid RuntimeTaskGuid = new Guid(unchecked((int)0xcd7d3e32), unchecked((short)0x65fe), unchecked((short)0x40cd), 0x92, 0x25, 0xa2, 0x57, 0x7d, 0x20, 0x3f, 0xc3); private static readonly Guid ClrPerfTrackTaskGuid = new Guid(unchecked((int)0xeac685f6), unchecked((short)0x2104), unchecked((short)0x4dec), 0x88, 0xfd, 0x91, 0xe4, 0x25, 0x42, 0x21, 0xec); private static readonly Guid TypeTaskGuid = new Guid(unchecked((int)0x003e5a9b), unchecked((short)0x4757), unchecked((short)0x4d3e), 0xb4, 0xa1, 0xe4, 0x7b, 0xfb, 0x48, 0x94, 0x08); private static readonly Guid ThreadPoolWorkingThreadCountTaskGuid = new Guid(unchecked((int)0x1b032b96), unchecked((short)0x767c), unchecked((short)0x42e4), 0x84, 0x81, 0xcb, 0x52, 0x8a, 0x66, 0xd7, 0xbd); private static readonly Guid ThreadPoolTaskGuid = new Guid(unchecked((int)0xead685f6), unchecked((short)0x2104), unchecked((short)0x4dec), 0x88, 0xfd, 0x91, 0xe4, 0x25, 0x42, 0x21, 0xe9); private static readonly Guid ThreadTaskGuid = new Guid(unchecked((int)0x641994c5), unchecked((short)0x16f2), unchecked((short)0x4123), 0x91, 0xa7, 0xa2, 0x99, 0x9d, 0xd7, 0xbf, 0xc3); private static readonly Guid CodeSymbolsTaskGuid = new Guid(unchecked((int)0x53aedf69), unchecked((short)0x2049), unchecked((short)0x4f7d), 0x93, 0x45, 0xd3, 0x01, 0x8b, 0x5c, 0x4d, 0x80); // TODO remove if project N's Guids are harmonized with the desktop private void RegisterTemplate(TraceEvent template) { Debug.Assert(template.ProviderGuid == ClrTraceEventParser.ProviderGuid); // It is the desktop GUID var projectNTemplate = template.Clone(); projectNTemplate.providerGuid = ClrTraceEventParser.NativeProviderGuid; source.RegisterEventTemplate(template); source.RegisterEventTemplate(projectNTemplate); // TODO FIX NOW also have to unregister the project N templates. } #endregion } } namespace Microsoft.Diagnostics.Tracing.Parsers.Clr { public sealed class GCStartTraceData : TraceEvent { public int Count { get { return GetInt32At(0); } } public GCReason Reason { get { if (EventDataLength >= 16) { return (GCReason)GetInt32At(8); } return (GCReason)GetInt32At(4); } } public int Depth { get { if (EventDataLength >= 16) { return GetInt32At(4); } return 0; } } public GCType Type { get { if (EventDataLength >= 16) { return (GCType)GetInt32At(12); } return (GCType)0; } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(16); } return 0; } } public long ClientSequenceNumber { get { if (Version >= 2) { return GetInt64At(18); } return 0; } } #region Private internal GCStartTraceData(Action<GCStartTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCStartTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength < 8)); // FIXed manually to be < 8 Debug.Assert(!(Version == 1 && EventDataLength != 18)); Debug.Assert(!(Version > 1 && EventDataLength < 18)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Count", Count); XmlAttrib(sb, "Reason", Reason); XmlAttrib(sb, "Depth", Depth); XmlAttrib(sb, "Type", Type); XmlAttrib(sb, "ClientSequenceNumber", ClientSequenceNumber); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Count", "Reason", "Depth", "Type", "ClrInstanceID", "ClientSequenceNumber" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Count; case 1: return Reason; case 2: return Depth; case 3: return Type; case 4: return ClrInstanceID; case 5: return ClientSequenceNumber; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCStartTraceData> Action; #endregion } public sealed class GCEndTraceData : TraceEvent { public int Count { get { return GetInt32At(0); } } public int Depth { get { if (Version >= 1) { return GetInt32At(4); } return GetInt16At(4); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(8); } return 0; } } #region Private internal GCEndTraceData(Action<GCEndTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCEndTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength < 6)); // HAND_MODIFIED < Debug.Assert(!(Version == 1 && EventDataLength != 10)); Debug.Assert(!(Version > 1 && EventDataLength < 10)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Count", Count); XmlAttrib(sb, "Depth", Depth); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Count", "Depth", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Count; case 1: return Depth; case 2: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCEndTraceData> Action; #endregion } public sealed class GCNoUserDataTraceData : TraceEvent { public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(0); } return 0; } } #region Private internal GCNoUserDataTraceData(Action<GCNoUserDataTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCNoUserDataTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 1 && EventDataLength != 2)); Debug.Assert(!(Version > 1 && EventDataLength < 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCNoUserDataTraceData> Action; #endregion } public sealed class GCHeapStatsTraceData : TraceEvent { // GCHeap stats are reported AFTER the GC has completed. Thus these number are the 'After' heap size for each generation // The sizes INCLUDE fragmentation (holes in the segement) // The TotalPromotedSize0 is the amount that SURVIVED Gen0 (thus it is now in Gen1, thus TotalPromoted0 <= GenerationSize1) public long TotalHeapSize { get { return GenerationSize0 + GenerationSize1 + GenerationSize2 + GenerationSize3; } } public long TotalPromoted { get { return TotalPromotedSize0 + TotalPromotedSize1 + TotalPromotedSize2 + TotalPromotedSize3; } } /// <summary> /// Note that this field is derived from teh TotalPromotedSize* fields. If nothing was promoted, it is possible /// that this could give a number that is smaller than what GC/Start or GC/Stop would indicate. /// </summary> public int Depth { get { if (TotalPromotedSize2 != 0) { return 2; } if (TotalPromotedSize1 != 0) { return 1; } return 0; } } public long GenerationSize0 { get { return GetInt64At(0); } } public long TotalPromotedSize0 { get { return GetInt64At(8); } } public long GenerationSize1 { get { return GetInt64At(16); } } public long TotalPromotedSize1 { get { return GetInt64At(24); } } public long GenerationSize2 { get { return GetInt64At(32); } } public long TotalPromotedSize2 { get { return GetInt64At(40); } } public long GenerationSize3 { get { return GetInt64At(48); } } public long TotalPromotedSize3 { get { return GetInt64At(56); } } public long FinalizationPromotedSize { get { return GetInt64At(64); } } public long FinalizationPromotedCount { get { return GetInt64At(72); } } public int PinnedObjectCount { get { return GetInt32At(80); } } public int SinkBlockCount { get { return GetInt32At(84); } } public int GCHandleCount { get { return GetInt32At(88); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(92); } return 0; } } #region Private internal GCHeapStatsTraceData(Action<GCHeapStatsTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCHeapStatsTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 96)); // HAND_MODIFIED C++ pads to 96 Debug.Assert(!(Version == 1 && EventDataLength != 94)); Debug.Assert(!(Version > 1 && EventDataLength < 94)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "TotalPromoted", TotalPromoted); XmlAttribHex(sb, "TotalHeapSize", TotalHeapSize); XmlAttribHex(sb, "Depth", Depth); XmlAttribHex(sb, "GenerationSize0", GenerationSize0); XmlAttribHex(sb, "TotalPromotedSize0", TotalPromotedSize0); XmlAttribHex(sb, "GenerationSize1", GenerationSize1); XmlAttribHex(sb, "TotalPromotedSize1", TotalPromotedSize1); XmlAttribHex(sb, "GenerationSize2", GenerationSize2); XmlAttribHex(sb, "TotalPromotedSize2", TotalPromotedSize2); XmlAttribHex(sb, "GenerationSize3", GenerationSize3); XmlAttribHex(sb, "TotalPromotedSize3", TotalPromotedSize3); XmlAttribHex(sb, "FinalizationPromotedSize", FinalizationPromotedSize); XmlAttrib(sb, "FinalizationPromotedCount", FinalizationPromotedCount); XmlAttrib(sb, "PinnedObjectCount", PinnedObjectCount); XmlAttrib(sb, "SinkBlockCount", SinkBlockCount); XmlAttrib(sb, "GCHandleCount", GCHandleCount); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "TotalHeapSize", "TotalPromoted", "Depth", "GenerationSize0", "TotalPromotedSize0", "GenerationSize1", "TotalPromotedSize1", "GenerationSize2", "TotalPromotedSize2", "GenerationSize3", "TotalPromotedSize3", "FinalizationPromotedSize", "FinalizationPromotedCount", "PinnedObjectCount", "SinkBlockCount", "GCHandleCount", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return TotalHeapSize; case 1: return TotalPromoted; case 2: return Depth; case 3: return GenerationSize0; case 4: return TotalPromotedSize0; case 5: return GenerationSize1; case 6: return TotalPromotedSize1; case 7: return GenerationSize2; case 8: return TotalPromotedSize2; case 9: return GenerationSize3; case 10: return TotalPromotedSize3; case 11: return FinalizationPromotedSize; case 12: return FinalizationPromotedCount; case 13: return PinnedObjectCount; case 14: return SinkBlockCount; case 15: return GCHandleCount; case 16: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCHeapStatsTraceData> Action; #endregion } public sealed class GCCreateSegmentTraceData : TraceEvent { public ulong Address { get { return (Address)GetInt64At(0); } } public ulong Size { get { return (Address)GetInt64At(8); } } public GCSegmentType Type { get { return (GCSegmentType)GetInt32At(16); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(20); } return 0; } } #region Private internal GCCreateSegmentTraceData(Action<GCCreateSegmentTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCCreateSegmentTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength < 20)); // HAND_MODIFIED V0 has 24 because of C++ rounding Debug.Assert(!(Version == 1 && EventDataLength != 22)); Debug.Assert(!(Version > 1 && EventDataLength < 22)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "Address", Address); XmlAttribHex(sb, "Size", Size); XmlAttrib(sb, "Type", Type); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Address", "Size", "Type", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Address; case 1: return Size; case 2: return Type; case 3: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCCreateSegmentTraceData> Action; #endregion } public sealed class GCFreeSegmentTraceData : TraceEvent { public long Address { get { return GetInt64At(0); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(8); } return 0; } } #region Private internal GCFreeSegmentTraceData(Action<GCFreeSegmentTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCFreeSegmentTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 8)); Debug.Assert(!(Version == 1 && EventDataLength != 10)); Debug.Assert(!(Version > 1 && EventDataLength < 10)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "Address", Address); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Address", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Address; case 1: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCFreeSegmentTraceData> Action; #endregion } public sealed class GCSuspendEETraceData : TraceEvent { public GCSuspendEEReason Reason { get { if (Version >= 1) { return (GCSuspendEEReason)GetInt32At(0); } return (GCSuspendEEReason)GetInt16At(0); } } public int Count { get { if (Version >= 1) { return GetInt32At(4); } return 0; } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(8); } return 0; } } #region Private internal GCSuspendEETraceData(Action<GCSuspendEETraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCSuspendEETraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength < 2)); // HAND_MODIFIED Debug.Assert(!(Version == 1 && EventDataLength != 10)); Debug.Assert(!(Version > 1 && EventDataLength < 10)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Reason", Reason); XmlAttrib(sb, "Count", Count); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Reason", "Count", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Reason; case 1: return Count; case 2: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCSuspendEETraceData> Action; #endregion } public sealed class ExceptionHandlingTraceData : TraceEvent { public long EntryEIP { get { return GetInt64At(0); } } public long MethodID { get { return GetInt64At(8); } } public string MethodName { get { return GetUnicodeStringAt(16); } } public int ClrInstanceID { get { return GetInt16At(SkipUnicodeString(16)); } } #region Private internal ExceptionHandlingTraceData(Action<ExceptionHandlingTraceData> target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { m_target = target; } protected internal override void Dispatch() { m_target(this); } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(16) + 2)); Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(16) + 2)); } protected internal override Delegate Target { get { return m_target; } set { m_target = (Action<ExceptionHandlingTraceData>)value; } } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "EntryEIP", EntryEIP); XmlAttrib(sb, "MethodID", MethodID); XmlAttrib(sb, "MethodName", MethodName); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "EntryEIP", "MethodID", "MethodName", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return EntryEIP; case 1: return MethodID; case 2: return MethodName; case 3: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ExceptionHandlingTraceData> m_target; #endregion } public sealed class GCAllocationTickTraceData : TraceEvent { public int AllocationAmount { get { return GetInt32At(0); } } public GCAllocationKind AllocationKind { get { return (GCAllocationKind)GetInt32At(4); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(8); } return 0; } } public long AllocationAmount64 { get { if (Version >= 2) { return GetInt64At(10); } return 0; } } public Address TypeID { get { if (Version >= 2) { return GetAddressAt(18); } return 0; } } public string TypeName { get { if (Version >= 2) { return GetUnicodeStringAt(18 + PointerSize); } return ""; } } public int HeapIndex { get { if (Version >= 2) { return GetInt32At(SkipUnicodeString(18 + PointerSize)); } return 0; } } public Address Address { get { if (Version >= 3) { return GetAddressAt(SkipUnicodeString(HostOffset(22, 1)) + 4); } return 0; } } #region Private internal GCAllocationTickTraceData(Action<GCAllocationTickTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCAllocationTickTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 8)); Debug.Assert(!(Version == 1 && EventDataLength != 10)); Debug.Assert(!(Version > 1 && EventDataLength < 10)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "AllocationAmount", AllocationAmount); XmlAttrib(sb, "AllocationKind", AllocationKind); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); if (Version >= 2) { XmlAttrib(sb, "AllocationAmount64", AllocationAmount64); XmlAttrib(sb, "TypeID", TypeID); XmlAttrib(sb, "TypeName", TypeName); XmlAttrib(sb, "HeapIndex", HeapIndex); if (Version >= 3) { XmlAttribHex(sb, "Address", Address); } } sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "AllocationAmount", "AllocationKind", "ClrInstanceID", "AllocationAmount64", "TypeID", "TypeName", "HeapIndex", "Address" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return AllocationAmount; case 1: return AllocationKind; case 2: return ClrInstanceID; case 3: return AllocationAmount64; case 4: return TypeID; case 5: return TypeName; case 6: return HeapIndex; case 7: return Address; default: Debug.Assert(false, "Bad field index"); return null; } } private const int OneKB = 1024; private const int OneMB = OneKB * OneKB; public long GetAllocAmount(ref bool seenBadAllocTick) { // We get bad values in old runtimes. once we see a bad value 'fix' all values. // TODO warn the user... long amount = AllocationAmount64; // AllocationAmount is truncated for allocation larger than 2Gb, use 64-bit value if available. if (amount == 0) { amount = AllocationAmount; } if (amount < 0) { seenBadAllocTick = true; } if (seenBadAllocTick) { // Clap this between 90K and 110K (for small objs) and 90K to 2Meg (for large obects). amount = Math.Max(amount, 90 * OneKB); amount = Math.Min(amount, (AllocationKind == GCAllocationKind.Small) ? 110 * OneKB : 2 * OneMB); } return amount; } private event Action<GCAllocationTickTraceData> Action; #endregion } public sealed class GCCreateConcurrentThreadTraceData : TraceEvent { public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(0); } return 0; } } #region Private internal GCCreateConcurrentThreadTraceData(Action<GCCreateConcurrentThreadTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCCreateConcurrentThreadTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 1 && EventDataLength != 2)); Debug.Assert(!(Version > 1 && EventDataLength < 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCCreateConcurrentThreadTraceData> Action; #endregion } public sealed class GCTerminateConcurrentThreadTraceData : TraceEvent { public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(0); } return 0; } } #region Private internal GCTerminateConcurrentThreadTraceData(Action<GCTerminateConcurrentThreadTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCTerminateConcurrentThreadTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 1 && EventDataLength != 2)); Debug.Assert(!(Version > 1 && EventDataLength < 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCTerminateConcurrentThreadTraceData> Action; #endregion } public sealed class GCFinalizersEndTraceData : TraceEvent { public int Count { get { return GetInt32At(0); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(4); } return 0; } } #region Private internal GCFinalizersEndTraceData(Action<GCFinalizersEndTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCFinalizersEndTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 4)); Debug.Assert(!(Version == 1 && EventDataLength != 6)); Debug.Assert(!(Version > 1 && EventDataLength < 6)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Count", Count); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Count", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Count; case 1: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCFinalizersEndTraceData> Action; #endregion } public sealed class GCBulkTypeTraceData : TraceEvent { public int Count { get { return GetInt32At(0); } } public int ClrInstanceID { get { return GetInt16At(4); } } /// <summary> /// Returns the edge at the given zero-based index (index less than Count). The returned BulkTypeValues /// points the the data in GCBulkRootEdgeTraceData so it cannot live beyond that lifetime. /// </summary> public GCBulkTypeValues Values(int index) { return new GCBulkTypeValues(this, OffsetForIndexInValuesArray(index)); } #region Private internal GCBulkTypeTraceData(Action<GCBulkTypeTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; m_lastOffset = 6; // Initialize it to something valid } protected internal override void Dispatch() { m_lastIdx = 0xFFFF; // Invalidate the cache Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCBulkTypeTraceData>)value; } } protected internal override void Validate() { m_lastIdx = 0xFFFF; // Invalidate the cache Debug.Assert(!(Version == 0 && EventDataLength != OffsetForIndexInValuesArray(Count))); Debug.Assert(Count == 0 || Values(Count - 1).TypeParameterCount < 256); // This just makes the asserts in the BulkType kick in } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Count", Count); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.AppendLine(">"); for (int i = 0; i < Count; i++) { Values(i).ToXml(sb).AppendLine(); } sb.Append("</Event>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Count", "ClrInstanceID", "TypeID_0", "TypeName_0" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Count; case 1: return ClrInstanceID; case 2: if (Count == 0) { return 0; } return Values(0).TypeID; case 3: if (Count == 0) { return 0; } return Values(0).TypeName; default: Debug.Assert(false, "Bad field index"); return null; } } private int OffsetForIndexInValuesArray(int targetIdx) { Debug.Assert(targetIdx <= Count); int offset; int idx; if (m_lastIdx <= targetIdx) { idx = m_lastIdx; offset = m_lastOffset; } else { idx = 0; offset = 6; } Debug.Assert(6 <= offset); while (idx < targetIdx) { // Get to to type parameter count int typeParamCountOffset = SkipUnicodeString(offset + 25); // fetch it int typeParamCount = GetInt32At(typeParamCountOffset); Debug.Assert(typeParamCount < 256); // skip the count and the type parameters. offset = typeParamCount * 8 + 4 + typeParamCountOffset; idx++; } Debug.Assert(offset <= EventDataLength); m_lastIdx = (ushort)targetIdx; m_lastOffset = (ushort)offset; Debug.Assert(idx == targetIdx); Debug.Assert(m_lastIdx == targetIdx && m_lastOffset == offset); // No truncation return offset; } private ushort m_lastIdx; private ushort m_lastOffset; private event Action<GCBulkTypeTraceData> Action; #endregion } /// <summary> /// This structure just POINTS at the data in the BulkTypeTraceData. It can only be used as long as /// the BulkTypeTraceData is alive which (unless you cloned it) is only for the lifetime of the callback. /// </summary> public struct GCBulkTypeValues { /// <summary> /// On the desktop this is the Method Table Pointer /// In project N this is the pointer to the EE Type /// </summary> public Address TypeID { get { return m_data.GetAddressAt(m_baseOffset); } } /// <summary> /// For Desktop this is the Module* /// For project N it is image base for the module that the type lives in? /// </summary> public Address ModuleID { get { return m_data.GetAddressAt(m_baseOffset + 8); } } /// <summary> /// On desktop this is the Meta-data token? /// On project N it is the RVA of the typeID /// </summary> public int TypeNameID { get { return m_data.GetInt32At(m_baseOffset + 16); } } public TypeFlags Flags { get { return (TypeFlags)m_data.GetInt32At(m_baseOffset + 20); } } public byte CorElementType { get { return (byte)m_data.GetByteAt(m_baseOffset + 24); } } /// <summary> /// Note that this method returns the type name with generic parameters in .NET Runtime /// syntax e.g. System.WeakReference`1[System.Diagnostics.Tracing.EtwSession] /// </summary> public string TypeName { get { return m_data.GetUnicodeStringAt(m_baseOffset + 25); } } public int TypeParameterCount { get { if (m_typeParamCountOffset == 0) { m_typeParamCountOffset = (ushort)m_data.SkipUnicodeString(m_baseOffset + 25); } int ret = m_data.GetInt32At(m_typeParamCountOffset); Debug.Assert(0 <= ret && ret <= 128); // Not really true, but it deserves investigation. return ret; } } public Address TypeParameterID(int index) { if (m_typeParamCountOffset == 0) { m_typeParamCountOffset = (ushort)m_data.SkipUnicodeString(m_baseOffset + 25); } return m_data.GetAddressAt(m_typeParamCountOffset + 4 + index * 8); } public override string ToString() { StringBuilder sb = new StringBuilder(); return ToXml(sb).ToString(); } public StringBuilder ToXml(StringBuilder sb) { sb.Append(" <GCBulkTypeValue "); TraceEvent.XmlAttrib(sb, "TypeName", TypeName); TraceEvent.XmlAttribHex(sb, "TypeID", TypeID); TraceEvent.XmlAttribHex(sb, "ModuleID", ModuleID); TraceEvent.XmlAttribHex(sb, "TypeNameID", TypeNameID).AppendLine().Append(" "); TraceEvent.XmlAttrib(sb, "Flags", Flags); TraceEvent.XmlAttrib(sb, "CorElementType", CorElementType); TraceEvent.XmlAttrib(sb, "TypeParameterCount", TypeParameterCount); sb.Append("/>"); // TODO display the type parameters IDs return sb; } #region private internal GCBulkTypeValues(TraceEvent data, int baseOffset) { m_data = data; m_baseOffset = (ushort)baseOffset; m_typeParamCountOffset = 0; Debug.Assert(CorElementType < 64); Debug.Assert(0 <= CorElementType && CorElementType <= 128); // Sanity checks. Not really true, but it deserves investigation. Debug.Assert(0 <= TypeParameterCount && TypeParameterCount < 128); Debug.Assert((TypeID & 0xFF00000000000001L) == 0); Debug.Assert((ModuleID & 0xFF00000000000003L) == 0); Debug.Assert((((int)Flags) & 0xFFFFFF00) == 0); } private TraceEvent m_data; private ushort m_baseOffset; private ushort m_typeParamCountOffset; #endregion } public sealed class GCBulkRootEdgeTraceData : TraceEvent { public int Index { get { return GetInt32At(0); } } public int Count { get { return GetInt32At(4); } } public int ClrInstanceID { get { return GetInt16At(8); } } /// <summary> /// Returns the edge at the given zero-based index (index less than Count). The returned GCBulkRootEdgeValues /// points the the data in GCBulkRootEdgeTraceData so it cannot live beyond that lifetime. /// </summary> public GCBulkRootEdgeValues Values(int index) { return new GCBulkRootEdgeValues(this, 10 + index * HostOffset(13, 2)); } #region Private internal GCBulkRootEdgeTraceData(Action<GCBulkRootEdgeTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCBulkRootEdgeTraceData>)value; } } protected internal override void Validate() { // The != 12 was added because I think we accidentally used the same event ID for a update of the runtime. Debug.Assert(!(Version == 0 && EventDataLength != (Count * HostOffset(13, 2)) + 10 && EventDataLength != 12)); Debug.Assert(!(Version > 0 && EventDataLength < (Count * HostOffset(13, 2)) + 10)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Index", Index); XmlAttrib(sb, "Count", Count); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.AppendLine(">"); for (int i = 0; i < Count; i++) { Values(i).ToXml(sb).AppendLine(); } sb.Append("</Event>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Index", "Count", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Index; case 1: return Count; case 2: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCBulkRootEdgeTraceData> Action; #endregion } /// <summary> /// This structure just POINTS at the data in the GCBulkEdgeTraceData. It can only be used as long as /// the GCBulkEdgeTraceData is alive which (unless you cloned it) is only for the lifetime of the callback. /// </summary> public struct GCBulkRootEdgeValues { public Address RootedNodeAddress { get { return m_data.GetAddressAt(m_baseOffset); } } public GCRootKind GCRootKind { get { return (GCRootKind)m_data.GetByteAt(m_data.HostOffset(m_baseOffset + 4, 1)); } } public GCRootFlags GCRootFlag { get { return (GCRootFlags)m_data.GetInt32At(m_data.HostOffset(m_baseOffset + 5, 1)); } } public Address GCRootID { get { return m_data.GetAddressAt(m_data.HostOffset(m_baseOffset + 9, 1)); } } public override string ToString() { StringBuilder sb = new StringBuilder(); return ToXml(sb).ToString(); } public StringBuilder ToXml(StringBuilder sb) { sb.Append(" <GCBulkRootEdgeValue "); TraceEvent.XmlAttribHex(sb, "RootedNodeAddress", RootedNodeAddress); TraceEvent.XmlAttrib(sb, "GCRootKind", GCRootKind); TraceEvent.XmlAttrib(sb, "GCRootFlag", GCRootFlag); TraceEvent.XmlAttribHex(sb, "GCRootID", GCRootID); sb.Append("/>"); return sb; } #region private internal GCBulkRootEdgeValues(TraceEvent data, int baseOffset) { m_data = data; m_baseOffset = baseOffset; Debug.Assert((RootedNodeAddress & 0xFF00000000000003L) == 0); Debug.Assert((GCRootID & 0xFF00000000000003L) == 0); Debug.Assert((int)GCRootFlag < 256); } private TraceEvent m_data; private int m_baseOffset; #endregion } public sealed class GCBulkRootConditionalWeakTableElementEdgeTraceData : TraceEvent { public int Index { get { return GetInt32At(0); } } public int Count { get { return GetInt32At(4); } } public int ClrInstanceID { get { return GetInt16At(8); } } /// <summary> /// Returns the range at the given zero-based index (index less than Count). The returned GCBulkRootConditionalWeakTableElementEdgeValues /// points the the data in GCBulkRootConditionalWeakTableElementEdgeTraceData so it cannot live beyond that lifetime. /// </summary> public GCBulkRootConditionalWeakTableElementEdgeValues Values(int index) { return new GCBulkRootConditionalWeakTableElementEdgeValues(this, 10 + (index * HostOffset(12, 3))); } #region Private internal GCBulkRootConditionalWeakTableElementEdgeTraceData(Action<GCBulkRootConditionalWeakTableElementEdgeTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCBulkRootConditionalWeakTableElementEdgeTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != Count * HostOffset(12, 3) + 10)); Debug.Assert(!(Version > 0 && EventDataLength < Count * HostOffset(12, 3) + 10)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Index", Index); XmlAttrib(sb, "Count", Count); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.AppendLine(">"); for (int i = 0; i < Count; i++) { Values(i).ToXml(sb).AppendLine(); } sb.Append("</Event>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Index", "Count", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Index; case 1: return Count; case 2: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCBulkRootConditionalWeakTableElementEdgeTraceData> Action; #endregion } /// <summary> /// This structure just POINTS at the data in the GCBulkRootConditionalWeakTableElementEdgeTraceData. It can only be used as long as /// the GCBulkRootConditionalWeakTableElementEdgeTraceData is alive which (unless you cloned it) is only for the lifetime of the callback. /// </summary> public struct GCBulkRootConditionalWeakTableElementEdgeValues { public Address GCKeyNodeID { get { return m_data.GetAddressAt(m_baseOffset); } } public Address GCValueNodeID { get { return m_data.GetAddressAt(m_data.HostOffset(m_baseOffset + 4, 1)); } } public Address GCRootID { get { return m_data.GetAddressAt(m_data.HostOffset(m_baseOffset + 8, 2)); } } public override string ToString() { StringBuilder sb = new StringBuilder(); return ToXml(sb).ToString(); } public StringBuilder ToXml(StringBuilder sb) { sb.Append(" <GCBulkRootConditionalWeakTableElementEdgeValue "); TraceEvent.XmlAttribHex(sb, "GCKeyNodeID", GCKeyNodeID); TraceEvent.XmlAttribHex(sb, "GCValueNodeID", GCValueNodeID); TraceEvent.XmlAttribHex(sb, "GCRootID", GCRootID); sb.Append("/>"); return sb; } #region private internal GCBulkRootConditionalWeakTableElementEdgeValues(TraceEvent data, int baseOffset) { m_data = data; m_baseOffset = baseOffset; Debug.Assert((GCKeyNodeID & 0xFF00000000000003L) == 0); Debug.Assert((GCValueNodeID & 0xFF00000000000003L) == 0); Debug.Assert((GCRootID & 0xFF00000000000003L) == 0); } private TraceEvent m_data; private int m_baseOffset; #endregion } public sealed class GCBulkNodeTraceData : TraceEvent { public int Index { get { return GetInt32At(0); } } public int Count { get { return GetInt32At(4); } } public int ClrInstanceID { get { return GetInt16At(8); } } /// <summary> /// Returns the node at the given zero-based index (idx less than Count). The returned GCBulkNodeNodes /// points the the data in GCBulkNodeTraceData so it cannot live beyond that lifetime. /// </summary> public GCBulkNodeValues Values(int index) { return new GCBulkNodeValues(this, 10 + index * HostOffset(28, 1)); } /// <summary> /// This unsafe interface may go away. Use the 'Nodes(idx)' instead /// </summary> public unsafe GCBulkNodeUnsafeNodes* UnsafeNodes(int arrayIdx, GCBulkNodeUnsafeNodes* buffer) { Debug.Assert(0 <= arrayIdx && arrayIdx < Count); GCBulkNodeUnsafeNodes* ret; if (PointerSize != 8) { GCBulkNodeUnsafeNodes32* basePtr = (GCBulkNodeUnsafeNodes32*)(((byte*)DataStart) + 10); GCBulkNodeUnsafeNodes32* value = basePtr + arrayIdx; buffer->Address = value->Address; buffer->Size = value->Size; buffer->TypeID = value->TypeID; buffer->EdgeCount = value->EdgeCount; ret = buffer; } else { GCBulkNodeUnsafeNodes* basePtr = (GCBulkNodeUnsafeNodes*)(((byte*)DataStart) + 10); ret = basePtr + arrayIdx; } Debug.Assert((ret->Address & 0xFF00000000000003L) == 0); Debug.Assert((ret->TypeID & 0xFF00000000000001L) == 0); Debug.Assert(ret->Size < 0x80000000L); Debug.Assert(ret->EdgeCount < 100000); return ret; } #region Private internal GCBulkNodeTraceData(Action<GCBulkNodeTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCBulkNodeTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != (Count * HostOffset(28, 1)) + 10)); Debug.Assert(!(Version > 0 && EventDataLength < (Count * HostOffset(28, 1)) + 10)); Debug.Assert(Count == 0 || Values(Count - 1).EdgeCount < 100000); // THis is to let the GCBulkNodeValues asserts kick in } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Index", Index); XmlAttrib(sb, "Count", Count); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.AppendLine(">"); for (int i = 0; i < Count; i++) { Values(i).ToXml(sb).AppendLine(); } sb.Append("</Event>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Index", "Count", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Index; case 1: return Count; case 2: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCBulkNodeTraceData> Action; #endregion } /// <summary> /// This structure just POINTS at the data in the GCBulkNodeTraceData. It can only be used as long as /// the GCBulkNodeTraceData is alive which (unless you cloned it) is only for the lifetime of the callback. /// </summary> public struct GCBulkNodeValues { public Address Address { get { return m_data.GetAddressAt(m_baseOffset); } } public Address Size { get { return m_data.GetAddressAt(m_data.HostOffset(m_baseOffset + 4, 1)); } } public Address TypeID { get { return m_data.GetAddressAt(m_data.HostOffset(m_baseOffset + 12, 1)); } } public long EdgeCount { get { return m_data.GetInt64At(m_data.HostOffset(m_baseOffset + 20, 1)); } } public override string ToString() { StringBuilder sb = new StringBuilder(); return ToXml(sb).ToString(); } public StringBuilder ToXml(StringBuilder sb) { sb.Append(" <GCBulkNodeValue "); TraceEvent.XmlAttribHex(sb, "Address", Address); TraceEvent.XmlAttribHex(sb, "Size", Size); TraceEvent.XmlAttribHex(sb, "TypeID", TypeID); TraceEvent.XmlAttrib(sb, "EdgeCount", EdgeCount); sb.Append("/>"); return sb; } #region private internal GCBulkNodeValues(TraceEvent data, int baseOffset) { m_data = data; m_baseOffset = baseOffset; Debug.Assert((Address & 0xFF00000000000003L) == 0); Debug.Assert((TypeID & 0xFF00000000000001L) == 0); Debug.Assert(Size < 0x80000000L); Debug.Assert(EdgeCount < 100000); } private TraceEvent m_data; private int m_baseOffset; #endregion } [StructLayout(LayoutKind.Sequential, Pack = 1)] internal struct GCBulkNodeUnsafeNodes32 { public uint Address; public Address Size; public Address TypeID; public long EdgeCount; } [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct GCBulkNodeUnsafeNodes { public Address Address; public Address Size; public Address TypeID; public long EdgeCount; } public sealed class GCBulkEdgeTraceData : TraceEvent { public int Index { get { return GetInt32At(0); } } public int Count { get { return GetInt32At(4); } } public int ClrInstanceID { get { return GetInt16At(8); } } /// <summary> /// Returns the 'idx' th edge. /// The returned GCBulkEdgeEdges cannot live beyond the TraceEvent that it comes from. /// </summary> public GCBulkEdgeValues Values(int index) { return new GCBulkEdgeValues(this, 10 + (index * HostOffset(8, 1))); } #region Private internal GCBulkEdgeTraceData(Action<GCBulkEdgeTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCBulkEdgeTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != Count * HostOffset(8, 1) + 10)); Debug.Assert(!(Version > 0 && EventDataLength < Count * HostOffset(8, 1) + 10)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Index", Index); XmlAttrib(sb, "Count", Count); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.AppendLine(">"); for (int i = 0; i < Count; i++) { Values(i).ToXml(sb).AppendLine(); } sb.Append("</Event>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Index", "Count", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Index; case 1: return Count; case 2: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCBulkEdgeTraceData> Action; #endregion } /// <summary> /// This structure just POINTS at the data in the GCBulkNodeTraceData. It can only be used as long as /// the GCBulkNodeTraceData is alive which (unless you cloned it) is only for the lifetime of the callback. /// </summary> public struct GCBulkEdgeValues { public Address Target { get { return m_data.GetAddressAt(m_baseOffset); } } public int ReferencingField { get { return m_data.GetInt32At(m_data.HostOffset(m_baseOffset + 4, 1)); } } public override string ToString() { StringBuilder sb = new StringBuilder(); return ToXml(sb).ToString(); } public StringBuilder ToXml(StringBuilder sb) { sb.Append(" <GCBulkEdgeValue "); TraceEvent.XmlAttribHex(sb, "Target", Target); TraceEvent.XmlAttrib(sb, "ReferencingField", ReferencingField); sb.Append("/>"); return sb; } #region private internal GCBulkEdgeValues(TraceEvent data, int baseOffset) { m_data = data; m_baseOffset = baseOffset; Debug.Assert((Target & 0xFF00000000000003L) == 0); Debug.Assert(ReferencingField < 0x10000); } private TraceEvent m_data; private int m_baseOffset; #endregion } public sealed class GCSampledObjectAllocationTraceData : TraceEvent { public Address Address { get { return GetAddressAt(0); } } public Address TypeID { get { return GetAddressAt(HostOffset(4, 1)); } } public int ObjectCountForTypeSample { get { return GetInt32At(HostOffset(8, 2)); } } public long TotalSizeForTypeSample { get { return GetInt64At(HostOffset(12, 2)); } } public int ClrInstanceID { get { return GetInt16At(HostOffset(20, 2)); } } #region Private internal GCSampledObjectAllocationTraceData(Action<GCSampledObjectAllocationTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCSampledObjectAllocationTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != HostOffset(22, 2))); Debug.Assert(!(Version > 0 && EventDataLength < HostOffset(22, 2))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "Address", Address); XmlAttribHex(sb, "TypeID", TypeID); XmlAttrib(sb, "ObjectCountForTypeSample", ObjectCountForTypeSample); XmlAttrib(sb, "TotalSizeForTypeSample", TotalSizeForTypeSample); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Address", "TypeID", "ObjectCountForTypeSample", "TotalSizeForTypeSample", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Address; case 1: return TypeID; case 2: return ObjectCountForTypeSample; case 3: return TotalSizeForTypeSample; case 4: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCSampledObjectAllocationTraceData> Action; #endregion } public sealed class GCBulkSurvivingObjectRangesTraceData : TraceEvent { public int Index { get { return GetInt32At(0); } } public int Count { get { return GetInt32At(4); } } public int ClrInstanceID { get { return GetInt16At(8); } } /// <summary> /// Returns the range at the given zero-based index (index less than Count). The returned GCBulkSurvivingObjectRangesValues /// points the the data in GCBulkSurvivingObjectRangesTraceData so it cannot live beyond that lifetime. /// </summary> public GCBulkSurvivingObjectRangesValues Values(int index) { return new GCBulkSurvivingObjectRangesValues(this, 10 + (index * HostOffset(12, 1))); } #region Private internal GCBulkSurvivingObjectRangesTraceData(Action<GCBulkSurvivingObjectRangesTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCBulkSurvivingObjectRangesTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 10 + (Count * HostOffset(12, 1)))); Debug.Assert(!(Version > 0 && EventDataLength < 10 + (Count * HostOffset(12, 1)))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Index", Index); XmlAttrib(sb, "Count", Count); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.AppendLine(">"); for (int i = 0; i < Count; i++) { Values(i).ToXml(sb).AppendLine(); } sb.Append("</Event>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Index", "Count", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Index; case 1: return Count; case 2: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCBulkSurvivingObjectRangesTraceData> Action; #endregion } /// <summary> /// This structure just POINTS at the data in the GCBulkEdgeTraceData. It can only be used as long as /// the GCBulkEdgeTraceData is alive which (unless you cloned it) is only for the lifetime of the callback. /// </summary> public struct GCBulkSurvivingObjectRangesValues { public Address RangeBase { get { return m_data.GetAddressAt(m_baseOffset); } } public Address RangeLength { get { return (Address)m_data.GetInt64At(m_data.HostOffset(m_baseOffset + 4, 1)); } } public override string ToString() { StringBuilder sb = new StringBuilder(); return ToXml(sb).ToString(); } public StringBuilder ToXml(StringBuilder sb) { sb.Append(" <GCBulkMovedObjectRangesValues "); TraceEvent.XmlAttribHex(sb, "RangeBase", RangeBase); TraceEvent.XmlAttribHex(sb, "RangeLength", RangeLength); sb.Append("/>"); return sb; } #region private internal GCBulkSurvivingObjectRangesValues(TraceEvent data, int baseOffset) { m_data = data; m_baseOffset = baseOffset; Debug.Assert((RangeBase & 0xFF00000000000003L) == 0); Debug.Assert((RangeLength & 0xFFFFFFF000000003L) == 0); } private TraceEvent m_data; private int m_baseOffset; #endregion } public sealed class GCBulkMovedObjectRangesTraceData : TraceEvent { public int Index { get { return GetInt32At(0); } } public int Count { get { return GetInt32At(4); } } public int ClrInstanceID { get { return GetInt16At(8); } } /// <summary> /// Returns the range at the given zero-based index (index less than Count). The returned GCBulkSurvivingObjectRangesValues /// points the the data in GCBulkSurvivingObjectRangesTraceData so it cannot live beyond that lifetime. /// </summary> public GCBulkMovedObjectRangesValues Values(int index) { return new GCBulkMovedObjectRangesValues(this, 10 + (index * HostOffset(16, 2))); } #region Private internal GCBulkMovedObjectRangesTraceData(Action<GCBulkMovedObjectRangesTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCBulkMovedObjectRangesTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != HostOffset(16, 2) * Count + 10)); Debug.Assert(!(Version > 0 && EventDataLength < HostOffset(16, 2) * Count + 10)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Index", Index); XmlAttrib(sb, "Count", Count); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.AppendLine(">"); for (int i = 0; i < Count; i++) { Values(i).ToXml(sb).AppendLine(); } sb.Append("</Event>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Index", "Count", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Index; case 1: return Count; case 2: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCBulkMovedObjectRangesTraceData> Action; #endregion } /// <summary> /// This structure just POINTS at the data in the GCBulkEdgeTraceData. It can only be used as long as /// the GCBulkEdgeTraceData is alive which (unless you cloned it) is only for the lifetime of the callback. /// </summary> public struct GCBulkMovedObjectRangesValues { public Address OldRangeBase { get { return m_data.GetAddressAt(m_baseOffset); } } public Address NewRangeBase { get { return m_data.GetAddressAt(m_data.HostOffset(m_baseOffset + 4, 1)); } } public Address RangeLength { get { return (Address)m_data.GetInt64At(m_data.HostOffset(m_baseOffset + 8, 2)); } } public override string ToString() { StringBuilder sb = new StringBuilder(); return ToXml(sb).ToString(); } public StringBuilder ToXml(StringBuilder sb) { sb.Append(" <GCBulkMovedObjectRangesValues "); TraceEvent.XmlAttribHex(sb, "OldRangeBase", OldRangeBase); TraceEvent.XmlAttribHex(sb, "NewRangeBase", NewRangeBase); TraceEvent.XmlAttribHex(sb, "RangeLength", RangeLength); sb.Append("/>"); return sb; } #region private internal GCBulkMovedObjectRangesValues(TraceEvent data, int baseOffset) { m_data = data; m_baseOffset = baseOffset; Debug.Assert((OldRangeBase & 0xFF00000000000003L) == 0); Debug.Assert((NewRangeBase & 0xFF00000000000003L) == 0); Debug.Assert((RangeLength & 0xFFFFFFF000000003L) == 0); } private TraceEvent m_data; private int m_baseOffset; #endregion } public sealed class GCGenerationRangeTraceData : TraceEvent { public int Generation { get { return GetByteAt(0); } } public Address RangeStart { get { return GetAddressAt(1); } } public Address RangeUsedLength { get { return (Address)GetInt64At(HostOffset(5, 1)); } } public Address RangeReservedLength { get { return (Address)GetInt64At(HostOffset(13, 1)); } } public int ClrInstanceID { get { return GetInt16At(HostOffset(21, 1)); } } #region Private internal GCGenerationRangeTraceData(Action<GCGenerationRangeTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCGenerationRangeTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != HostOffset(23, 1))); Debug.Assert(!(Version > 0 && EventDataLength < HostOffset(23, 1))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Generation", Generation); XmlAttribHex(sb, "RangeStart", RangeStart); XmlAttrib(sb, "RangeUsedLength", RangeUsedLength); XmlAttrib(sb, "RangeReservedLength", RangeReservedLength); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Generation", "RangeStart", "RangeUsedLength", "RangeReservedLength", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Generation; case 1: return RangeStart; case 2: return RangeUsedLength; case 3: return RangeReservedLength; case 4: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCGenerationRangeTraceData> Action; #endregion } public enum MarkRootType { MarkStack = 0, MarkFQ = 1, MarkHandles = 2, MarkOlder = 3, MarkSizedRef = 4, MarkOverflow = 5, MarkMax = 6, } public sealed class GCMarkTraceData : TraceEvent { public int HeapNum { get { return GetInt32At(0); } } public int ClrInstanceID { get { return GetInt16At(4); } } #region Private internal GCMarkTraceData(Action<GCMarkTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCMarkTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 6)); Debug.Assert(!(Version > 0 && EventDataLength < 6)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "HeapNum", HeapNum); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "HeapNum", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return HeapNum; case 1: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCMarkTraceData> Action; #endregion } public sealed class GCMarkWithTypeTraceData : TraceEvent { public int HeapNum { get { return GetInt32At(0); } } public int ClrInstanceID { get { return GetInt16At(4); } } public int Type { get { return GetInt32At(6); } } public long Promoted { get { return GetInt64At(10); } } #region Private internal GCMarkWithTypeTraceData(Action<GCMarkWithTypeTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCMarkWithTypeTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 18)); Debug.Assert(!(Version > 0 && EventDataLength < 18)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "HeapNum", HeapNum); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); XmlAttrib(sb, "Type", Type); XmlAttrib(sb, "Promoted", Promoted); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "HeapNum", "ClrInstanceID", "Type", "Promoted" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return HeapNum; case 1: return ClrInstanceID; case 2: return Type; case 3: return Promoted; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCMarkWithTypeTraceData> Action; #endregion } /// <summary> /// We keep Heap history for every Generation in 'Gens' /// </summary> public enum Gens { Gen0, Gen1, Gen2, GenLargeObj, Gen0After, } /// <summary> /// Taken from gcrecords.h, used to differentiate heap expansion and compaction reasons /// </summary> public enum gc_heap_expand_mechanism : int { expand_reuse_normal = 0, expand_reuse_bestfit = 1, expand_new_seg_ep = 2, // new seg with ephemeral promotion expand_new_seg = 3, expand_no_memory = 4, // we can't get a new seg. expand_next_full_gc = 5, max_expand_mechanisms_count = 6, not_specified = 1024 } public enum gc_heap_compact_reason : int { compact_low_ephemeral = 0, compact_high_frag = 1, compact_no_gaps = 2, compact_loh_forced = 3, compact_last_gc = 4, compact_induced_compacting = 5, compact_fragmented_gen0 = 6, compact_high_mem_load = 7, compact_high_mem_frag = 8, compact_vhigh_mem_frag = 9, compact_no_gc_mode = 10, max_compact_reasons_count = 11, not_specified = 1024 } public enum gc_concurrent_compact_reason : int { concurrent_compact_high_frag = 0, concurrent_compact_c_mark = 1, max_concurrent_compat_reason = 2, not_specified = 1024 } /// <summary> /// Version 0, PreciseVersion 0.1: Silverlight (x86) /// 0:041> dt -r2 coreclr!WKS::gc_history_per_heap /// +0x000 gen_data : [5] WKS::gc_generation_data /// +0x000 size_before : Uint4B/8B : [0 - 40), [40 - 80), [80 - 120), [120 - 160), [160 - 200) /// +0x004 size_after : Uint4B/8B /// +0x008 current_size : Uint4B/8B /// +0x00c previous_size : Uint4B/8B /// +0x010 fragmentation : Uint4B/8B /// +0x014 in : Uint4B/8B /// +0x018 out : Uint4B/8B /// +0x01c new_allocation : Uint4B/8B /// +0x020 surv : Uint4B/8B /// +0x024 growth : Uint4B/8B /// +0x0c8 mem_pressure : Uint4B : 200 /// +0x0cc mechanisms : [2] Uint4B : 204 (expand), 208 (compact) /// +0x0d4 gen_condemn_reasons : Uint4B : 212 /// +0x0d8 heap_index : Uint4B : 216 /// /// clrInstanceId : byte : 220 /// /// Version 0, PreciseVersion 0.2: .NET 4.0 /// 0:000> dt -r2 clr!WKS::gc_history_per_heap /// +0x000 gen_data : [5] WKS::gc_generation_data /// +0x000 size_before : Uint4B/8B : [0 - 40), [40 - 80), [80 - 120), [120 - 160), [160 - 200) /// +0x004 size_after : Uint4B/8B /// +0x008 current_size : Uint4B/8B /// +0x00c previous_size : Uint4B/8B /// +0x010 fragmentation : Uint4B/8B /// +0x014 in : Uint4B/8B /// +0x018 out : Uint4B/8B /// +0x01c new_allocation : Uint4B/8B /// +0x020 surv : Uint4B/8B /// +0x024 growth : Uint4B/8B /// +0x0c8 mem_pressure : Uint4B : 200 /// +0x0cc mechanisms : [3] Uint4B : 204 (expand), 208 (compact), 212 (concurrent_compact) /// +0x0d8 gen_condemn_reasons : Uint4B : 216 /// +0x0dc heap_index : Uint4B : 220 /// /// clrInstanceId : byte : 224 /// /// vm\gcrecord.h /// Etw_GCDataPerHeapSpecial(...) /// ... /// EventDataDescCreate(EventData[0], gc_data_per_heap, datasize); /// EventDataDescCreate(EventData[1], ClrInstanceId, sizeof(ClrInstanceId)); /// /// Version 1: ??? /// /// Version 2, PreciseVersion 2.1: .NET 4.5 (x86) /// 0:000> dt -r2 WKS::gc_history_per_heap /// clr!WKS::gc_history_per_heap /// +0x000 gen_data : [5] WKS::gc_generation_data /// +0x000 size_before : Uint4B/8B : [0 - 40), [40 - 80), [80 - 120), [120 - 160), [160 - 200) /// +0x004 free_list_space_before : Uint4B/8B /// +0x008 free_obj_space_before : Uint4B/8B /// +0x00c size_after : Uint4B/8B /// +0x010 free_list_space_after : Uint4B/8B /// +0x014 free_obj_space_after : Uint4B/8B /// +0x018 in : Uint4B/8B /// +0x01c out : Uint4B/8B /// +0x020 new_allocation : Uint4B/8B /// +0x024 surv : Uint4B/8B /// +0x0c8 gen_to_condemn_reasons : WKS::gen_to_condemn_tuning /// +0x000 condemn_reasons_gen : Uint4B : 200 /// +0x004 condemn_reasons_condition : Uint4B : 204 /// +0x0d0 mem_pressure : Uint4B : 208 /// +0x0d4 mechanisms : [2] Uint4B : 212 (expand), 216 (compact) /// +0x0dc heap_index : Uint4B : 220 /// /// vm\gcrecord.h /// Etw_GCDataPerHeapSpecial(...) /// ... /// EventDataDescCreate(EventData[0], gc_data_per_heap, datasize); /// EventDataDescCreate(EventData[1], ClrInstanceId, sizeof(ClrInstanceId)); /// /// Version 2, PreciseVersion 2.2: .NET 4.5.2 (x86) /// 0:000> dt -r2 WKS::gc_history_per_heap /// clr!WKS::gc_history_per_heap /// +0x000 gen_data : [5] WKS::gc_generation_data /// +0x000 size_before : Uint4B/8B : [0 - 40), [40 - 80), [80 - 120), [120 - 160), [160 - 200) /// +0x004 free_list_space_before : Uint4B/8B /// +0x008 free_obj_space_before : Uint4B/8B /// +0x00c size_after : Uint4B/8B /// +0x010 free_list_space_after : Uint4B/8B /// +0x014 free_obj_space_after : Uint4B/8B /// +0x018 in : Uint4B/8B /// +0x01c out : Uint4B/8B /// +0x020 new_allocation : Uint4B/8B /// +0x024 surv : Uint4B/8B /// +0x0c8 gen_to_condemn_reasons : WKS::gen_to_condemn_tuning /// +0x000 condemn_reasons_gen : Uint4B : 200 /// +0x004 condemn_reasons_condition : Uint4B : 204 /// +0x0d0 mem_pressure : Uint4B : 208 /// +0x0d4 mechanisms : [2] Uint4B : 212 (expand), 216 (compact) /// +0x0dc heap_index : Uint4B : 220 /// +0x0e0 extra_gen0_committed : Uint8B : 224 /// /// vm\gcrecord.h /// Etw_GCDataPerHeapSpecial(...) /// ... /// EventDataDescCreate(EventData[0], gc_data_per_heap, datasize); /// EventDataDescCreate(EventData[1], ClrInstanceId, sizeof(ClrInstanceId)); /// /// Version 3: .NET 4.6 (x86) /// 0:000> dt -r2 WKS::gc_history_per_heap /// clr!WKS::gc_history_per_heap /// +0x000 gen_data : [4] /// WKS::gc_generation_data /// +0x000 size_before : Uint4B/8B /// +0x004 free_list_space_before : Uint4B/8B /// +0x008 free_obj_space_before : Uint4B/8B /// +0x00c size_after : Uint4B/8B /// +0x010 free_list_space_after : Uint4B/8B /// +0x014 free_obj_space_after : Uint4B/8B /// +0x018 in : Uint4B/8B /// +0x01c pinned_surv : Uint4B/8B /// +0x020 npinned_surv : Uint4B/8B /// +0x024 new_allocation : Uint4B/8B /// +0x0a0 maxgen_size_info : WKS::maxgen_size_increase /// +0x000 free_list_allocated : Uint4B/8B /// +0x004 free_list_rejected : Uint4B/8B /// +0x008 end_seg_allocated : Uint4B/8B /// +0x00c condemned_allocated : Uint4B/8B /// +0x010 pinned_allocated : Uint4B/8B /// +0x014 pinned_allocated_advance : Uint4B/8B /// +0x018 running_free_list_efficiency : Uint4B/8B /// +0x0bc gen_to_condemn_reasons : WKS::gen_to_condemn_tuning /// +0x000 condemn_reasons_gen : Uint4B /// +0x004 condemn_reasons_condition : Uint4B /// +0x0c4 mechanisms : [2] Uint4B /// +0x0cc machanism_bits : Uint4B /// +0x0d0 heap_index : Uint4B /// +0x0d4 extra_gen0_committed : Uint4B/8B /// /// pal\src\eventprovider\lttng\eventprovdotnetruntime.cpp /// FireEtXplatGCPerHeapHistory_V3(...) /// /// tracepoint( /// DotNETRuntime, /// GCPerHeapHistory_V3, x86 offsets /// ClrInstanceID, : 0 /// (const size_t) FreeListAllocated, : 2 /// (const size_t) FreeListRejected, : 6 /// (const size_t) EndOfSegAllocated, : 10 /// (const size_t) CondemnedAllocated, : 14 /// (const size_t) PinnedAllocated, : 18 /// (const size_t) PinnedAllocatedAdvance, : 22 /// RunningFreeListEfficiency, : 26 /// CondemnReasons0, : 30 /// CondemnReasons1 : 34 /// ); /// tracepoint( /// DotNETRuntime, /// GCPerHeapHistory_V3_1, /// CompactMechanisms, : 38 /// ExpandMechanisms, : 42 /// HeapIndex, : 46 /// (const size_t) ExtraGen0Commit, : 50 /// Count, : 54 (number of WKS::gc_generation_data's) /// Arg15_Struct_Len_, : ?? not really sent /// (const int*) Arg15_Struct_Pointer_ : [58 - 98), ... /// ); /// /// Version 3 is now setup to allow "add to the end" scenarios /// /// </summary> public sealed class GCPerHeapHistoryTraceData : TraceEvent { public int ClrInstanceID { get { int cid = -1; if (Version == 0) { cid = GetByteAt(EventDataLength - 1); } else if (Version == 2) { cid = GetByteAt(EventDataLength - 1); } else if (Version >= 3) { cid = GetInt16At(0); } else { Debug.Assert(false, "ClrInstanceId invalid Version : " + Version); } Debug.Assert(cid >= 0); return cid; } } public long FreeListAllocated { get { long ret = long.MinValue; if (Version >= 3) { ret = (long)GetAddressAt(2); } else { Debug.Assert(false, "FreeListAllocated invalid Version : " + Version); } Debug.Assert(ret >= 0); return ret; } } public bool HasFreeListAllocated { get { return Version >= 3; } } public long FreeListRejected { get { long ret = long.MinValue; if (Version >= 3) { ret = (long)GetAddressAt(HostOffset(6, 1)); } else { Debug.Assert(false, "FreeListRejected invalid Version : " + Version); } Debug.Assert(ret >= 0); return ret; } } public bool HasFreeListRejected { get { return Version >= 3; } } public long EndOfSegAllocated { get { long ret = long.MinValue; if (Version >= 3) { ret = (long)GetAddressAt(HostOffset(10, 2)); } else { Debug.Assert(false, "EndOfSegAllocated invalid Version : " + Version); } Debug.Assert(ret >= 0); return ret; } } public bool HasEndOfSegAllocated { get { return Version >= 3; } } public long CondemnedAllocated { get { long ret = long.MinValue; if (Version >= 3) { ret = (long)GetAddressAt(HostOffset(14, 3)); } else { Debug.Assert(false, "CondemnedAllocated invalid Version : " + Version); } Debug.Assert(ret >= 0); return ret; } } public bool HasCondemnedAllocated { get { return Version >= 3; } } public long PinnedAllocated { get { long ret = long.MinValue; if (Version >= 3) { ret = (long)GetAddressAt(HostOffset(18, 4)); } else { Debug.Assert(false, "PinnedAllocated invalid Version : " + Version); } Debug.Assert(ret >= 0); return ret; } } public bool HasPinnedAllocated { get { return Version >= 3; } } public long PinnedAllocatedAdvance { get { long ret = long.MinValue; if (Version >= 3) { ret = (long)GetAddressAt(HostOffset(22, 5)); } else { Debug.Assert(false, "PinnedAllocatedAdvance invalid Version : " + Version); } Debug.Assert(ret >= 0); return ret; } } public bool HasPinnedAllocatedAdvance { get { return Version >= 3; } } public int RunningFreeListEfficiency { get { int ret = int.MinValue; if (Version >= 3) { ret = GetInt32At(HostOffset(26, 6)); } else { Debug.Assert(false, "RunningFreeListEfficiency invalid Version : " + Version); } Debug.Assert(ret >= 0); return ret; } } public bool HasRunningFreeListEfficiency { get { return Version >= 3; } } /// <summary> /// Returns the condemned generation number /// </summary> public int CondemnReasons0 { get { int ret = int.MinValue; if (Version == 0 && (MinorVersion == 0 || MinorVersion == 1)) { ret = GetInt32At(SizeOfGenData * maxGenData + sizeof(int) * 3); } else if (Version == 0 && MinorVersion == 2) { ret = GetInt32At(SizeOfGenData * maxGenData + sizeof(int) * 4); } else if (Version == 2) { ret = GetInt32At(SizeOfGenData * maxGenData); } else if (Version >= 3) { ret = GetInt32At(HostOffset(30, 6)); } else { Debug.Assert(false, "CondenReasons0 invalid Version : " + Version + " " + MinorVersion); } Debug.Assert(ret >= 0); return ret; } } /// <summary> /// Returns the condemned condition /// </summary> public int CondemnReasons1 { get { int ret = int.MinValue; if (Version == 2) { ret = GetInt32At(SizeOfGenData * maxGenData + sizeof(int)); } else if (Version >= 3) { ret = GetInt32At(HostOffset(34, 6)); } else { Debug.Assert(false, "CondenReasons1 invalid Version : " + Version); } Debug.Assert(ret >= 0); return ret; } } public bool HasCondemnReasons1 { get { return (Version == 2 || Version >= 3); } } public gc_heap_compact_reason CompactMechanisms { get { int ret = 0; if (Version == 0) { ret = GetInt32At(SizeOfGenData * maxGenData + sizeof(int) * 2); } else if (Version == 2) { ret = GetInt32At(SizeOfGenData * maxGenData + sizeof(int) * 4); } else if (Version >= 3) { ret = GetInt32At(HostOffset(38, 6)); } else { Debug.Assert(false, "CompactMechanisms invalid Version : " + Version); } Debug.Assert(ret <= 0); if (ret == 0) { return gc_heap_compact_reason.not_specified; } int index = IndexOfSetBit(ret); if (index >= 0 && index < (int)gc_heap_compact_reason.max_compact_reasons_count) { return (gc_heap_compact_reason)index; } Debug.Assert(false, index + " >= 0 && " + index + " < " + (int)gc_heap_compact_reason.max_compact_reasons_count); return gc_heap_compact_reason.not_specified; } } public gc_heap_expand_mechanism ExpandMechanisms { get { int ret = 0; if (Version == 0) { ret = GetInt32At(SizeOfGenData * maxGenData + sizeof(int) * 1); } else if (Version == 2) { ret = GetInt32At(SizeOfGenData * maxGenData + sizeof(int) * 3); } else if (Version >= 3) { ret = GetInt32At(HostOffset(42, 6)); } else { Debug.Assert(false, "ExpandMechanisms invalid Version : " + Version); } Debug.Assert(ret <= 0); if (ret == 0) { return gc_heap_expand_mechanism.not_specified; } int index = IndexOfSetBit(ret); if (index >= 0 && index < (int)gc_heap_expand_mechanism.max_expand_mechanisms_count) { return (gc_heap_expand_mechanism)index; } Debug.Assert(false, index + " >= 0 && " + index + " < " + (int)gc_heap_expand_mechanism.max_expand_mechanisms_count); return gc_heap_expand_mechanism.not_specified; } } public gc_concurrent_compact_reason ConcurrentCompactMechanisms { get { int ret = 0; if (Version == 0 && MinorVersion == 2) { ret = GetInt32At(SizeOfGenData * maxGenData + sizeof(int) * 3); } else { Debug.Assert(false, "ConcurrentCompactMechanisms invalid Version : " + Version + " " + MinorVersion); } Debug.Assert(ret <= 0); if (ret == 0) { return gc_concurrent_compact_reason.not_specified; } int index = IndexOfSetBit(ret); if (index >= 0 && index < (int)gc_concurrent_compact_reason.max_concurrent_compat_reason) { return (gc_concurrent_compact_reason)index; } Debug.Assert(false, index + " >= 0 && " + index + " < " + (int)gc_concurrent_compact_reason.max_concurrent_compat_reason); return gc_concurrent_compact_reason.not_specified; } } public bool HasConcurrentCompactMechanisms { get { return Version == 0 && MinorVersion == 2; } } public int HeapIndex { get { int ret = int.MinValue; if (Version == 0) { ret = GetInt32At(EventDataLength - (sizeof(int) + sizeof(byte))); } else if (Version == 2 && (MinorVersion == 0 || MinorVersion == 1)) { ret = GetInt32At(EventDataLength - (sizeof(int) + sizeof(Int16))); } else if (Version == 2 && MinorVersion == 2) { ret = GetInt32At(EventDataLength - (sizeof(int) + sizeof(Int16) + sizeof(Int64))); } else if (Version >= 3) { ret = GetInt32At(HostOffset(46, 6)); } else { Debug.Assert(false, "HeapIndex invalid Version : " + Version + " " + MinorVersion); } Debug.Assert(ret >= 0); if (Version >= 0 && Version < 3) { Debug.Assert(ret < maxGenData); } else if (Version >= 3) { Debug.Assert(ret < Environment.ProcessorCount); // This is really GCGlobalHeapHistoryTraceData.NumHeaps, but we don't have access to that here // It is VERY unlikely that we make more heaps than there are processors. } if (ret < 0) { return 0; // on retail avoid array out of range exceptions } else { return ret; } } } public long ExtraGen0Commit { get { long ret = -1; if (Version == 2 && MinorVersion == 2) { ret = GetInt32At(EventDataLength - (sizeof(Int16) + sizeof(Int64))); } else if (Version >= 3) { ret = (long)GetAddressAt(HostOffset(50, 6)); } else { Debug.Assert(false, "ExtraGen0Commit invalid Version : " + Version + " " + MinorVersion); } Debug.Assert(ret >= 0); return ret; } } public bool HasExtraGen0Commit { get { return (Version == 2 && MinorVersion == 2) || Version >= 3; } } public int Count { get { int ret = int.MinValue; if (Version >= 3) { ret = GetInt32At(HostOffset(54, 7)); } else { Debug.Assert(false, "Count invalid Version : " + Version); } Debug.Assert(ret >= 0); if (ret < 0) { return 0; // on retail avoid array out of range exceptions } else { return ret; } } } public bool HasCount { get { return Version >= 3; } } public int MemoryPressure { get { int ret = int.MinValue; if (Version == 0) { ret = GetInt32At(SizeOfGenData * maxGenData); } else if (Version == 2) { ret = GetInt32At(SizeOfGenData * maxGenData + sizeof(Int32) * 2); } else { Debug.Assert(false, "MemoryPressure invalid Version : " + Version); } Debug.Assert(ret >= 0); return ret; } } public bool HasMemoryPressure { get { return Version == 0 || Version == 2; } } /// <summary> /// genNumber is a number from 0 to maxGenData-1. These are for generation 0, 1, 2, 3 = Large Object Heap /// genNumber = 4 is that second pass for Gen 0. /// </summary> public GCPerHeapHistoryGenData GenData(Gens genNumber) { if (Version == 0 || Version == 2) { Debug.Assert((int)genNumber < maxGenData); // each GenData structure contains 10 pointers sized integers return new GCPerHeapHistoryGenData(Version, GetIntPtrArray(SizeOfGenData * (int)genNumber, EntriesInGenData)); } else if (Version >= 3) { Debug.Assert((int)genNumber < Count); return new GCPerHeapHistoryGenData(Version, GetIntPtrArray((HostOffset(54, 7) + sizeof(Int32)) + SizeOfGenData * (int)genNumber, EntriesInGenData)); } else { Debug.Assert(false, "GenData invalid Version : " + Version); return new GCPerHeapHistoryGenData(Version, GetIntPtrArray(SizeOfGenData * (int)genNumber, EntriesInGenData)); } } public bool VersionRecognized { get { int ver; return ParseMinorVersion(out ver); } } #region Private public int MinorVersion { get { if (m_minorVersion == -1) { ParseMinorVersion(out m_minorVersion); } return m_minorVersion; } } private int m_minorVersion = -1; private bool ParseMinorVersion(out int mversion) { mversion = -1; int size = 0; bool exactMatch = false; if (Version == 0) { size = (SizeOfGenData * 5) + 25; // For silverlight, there is one less mechanism. It only affects the layout of gen_condemended_reasons. if (base.EventDataLength == (size - sizeof(int))) { mversion = 1; // Silverlight } else if (base.EventDataLength == size) { mversion = 2; // .NET 4.0 } if (mversion > 0) { exactMatch = true; } else { mversion = 0; } } else if (Version == 2) { size = (SizeOfGenData * 5) + sizeof(Int32) * 6 + sizeof(byte) + sizeof(Int64); if (base.EventDataLength == (size - sizeof(Int64))) { mversion = 1; // .NET 4.5 } else if (base.EventDataLength == size) { mversion = 2; // .NET 4.5.2 } if (mversion > 0) { exactMatch = true; } else { mversion = 0; } } else if (Version >= 3) { size = sizeof(Int16) + HostSizePtr(7) + sizeof(Int32) * 7 + SizeOfGenData * 4; // set this check up to enable future versions that "add to the end" if (base.EventDataLength >= size) { mversion = 0; // .NET 4.6+ } if (mversion >= 0) { exactMatch = true; } else { mversion = 0; } } Debug.Assert(exactMatch, "Unrecognized version (" + Version + ") and stream size (" + base.EventDataLength + ") not equal to expected (" + size + ")"); return exactMatch; } private int IndexOfSetBit(int pow2) { int index = 0; while ((pow2 & 1) != 1 && pow2 > 0) { pow2 >>= 1; index++; } return index; } private long[] GetIntPtrArray(int offset, int count) { long[] arr = new long[count]; for (int i = 0; i < count; i++) { arr[i] = GetIntPtrAt(offset); offset += base.HostSizePtr(1); } return arr; } private const int maxGenData = (int)Gens.Gen0After + 1; internal GCPerHeapHistoryTraceData(Delegate action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { ((Action<GCPerHeapHistoryTraceData>)Action)(this); } protected internal override Delegate Target { get { return Action; } set { Action = value; } } protected internal override void Validate() { Debug.Assert(VersionRecognized); } public int EntriesInGenData { get { return 10; } } public int SizeOfGenData { get { return base.HostSizePtr(EntriesInGenData); } } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); if (HasFreeListAllocated) { XmlAttrib(sb, "FreeListAllocated", FreeListAllocated); } if (HasFreeListRejected) { XmlAttrib(sb, "FreeListRejected", FreeListRejected); } if (HasEndOfSegAllocated) { XmlAttrib(sb, "EndOfSegAllocated", EndOfSegAllocated); } if (HasCondemnedAllocated) { XmlAttrib(sb, "CondemnedAllocated", CondemnedAllocated); } if (HasPinnedAllocated) { XmlAttrib(sb, "PinnedAllocated", PinnedAllocated); } if (HasPinnedAllocatedAdvance) { XmlAttrib(sb, "PinnedAllocatedAdvance", PinnedAllocatedAdvance); } if (HasRunningFreeListEfficiency) { XmlAttrib(sb, "RunningFreeListEfficiency", RunningFreeListEfficiency); } XmlAttrib(sb, "CondemnReasons0", CondemnReasons0); if (HasCondemnReasons1) { XmlAttrib(sb, "CondemnReasons1", CondemnReasons1); } XmlAttrib(sb, "CompactMechanisms", CompactMechanisms); XmlAttrib(sb, "ExpandMechanisms", ExpandMechanisms); if (HasConcurrentCompactMechanisms) { XmlAttrib(sb, "ConcurrentCompactMechanisms", ConcurrentCompactMechanisms); } XmlAttrib(sb, "HeapIndex", HeapIndex); if (HasExtraGen0Commit) { XmlAttrib(sb, "ExtraGen0Commit", ExtraGen0Commit); } if (HasCount) { XmlAttrib(sb, "Count", Count); } if (HasMemoryPressure) { XmlAttrib(sb, "MemoryPressure", MemoryPressure); } sb.Append("/>"); // @TODO the upper bound is not right for >= 3 for (var gens = Gens.Gen0; gens <= Gens.GenLargeObj; gens++) { GenData(gens).ToXml(gens, sb).AppendLine(); } sb.AppendLine("</Event>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] {"ClrInstanceID", "FreeListAllocated", "FreeListRejected", "EndOfSegAllocated", "CondemnedAllocated" , "PinnedAllocated", "PinnedAllocatedAdvance", "RunningFreeListEfficiency", "CondemnReasons0", "CondemnReasons1", "CompactMechanisms", "ExpandMechanisms" , "ConcurrentCompactMechanisms", "HeapIndex", "ExtraGen0Commit", "Count", "MemoryPressure" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ClrInstanceID; case 1: if (HasFreeListAllocated) { return FreeListAllocated; } return null; case 2: if (HasFreeListRejected) { return FreeListRejected; } return null; case 3: if (HasEndOfSegAllocated) { return EndOfSegAllocated; } return null; case 4: if (HasCondemnedAllocated) { return CondemnedAllocated; } else { return null; } case 5: if (HasPinnedAllocated) { return PinnedAllocated; } else { return null; } case 6: if (HasPinnedAllocatedAdvance) { return PinnedAllocatedAdvance; } else { return null; } case 7: if (HasRunningFreeListEfficiency) { return RunningFreeListEfficiency; } else { return null; } case 8: return CondemnReasons0; case 9: if (HasCondemnReasons1) { return CondemnReasons1; } else { return null; } case 10: return CompactMechanisms; case 11: return ExpandMechanisms; case 12: if (HasConcurrentCompactMechanisms) { return ConcurrentCompactMechanisms; } else { return null; } case 13: return HeapIndex; case 14: if (HasExtraGen0Commit) { return ExtraGen0Commit; } else { return null; } case 15: if (HasCount) { return Count; } else { return null; } case 16: if (HasMemoryPressure) { return MemoryPressure; } else { return null; } default: Debug.Assert(false, "Bad field index"); return null; } } private Delegate Action; #endregion } public enum GCExpandMechanism : uint { None = 0, ReuseNormal = 0x80000000, ReuseBestFit = 0x80000001, NewSegEphemeralPromotion = 0x80000002, NewSeg = 0x80000003, NoMemory = 0x80000004, }; /// <summary> /// Version 0: Silverlight (x86), .NET 4.0 /// [5] WKS::gc_generation_data /// +0x000 size_before : Uint4B/8B /// +0x004 size_after : Uint4B/8B /// +0x008 current_size : Uint4B/8B /// +0x00c previous_size : Uint4B/8B /// +0x010 fragmentation : Uint4B/8B /// +0x014 in : Uint4B/8B /// +0x018 out : Uint4B/8B /// +0x01c new_allocation : Uint4B/8B /// +0x020 surv : Uint4B/8B /// +0x024 growth : Uint4B/8B /// /// Version 1: ??? /// /// Version 2, PreciseVersion 2.1: .NET 4.5 (x86), .NET 4.5.2 (x86) /// [5] WKS::gc_generation_data /// +0x000 size_before : Uint4B/8B /// +0x004 free_list_space_before : Uint4B/8B /// +0x008 free_obj_space_before : Uint4B/8B /// +0x00c size_after : Uint4B/8B /// +0x010 free_list_space_after : Uint4B/8B /// +0x014 free_obj_space_after : Uint4B/8B /// +0x018 in : Uint4B/8B /// +0x01c out : Uint4B/8B /// +0x020 new_allocation : Uint4B/8B /// +0x024 surv : Uint4B/8B /// /// Version 3: .NET 4.6 (x86) /// [4] WKS::gc_generation_data /// +0x000 size_before : Uint4B/8B /// +0x004 free_list_space_before : Uint4B/8B /// +0x008 free_obj_space_before : Uint4B/8B /// +0x00c size_after : Uint4B/8B /// +0x010 free_list_space_after : Uint4B/8B /// +0x014 free_obj_space_after : Uint4B/8B /// +0x018 in : Uint4B/8B /// +0x01c pinned_surv : Uint4B/8B /// +0x020 npinned_surv : Uint4B/8B /// +0x024 new_allocation : Uint4B/8B /// </summary> public sealed class GCPerHeapHistoryGenData { /// <summary> /// Size of the generation before the GC, includes fragmentation /// </summary> public long SizeBefore { get { long ret = m_genDataArray[0]; Debug.Assert(ret >= 0); return ret; } } /// <summary> /// Size of the generation after GC. Includes fragmentation /// </summary> public long SizeAfter { get { long ret = long.MinValue; if (m_version == 0) { ret = m_genDataArray[1]; } else if (m_version >= 2) { ret = m_genDataArray[3]; } else { Debug.Assert(false, "SizeAfter invalid version : " + m_version); } Debug.Assert(ret >= 0); return ret; } } /// <summary> /// Size occupied by objects at the beginning of the GC, discounting fragmentation. /// Only exits on 4.5 RC and beyond. /// </summary> public long ObjSpaceBefore { get { long ret = long.MinValue; if (m_version >= 2) { ret = (SizeBefore - FreeListSpaceBefore - FreeObjSpaceBefore); } else { Debug.Assert(false, "ObjSpaceBefore invalid version : " + m_version); } Debug.Assert(ret >= 0); return ret; } } public bool HasObjSpaceBefore { get { return m_version >= 2; } } /// <summary> /// This is the fragmenation at the end of the GC. /// </summary> public long Fragmentation { get { long ret = long.MinValue; if (m_version == 0) { ret = m_genDataArray[4]; } else if (m_version >= 2) { ret = (FreeListSpaceAfter + FreeObjSpaceAfter); } else { Debug.Assert(false, "Fragmentation invalid version : " + m_version); } Debug.Assert(ret >= 0); return ret; } } /// <summary> /// Size occupied by objects, discounting fragmentation. /// </summary> public long ObjSizeAfter { get { long ret = SizeAfter - Fragmentation; Debug.Assert(ret >= 0); return ret; } } /// <summary> /// This is the free list space (ie, what's threaded onto the free list) at the beginning of the GC. /// Only exits on 4.5 RC and beyond. /// </summary> public long FreeListSpaceBefore { get { long ret = long.MinValue; if (m_version >= 2) { ret = m_genDataArray[1]; } else { Debug.Assert(false, "FreeListSpaceBefore invalid version : " + m_version); } Debug.Assert(ret >= 0); return ret; } } public bool HasFreeListSpaceBefore { get { return m_version >= 2; } } /// <summary> /// This is the free obj space (ie, what's free but not threaded onto the free list) at the beginning of the GC. /// Only exits on 4.5 RC and beyond. /// </summary> public long FreeObjSpaceBefore { get { long ret = long.MinValue; if (m_version >= 2) { ret = m_genDataArray[2]; } else { Debug.Assert(false, "FreeObjSpaceBefore invalid version : " + m_version); } Debug.Assert(ret >= 0); return ret; } } public bool HasFreeObjSpaceBefore { get { return m_version >= 2; } } /// <summary> /// This is the free list space (ie, what's threaded onto the free list) at the end of the GC. /// Only exits on 4.5 Beta and beyond. /// </summary> public long FreeListSpaceAfter { get { long ret = long.MinValue; if (m_version >= 2) { ret = m_genDataArray[4]; } else { Debug.Assert(false, "FreeListSpaceAfter invalid version : " + m_version); } Debug.Assert(ret >= 0); return ret; } } public bool HasFreeListSpaceAfter { get { return m_version >= 2; } } /// <summary> /// This is the free obj space (ie, what's free but not threaded onto the free list) at the end of the GC. /// Only exits on 4.5 Beta and beyond. /// </summary> public long FreeObjSpaceAfter { get { long ret = long.MinValue; if (m_version >= 2) { ret = m_genDataArray[5]; } else { Debug.Assert(false, "FreeObjSpaceAfter invalid version : " + m_version); } Debug.Assert(ret >= 0); return ret; } } public bool HasFreeObjSpaceAfter { get { return m_version >= 2; } } /// <summary> /// This is the amount that came into this generation on this GC /// </summary> public long In { get { long ret = long.MinValue; if (m_version == 0) { ret = m_genDataArray[5]; } else if (m_version >= 2) { ret = m_genDataArray[6]; } else { Debug.Assert(false, "In invalid version : " + m_version); } Debug.Assert(ret >= 0); return ret; } } /// <summary> /// This is the number of bytes survived in this generation. /// </summary> public long Out { get { long ret = long.MinValue; if (m_version == 0) { ret = m_genDataArray[6]; } else if (m_version == 2) { ret = m_genDataArray[7]; } else if (m_version >= 3) { ret = (PinnedSurv + NonePinnedSurv); } else { Debug.Assert(false, "Out invalid version : " + m_version); } Debug.Assert(ret >= 0); return ret; } } /// <summary> /// This is the new budget for the generation /// </summary> public long Budget { get { long ret = long.MinValue; if (m_version == 0) { ret = m_genDataArray[7]; } else if (m_version == 2) { ret = m_genDataArray[8]; } else if (m_version >= 3) { ret = m_genDataArray[9]; } else { Debug.Assert(false, "Budget invalid version : " + m_version); } Debug.Assert(ret >= 0); return ret; } } /// <summary> /// This is the survival rate /// </summary> public long SurvRate { get { long ret = long.MinValue; if (m_version == 0) { ret = m_genDataArray[8]; } else if (m_version == 2) { ret = m_genDataArray[9]; } else if (m_version >= 3) { if (ObjSpaceBefore == 0) { ret = 0; } else { ret = (long)((double)Out * 100.0 / (double)ObjSpaceBefore); } } else { Debug.Assert(false, "SurvRate invalid version : " + m_version); } Debug.Assert(ret >= 0); return ret; } } public long PinnedSurv { get { long ret = long.MinValue; if (m_version >= 3) { ret = m_genDataArray[7]; } else { Debug.Assert(false, "PinnedSurv invalid version : " + m_version); } Debug.Assert(ret >= 0); return ret; } } public bool HasPinnedSurv { get { return (m_version >= 3); } } public long NonePinnedSurv { get { long ret = long.MinValue; if (m_version >= 3) { ret = m_genDataArray[8]; } else { Debug.Assert(false, "NonePinnedSurv invalid version : " + m_version); } Debug.Assert(ret >= 0); return ret; } } public bool HasNonePinnedSurv { get { return (m_version >= 3); } } public StringBuilder ToXml(Gens genName, StringBuilder sb) { sb.Append(" <GenData"); TraceEvent.XmlAttrib(sb, "Name", genName); TraceEvent.XmlAttrib(sb, "SizeBefore", SizeBefore); TraceEvent.XmlAttrib(sb, "SizeAfter", SizeAfter); if (HasObjSpaceBefore) { TraceEvent.XmlAttrib(sb, "ObjSpaceBefore", ObjSpaceBefore); } TraceEvent.XmlAttrib(sb, "Fragmentation", Fragmentation); TraceEvent.XmlAttrib(sb, "ObjSizeAfter", ObjSizeAfter); if (HasFreeListSpaceBefore) { TraceEvent.XmlAttrib(sb, "FreeListSpaceBefore", FreeListSpaceBefore); } if (HasFreeObjSpaceBefore) { TraceEvent.XmlAttrib(sb, "FreeObjSpaceBefore", FreeObjSpaceBefore); } if (HasFreeListSpaceAfter) { TraceEvent.XmlAttrib(sb, "FreeListSpaceAfter", FreeListSpaceAfter); } if (HasFreeObjSpaceAfter) { TraceEvent.XmlAttrib(sb, "FreeObjSpaceAfter", FreeObjSpaceAfter); } TraceEvent.XmlAttrib(sb, "In", In); TraceEvent.XmlAttrib(sb, "Out", Out); TraceEvent.XmlAttrib(sb, "NewAllocation", Budget); // not sure why this is not called Budget TraceEvent.XmlAttrib(sb, "SurvRate", SurvRate); if (HasPinnedSurv) { TraceEvent.XmlAttrib(sb, "PinnedSurv", PinnedSurv); } if (HasNonePinnedSurv) { TraceEvent.XmlAttrib(sb, "NonePinnedSurv", NonePinnedSurv); } sb.Append("/>"); return sb; } public override string ToString() { return ToXml(Gens.Gen0, new StringBuilder()).ToString(); } #region private internal GCPerHeapHistoryGenData(int version, long[] genDataArray) { m_version = version; m_genDataArray = genDataArray; } private int m_version; private long[] m_genDataArray; #endregion } /// <summary> /// Version 0: ??? /// /// Version 1: Silverlight (x86), .NET 4.0, .NET 4.5, .NET 4.5.2 /// VM\gc.cpp /// 0:041> dt -r3 WKS::gc_history_global /// coreclr!WKS::gc_history_global /// +0x000 final_youngest_desired : Uint4B/8B /// +0x004 num_heaps : Uint4B /// +0x008 condemned_generation : Int4B /// +0x00c gen0_reduction_count : Int4B /// +0x010 reason : /// reason_alloc_soh = 0n0 /// reason_induced = 0n1 /// reason_lowmemory = 0n2 /// reason_empty = 0n3 /// reason_alloc_loh = 0n4 /// reason_oos_soh = 0n5 /// reason_oos_loh = 0n6 /// reason_induced_noforce = 0n7 /// reason_gcstress = 0n8 /// reason_max = 0n9 /// +0x014 global_mechanims_p : Uint4B /// /// FireEtwGCGlobalHeapHistory_V1(gc_data_global.final_youngest_desired, // upcast on 32bit to __int64 /// gc_data_global.num_heaps, /// gc_data_global.condemned_generation, /// gc_data_global.gen0_reduction_count, /// gc_data_global.reason, /// gc_data_global.global_mechanims_p, /// GetClrInstanceId()); /// Version 2: .NET 4.6 /// clr!WKS::gc_history_global /// +0x000 final_youngest_desired : Uint4B/8B /// +0x004 num_heaps : Uint4B /// +0x008 condemned_generation : Int4B /// +0x00c gen0_reduction_count : Int4B /// +0x010 reason : /// reason_alloc_soh = 0n0 /// reason_induced = 0n1 /// reason_lowmemory = 0n2 /// reason_empty = 0n3 /// reason_alloc_loh = 0n4 /// reason_oos_soh = 0n5 /// reason_oos_loh = 0n6 /// reason_induced_noforce = 0n7 /// reason_gcstress = 0n8 /// reason_lowmemory_blocking = 0n9 /// reason_induced_compacting = 0n10 /// reason_lowmemory_host = 0n11 /// reason_max = 0n12 /// +0x014 pause_mode : Int4B /// +0x018 mem_pressure : Uint4B /// +0x01c global_mechanims_p : Uint4B /// /// FireEtwGCGlobalHeapHistory_V2(gc_data_global.final_youngest_desired, // upcast on 32bit to __int64 /// gc_data_global.num_heaps, /// gc_data_global.condemned_generation, /// gc_data_global.gen0_reduction_count, /// gc_data_global.reason, /// gc_data_global.global_mechanims_p, /// GetClrInstanceId()); /// gc_data_global.pause_mode, /// gc_data_global.mem_pressure); /// /// </summary> public sealed class GCGlobalHeapHistoryTraceData : TraceEvent { public long FinalYoungestDesired { get { return GetInt64At(0); } } public int NumHeaps { get { return GetInt32At(8); } } public int CondemnedGeneration { get { return GetInt32At(12); } } public int Gen0ReductionCount { get { return GetInt32At(16); } } public GCReason Reason { get { return (GCReason)GetInt32At(20); } } public GCGlobalMechanisms GlobalMechanisms { get { return (GCGlobalMechanisms)GetInt32At(24); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(28); } return 0; } } public bool HasClrInstanceID { get { return Version >= 1; } } public int PauseMode { get { if (Version >= 2) { return GetInt32At(30); } return 0; } } public bool HasPauseMode { get { return (Version >= 2); } } public int MemoryPressure { get { if (Version >= 2) { return GetInt32At(34); } return 0; } } public bool HasMemoryPressure { get { return (Version >= 2); } } #region Private internal GCGlobalHeapHistoryTraceData(Action<GCGlobalHeapHistoryTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCGlobalHeapHistoryTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 28)); Debug.Assert(!(Version == 1 && EventDataLength != 30)); Debug.Assert(!(Version == 2 && EventDataLength != 38)); Debug.Assert(!(Version > 2 && EventDataLength < 38)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "FinalYoungestDesired", FinalYoungestDesired); XmlAttrib(sb, "NumHeaps", NumHeaps); XmlAttrib(sb, "CondemnedGeneration", CondemnedGeneration); XmlAttrib(sb, "Gen0ReductionCount", Gen0ReductionCount); XmlAttrib(sb, "Reason", Reason); XmlAttrib(sb, "GlobalMechanisms", GlobalMechanisms); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "FinalYoungestDesired", "NumHeaps", "CondemnedGeneration", "Gen0ReductionCount", "Reason", "GlobalMechanisms", "ClrInstanceID", "PauseMode", "MemoryPressure" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return FinalYoungestDesired; case 1: return NumHeaps; case 2: return CondemnedGeneration; case 3: return Gen0ReductionCount; case 4: return Reason; case 5: return GlobalMechanisms; case 6: if (HasClrInstanceID) { return ClrInstanceID; } else { return null; } case 7: if (HasPauseMode) { return PauseMode; } else { return null; } case 8: if (HasMemoryPressure) { return MemoryPressure; } else { return null; } default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCGlobalHeapHistoryTraceData> Action; #endregion } public enum GcJoinType : int { LastJoin = 0, Join = 1, Restart = 2, FirstJoin = 3 } public enum GcJoinTime : int { Start = 0, End = 1 } public enum GcJoinID : int { Restart = -1, Invalid = ~(int)0xff } public sealed class GCJoinTraceData : TraceEvent { public int Heap { get { return GetInt32At(0); } } public GcJoinTime JoinTime { get { return (GcJoinTime)GetInt32At(4); } } public GcJoinType JoinType { get { return (GcJoinType)GetInt32At(8); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(12); } return 0; } } public int GCID { get { if (Version >= 2) { return GetInt32At(14); } return (int)(GcJoinID.Invalid); } } #region Private internal GCJoinTraceData(Action<GCJoinTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCJoinTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 12)); Debug.Assert(!(Version == 1 && EventDataLength != 14)); Debug.Assert(!(Version > 1 && EventDataLength < 14)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Heap", Heap); XmlAttrib(sb, "JoinTime", JoinTime); XmlAttrib(sb, "JoinType", JoinType); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); XmlAttrib(sb, "ID", GCID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Heap", "JoinTime", "JoinType", "ClrInstanceID", "ID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Heap; case 1: return JoinTime; case 2: return JoinType; case 3: return ClrInstanceID; case 4: return GCID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCJoinTraceData> Action; #endregion } public sealed class FinalizeObjectTraceData : TraceEvent { public Address TypeID { get { return GetAddressAt(0); } } public Address ObjectID { get { return GetAddressAt(HostOffset(4, 1)); } } public int ClrInstanceID { get { return GetInt16At(HostOffset(8, 2)); } } /// <summary> /// Gets the full type name including generic parameters in runtime syntax /// For example System.WeakReference`1[System.Diagnostics.Tracing.EtwSession] /// </summary> public string TypeName { get { return state.TypeIDToName(ProcessID, TypeID, TimeStampQPC); } } #region Private internal FinalizeObjectTraceData(Action<FinalizeObjectTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName, ClrTraceEventParserState state) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; this.state = state; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<FinalizeObjectTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != HostOffset(10, 2))); Debug.Assert(!(Version > 0 && EventDataLength < HostOffset(10, 2))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "TypeName", TypeName); XmlAttribHex(sb, "ObjectID", ObjectID); XmlAttribHex(sb, "TypeID", TypeID); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "TypeName", "ObjectID", "TypeID", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return TypeName; case 1: return ObjectID; case 2: return TypeID; case 3: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<FinalizeObjectTraceData> Action; protected internal override void SetState(object newState) { state = (ClrTraceEventParserState)newState; } private ClrTraceEventParserState state; #endregion } public sealed class SetGCHandleTraceData : TraceEvent { public Address HandleID { get { return GetAddressAt(0); } } public Address ObjectID { get { return GetAddressAt(HostOffset(4, 1)); } } public GCHandleKind Kind { get { return (GCHandleKind)GetInt32At(HostOffset(8, 2)); } } public int Generation { get { return GetInt32At(HostOffset(12, 2)); } } public long AppDomainID { get { return GetInt64At(HostOffset(16, 2)); } } public int ClrInstanceID { get { return GetInt16At(HostOffset(24, 2)); } } #region Private internal SetGCHandleTraceData(Action<SetGCHandleTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<SetGCHandleTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != HostOffset(26, 2))); Debug.Assert(!(Version > 0 && EventDataLength < HostOffset(26, 2))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "HandleID", HandleID); XmlAttribHex(sb, "ObjectID", ObjectID); XmlAttrib(sb, "Kind", Kind); XmlAttrib(sb, "Generation", Generation); XmlAttribHex(sb, "AppDomainID", AppDomainID); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "HandleID", "ObjectID", "Kind", "Generation", "AppDomainID", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return HandleID; case 1: return ObjectID; case 2: return Kind; case 3: return Generation; case 4: return AppDomainID; case 5: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<SetGCHandleTraceData> Action; #endregion } public sealed class DestroyGCHandleTraceData : TraceEvent { public Address HandleID { get { return GetAddressAt(0); } } public int ClrInstanceID { get { return GetInt16At(HostOffset(4, 1)); } } #region Private internal DestroyGCHandleTraceData(Action<DestroyGCHandleTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<DestroyGCHandleTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != HostOffset(6, 1))); Debug.Assert(!(Version > 0 && EventDataLength < HostOffset(6, 1))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "HandleID", HandleID); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "HandleID", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return HandleID; case 1: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<DestroyGCHandleTraceData> Action; #endregion } public sealed class PinObjectAtGCTimeTraceData : TraceEvent { public Address HandleID { get { return GetAddressAt(0); } } public Address ObjectID { get { return GetAddressAt(HostOffset(4, 1)); } } public long ObjectSize { get { return GetInt64At(HostOffset(8, 2)); } } // TODO you can remove the length test after 2104. It was an old internal case public string TypeName { get { if (HostOffset(16, 2) < EventDataLength) { return GetUnicodeStringAt(HostOffset(16, 2)); } return ""; } } public int ClrInstanceID { get { return GetInt16At(SkipUnicodeString(HostOffset(16, 2))); } } #region Private internal PinObjectAtGCTimeTraceData(Action<PinObjectAtGCTimeTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<PinObjectAtGCTimeTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(HostOffset(16, 2)) + 2)); Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(HostOffset(16, 2)) + 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "HandleID", HandleID); XmlAttribHex(sb, "ObjectID", ObjectID); XmlAttrib(sb, "ObjectSize", ObjectSize); XmlAttrib(sb, "TypeName", TypeName); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "HandleID", "ObjectID", "ObjectSize", "TypeName", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return HandleID; case 1: return ObjectID; case 2: return ObjectSize; case 3: return TypeName; case 4: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<PinObjectAtGCTimeTraceData> Action; #endregion } public sealed class PinPlugAtGCTimeTraceData : TraceEvent { public Address PlugStart { get { return GetAddressAt(0); } } public Address PlugEnd { get { return GetAddressAt(HostOffset(4, 1)); } } public Address GapBeforeSize { get { return GetAddressAt(HostOffset(8, 2)); } } public int ClrInstanceID { get { return GetInt16At(HostOffset(12, 3)); } } #region Private internal PinPlugAtGCTimeTraceData(Action<PinPlugAtGCTimeTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<PinPlugAtGCTimeTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != HostOffset(14, 3))); Debug.Assert(!(Version > 0 && EventDataLength < HostOffset(14, 3))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "PlugStart", PlugStart); XmlAttribHex(sb, "PlugEnd", PlugEnd); XmlAttribHex(sb, "GapBeforeSize", GapBeforeSize); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "PlugStart", "PlugEnd", "GapBeforeSize", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return PlugStart; case 1: return PlugEnd; case 2: return GapBeforeSize; case 3: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<PinPlugAtGCTimeTraceData> Action; #endregion } public sealed class GCTriggeredTraceData : TraceEvent { public GCReason Reason { get { return (GCReason)GetInt32At(0); } } public int ClrInstanceID { get { return GetInt16At(4); } } #region Private internal GCTriggeredTraceData(Action<GCTriggeredTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCTriggeredTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 6)); Debug.Assert(!(Version > 0 && EventDataLength < 6)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Reason", Reason); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Reason", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Reason; case 1: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCTriggeredTraceData> Action; #endregion } public sealed class GCBulkRootCCWTraceData : TraceEvent { public int Count { get { int len = EventDataLength; int ret = GetInt32At(0); // V4.5.1 uses this same event for somethings else. Ignore it by setting the count to 0. if (EventDataLength < ret * 40 + 6) { ret = 0; } return ret; } } public int ClrInstanceID { get { return GetInt16At(4); } } /// <summary> /// Returns the CCW at the given zero-based index (index less than Count). The returned GCBulkRootCCWValues /// points the the data in GCBulkRootCCWTraceData so it cannot live beyond that lifetime. /// </summary> public GCBulkRootCCWValues Values(int index) { return new GCBulkRootCCWValues(this, 6 + index * ValueSize); } #region Private internal GCBulkRootCCWTraceData(Action<GCBulkRootCCWTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCBulkRootCCWTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 0 + (Count * ValueSize) + 6 && Count != 0)); // The Count==0 fixes a old bad event using the same ID. Debug.Assert(!(Version > 0 && EventDataLength < (Count * ValueSize) + 6)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Count", Count); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.AppendLine(">"); for (int i = 0; i < Count; i++) { Values(i).ToXml(sb).AppendLine(); } sb.Append("</Event>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Count", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Count; case 1: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCBulkRootCCWTraceData> Action; /// <summary> /// Computes the size of one GCBulkRootCCWValues structure. /// TODO FIX NOW Can rip out and make a constant 44 after 6/2014 /// </summary> private int ValueSize { get { if (m_valueSize == 0) { m_valueSize = 44; // Project N rounds up on 64 bit It did go out for build in 4/2014 but soon we won't care. if (EventDataLength == (Count * 48) + 6) { Debug.Assert(PointerSize == 8); m_valueSize = 48; } } return m_valueSize; } } private int m_valueSize; #endregion } /// <summary> /// This structure just POINTS at the data in the GCBulkRootCCWTraceData. It can only be used as long as /// the GCBulkRootCCWTraceData is alive which (unless you cloned it) is only for the lifetime of the callback. /// </summary> public struct GCBulkRootCCWValues { public Address GCRootID { get { return m_data.GetAddressAt(m_baseOffset); } } public Address ObjectID { get { return m_data.GetAddressAt(m_baseOffset + 8); } } public Address TypeID { get { return m_data.GetAddressAt(m_baseOffset + 16); } } public Address IUnknown { get { return m_data.GetAddressAt(m_baseOffset + 24); } } public int RefCount { get { return m_data.GetInt32At(m_baseOffset + 32); } } public int PeggedRefCount { get { return m_data.GetInt32At(m_baseOffset + 36); } } public GCRootCCWFlags Flags { get { return (GCRootCCWFlags)m_data.GetInt32At(m_baseOffset + 40); } } public override string ToString() { StringBuilder sb = new StringBuilder(); return ToXml(sb).ToString(); } public StringBuilder ToXml(StringBuilder sb) { sb.Append(" <GCBulkRootCCWValue "); TraceEvent.XmlAttribHex(sb, "GCRootID", GCRootID); TraceEvent.XmlAttribHex(sb, "ObjectID", ObjectID); TraceEvent.XmlAttribHex(sb, "TypeID", TypeID); TraceEvent.XmlAttribHex(sb, "IUnknown", IUnknown).AppendLine().Append(" "); TraceEvent.XmlAttrib(sb, "RefCount", RefCount); TraceEvent.XmlAttrib(sb, "PeggedRefCount", PeggedRefCount); TraceEvent.XmlAttrib(sb, "Flags", Flags); sb.Append("/>"); return sb; } #region private internal GCBulkRootCCWValues(TraceEvent data, int baseOffset) { m_data = data; m_baseOffset = baseOffset; Debug.Assert(PeggedRefCount < 10000); Debug.Assert(RefCount < 10000); Debug.Assert((GCRootID & 0x0000000000000003L) == 0); Debug.Assert((ObjectID & 00000000000000003L) == 0); Debug.Assert((TypeID & 0x0000000000000003L) == 0); Debug.Assert((IUnknown & 0x0000000000000003L) == 0); } private TraceEvent m_data; private int m_baseOffset; #endregion } public sealed class GCBulkRCWTraceData : TraceEvent { public int Count { get { int len = EventDataLength; int ret = GetInt32At(0); // V4.5.1 uses this same event for somethings else. Ignore it by setting the count to 0. if (EventDataLength < ret * 40 + 6) { ret = 0; } return ret; } } public int ClrInstanceID { get { return GetInt16At(4); } } /// <summary> /// Returns the edge at the given zero-based index (index less than Count). The returned GCBulkRCWValues /// points the the data in GCBulkRCWTraceData so it cannot live beyond that lifetime. /// </summary> public GCBulkRCWValues Values(int index) { return new GCBulkRCWValues(this, 6 + index * 40); } #region Private internal GCBulkRCWTraceData(Action<GCBulkRCWTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCBulkRCWTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 0 + (Count * 40) + 6 && Count != 0)); // The Count==0 fixes a old bad event using the same ID. Debug.Assert(!(Version > 0 && EventDataLength < 0 + (Count * 40) + 6)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Count", Count); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.AppendLine(">"); for (int i = 0; i < Count; i++) { Values(i).ToXml(sb).AppendLine(); } sb.Append("</Event>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Count", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Count; case 1: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<GCBulkRCWTraceData> Action; #endregion } /// <summary> /// This structure just POINTS at the data in the GCBulkRCWTraceData. It can only be used as long as /// the GCBulkRCWTraceData is alive which (unless you cloned it) is only for the lifetime of the callback. /// </summary> public struct GCBulkRCWValues { public Address ObjectID { get { return m_data.GetAddressAt(m_baseOffset); } } public Address TypeID { get { return m_data.GetAddressAt(m_baseOffset + 8); } } public Address IUnknown { get { return m_data.GetAddressAt(m_baseOffset + 16); } } public Address VTable { get { return m_data.GetAddressAt(m_baseOffset + 24); } } public int RefCount { get { return m_data.GetInt32At(m_baseOffset + 32); } } public GCRootRCWFlags Flags { get { return (GCRootRCWFlags)m_data.GetInt32At(m_baseOffset + 36); } } public override string ToString() { StringBuilder sb = new StringBuilder(); return ToXml(sb).ToString(); } public StringBuilder ToXml(StringBuilder sb) { sb.Append(" <GCBulkRCWValue "); TraceEvent.XmlAttribHex(sb, "ObjectID", ObjectID); TraceEvent.XmlAttribHex(sb, "TypeID", TypeID); TraceEvent.XmlAttribHex(sb, "IUnknown", IUnknown); TraceEvent.XmlAttribHex(sb, "VTable", VTable).AppendLine().Append(" "); TraceEvent.XmlAttrib(sb, "RefCount", RefCount); TraceEvent.XmlAttrib(sb, "Flags", Flags); sb.Append("/>"); return sb; } #region private internal GCBulkRCWValues(TraceEvent data, int baseOffset) { m_data = data; m_baseOffset = baseOffset; Debug.Assert((ObjectID & 0x0000000000000003L) == 0); Debug.Assert((TypeID & 0x0000000000000003L) == 0); Debug.Assert((IUnknown & 0x0000000000000003L) == 0); Debug.Assert((VTable & 0xFF00000000000003L) == 0); Debug.Assert(RefCount < 10000); } private TraceEvent m_data; private int m_baseOffset; #endregion } public sealed class GCBulkRootStaticVarTraceData : TraceEvent { public int Count { get { return GetInt32At(0); } } public long AppDomainID { get { return GetInt64At(4); } } public int ClrInstanceID { get { return GetInt16At(12); } } /// <summary> /// Returns 'idx'th static root. /// The returned GCBulkRootStaticVarStatics cannot live beyond the TraceEvent that it comes from. /// The implementation is highly tuned for sequential access. /// </summary> public GCBulkRootStaticVarValues Values(int index) { return new GCBulkRootStaticVarValues(this, OffsetForIndexInValuesArray(index)); } #region Private internal GCBulkRootStaticVarTraceData(Action<GCBulkRootStaticVarTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { m_lastIdx = 0xFFFF; // Invalidate the cache Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<GCBulkRootStaticVarTraceData>)value; } } protected internal override void Validate() { m_lastIdx = 0xFFFF; // Invalidate the cache Debug.Assert(!(EventDataLength != OffsetForIndexInValuesArray(Count))); Debug.Assert(Count == 0 || (int)Values(Count - 1).Flags < 256); // This just makes the asserts in the BulkType kick in } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Count", Count); XmlAttrib(sb, "AppDomainID", AppDomainID); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.AppendLine(">"); for (int i = 0; i < Count; i++) { Values(i).ToXml(sb).AppendLine(); } sb.Append("</Event>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Count", "AppDomainID", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Count; case 1: return AppDomainID; case 2: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private int OffsetForIndexInValuesArray(int targetIdx) { Debug.Assert(targetIdx <= Count); int offset; int idx; if (m_lastIdx <= targetIdx) { idx = m_lastIdx; offset = m_lastOffset; } else { idx = 0; offset = 14; } while (idx < targetIdx) { offset = SkipUnicodeString(offset + 28); idx++; } Debug.Assert(offset <= EventDataLength); m_lastIdx = (ushort)targetIdx; m_lastOffset = (ushort)offset; Debug.Assert(m_lastIdx == targetIdx && m_lastOffset == offset); // No truncation return offset; } // These remember the last offset of the element in Statics to optimize a linear scan. private ushort m_lastIdx; private ushort m_lastOffset; private event Action<GCBulkRootStaticVarTraceData> Action; #endregion } /// <summary> /// This structure just POINTS at the data in the GCBulkRootStaticVarTraceData. It can only be used as long as /// the GCBulkRootStaticVarTraceData is alive which (unless you cloned it) is only for the lifetime of the callback. /// </summary> public struct GCBulkRootStaticVarValues { public Address GCRootID { get { return (Address)m_data.GetInt64At(m_baseOffset); } } public Address ObjectID { get { return (Address)m_data.GetInt64At(m_baseOffset + 8); } } public Address TypeID { get { return (Address)m_data.GetInt64At(m_baseOffset + 16); } } public GCRootStaticVarFlags Flags { get { return (GCRootStaticVarFlags)m_data.GetInt32At(m_baseOffset + 24); } } public string FieldName { get { return m_data.GetUnicodeStringAt(m_baseOffset + 28); } } public override string ToString() { StringBuilder sb = new StringBuilder(); return ToXml(sb).ToString(); } public StringBuilder ToXml(StringBuilder sb) { sb.Append(" <GCBulkRootStaticVarValue "); TraceEvent.XmlAttrib(sb, "FieldName", FieldName); TraceEvent.XmlAttribHex(sb, "GCRootID", GCRootID); TraceEvent.XmlAttribHex(sb, "ObjectID", ObjectID).AppendLine().Append(" "); TraceEvent.XmlAttribHex(sb, "TypeID", TypeID); TraceEvent.XmlAttrib(sb, "Flags", Flags); sb.Append("/>"); return sb; } #region private internal GCBulkRootStaticVarValues(TraceEvent data, int baseOffset) { m_data = data; m_baseOffset = baseOffset; Debug.Assert((GCRootID & 0xFF00000000000003L) == 0); Debug.Assert((ObjectID & 0xFF00000000000003L) == 0); Debug.Assert((TypeID & 0xFF00000000000001L) == 0); Debug.Assert(((int)Flags & 0xFFFFFFF0) == 0); // We don't use the upper bits presently so we can assert they are not used as a validity check. } private TraceEvent m_data; private int m_baseOffset; #endregion } public sealed class ClrWorkerThreadTraceData : TraceEvent { public int WorkerThreadCount { get { return GetInt32At(0); } } public int RetiredWorkerThreads { get { return GetInt32At(4); } } #region Private internal ClrWorkerThreadTraceData(Action<ClrWorkerThreadTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ClrWorkerThreadTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 8)); Debug.Assert(!(Version > 0 && EventDataLength < 8)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "WorkerThreadCount", WorkerThreadCount); XmlAttrib(sb, "RetiredWorkerThreads", RetiredWorkerThreads); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "WorkerThreadCount", "RetiredWorkerThreads" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return WorkerThreadCount; case 1: return RetiredWorkerThreads; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ClrWorkerThreadTraceData> Action; #endregion } public sealed class IOThreadTraceData : TraceEvent { public int IOThreadCount { get { return GetInt32At(0); } } public int RetiredIOThreads { get { return GetInt32At(4); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(8); } return 0; } } #region Private internal IOThreadTraceData(Action<IOThreadTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<IOThreadTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 8)); Debug.Assert(!(Version == 1 && EventDataLength != 10)); Debug.Assert(!(Version > 1 && EventDataLength < 10)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "IOThreadCount", IOThreadCount); XmlAttrib(sb, "RetiredIOThreads", RetiredIOThreads); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "IOThreadCount", "RetiredIOThreads", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return IOThreadCount; case 1: return RetiredIOThreads; case 2: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<IOThreadTraceData> Action; #endregion } public sealed class ClrThreadPoolSuspendTraceData : TraceEvent { public int ClrThreadID { get { return GetInt32At(0); } } public int CpuUtilization { get { return GetInt32At(4); } } #region Private internal ClrThreadPoolSuspendTraceData(Action<ClrThreadPoolSuspendTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ClrThreadPoolSuspendTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 8)); Debug.Assert(!(Version > 0 && EventDataLength < 8)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "ClrThreadID", ClrThreadID); XmlAttrib(sb, "CpuUtilization", CpuUtilization); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ClrThreadID", "CpuUtilization" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ClrThreadID; case 1: return CpuUtilization; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ClrThreadPoolSuspendTraceData> Action; #endregion } public sealed class ThreadPoolWorkerThreadTraceData : TraceEvent { public int ActiveWorkerThreadCount { get { return GetInt32At(0); } } public int RetiredWorkerThreadCount { get { return GetInt32At(4); } } public int ClrInstanceID { get { return GetInt16At(8); } } #region Private internal ThreadPoolWorkerThreadTraceData(Action<ThreadPoolWorkerThreadTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ThreadPoolWorkerThreadTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 10)); Debug.Assert(!(Version > 0 && EventDataLength < 10)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "ActiveWorkerThreadCount", ActiveWorkerThreadCount); XmlAttrib(sb, "RetiredWorkerThreadCount", RetiredWorkerThreadCount); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ActiveWorkerThreadCount", "RetiredWorkerThreadCount", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ActiveWorkerThreadCount; case 1: return RetiredWorkerThreadCount; case 2: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ThreadPoolWorkerThreadTraceData> Action; #endregion } public sealed class ThreadPoolWorkerThreadAdjustmentSampleTraceData : TraceEvent { public double Throughput { get { return GetDoubleAt(0); } } public int ClrInstanceID { get { return GetInt16At(8); } } #region Private internal ThreadPoolWorkerThreadAdjustmentSampleTraceData(Action<ThreadPoolWorkerThreadAdjustmentSampleTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ThreadPoolWorkerThreadAdjustmentSampleTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 10)); Debug.Assert(!(Version > 0 && EventDataLength < 10)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Throughput", Throughput); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Throughput", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Throughput; case 1: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ThreadPoolWorkerThreadAdjustmentSampleTraceData> Action; #endregion } public sealed class ThreadPoolWorkerThreadAdjustmentTraceData : TraceEvent { public double AverageThroughput { get { return GetDoubleAt(0); } } public int NewWorkerThreadCount { get { return GetInt32At(8); } } public ThreadAdjustmentReason Reason { get { return (ThreadAdjustmentReason)GetInt32At(12); } } public int ClrInstanceID { get { return GetInt16At(16); } } #region Private internal ThreadPoolWorkerThreadAdjustmentTraceData(Action<ThreadPoolWorkerThreadAdjustmentTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ThreadPoolWorkerThreadAdjustmentTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 18)); Debug.Assert(!(Version > 0 && EventDataLength < 18)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "AverageThroughput", AverageThroughput); XmlAttrib(sb, "NewWorkerThreadCount", NewWorkerThreadCount); XmlAttrib(sb, "Reason", Reason); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "AverageThroughput", "NewWorkerThreadCount", "Reason", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return AverageThroughput; case 1: return NewWorkerThreadCount; case 2: return Reason; case 3: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ThreadPoolWorkerThreadAdjustmentTraceData> Action; #endregion } public sealed class ThreadPoolWorkerThreadAdjustmentStatsTraceData : TraceEvent { public double Duration { get { return GetDoubleAt(0); } } public double Throughput { get { return GetDoubleAt(8); } } public double ThreadWave { get { return GetDoubleAt(16); } } public double ThroughputWave { get { return GetDoubleAt(24); } } public double ThroughputErrorEstimate { get { return GetDoubleAt(32); } } public double AverageThroughputErrorEstimate { get { return GetDoubleAt(40); } } public double ThroughputRatio { get { return GetDoubleAt(48); } } public double Confidence { get { return GetDoubleAt(56); } } public double NewControlSetting { get { return GetDoubleAt(64); } } public int NewThreadWaveMagnitude { get { return GetInt16At(72); } } public int ClrInstanceID { get { return GetInt16At(74); } } #region Private internal ThreadPoolWorkerThreadAdjustmentStatsTraceData(Action<ThreadPoolWorkerThreadAdjustmentStatsTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ThreadPoolWorkerThreadAdjustmentStatsTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 76)); Debug.Assert(!(Version > 0 && EventDataLength < 76)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Duration", Duration); XmlAttrib(sb, "Throughput", Throughput); XmlAttrib(sb, "ThreadWave", ThreadWave); XmlAttrib(sb, "ThroughputWave", ThroughputWave); XmlAttrib(sb, "ThroughputErrorEstimate", ThroughputErrorEstimate); XmlAttrib(sb, "AverageThroughputErrorEstimate", AverageThroughputErrorEstimate); XmlAttrib(sb, "ThroughputRatio", ThroughputRatio); XmlAttrib(sb, "Confidence", Confidence); XmlAttrib(sb, "NewControlSetting", NewControlSetting); XmlAttrib(sb, "NewThreadWaveMagnitude", NewThreadWaveMagnitude); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Duration", "Throughput", "ThreadWave", "ThroughputWave", "ThroughputErrorEstimate", "AverageThroughputErrorEstimate", "ThroughputRatio", "Confidence", "NewControlSetting", "NewThreadWaveMagnitude", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Duration; case 1: return Throughput; case 2: return ThreadWave; case 3: return ThroughputWave; case 4: return ThroughputErrorEstimate; case 5: return AverageThroughputErrorEstimate; case 6: return ThroughputRatio; case 7: return Confidence; case 8: return NewControlSetting; case 9: return NewThreadWaveMagnitude; case 10: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ThreadPoolWorkerThreadAdjustmentStatsTraceData> Action; #endregion } public sealed class ThreadPoolWorkingThreadCountTraceData : TraceEvent { public int Count { get { return GetInt32At(0); } } public int ClrInstanceID { get { return GetInt16At(4); } } #region Private internal ThreadPoolWorkingThreadCountTraceData(Action<ThreadPoolWorkingThreadCountTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ThreadPoolWorkingThreadCountTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 6)); Debug.Assert(!(Version > 0 && EventDataLength < 6)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "Count", Count); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Count", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Count; case 1: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ThreadPoolWorkingThreadCountTraceData> Action; #endregion } public sealed class ThreadPoolWorkTraceData : TraceEvent { public Address WorkID { get { return GetAddressAt(0); } } public int ClrInstanceID { get { return GetInt16At(HostOffset(4, 1)); } } #region Private internal ThreadPoolWorkTraceData(Action<ThreadPoolWorkTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ThreadPoolWorkTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != HostOffset(6, 1))); Debug.Assert(!(Version > 0 && EventDataLength < HostOffset(6, 1))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "WorkID", WorkID); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "WorkID", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return WorkID; case 1: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ThreadPoolWorkTraceData> Action; #endregion } public sealed class ThreadPoolIOWorkEnqueueTraceData : TraceEvent { public Address NativeOverlapped { get { return GetAddressAt(0); } } public Address Overlapped { get { return GetAddressAt(HostOffset(4, 1)); } } public bool MultiDequeues { get { return GetInt32At(HostOffset(8, 2)) != 0; } } public int ClrInstanceID { get { return GetInt16At(HostOffset(12, 2)); } } #region Private internal ThreadPoolIOWorkEnqueueTraceData(Action<ThreadPoolIOWorkEnqueueTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ThreadPoolIOWorkEnqueueTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != HostOffset(14, 2))); Debug.Assert(!(Version > 0 && EventDataLength < HostOffset(14, 2))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "NativeOverlapped", NativeOverlapped); XmlAttribHex(sb, "Overlapped", Overlapped); XmlAttrib(sb, "MultiDequeues", MultiDequeues); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "NativeOverlapped", "Overlapped", "MultiDequeues", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return NativeOverlapped; case 1: return Overlapped; case 2: return MultiDequeues; case 3: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ThreadPoolIOWorkEnqueueTraceData> Action; #endregion } public sealed class ThreadPoolIOWorkTraceData : TraceEvent { public Address NativeOverlapped { get { return GetAddressAt(0); } } public Address Overlapped { get { return GetAddressAt(HostOffset(4, 1)); } } public int ClrInstanceID { get { return GetInt16At(HostOffset(8, 2)); } } #region Private internal ThreadPoolIOWorkTraceData(Action<ThreadPoolIOWorkTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ThreadPoolIOWorkTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != HostOffset(10, 2))); Debug.Assert(!(Version > 0 && EventDataLength < HostOffset(10, 2))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "NativeOverlapped", NativeOverlapped); XmlAttribHex(sb, "Overlapped", Overlapped); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "NativeOverlapped", "Overlapped", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return NativeOverlapped; case 1: return Overlapped; case 2: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ThreadPoolIOWorkTraceData> Action; #endregion } public sealed class ThreadStartWorkTraceData : TraceEvent { public Address ThreadStartWorkID { get { return GetAddressAt(0); } } public int ClrInstanceID { get { return GetInt16At(HostOffset(4, 1)); } } #region Private internal ThreadStartWorkTraceData(Action<ThreadStartWorkTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ThreadStartWorkTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != HostOffset(6, 1))); Debug.Assert(!(Version > 0 && EventDataLength < HostOffset(6, 1))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "ID", ThreadStartWorkID); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ID", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ThreadStartWorkID; case 1: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ThreadStartWorkTraceData> Action; #endregion } public sealed class ExceptionTraceData : TraceEvent { public string ExceptionType { get { if (Version >= 1) { return GetUnicodeStringAt(0); } return ""; } } public string ExceptionMessage { get { if (Version >= 1) { return GetUnicodeStringAt(SkipUnicodeString(0)); } return ""; } } public Address ExceptionEIP { get { if (Version >= 1) { return GetAddressAt(SkipUnicodeString(SkipUnicodeString(0))); } return 0; } } public int ExceptionHRESULT { get { if (Version >= 1) { return GetInt32At(HostOffset(SkipUnicodeString(SkipUnicodeString(0)) + 4, 1)); } return 0; } } public ExceptionThrownFlags ExceptionFlags { get { if (Version >= 1) { return (ExceptionThrownFlags)GetInt16At(HostOffset(SkipUnicodeString(SkipUnicodeString(0)) + 8, 1)); } return (ExceptionThrownFlags)0; } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(HostOffset(SkipUnicodeString(SkipUnicodeString(0)) + 10, 1)); } return 0; } } #region Private internal ExceptionTraceData(Action<ExceptionTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ExceptionTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 1 && EventDataLength != HostOffset(SkipUnicodeString(SkipUnicodeString(0)) + 12, 1))); Debug.Assert(!(Version > 1 && EventDataLength < HostOffset(SkipUnicodeString(SkipUnicodeString(0)) + 12, 1))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "ExceptionType", ExceptionType); XmlAttrib(sb, "ExceptionMessage", ExceptionMessage); XmlAttribHex(sb, "ExceptionEIP", ExceptionEIP); XmlAttribHex(sb, "ExceptionHRESULT", ExceptionHRESULT); XmlAttrib(sb, "ExceptionFlags", ExceptionFlags); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ExceptionType", "ExceptionMessage", "ExceptionEIP", "ExceptionHRESULT", "ExceptionFlags", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ExceptionType; case 1: return ExceptionMessage; case 2: return ExceptionEIP; case 3: return ExceptionHRESULT; case 4: return ExceptionFlags; case 5: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ExceptionTraceData> Action; #endregion } public sealed class ContentionTraceData : TraceEvent { public ContentionFlags ContentionFlags { get { if (Version >= 1) { return (ContentionFlags)GetByteAt(0); } return (ContentionFlags)0; } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(1); } return 0; } } #region Private internal ContentionTraceData(Action<ContentionTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ContentionTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 1 && EventDataLength != 3)); Debug.Assert(!(Version > 1 && EventDataLength < 3)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "ContentionFlags", ContentionFlags); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ContentionFlags", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ContentionFlags; case 1: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ContentionTraceData> Action; #endregion } public sealed class R2RGetEntryPointTraceData : TraceEvent { public long MethodID { get { return GetInt64At(0); } } public string MethodNamespace { get { return GetUnicodeStringAt(8); } } public string MethodName { get { return GetUnicodeStringAt(SkipUnicodeString(8)); } } public string MethodSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(8))); } } public long EntryPoint { get { return GetInt64At(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(8)))); } } public int ClrInstanceID { get { return GetInt16At(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(8))) + 8); } } #region Private internal R2RGetEntryPointTraceData(Action<R2RGetEntryPointTraceData> target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { this.m_target = target; } protected internal override void Dispatch() { m_target(this); } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(8))) + 10)); Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(8))) + 10)); } protected internal override Delegate Target { get { return m_target; } set { m_target = (Action<R2RGetEntryPointTraceData>)value; } } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "MethodID", MethodID); XmlAttrib(sb, "MethodNamespace", MethodNamespace); XmlAttrib(sb, "MethodName", MethodName); XmlAttrib(sb, "MethodSignature", MethodSignature); XmlAttrib(sb, "EntryPoint", EntryPoint); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) payloadNames = new string[] { "MethodID", "MethodNamespace", "MethodName", "MethodSignature", "EntryPoint", "ClrInstanceID" }; return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return MethodID; case 1: return MethodNamespace; case 2: return MethodName; case 3: return MethodSignature; case 4: return EntryPoint; case 5: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<R2RGetEntryPointTraceData> m_target; #endregion } public sealed class MethodILToNativeMapTraceData : TraceEvent { private const int ILProlog = -2; // Returned by ILOffset to represent the prologue of the method private const int ILEpilog = -3; // Returned by ILOffset to represent the epilogue of the method public long MethodID { get { return GetInt64At(0); } } public long ReJITID { get { return GetInt64At(8); } } public int MethodExtent { get { return GetByteAt(16); } } public int CountOfMapEntries { get { return GetInt16At(17); } } // May also return the special values ILProlog (-2) and ILEpilog (-3) public int ILOffset(int index) { return GetInt32At(index * 4 + 19); } public int NativeOffset(int index) { return GetInt32At((CountOfMapEntries + index) * 4 + 19); } public int ClrInstanceID { get { return GetInt16At(CountOfMapEntries * 8 + 19); } } internal unsafe int* ILOffsets { get { return (int*)(((byte*)DataStart) + 19); } } internal unsafe int* NativeOffsets { get { return (int*)(((byte*)DataStart) + CountOfMapEntries * 4 + 19); } } #region Private internal MethodILToNativeMapTraceData(Action<MethodILToNativeMapTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<MethodILToNativeMapTraceData>)value; } } protected internal override void Validate() { Debug.Assert(Version != 0 || EventDataLength == CountOfMapEntries * 8 + 21); Debug.Assert(Version > 0 || EventDataLength >= CountOfMapEntries * 8 + 21); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "MethodID", MethodID); XmlAttrib(sb, "ReJITID", ReJITID); XmlAttrib(sb, "MethodExtent", MethodExtent); XmlAttrib(sb, "CountOfMapEntries", CountOfMapEntries); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.AppendLine(">"); for (int i = 0; i < CountOfMapEntries; i++) { sb.Append(" ").Append(ILOffset(i)).Append("->").Append(NativeOffset(i)).AppendLine(); } sb.Append("</Event>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "MethodID", "ReJITID", "MethodExtent", "CountOfMapEntries", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return MethodID; case 1: return ReJITID; case 2: return MethodExtent; case 3: return CountOfMapEntries; case 4: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<MethodILToNativeMapTraceData> Action; #endregion } public sealed class ClrStackWalkTraceData : TraceEvent { public int ClrInstanceID { get { return GetInt16At(0); } } // Skipping Reserved1 // Skipping Reserved2 public int FrameCount { get { return GetInt32At(4); } } /// <summary> /// Fetches the instruction pointer of a eventToStack frame 0 is the deepest frame, and the maximum should /// be a thread offset routine (if you get a complete eventToStack). /// </summary> /// <param name="index">The index of the frame to fetch. 0 is the CPU EIP, 1 is the Caller of that /// routine ...</param> /// <returns>The instruction pointer of the specified frame.</returns> public Address InstructionPointer(int index) { Debug.Assert(0 <= index && index < FrameCount); return GetAddressAt(8 + index * PointerSize); } /// <summary> /// Access to the instruction pointers as a unsafe memory blob /// </summary> internal unsafe void* InstructionPointers { get { return ((byte*)DataStart) + 8; } } #region Private internal ClrStackWalkTraceData(Action<ClrStackWalkTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ClrStackWalkTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(EventDataLength < 6)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); XmlAttrib(sb, "FrameCount", FrameCount); sb.AppendLine(">"); for (int i = 0; i < FrameCount; i++) { sb.Append(" "); sb.Append("0x").Append(((ulong)InstructionPointer(i)).ToString("x")); } sb.AppendLine(); sb.Append("</Event>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ClrInstanceID", "FrameCount" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ClrInstanceID; case 1: return FrameCount; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ClrStackWalkTraceData> Action; #endregion } public sealed class CodeSymbolsTraceData : TraceEvent { public long ModuleId { get { return GetInt64At(0); } } public int TotalChunks { get { return GetInt16At(8); } } public int ChunkNumber { get { return GetInt16At(10); } } public int ChunkLength { get { return GetInt32At(12); } } public byte[] Chunk { get { return GetByteArrayAt(16, ChunkLength); } } public int ClrInstanceID { get { return GetInt16At(0 + (ChunkLength * 1) + 16); } } #region Private internal CodeSymbolsTraceData(Action<CodeSymbolsTraceData> target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { m_target = target; } protected internal override void Dispatch() { m_target(this); } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 0 + (ChunkLength * 1) + 18)); Debug.Assert(!(Version > 0 && EventDataLength < 0 + (ChunkLength * 1) + 18)); } protected internal override Delegate Target { get { return m_target; } set { m_target = (Action<CodeSymbolsTraceData>)value; } } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "ModuleId", ModuleId); XmlAttrib(sb, "TotalChunks", TotalChunks); XmlAttrib(sb, "ChunkNumber", ChunkNumber); XmlAttrib(sb, "ChunkLength", ChunkLength); XmlAttrib(sb, "Chunk", Chunk); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ModuleId", "TotalChunks", "ChunkNumber", "ChunkLength", "Chunk", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ModuleId; case 1: return TotalChunks; case 2: return ChunkNumber; case 3: return ChunkLength; case 4: return Chunk; case 5: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<CodeSymbolsTraceData> m_target; #endregion } public sealed class AppDomainMemAllocatedTraceData : TraceEvent { public long AppDomainID { get { return GetInt64At(0); } } public long Allocated { get { return GetInt64At(8); } } public int ClrInstanceID { get { return GetInt16At(16); } } #region Private internal AppDomainMemAllocatedTraceData(Action<AppDomainMemAllocatedTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<AppDomainMemAllocatedTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 18)); Debug.Assert(!(Version > 0 && EventDataLength < 18)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "AppDomainID", AppDomainID); XmlAttribHex(sb, "Allocated", Allocated); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "AppDomainID", "Allocated", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return AppDomainID; case 1: return Allocated; case 2: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<AppDomainMemAllocatedTraceData> Action; #endregion } public sealed class AppDomainMemSurvivedTraceData : TraceEvent { public long AppDomainID { get { return GetInt64At(0); } } public long Survived { get { return GetInt64At(8); } } public long ProcessSurvived { get { return GetInt64At(16); } } public int ClrInstanceID { get { return GetInt16At(24); } } #region Private internal AppDomainMemSurvivedTraceData(Action<AppDomainMemSurvivedTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<AppDomainMemSurvivedTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 26)); Debug.Assert(!(Version > 0 && EventDataLength < 26)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "AppDomainID", AppDomainID); XmlAttribHex(sb, "Survived", Survived); XmlAttribHex(sb, "ProcessSurvived", ProcessSurvived); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "AppDomainID", "Survived", "ProcessSurvived", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return AppDomainID; case 1: return Survived; case 2: return ProcessSurvived; case 3: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<AppDomainMemSurvivedTraceData> Action; #endregion } public sealed class ThreadCreatedTraceData : TraceEvent { public long ManagedThreadID { get { return GetInt64At(0); } } public long AppDomainID { get { return GetInt64At(8); } } public int Flags { get { return GetInt32At(16); } } public int ManagedThreadIndex { get { return GetInt32At(20); } } public int OSThreadID { get { return GetInt32At(24); } } public int ClrInstanceID { get { return GetInt16At(28); } } #region Private internal ThreadCreatedTraceData(Action<ThreadCreatedTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ThreadCreatedTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 30)); Debug.Assert(!(Version > 0 && EventDataLength < 30)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "ManagedThreadID", ManagedThreadID); XmlAttribHex(sb, "AppDomainID", AppDomainID); XmlAttribHex(sb, "Flags", Flags); XmlAttrib(sb, "ManagedThreadIndex", ManagedThreadIndex); XmlAttrib(sb, "OSThreadID", OSThreadID); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ManagedThreadID", "AppDomainID", "Flags", "ManagedThreadIndex", "OSThreadID", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ManagedThreadID; case 1: return AppDomainID; case 2: return Flags; case 3: return ManagedThreadIndex; case 4: return OSThreadID; case 5: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ThreadCreatedTraceData> Action; #endregion } public sealed class ThreadTerminatedOrTransitionTraceData : TraceEvent { public long ManagedThreadID { get { return GetInt64At(0); } } public long AppDomainID { get { return GetInt64At(8); } } public int ClrInstanceID { get { return GetInt16At(16); } } #region Private internal ThreadTerminatedOrTransitionTraceData(Action<ThreadTerminatedOrTransitionTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ThreadTerminatedOrTransitionTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 18)); Debug.Assert(!(Version > 0 && EventDataLength < 18)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "ManagedThreadID", ManagedThreadID); XmlAttribHex(sb, "AppDomainID", AppDomainID); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ManagedThreadID", "AppDomainID", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ManagedThreadID; case 1: return AppDomainID; case 2: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ThreadTerminatedOrTransitionTraceData> Action; #endregion } public sealed class ILStubGeneratedTraceData : TraceEvent { public int ClrInstanceID { get { return GetInt16At(0); } } public long ModuleID { get { return GetInt64At(2); } } public long StubMethodID { get { return GetInt64At(10); } } public ILStubGeneratedFlags StubFlags { get { return (ILStubGeneratedFlags)GetInt32At(18); } } public int ManagedInteropMethodToken { get { return GetInt32At(22); } } public string ManagedInteropMethodNamespace { get { return GetUnicodeStringAt(26); } } public string ManagedInteropMethodName { get { return GetUnicodeStringAt(SkipUnicodeString(26)); } } public string ManagedInteropMethodSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(26))); } } public string NativeMethodSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(26)))); } } public string StubMethodSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(26))))); } } public string StubMethodILCode { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(26)))))); } } #region Private internal ILStubGeneratedTraceData(Action<ILStubGeneratedTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ILStubGeneratedTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(26)))))))); Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(26)))))))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); XmlAttribHex(sb, "ModuleID", ModuleID); XmlAttribHex(sb, "StubMethodID", StubMethodID); XmlAttrib(sb, "StubFlags", StubFlags); XmlAttribHex(sb, "ManagedInteropMethodToken", ManagedInteropMethodToken); XmlAttrib(sb, "ManagedInteropMethodNamespace", ManagedInteropMethodNamespace); XmlAttrib(sb, "ManagedInteropMethodName", ManagedInteropMethodName); XmlAttrib(sb, "ManagedInteropMethodSignature", ManagedInteropMethodSignature); XmlAttrib(sb, "NativeMethodSignature", NativeMethodSignature); XmlAttrib(sb, "StubMethodSignature", StubMethodSignature); XmlAttrib(sb, "StubMethodILCode", StubMethodILCode); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ClrInstanceID", "ModuleID", "StubMethodID", "StubFlags", "ManagedInteropMethodToken", "ManagedInteropMethodNamespace", "ManagedInteropMethodName", "ManagedInteropMethodSignature", "NativeMethodSignature", "StubMethodSignature", "StubMethodILCode" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ClrInstanceID; case 1: return ModuleID; case 2: return StubMethodID; case 3: return StubFlags; case 4: return ManagedInteropMethodToken; case 5: return ManagedInteropMethodNamespace; case 6: return ManagedInteropMethodName; case 7: return ManagedInteropMethodSignature; case 8: return NativeMethodSignature; case 9: return StubMethodSignature; case 10: return StubMethodILCode; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ILStubGeneratedTraceData> Action; #endregion } public sealed class ILStubCacheHitTraceData : TraceEvent { public int ClrInstanceID { get { return GetInt16At(0); } } public long ModuleID { get { return GetInt64At(2); } } public long StubMethodID { get { return GetInt64At(10); } } public int ManagedInteropMethodToken { get { return GetInt32At(18); } } public string ManagedInteropMethodNamespace { get { return GetUnicodeStringAt(22); } } public string ManagedInteropMethodName { get { return GetUnicodeStringAt(SkipUnicodeString(22)); } } public string ManagedInteropMethodSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(22))); } } #region Private internal ILStubCacheHitTraceData(Action<ILStubCacheHitTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ILStubCacheHitTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(22))))); Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(22))))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); XmlAttribHex(sb, "ModuleID", ModuleID); XmlAttribHex(sb, "StubMethodID", StubMethodID); XmlAttribHex(sb, "ManagedInteropMethodToken", ManagedInteropMethodToken); XmlAttrib(sb, "ManagedInteropMethodNamespace", ManagedInteropMethodNamespace); XmlAttrib(sb, "ManagedInteropMethodName", ManagedInteropMethodName); XmlAttrib(sb, "ManagedInteropMethodSignature", ManagedInteropMethodSignature); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ClrInstanceID", "ModuleID", "StubMethodID", "ManagedInteropMethodToken", "ManagedInteropMethodNamespace", "ManagedInteropMethodName", "ManagedInteropMethodSignature" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ClrInstanceID; case 1: return ModuleID; case 2: return StubMethodID; case 3: return ManagedInteropMethodToken; case 4: return ManagedInteropMethodNamespace; case 5: return ManagedInteropMethodName; case 6: return ManagedInteropMethodSignature; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ILStubCacheHitTraceData> Action; #endregion } public sealed class MethodLoadUnloadTraceData : TraceEvent { public long MethodID { get { return GetInt64At(0); } } public long ModuleID { get { return GetInt64At(8); } } public Address MethodStartAddress { get { return (Address)GetInt64At(16); } } public int MethodSize { get { return GetInt32At(24); } } public int MethodToken { get { return GetInt32At(28); } } public MethodFlags MethodFlags { get { return (MethodFlags)(GetInt32At(32) & 0xFFFFFFF); } } public bool IsDynamic { get { return (MethodFlags & MethodFlags.Dynamic) != 0; } } public bool IsGeneric { get { return (MethodFlags & MethodFlags.Generic) != 0; } } public bool IsJitted { get { return (MethodFlags & MethodFlags.Jitted) != 0; } } public int MethodExtent { get { return GetInt32At(32) >> 28; } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(36); } return 0; } } #region Private internal MethodLoadUnloadTraceData(Action<MethodLoadUnloadTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<MethodLoadUnloadTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != 36)); Debug.Assert(!(Version == 1 && EventDataLength != 38)); Debug.Assert(!(Version > 1 && EventDataLength < 38)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "MethodID", MethodID); XmlAttribHex(sb, "ModuleID", ModuleID); XmlAttribHex(sb, "MethodStartAddress", MethodStartAddress); XmlAttribHex(sb, "MethodSize", MethodSize); XmlAttribHex(sb, "MethodToken", MethodToken); XmlAttrib(sb, "MethodFlags", MethodFlags); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "MethodID", "ModuleID", "MethodStartAddress", "MethodSize", "MethodToken", "MethodFlags", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return MethodID; case 1: return ModuleID; case 2: return MethodStartAddress; case 3: return MethodSize; case 4: return MethodToken; case 5: return MethodFlags; case 6: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<MethodLoadUnloadTraceData> Action; #endregion } public sealed class MethodLoadUnloadVerboseTraceData : TraceEvent { public long MethodID { get { return GetInt64At(0); } } public long ModuleID { get { return GetInt64At(8); } } public Address MethodStartAddress { get { return (Address)GetInt64At(16); } } public int MethodSize { get { return GetInt32At(24); } } public int MethodToken { get { return GetInt32At(28); } } public MethodFlags MethodFlags { get { return (MethodFlags)(GetInt32At(32) & 0xFFFFFFF); } } public bool IsDynamic { get { return (MethodFlags & MethodFlags.Dynamic) != 0; } } public bool IsGeneric { get { return (MethodFlags & MethodFlags.Generic) != 0; } } public bool IsJitted { get { return (MethodFlags & MethodFlags.Jitted) != 0; } } public int MethodExtent { get { return GetInt32At(32) >> 28; } } public string MethodNamespace { get { return GetUnicodeStringAt(36); } } public string MethodName { get { return GetUnicodeStringAt(SkipUnicodeString(36)); } } public string MethodSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(36))); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(36)))); } return 0; } } public long ReJITID { get { if (Version >= 2) { return GetInt64At(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(36))) + 2); } return 0; } } #region Private internal MethodLoadUnloadVerboseTraceData(Action<MethodLoadUnloadVerboseTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<MethodLoadUnloadVerboseTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(36))))); Debug.Assert(!(Version == 1 && EventDataLength != SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(36))) + 2)); Debug.Assert(!(Version == 2 && EventDataLength != SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(36))) + 10)); Debug.Assert(!(Version > 2 && EventDataLength < SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(36))) + 10)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "MethodID", MethodID); XmlAttribHex(sb, "ModuleID", ModuleID); XmlAttribHex(sb, "MethodStartAddress", MethodStartAddress); XmlAttribHex(sb, "MethodSize", MethodSize); XmlAttribHex(sb, "MethodToken", MethodToken); XmlAttrib(sb, "MethodFlags", MethodFlags); XmlAttrib(sb, "MethodNamespace", MethodNamespace); XmlAttrib(sb, "MethodName", MethodName); XmlAttrib(sb, "MethodSignature", MethodSignature); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); XmlAttribHex(sb, "ReJITID", ReJITID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "MethodID", "ModuleID", "MethodStartAddress", "MethodSize", "MethodToken", "MethodFlags", "MethodNamespace", "MethodName", "MethodSignature", "ClrInstanceID", "ReJITID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return MethodID; case 1: return ModuleID; case 2: return MethodStartAddress; case 3: return MethodSize; case 4: return MethodToken; case 5: return MethodFlags; case 6: return MethodNamespace; case 7: return MethodName; case 8: return MethodSignature; case 9: return ClrInstanceID; case 10: return ReJITID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<MethodLoadUnloadVerboseTraceData> Action; #endregion } public sealed class MethodJittingStartedTraceData : TraceEvent { public long MethodID { get { return GetInt64At(0); } } public long ModuleID { get { return GetInt64At(8); } } public int MethodToken { get { return GetInt32At(16); } } public int MethodILSize { get { return GetInt32At(20); } } public string MethodNamespace { get { return GetUnicodeStringAt(24); } } public string MethodName { get { return GetUnicodeStringAt(SkipUnicodeString(24)); } } public string MethodSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(24))); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(24)))); } return 0; } } #region Private internal MethodJittingStartedTraceData(Action<MethodJittingStartedTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<MethodJittingStartedTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(24))))); Debug.Assert(!(Version == 1 && EventDataLength != SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(24))) + 2)); Debug.Assert(!(Version > 1 && EventDataLength < SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(24))) + 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "MethodID", MethodID); XmlAttribHex(sb, "ModuleID", ModuleID); XmlAttribHex(sb, "MethodToken", MethodToken); XmlAttribHex(sb, "MethodILSize", MethodILSize); XmlAttrib(sb, "MethodNamespace", MethodNamespace); XmlAttrib(sb, "MethodName", MethodName); XmlAttrib(sb, "MethodSignature", MethodSignature); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "MethodID", "ModuleID", "MethodToken", "MethodILSize", "MethodNamespace", "MethodName", "MethodSignature", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return MethodID; case 1: return ModuleID; case 2: return MethodToken; case 3: return MethodILSize; case 4: return MethodNamespace; case 5: return MethodName; case 6: return MethodSignature; case 7: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<MethodJittingStartedTraceData> Action; #endregion } public sealed class ModuleLoadUnloadTraceData : TraceEvent { public long ModuleID { get { return GetInt64At(0); } } public long AssemblyID { get { return GetInt64At(8); } } public ModuleFlags ModuleFlags { get { return (ModuleFlags)GetInt32At(16); } } // Skipping Reserved1 public string ModuleILPath { get { return GetUnicodeStringAt(24); } } public string ModuleNativePath { get { return GetUnicodeStringAt(SkipUnicodeString(24)); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(SkipUnicodeString(SkipUnicodeString(24))); } return 0; } } public Guid ManagedPdbSignature { get { if (Version >= 2) { return GetGuidAt(SkipUnicodeString(SkipUnicodeString(24)) + 2); } return Guid.Empty; } } public int ManagedPdbAge { get { if (Version >= 2) { return GetInt32At(SkipUnicodeString(SkipUnicodeString(24)) + 18); } return 0; } } public string ManagedPdbBuildPath { get { if (Version >= 2) { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(24)) + 22); } return ""; } } public Guid NativePdbSignature { get { if (Version >= 2) { return GetGuidAt(GetNativePdbSigStart); } return Guid.Empty; } } public int NativePdbAge { get { if (Version >= 2) { return GetInt32At(GetNativePdbSigStart + 16); } return 0; } } public string NativePdbBuildPath { get { if (Version >= 2) { return GetUnicodeStringAt(GetNativePdbSigStart + 20); } return ""; } } /// <summary> /// This is simply the file name part of the ModuleILPath. It is a convenience method. /// </summary> public string ModuleILFileName { get { return System.IO.Path.GetFileName(ModuleILPath); } } #region Private internal ModuleLoadUnloadTraceData(Action<ModuleLoadUnloadTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } private int GetNativePdbSigStart { get { return SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(24)) + 22); } } protected internal override Delegate Target { get { return Action; } set { Action = (Action<ModuleLoadUnloadTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(24)))); Debug.Assert(!(Version == 1 && EventDataLength != SkipUnicodeString(SkipUnicodeString(24)) + 2)); Debug.Assert(!(Version == 2 && EventDataLength != SkipUnicodeString(GetNativePdbSigStart + 20))); Debug.Assert(!(Version > 2 && EventDataLength < SkipUnicodeString(GetNativePdbSigStart + 20))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "ModuleID", ModuleID); XmlAttribHex(sb, "AssemblyID", AssemblyID); XmlAttrib(sb, "ModuleFlags", ModuleFlags); XmlAttrib(sb, "ModuleILPath", ModuleILPath); XmlAttrib(sb, "ModuleNativePath", ModuleNativePath); if (ManagedPdbSignature != Guid.Empty) { XmlAttrib(sb, "ManagedPdbSignature", ManagedPdbSignature); } if (ManagedPdbAge != 0) { XmlAttrib(sb, "ManagedPdbAge", ManagedPdbAge); } if (ManagedPdbBuildPath.Length != 0) { XmlAttrib(sb, "ManagedPdbBuildPath", ManagedPdbBuildPath); } if (NativePdbSignature != Guid.Empty) { XmlAttrib(sb, "NativePdbSignature", NativePdbSignature); } if (NativePdbAge != 0) { XmlAttrib(sb, "NativePdbAge", NativePdbAge); } if (NativePdbBuildPath.Length != 0) { XmlAttrib(sb, "NativePdbBuildPath", NativePdbBuildPath); } sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ModuleID", "AssemblyID", "ModuleFlags", "ModuleILPath", "ModuleNativePath", "ManagedPdbSignature", "ManagedPdbAge", "ManagedPdbBuildPath", "NativePdbSignature", "NativePdbAge", "NativePdbBuildPath", "ModuleILFileName" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ModuleID; case 1: return AssemblyID; case 2: return ModuleFlags; case 3: return ModuleILPath; case 4: return ModuleNativePath; case 5: return ManagedPdbSignature; case 6: return ManagedPdbAge; case 7: return ManagedPdbBuildPath; case 8: return NativePdbSignature; case 9: return NativePdbAge; case 10: return NativePdbBuildPath; case 11: return ModuleILFileName; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<ModuleLoadUnloadTraceData> Action; #endregion } public sealed class DomainModuleLoadUnloadTraceData : TraceEvent { public long ModuleID { get { return GetInt64At(0); } } public long AssemblyID { get { return GetInt64At(8); } } public long AppDomainID { get { return GetInt64At(16); } } public ModuleFlags ModuleFlags { get { return (ModuleFlags)GetInt32At(24); } } // Skipping Reserved1 public string ModuleILPath { get { return GetUnicodeStringAt(32); } } public string ModuleNativePath { get { return GetUnicodeStringAt(SkipUnicodeString(32)); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(SkipUnicodeString(SkipUnicodeString(32))); } return 0; } } #region Private internal DomainModuleLoadUnloadTraceData(Action<DomainModuleLoadUnloadTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<DomainModuleLoadUnloadTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(32)))); Debug.Assert(!(Version == 1 && EventDataLength != SkipUnicodeString(SkipUnicodeString(32)) + 2)); Debug.Assert(!(Version > 1 && EventDataLength < SkipUnicodeString(SkipUnicodeString(32)) + 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "ModuleID", ModuleID); XmlAttribHex(sb, "AssemblyID", AssemblyID); XmlAttribHex(sb, "AppDomainID", AppDomainID); XmlAttrib(sb, "ModuleFlags", ModuleFlags); XmlAttrib(sb, "ModuleILPath", ModuleILPath); XmlAttrib(sb, "ModuleNativePath", ModuleNativePath); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ModuleID", "AssemblyID", "AppDomainID", "ModuleFlags", "ModuleILPath", "ModuleNativePath", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ModuleID; case 1: return AssemblyID; case 2: return AppDomainID; case 3: return ModuleFlags; case 4: return ModuleILPath; case 5: return ModuleNativePath; case 6: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<DomainModuleLoadUnloadTraceData> Action; #endregion } public sealed class AssemblyLoadUnloadTraceData : TraceEvent { public long AssemblyID { get { return GetInt64At(0); } } public long AppDomainID { get { return GetInt64At(8); } } public AssemblyFlags AssemblyFlags { get { if (Version >= 1) { return (AssemblyFlags)GetInt32At(24); } return (AssemblyFlags)GetInt32At(16); } } public string FullyQualifiedAssemblyName { get { if (Version >= 1) { return GetUnicodeStringAt(28); } return GetUnicodeStringAt(20); } } public long BindingID { get { if (Version >= 1) { return GetInt64At(16); } return 0; } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(SkipUnicodeString(28)); } return 0; } } #region Private internal AssemblyLoadUnloadTraceData(Action<AssemblyLoadUnloadTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<AssemblyLoadUnloadTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(20))); Debug.Assert(!(Version == 1 && EventDataLength != SkipUnicodeString(28) + 2)); Debug.Assert(!(Version > 1 && EventDataLength < SkipUnicodeString(28) + 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "AssemblyID", AssemblyID); XmlAttribHex(sb, "AppDomainID", AppDomainID); XmlAttrib(sb, "AssemblyFlags", AssemblyFlags); XmlAttrib(sb, "FullyQualifiedAssemblyName", FullyQualifiedAssemblyName); XmlAttribHex(sb, "BindingID", BindingID); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "AssemblyID", "AppDomainID", "AssemblyFlags", "FullyQualifiedAssemblyName", "BindingID", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return AssemblyID; case 1: return AppDomainID; case 2: return AssemblyFlags; case 3: return FullyQualifiedAssemblyName; case 4: return BindingID; case 5: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<AssemblyLoadUnloadTraceData> Action; #endregion } public sealed class AppDomainLoadUnloadTraceData : TraceEvent { public long AppDomainID { get { return GetInt64At(0); } } public AppDomainFlags AppDomainFlags { get { return (AppDomainFlags)GetInt32At(8); } } public string AppDomainName { get { return GetUnicodeStringAt(12); } } public int AppDomainIndex { get { if (Version >= 1) { return GetInt32At(SkipUnicodeString(12)); } return 0; } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(SkipUnicodeString(12) + 4); } return 0; } } #region Private internal AppDomainLoadUnloadTraceData(Action<AppDomainLoadUnloadTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<AppDomainLoadUnloadTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(12))); Debug.Assert(!(Version == 1 && EventDataLength != SkipUnicodeString(12) + 6)); Debug.Assert(!(Version > 1 && EventDataLength < SkipUnicodeString(12) + 6)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "AppDomainID", AppDomainID); XmlAttrib(sb, "AppDomainFlags", AppDomainFlags); XmlAttrib(sb, "AppDomainName", AppDomainName); XmlAttrib(sb, "AppDomainIndex", AppDomainIndex); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "AppDomainID", "AppDomainFlags", "AppDomainName", "AppDomainIndex", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return AppDomainID; case 1: return AppDomainFlags; case 2: return AppDomainName; case 3: return AppDomainIndex; case 4: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<AppDomainLoadUnloadTraceData> Action; #endregion } public sealed class EventSourceTraceData : TraceEvent { public int EventID { get { return GetInt32At(0); } } public string Name { get { return GetUnicodeStringAt(4); } } public string EventSourceName { get { return GetUnicodeStringAt(SkipUnicodeString(4)); } } public string Payload { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(4))); } } #region Private internal EventSourceTraceData(Action<EventSourceTraceData> target, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { m_target = target; } protected internal override void Dispatch() { m_target(this); } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(4))))); Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(4))))); } protected internal override Delegate Target { get { return m_target; } set { m_target = (Action<EventSourceTraceData>)value; } } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "EventID", EventID); XmlAttrib(sb, "Name", Name); XmlAttrib(sb, "EventSourceName", EventSourceName); XmlAttrib(sb, "Payload", Payload); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "EventID", "Name", "EventSourceName", "Payload" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return EventID; case 1: return Name; case 2: return EventSourceName; case 3: return Payload; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<EventSourceTraceData> m_target; #endregion } public sealed class StrongNameVerificationTraceData : TraceEvent { public int VerificationFlags { get { return GetInt32At(0); } } public int ErrorCode { get { return GetInt32At(4); } } public string FullyQualifiedAssemblyName { get { return GetUnicodeStringAt(8); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(SkipUnicodeString(8)); } return 0; } } #region Private internal StrongNameVerificationTraceData(Action<StrongNameVerificationTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<StrongNameVerificationTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(8))); Debug.Assert(!(Version == 1 && EventDataLength != SkipUnicodeString(8) + 2)); Debug.Assert(!(Version > 1 && EventDataLength < SkipUnicodeString(8) + 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "VerificationFlags", VerificationFlags); XmlAttribHex(sb, "ErrorCode", ErrorCode); XmlAttrib(sb, "FullyQualifiedAssemblyName", FullyQualifiedAssemblyName); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "VerificationFlags", "ErrorCode", "FullyQualifiedAssemblyName", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return VerificationFlags; case 1: return ErrorCode; case 2: return FullyQualifiedAssemblyName; case 3: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<StrongNameVerificationTraceData> Action; #endregion } public sealed class AuthenticodeVerificationTraceData : TraceEvent { public int VerificationFlags { get { return GetInt32At(0); } } public int ErrorCode { get { return GetInt32At(4); } } public string ModulePath { get { return GetUnicodeStringAt(8); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(SkipUnicodeString(8)); } return 0; } } #region Private internal AuthenticodeVerificationTraceData(Action<AuthenticodeVerificationTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<AuthenticodeVerificationTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(8))); Debug.Assert(!(Version == 1 && EventDataLength != SkipUnicodeString(8) + 2)); Debug.Assert(!(Version > 1 && EventDataLength < SkipUnicodeString(8) + 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "VerificationFlags", VerificationFlags); XmlAttribHex(sb, "ErrorCode", ErrorCode); XmlAttrib(sb, "ModulePath", ModulePath); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "VerificationFlags", "ErrorCode", "ModulePath", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return VerificationFlags; case 1: return ErrorCode; case 2: return ModulePath; case 3: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<AuthenticodeVerificationTraceData> Action; #endregion } public sealed class MethodJitInliningSucceededTraceData : TraceEvent { public string MethodBeingCompiledNamespace { get { return GetUnicodeStringAt(0); } } public string MethodBeingCompiledName { get { return GetUnicodeStringAt(SkipUnicodeString(0)); } } public string MethodBeingCompiledNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(0))); } } public string InlinerNamespace { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))); } } public string InlinerName { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))); } } public string InlinerNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))); } } public string InlineeNamespace { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))); } } public string InlineeName { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))))); } } public string InlineeNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))); } } public int ClrInstanceID { get { return GetInt16At(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))))))); } } #region Private internal MethodJitInliningSucceededTraceData(Action<MethodJitInliningSucceededTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<MethodJitInliningSucceededTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 2)); Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "MethodBeingCompiledNamespace", MethodBeingCompiledNamespace); XmlAttrib(sb, "MethodBeingCompiledName", MethodBeingCompiledName); XmlAttrib(sb, "MethodBeingCompiledNameSignature", MethodBeingCompiledNameSignature); XmlAttrib(sb, "InlinerNamespace", InlinerNamespace); XmlAttrib(sb, "InlinerName", InlinerName); XmlAttrib(sb, "InlinerNameSignature", InlinerNameSignature); XmlAttrib(sb, "InlineeNamespace", InlineeNamespace); XmlAttrib(sb, "InlineeName", InlineeName); XmlAttrib(sb, "InlineeNameSignature", InlineeNameSignature); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "MethodBeingCompiledNamespace", "MethodBeingCompiledName", "MethodBeingCompiledNameSignature", "InlinerNamespace", "InlinerName", "InlinerNameSignature", "InlineeNamespace", "InlineeName", "InlineeNameSignature", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return MethodBeingCompiledNamespace; case 1: return MethodBeingCompiledName; case 2: return MethodBeingCompiledNameSignature; case 3: return InlinerNamespace; case 4: return InlinerName; case 5: return InlinerNameSignature; case 6: return InlineeNamespace; case 7: return InlineeName; case 8: return InlineeNameSignature; case 9: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<MethodJitInliningSucceededTraceData> Action; #endregion } public sealed class MethodJitInliningFailedAnsiTraceData : TraceEvent { public string MethodBeingCompiledNamespace { get { return GetUnicodeStringAt(0); } } public string MethodBeingCompiledName { get { return GetUnicodeStringAt(SkipUnicodeString(0)); } } public string MethodBeingCompiledNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(0))); } } public string InlinerNamespace { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))); } } public string InlinerName { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))); } } public string InlinerNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))); } } public string InlineeNamespace { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))); } } public string InlineeName { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))))); } } public string InlineeNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))); } } public bool FailAlways { get { return GetInt32At(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))))))) != 0; } } public string FailReason { get { return GetUTF8StringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4); } } public int ClrInstanceID { get { return GetInt16At(SkipUTF8String(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4)); } } #region Private internal MethodJitInliningFailedAnsiTraceData(Action<MethodJitInliningFailedAnsiTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<MethodJitInliningFailedAnsiTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUTF8String(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4) + 2)); Debug.Assert(!(Version > 0 && EventDataLength < SkipUTF8String(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4) + 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "MethodBeingCompiledNamespace", MethodBeingCompiledNamespace); XmlAttrib(sb, "MethodBeingCompiledName", MethodBeingCompiledName); XmlAttrib(sb, "MethodBeingCompiledNameSignature", MethodBeingCompiledNameSignature); XmlAttrib(sb, "InlinerNamespace", InlinerNamespace); XmlAttrib(sb, "InlinerName", InlinerName); XmlAttrib(sb, "InlinerNameSignature", InlinerNameSignature); XmlAttrib(sb, "InlineeNamespace", InlineeNamespace); XmlAttrib(sb, "InlineeName", InlineeName); XmlAttrib(sb, "InlineeNameSignature", InlineeNameSignature); XmlAttrib(sb, "FailAlways", FailAlways); XmlAttrib(sb, "FailReason", FailReason); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "MethodBeingCompiledNamespace", "MethodBeingCompiledName", "MethodBeingCompiledNameSignature", "InlinerNamespace", "InlinerName", "InlinerNameSignature", "InlineeNamespace", "InlineeName", "InlineeNameSignature", "FailAlways", "FailReason", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return MethodBeingCompiledNamespace; case 1: return MethodBeingCompiledName; case 2: return MethodBeingCompiledNameSignature; case 3: return InlinerNamespace; case 4: return InlinerName; case 5: return InlinerNameSignature; case 6: return InlineeNamespace; case 7: return InlineeName; case 8: return InlineeNameSignature; case 9: return FailAlways; case 10: return FailReason; case 11: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<MethodJitInliningFailedAnsiTraceData> Action; #endregion } public sealed class MethodJitInliningFailedTraceData : TraceEvent { public string MethodBeingCompiledNamespace { get { return GetUnicodeStringAt(0); } } public string MethodBeingCompiledName { get { return GetUnicodeStringAt(SkipUnicodeString(0)); } } public string MethodBeingCompiledNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(0))); } } public string InlinerNamespace { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))); } } public string InlinerName { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))); } } public string InlinerNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))); } } public string InlineeNamespace { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))); } } public string InlineeName { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))))); } } public string InlineeNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))); } } public bool FailAlways { get { return GetInt32At(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))))))) != 0; } } public string FailReason { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4); } } public int ClrInstanceID { get { return GetInt16At(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4)); } } #region Private internal MethodJitInliningFailedTraceData(Action<MethodJitInliningFailedTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<MethodJitInliningFailedTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUTF8String(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4) + 2)); Debug.Assert(!(Version > 0 && EventDataLength < SkipUTF8String(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4) + 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "MethodBeingCompiledNamespace", MethodBeingCompiledNamespace); XmlAttrib(sb, "MethodBeingCompiledName", MethodBeingCompiledName); XmlAttrib(sb, "MethodBeingCompiledNameSignature", MethodBeingCompiledNameSignature); XmlAttrib(sb, "InlinerNamespace", InlinerNamespace); XmlAttrib(sb, "InlinerName", InlinerName); XmlAttrib(sb, "InlinerNameSignature", InlinerNameSignature); XmlAttrib(sb, "InlineeNamespace", InlineeNamespace); XmlAttrib(sb, "InlineeName", InlineeName); XmlAttrib(sb, "InlineeNameSignature", InlineeNameSignature); XmlAttrib(sb, "FailAlways", FailAlways); XmlAttrib(sb, "FailReason", FailReason); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "MethodBeingCompiledNamespace", "MethodBeingCompiledName", "MethodBeingCompiledNameSignature", "InlinerNamespace", "InlinerName", "InlinerNameSignature", "InlineeNamespace", "InlineeName", "InlineeNameSignature", "FailAlways", "FailReason", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return MethodBeingCompiledNamespace; case 1: return MethodBeingCompiledName; case 2: return MethodBeingCompiledNameSignature; case 3: return InlinerNamespace; case 4: return InlinerName; case 5: return InlinerNameSignature; case 6: return InlineeNamespace; case 7: return InlineeName; case 8: return InlineeNameSignature; case 9: return FailAlways; case 10: return FailReason; case 11: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<MethodJitInliningFailedTraceData> Action; #endregion } public sealed class RuntimeInformationTraceData : TraceEvent { public int ClrInstanceID { get { return GetInt16At(0); } } public RuntimeSku Sku { get { return (RuntimeSku)GetInt16At(2); } } public int BclMajorVersion { get { return (ushort)GetInt16At(4); } } public int BclMinorVersion { get { return (ushort)GetInt16At(6); } } public int BclBuildNumber { get { return (ushort)GetInt16At(8); } } public int BclQfeNumber { get { return (ushort)GetInt16At(10); } } public int VMMajorVersion { get { return (ushort)GetInt16At(12); } } public int VMMinorVersion { get { return (ushort)GetInt16At(14); } } public int VMBuildNumber { get { return (ushort)GetInt16At(16); } } public int VMQfeNumber { get { return (ushort)GetInt16At(18); } } public StartupFlags StartupFlags { get { return (StartupFlags)GetInt32At(20); } } public StartupMode StartupMode { get { return (StartupMode)GetByteAt(24); } } public string CommandLine { get { return GetUnicodeStringAt(25); } } public Guid ComObjectGuid { get { return GetGuidAt(SkipUnicodeString(25)); } } public string RuntimeDllPath { get { return GetUnicodeStringAt(SkipUnicodeString(25) + 16); } } #region Private internal RuntimeInformationTraceData(Action<RuntimeInformationTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<RuntimeInformationTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(25) + 16))); Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(SkipUnicodeString(25) + 16))); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); XmlAttrib(sb, "Sku", Sku); XmlAttrib(sb, "BclMajorVersion", BclMajorVersion); XmlAttrib(sb, "BclMinorVersion", BclMinorVersion); XmlAttrib(sb, "BclBuildNumber", BclBuildNumber); XmlAttrib(sb, "BclQfeNumber", BclQfeNumber); XmlAttrib(sb, "VMMajorVersion", VMMajorVersion); XmlAttrib(sb, "VMMinorVersion", VMMinorVersion); XmlAttrib(sb, "VMBuildNumber", VMBuildNumber); XmlAttrib(sb, "VMQfeNumber", VMQfeNumber); XmlAttrib(sb, "StartupFlags", StartupFlags); XmlAttrib(sb, "StartupMode", StartupMode); XmlAttrib(sb, "CommandLine", CommandLine); XmlAttrib(sb, "ComObjectGuid", ComObjectGuid); XmlAttrib(sb, "RuntimeDllPath", RuntimeDllPath); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "ClrInstanceID", "Sku", "BclMajorVersion", "BclMinorVersion", "BclBuildNumber", "BclQfeNumber", "VMMajorVersion", "VMMinorVersion", "VMBuildNumber", "VMQfeNumber", "StartupFlags", "StartupMode", "CommandLine", "ComObjectGuid", "RuntimeDllPath" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ClrInstanceID; case 1: return Sku; case 2: return BclMajorVersion; case 3: return BclMinorVersion; case 4: return BclBuildNumber; case 5: return BclQfeNumber; case 6: return VMMajorVersion; case 7: return VMMinorVersion; case 8: return VMBuildNumber; case 9: return VMQfeNumber; case 10: return StartupFlags; case 11: return StartupMode; case 12: return CommandLine; case 13: return ComObjectGuid; case 14: return RuntimeDllPath; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<RuntimeInformationTraceData> Action; #endregion } public sealed class MethodJitTailCallSucceededTraceData : TraceEvent { public string MethodBeingCompiledNamespace { get { return GetUnicodeStringAt(0); } } public string MethodBeingCompiledName { get { return GetUnicodeStringAt(SkipUnicodeString(0)); } } public string MethodBeingCompiledNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(0))); } } public string CallerNamespace { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))); } } public string CallerName { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))); } } public string CallerNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))); } } public string CalleeNamespace { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))); } } public string CalleeName { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))))); } } public string CalleeNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))); } } public bool TailPrefix { get { return GetInt32At(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))))))) != 0; } } public TailCallType TailCallType { get { return (TailCallType)GetInt32At(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4); } } public int ClrInstanceID { get { return GetInt16At(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 8); } } #region Private internal MethodJitTailCallSucceededTraceData(Action<MethodJitTailCallSucceededTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<MethodJitTailCallSucceededTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 10)); Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 10)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "MethodBeingCompiledNamespace", MethodBeingCompiledNamespace); XmlAttrib(sb, "MethodBeingCompiledName", MethodBeingCompiledName); XmlAttrib(sb, "MethodBeingCompiledNameSignature", MethodBeingCompiledNameSignature); XmlAttrib(sb, "CallerNamespace", CallerNamespace); XmlAttrib(sb, "CallerName", CallerName); XmlAttrib(sb, "CallerNameSignature", CallerNameSignature); XmlAttrib(sb, "CalleeNamespace", CalleeNamespace); XmlAttrib(sb, "CalleeName", CalleeName); XmlAttrib(sb, "CalleeNameSignature", CalleeNameSignature); XmlAttrib(sb, "TailPrefix", TailPrefix); XmlAttrib(sb, "TailCallType", TailCallType); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "MethodBeingCompiledNamespace", "MethodBeingCompiledName", "MethodBeingCompiledNameSignature", "CallerNamespace", "CallerName", "CallerNameSignature", "CalleeNamespace", "CalleeName", "CalleeNameSignature", "TailPrefix", "TailCallType", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return MethodBeingCompiledNamespace; case 1: return MethodBeingCompiledName; case 2: return MethodBeingCompiledNameSignature; case 3: return CallerNamespace; case 4: return CallerName; case 5: return CallerNameSignature; case 6: return CalleeNamespace; case 7: return CalleeName; case 8: return CalleeNameSignature; case 9: return TailPrefix; case 10: return TailCallType; case 11: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<MethodJitTailCallSucceededTraceData> Action; #endregion } public sealed class MethodJitTailCallFailedAnsiTraceData : TraceEvent { public string MethodBeingCompiledNamespace { get { return GetUnicodeStringAt(0); } } public string MethodBeingCompiledName { get { return GetUnicodeStringAt(SkipUnicodeString(0)); } } public string MethodBeingCompiledNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(0))); } } public string CallerNamespace { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))); } } public string CallerName { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))); } } public string CallerNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))); } } public string CalleeNamespace { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))); } } public string CalleeName { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))))); } } public string CalleeNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))); } } public bool TailPrefix { get { return GetInt32At(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))))))) != 0; } } public string FailReason { get { return GetUTF8StringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4); } } public int ClrInstanceID { get { return GetInt16At(SkipUTF8String(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4)); } } #region Private internal MethodJitTailCallFailedAnsiTraceData(Action<MethodJitTailCallFailedAnsiTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<MethodJitTailCallFailedAnsiTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUTF8String(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4) + 2)); Debug.Assert(!(Version > 0 && EventDataLength < SkipUTF8String(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4) + 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "MethodBeingCompiledNamespace", MethodBeingCompiledNamespace); XmlAttrib(sb, "MethodBeingCompiledName", MethodBeingCompiledName); XmlAttrib(sb, "MethodBeingCompiledNameSignature", MethodBeingCompiledNameSignature); XmlAttrib(sb, "CallerNamespace", CallerNamespace); XmlAttrib(sb, "CallerName", CallerName); XmlAttrib(sb, "CallerNameSignature", CallerNameSignature); XmlAttrib(sb, "CalleeNamespace", CalleeNamespace); XmlAttrib(sb, "CalleeName", CalleeName); XmlAttrib(sb, "CalleeNameSignature", CalleeNameSignature); XmlAttrib(sb, "TailPrefix", TailPrefix); XmlAttrib(sb, "FailReason", FailReason); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "MethodBeingCompiledNamespace", "MethodBeingCompiledName", "MethodBeingCompiledNameSignature", "CallerNamespace", "CallerName", "CallerNameSignature", "CalleeNamespace", "CalleeName", "CalleeNameSignature", "TailPrefix", "FailReason", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return MethodBeingCompiledNamespace; case 1: return MethodBeingCompiledName; case 2: return MethodBeingCompiledNameSignature; case 3: return CallerNamespace; case 4: return CallerName; case 5: return CallerNameSignature; case 6: return CalleeNamespace; case 7: return CalleeName; case 8: return CalleeNameSignature; case 9: return TailPrefix; case 10: return FailReason; case 11: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<MethodJitTailCallFailedAnsiTraceData> Action; #endregion } public sealed class MethodJitTailCallFailedTraceData : TraceEvent { public string MethodBeingCompiledNamespace { get { return GetUnicodeStringAt(0); } } public string MethodBeingCompiledName { get { return GetUnicodeStringAt(SkipUnicodeString(0)); } } public string MethodBeingCompiledNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(0))); } } public string CallerNamespace { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))); } } public string CallerName { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))); } } public string CallerNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))); } } public string CalleeNamespace { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))); } } public string CalleeName { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))))); } } public string CalleeNameSignature { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))); } } public bool TailPrefix { get { return GetInt32At(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0)))))))))) != 0; } } public string FailReason { get { return GetUnicodeStringAt(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4); } } public int ClrInstanceID { get { return GetInt16At(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4)); } } #region Private internal MethodJitTailCallFailedTraceData(Action<MethodJitTailCallFailedTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<MethodJitTailCallFailedTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4) + 2)); Debug.Assert(!(Version > 0 && EventDataLength < SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(SkipUnicodeString(0))))))))) + 4) + 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "MethodBeingCompiledNamespace", MethodBeingCompiledNamespace); XmlAttrib(sb, "MethodBeingCompiledName", MethodBeingCompiledName); XmlAttrib(sb, "MethodBeingCompiledNameSignature", MethodBeingCompiledNameSignature); XmlAttrib(sb, "CallerNamespace", CallerNamespace); XmlAttrib(sb, "CallerName", CallerName); XmlAttrib(sb, "CallerNameSignature", CallerNameSignature); XmlAttrib(sb, "CalleeNamespace", CalleeNamespace); XmlAttrib(sb, "CalleeName", CalleeName); XmlAttrib(sb, "CalleeNameSignature", CalleeNameSignature); XmlAttrib(sb, "TailPrefix", TailPrefix); XmlAttrib(sb, "FailReason", FailReason); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "MethodBeingCompiledNamespace", "MethodBeingCompiledName", "MethodBeingCompiledNameSignature", "CallerNamespace", "CallerName", "CallerNameSignature", "CalleeNamespace", "CalleeName", "CalleeNameSignature", "TailPrefix", "FailReason", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return MethodBeingCompiledNamespace; case 1: return MethodBeingCompiledName; case 2: return MethodBeingCompiledNameSignature; case 3: return CallerNamespace; case 4: return CallerName; case 5: return CallerNameSignature; case 6: return CalleeNamespace; case 7: return CalleeName; case 8: return CalleeNameSignature; case 9: return TailPrefix; case 10: return FailReason; case 11: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<MethodJitTailCallFailedTraceData> Action; #endregion } [Flags] public enum AppDomainFlags { None = 0, Default = 0x1, Executable = 0x2, Shared = 0x4, } [Flags] public enum AssemblyFlags { None = 0, DomainNeutral = 0x1, Dynamic = 0x2, Native = 0x4, Collectible = 0x8, ReadyToRun = 0x10, } [Flags] public enum ModuleFlags { None = 0, DomainNeutral = 0x1, Native = 0x2, Dynamic = 0x4, Manifest = 0x8, IbcOptimized = 0x10, ReadyToRunModule = 0x20, PartialReadyToRunModule = 0x40, } [Flags] public enum MethodFlags { None = 0, Dynamic = 0x1, Generic = 0x2, HasSharedGenericCode = 0x4, Jitted = 0x8, JitHelper=0x10, ProfilerRejectedPrecompiledCode = 0x20, ReadyToRunRejectedPrecompiledCode = 0x40, } [Flags] public enum StartupMode { None = 0, ManagedExe = 0x1, HostedClr = 0x2, IjwDll = 0x4, ComActivated = 0x8, Other = 0x10, } [Flags] public enum RuntimeSku { None = 0, DesktopClr = 0x1, CoreClr = 0x2, } [Flags] public enum ExceptionThrownFlags { None = 0, HasInnerException = 0x1, Nested = 0x2, ReThrown = 0x4, CorruptedState = 0x8, CLSCompliant = 0x10, } [Flags] public enum ILStubGeneratedFlags { None = 0, ReverseInterop = 0x1, ComInterop = 0x2, NGenedStub = 0x4, Delegate = 0x8, VarArg = 0x10, UnmanagedCallee = 0x20, } [Flags] public enum StartupFlags { None = 0, CONCURRENT_GC = 0x000001, LOADER_OPTIMIZATION_SINGLE_DOMAIN = 0x000002, LOADER_OPTIMIZATION_MULTI_DOMAIN = 0x000004, LOADER_SAFEMODE = 0x000010, LOADER_SETPREFERENCE = 0x000100, SERVER_GC = 0x001000, HOARD_GC_VM = 0x002000, SINGLE_VERSION_HOSTING_INTERFACE = 0x004000, LEGACY_IMPERSONATION = 0x010000, DISABLE_COMMITTHREADSTACK = 0x020000, ALWAYSFLOW_IMPERSONATION = 0x040000, TRIM_GC_COMMIT = 0x080000, ETW = 0x100000, SERVER_BUILD = 0x200000, ARM = 0x400000, } [Flags] public enum TypeFlags { None = 0, Delegate = 0x1, Finalizable = 0x2, ExternallyImplementedCOMObject = 0x4, // RCW. Array = 0x8, ModuleBaseAddress = 0x10, // TODO FIX NOW, need to add ContainsPointer // Also want ElementSize. (not in flags of course) } [Flags] public enum GCRootFlags { None = 0, Pinning = 0x1, WeakRef = 0x2, Interior = 0x4, RefCounted = 0x8, } [Flags] public enum GCRootStaticVarFlags { None = 0, ThreadLocal = 0x1, } [Flags] public enum ThreadFlags { None = 0, GCSpecial = 0x1, Finalizer = 0x2, ThreadPoolWorker = 0x4, } public enum GCSegmentType { SmallObjectHeap = 0x0, LargeObjectHeap = 0x1, ReadOnlyHeap = 0x2, } public enum GCAllocationKind { Small = 0x0, Large = 0x1, } public enum GCType { NonConcurrentGC = 0x0, // A 'blocking' GC. BackgroundGC = 0x1, // A Gen 2 GC happening while code continues to run ForegroundGC = 0x2, // A Gen 0 or Gen 1 blocking GC which is happening when a Background GC is in progress. } public enum GCReason { AllocSmall = 0x0, Induced = 0x1, LowMemory = 0x2, Empty = 0x3, AllocLarge = 0x4, OutOfSpaceSOH = 0x5, OutOfSpaceLOH = 0x6, InducedNotForced = 0x7, Internal = 0x8, InducedLowMemory = 0x9, InducedCompacting = 0xa, LowMemoryHost = 0xb, PMFullGC = 0xc, LowMemoryHostBlocking = 0xd } public enum GCSuspendEEReason { SuspendOther = 0x0, SuspendForGC = 0x1, SuspendForAppDomainShutdown = 0x2, SuspendForCodePitching = 0x3, SuspendForShutdown = 0x4, SuspendForDebugger = 0x5, SuspendForGCPrep = 0x6, SuspendForDebuggerSweep = 0x7, } public enum ContentionFlags { Managed = 0x0, Native = 0x1, } public enum TailCallType { Unknown = -1, OptimizedTailCall = 0x0, RecursiveLoop = 0x1, HelperAssistedTailCall = 0x2, } public enum ThreadAdjustmentReason { Warmup = 0x0, Initializing = 0x1, RandomMove = 0x2, ClimbingMove = 0x3, ChangePoint = 0x4, Stabilizing = 0x5, Starvation = 0x6, ThreadTimedOut = 0x7, } [Flags] public enum GCRootRCWFlags { None = 0, Duplicate = 1, XAMLObject = 2, ExtendsComObject = 4, } [Flags] public enum GCRootCCWFlags { None = 0, Strong = 1, XAMLObject = 2, ExtendsComObject = 4, } public enum GCRootKind { Stack = 0, Finalizer = 1, Handle = 2, Older = 0x3, SizedRef = 0x4, Overflow = 0x5, } public enum GCHandleKind { WeakShort = 0x0, WeakLong = 0x1, Strong = 0x2, Pinned = 0x3, Variable = 0x4, RefCounted = 0x5, Dependent = 0x6, AsyncPinned = 0x7, SizedRef = 0x8, DependendAsyncPinned = -0x7, } // [SecuritySafeCritical] [System.CodeDom.Compiler.GeneratedCode("traceparsergen", "1.0")] public sealed class ClrRundownTraceEventParser : TraceEventParser { public static readonly string ProviderName = "Microsoft-Windows-DotNETRuntimeRundown"; public static readonly Guid ProviderGuid = new Guid(unchecked((int)0xa669021c), unchecked((short)0xc450), unchecked((short)0x4609), 0xa0, 0x35, 0x5a, 0xf5, 0x9a, 0xf4, 0xdf, 0x18); public enum Keywords : long { Loader = 0x8, Jit = 0x10, NGen = 0x20, StartEnumeration = 0x40, // Do rundown at DC_START StopEnumeration = 0x80, // Do rundown at DC_STOP ForceEndRundown = 0x100, AppDomainResourceManagement = 0x800, /// <summary> /// Log events associated with the threadpool, and other threading events. /// </summary> Threading = 0x10000, /// <summary> /// Dump the native to IL mapping of any method that is JIT compiled. (V4.5 runtimes and above). /// </summary> JittedMethodILToNativeMap = 0x20000, /// <summary> /// This supresses NGEN events on V4.0 (where you have NGEN PDBs), but not on V2.0 (which does not know about this /// bit and also does not have NGEN PDBS). /// </summary> SupressNGen = 0x40000, /// <summary> /// TODO document /// </summary> PerfTrack = 0x20000000, Stack = 0x40000000, /// <summary> /// Dump PDBs for dynamically generated modules. /// </summary> CodeSymbolsRundown = 0x80000000, Default = ForceEndRundown + NGen + Jit + SupressNGen + JittedMethodILToNativeMap + Loader + CodeSymbolsRundown, }; public ClrRundownTraceEventParser(TraceEventSource source) : base(source) { } public event Action<MethodILToNativeMapTraceData> MethodILToNativeMapDCStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new MethodILToNativeMapTraceData(value, 149, 1, "Method", MethodTaskGuid, 41, "ILToNativeMapDCStart", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 149, ProviderGuid); source.UnregisterEventTemplate(value, 41, MethodTaskGuid); } } public event Action<MethodILToNativeMapTraceData> MethodILToNativeMapDCStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new MethodILToNativeMapTraceData(value, 150, 1, "Method", MethodTaskGuid, 42, "ILToNativeMapDCStop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 150, ProviderGuid); source.UnregisterEventTemplate(value, 42, MethodTaskGuid); } } public event Action<ClrStackWalkTraceData> ClrStackWalk { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new ClrStackWalkTraceData(value, 0, 11, "ClrStack", ClrStackTaskGuid, 82, "Walk", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 0, ProviderGuid); source.UnregisterEventTemplate(value, 82, ClrStackTaskGuid); } } public event Action<MethodLoadUnloadTraceData> MethodDCStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new MethodLoadUnloadTraceData(value, 141, 1, "Method", MethodTaskGuid, 35, "DCStart", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 141, ProviderGuid); source.UnregisterEventTemplate(value, 35, MethodTaskGuid); } } public event Action<MethodLoadUnloadTraceData> MethodDCStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new MethodLoadUnloadTraceData(value, 142, 1, "Method", MethodTaskGuid, 36, "DCStop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 142, ProviderGuid); source.UnregisterEventTemplate(value, 36, MethodTaskGuid); } } public event Action<MethodLoadUnloadVerboseTraceData> MethodDCStartVerbose { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new MethodLoadUnloadVerboseTraceData(value, 143, 1, "Method", MethodTaskGuid, 39, "DCStartVerbose", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 143, ProviderGuid); source.UnregisterEventTemplate(value, 39, MethodTaskGuid); } } public event Action<MethodLoadUnloadVerboseTraceData> MethodDCStopVerbose { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new MethodLoadUnloadVerboseTraceData(value, 144, 1, "Method", MethodTaskGuid, 40, "DCStopVerbose", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 144, ProviderGuid); source.UnregisterEventTemplate(value, 40, MethodTaskGuid); } } public event Action<DCStartEndTraceData> MethodDCStartComplete { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new DCStartEndTraceData(value, 145, 1, "Method", MethodTaskGuid, 14, "DCStartComplete", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 145, ProviderGuid); source.UnregisterEventTemplate(value, 14, MethodTaskGuid); } } public event Action<DCStartEndTraceData> MethodDCStopComplete { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new DCStartEndTraceData(value, 146, 1, "Method", MethodTaskGuid, 15, "DCStopComplete", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 146, ProviderGuid); source.UnregisterEventTemplate(value, 15, MethodTaskGuid); } } public event Action<DCStartEndTraceData> MethodDCStartInit { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new DCStartEndTraceData(value, 147, 1, "Method", MethodTaskGuid, 16, "DCStartInit", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 147, ProviderGuid); source.UnregisterEventTemplate(value, 16, MethodTaskGuid); } } public event Action<DCStartEndTraceData> MethodDCStopInit { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new DCStartEndTraceData(value, 148, 1, "Method", MethodTaskGuid, 17, "DCStopInit", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 148, ProviderGuid); source.UnregisterEventTemplate(value, 17, MethodTaskGuid); } } public event Action<DomainModuleLoadUnloadTraceData> LoaderDomainModuleDCStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new DomainModuleLoadUnloadTraceData(value, 151, 2, "Loader", LoaderTaskGuid, 46, "DomainModuleDCStart", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 151, ProviderGuid); source.UnregisterEventTemplate(value, 46, LoaderTaskGuid); } } public event Action<DomainModuleLoadUnloadTraceData> LoaderDomainModuleDCStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new DomainModuleLoadUnloadTraceData(value, 152, 2, "Loader", LoaderTaskGuid, 47, "DomainModuleDCStop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 152, ProviderGuid); source.UnregisterEventTemplate(value, 47, LoaderTaskGuid); } } public event Action<ModuleLoadUnloadTraceData> LoaderModuleDCStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new ModuleLoadUnloadTraceData(value, 153, 2, "Loader", LoaderTaskGuid, 35, "ModuleDCStart", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 153, ProviderGuid); source.UnregisterEventTemplate(value, 35, LoaderTaskGuid); } } public event Action<ModuleLoadUnloadTraceData> LoaderModuleDCStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new ModuleLoadUnloadTraceData(value, 154, 2, "Loader", LoaderTaskGuid, 36, "ModuleDCStop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 154, ProviderGuid); source.UnregisterEventTemplate(value, 36, LoaderTaskGuid); } } public event Action<AssemblyLoadUnloadTraceData> LoaderAssemblyDCStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new AssemblyLoadUnloadTraceData(value, 155, 2, "Loader", LoaderTaskGuid, 39, "AssemblyDCStart", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 155, ProviderGuid); source.UnregisterEventTemplate(value, 39, LoaderTaskGuid); } } public event Action<AssemblyLoadUnloadTraceData> LoaderAssemblyDCStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new AssemblyLoadUnloadTraceData(value, 156, 2, "Loader", LoaderTaskGuid, 40, "AssemblyDCStop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 156, ProviderGuid); source.UnregisterEventTemplate(value, 40, LoaderTaskGuid); } } public event Action<AppDomainLoadUnloadTraceData> LoaderAppDomainDCStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new AppDomainLoadUnloadTraceData(value, 157, 2, "Loader", LoaderTaskGuid, 43, "AppDomainDCStart", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 157, ProviderGuid); source.UnregisterEventTemplate(value, 43, LoaderTaskGuid); } } public event Action<AppDomainLoadUnloadTraceData> LoaderAppDomainDCStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new AppDomainLoadUnloadTraceData(value, 158, 2, "Loader", LoaderTaskGuid, 44, "AppDomainDCStop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 158, ProviderGuid); source.UnregisterEventTemplate(value, 44, LoaderTaskGuid); } } public event Action<ThreadCreatedTraceData> LoaderThreadDCStop { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new ThreadCreatedTraceData(value, 159, 2, "Loader", LoaderTaskGuid, 48, "ThreadDCStop", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 159, ProviderGuid); source.UnregisterEventTemplate(value, 48, LoaderTaskGuid); } } public event Action<RuntimeInformationTraceData> RuntimeStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new RuntimeInformationTraceData(value, 187, 19, "Runtime", RuntimeTaskGuid, 1, "Start", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 187, ProviderGuid); source.UnregisterEventTemplate(value, 1, RuntimeTaskGuid); } } public event Action<CodeSymbolsTraceData> CodeSymbolsRundownStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new CodeSymbolsTraceData(value, 188, 21, "CodeSymbolsRundown", CodeSymbolsRundownTaskGuid, 1, "Start", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 188, ProviderGuid); source.UnregisterEventTemplate(value, 1, CodeSymbolsRundownTaskGuid); } } #region Event ID Definitions private const TraceEventID ClrStackWalkEventID = (TraceEventID)0; private const TraceEventID MethodDCStartEventID = (TraceEventID)141; private const TraceEventID MethodDCStopEventID = (TraceEventID)142; private const TraceEventID MethodDCStartVerboseEventID = (TraceEventID)143; private const TraceEventID MethodDCStopVerboseEventID = (TraceEventID)144; private const TraceEventID MethodDCStartCompleteEventID = (TraceEventID)145; private const TraceEventID MethodDCStopCompleteEventID = (TraceEventID)146; private const TraceEventID MethodDCStartInitEventID = (TraceEventID)147; private const TraceEventID MethodDCStopInitEventID = (TraceEventID)148; private const TraceEventID LoaderDomainModuleDCStartEventID = (TraceEventID)151; private const TraceEventID LoaderDomainModuleDCStopEventID = (TraceEventID)152; private const TraceEventID LoaderModuleDCStartEventID = (TraceEventID)153; private const TraceEventID LoaderModuleDCStopEventID = (TraceEventID)154; private const TraceEventID LoaderAssemblyDCStartEventID = (TraceEventID)155; private const TraceEventID LoaderAssemblyDCStopEventID = (TraceEventID)156; private const TraceEventID LoaderAppDomainDCStartEventID = (TraceEventID)157; private const TraceEventID LoaderAppDomainDCStopEventID = (TraceEventID)158; private const TraceEventID LoaderThreadDCStopEventID = (TraceEventID)159; private const TraceEventID RuntimeStartEventID = (TraceEventID)187; private const TraceEventID CodeSymbolsRundownStartEventID = (TraceEventID)188; #endregion public sealed class DCStartEndTraceData : TraceEvent { public int ClrInstanceID { get { if (Version >= 1) return GetInt16At(0); return 0; } } #region Private internal DCStartEndTraceData(Action<DCStartEndTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { this.Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<DCStartEndTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 1 && EventDataLength != 2)); Debug.Assert(!(Version > 1 && EventDataLength < 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) payloadNames = new string[] { "ClrInstanceID" }; return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<DCStartEndTraceData> Action; #endregion } #region private protected override string GetProviderName() { return ProviderName; } static private volatile TraceEvent[] s_templates; protected internal override void EnumerateTemplates(Func<string, string, EventFilterResponse> eventsToObserve, Action<TraceEvent> callback) { if (s_templates == null) { var templates = new TraceEvent[22]; templates[0] = new MethodILToNativeMapTraceData(null, 149, 1, "Method", MethodTaskGuid, 41, "ILToNativeMapDCStart", ProviderGuid, ProviderName); templates[1] = new MethodILToNativeMapTraceData(null, 150, 1, "Method", MethodTaskGuid, 42, "ILToNativeMapDCStop", ProviderGuid, ProviderName); templates[2] = new ClrStackWalkTraceData(null, 0, 11, "ClrStack", ClrStackTaskGuid, 82, "Walk", ProviderGuid, ProviderName); templates[3] = new MethodLoadUnloadTraceData(null, 141, 1, "Method", MethodTaskGuid, 35, "DCStart", ProviderGuid, ProviderName); templates[4] = new MethodLoadUnloadTraceData(null, 142, 1, "Method", MethodTaskGuid, 36, "DCStop", ProviderGuid, ProviderName); templates[5] = new MethodLoadUnloadVerboseTraceData(null, 143, 1, "Method", MethodTaskGuid, 39, "DCStartVerbose", ProviderGuid, ProviderName); templates[6] = new MethodLoadUnloadVerboseTraceData(null, 144, 1, "Method", MethodTaskGuid, 40, "DCStopVerbose", ProviderGuid, ProviderName); templates[7] = new DCStartEndTraceData(null, 145, 1, "Method", MethodTaskGuid, 14, "DCStartComplete", ProviderGuid, ProviderName); templates[8] = new DCStartEndTraceData(null, 146, 1, "Method", MethodTaskGuid, 15, "DCStopComplete", ProviderGuid, ProviderName); templates[9] = new DCStartEndTraceData(null, 147, 1, "Method", MethodTaskGuid, 16, "DCStartInit", ProviderGuid, ProviderName); templates[10] = new DCStartEndTraceData(null, 148, 1, "Method", MethodTaskGuid, 17, "DCStopInit", ProviderGuid, ProviderName); templates[11] = new DomainModuleLoadUnloadTraceData(null, 151, 2, "Loader", LoaderTaskGuid, 46, "DomainModuleDCStart", ProviderGuid, ProviderName); templates[12] = new DomainModuleLoadUnloadTraceData(null, 152, 2, "Loader", LoaderTaskGuid, 47, "DomainModuleDCStop", ProviderGuid, ProviderName); templates[13] = new ModuleLoadUnloadTraceData(null, 153, 2, "Loader", LoaderTaskGuid, 35, "ModuleDCStart", ProviderGuid, ProviderName); templates[14] = new ModuleLoadUnloadTraceData(null, 154, 2, "Loader", LoaderTaskGuid, 36, "ModuleDCStop", ProviderGuid, ProviderName); templates[15] = new AssemblyLoadUnloadTraceData(null, 155, 2, "Loader", LoaderTaskGuid, 39, "AssemblyDCStart", ProviderGuid, ProviderName); templates[16] = new AssemblyLoadUnloadTraceData(null, 156, 2, "Loader", LoaderTaskGuid, 40, "AssemblyDCStop", ProviderGuid, ProviderName); templates[17] = new AppDomainLoadUnloadTraceData(null, 157, 2, "Loader", LoaderTaskGuid, 43, "AppDomainDCStart", ProviderGuid, ProviderName); templates[18] = new AppDomainLoadUnloadTraceData(null, 158, 2, "Loader", LoaderTaskGuid, 44, "AppDomainDCStop", ProviderGuid, ProviderName); templates[19] = new ThreadCreatedTraceData(null, 159, 2, "Loader", LoaderTaskGuid, 48, "ThreadDCStop", ProviderGuid, ProviderName); templates[20] = new RuntimeInformationTraceData(null, 187, 19, "Runtime", RuntimeTaskGuid, 1, "Start", ProviderGuid, ProviderName); templates[21] = new CodeSymbolsTraceData(null, 188, 21, "CodeSymbolsRundown", CodeSymbolsRundownTaskGuid, 1, "Start", ProviderGuid, ProviderName); s_templates = templates; } foreach (var template in s_templates) if (eventsToObserve == null || eventsToObserve(template.ProviderName, template.EventName) == EventFilterResponse.AcceptEvent) callback(template); } private static readonly Guid MethodTaskGuid = new Guid(unchecked((int)0x0bcd91db), unchecked((short)0xf943), unchecked((short)0x454a), 0xa6, 0x62, 0x6e, 0xdb, 0xcf, 0xbb, 0x76, 0xd2); private static readonly Guid LoaderTaskGuid = new Guid(unchecked((int)0x5a54f4df), unchecked((short)0xd302), unchecked((short)0x4fee), 0xa2, 0x11, 0x6c, 0x2c, 0x0c, 0x1d, 0xcb, 0x1a); private static readonly Guid ClrStackTaskGuid = new Guid(unchecked((int)0xd3363dc0), unchecked((short)0x243a), unchecked((short)0x4620), 0xa4, 0xd0, 0x8a, 0x07, 0xd7, 0x72, 0xf5, 0x33); private static readonly Guid RuntimeTaskGuid = new Guid(unchecked((int)0xcd7d3e32), unchecked((short)0x65fe), unchecked((short)0x40cd), 0x92, 0x25, 0xa2, 0x57, 0x7d, 0x20, 0x3f, 0xc3); private static readonly Guid CodeSymbolsRundownTaskGuid = new Guid(unchecked((int)0x86b6c496), unchecked((short)0x0d9e), unchecked((short)0x4ba6), 0x81, 0x93, 0xca, 0x58, 0xe6, 0xe8, 0xc5, 0x15); #endregion } [System.CodeDom.Compiler.GeneratedCode("traceparsergen", "1.0")] public sealed class ClrStressTraceEventParser : TraceEventParser { public static readonly string ProviderName = "Microsoft-Windows-DotNETRuntimeStress"; public static readonly Guid ProviderGuid = new Guid(unchecked((int)0xcc2bcbba), unchecked((short)0x16b6), unchecked((short)0x4cf3), 0x89, 0x90, 0xd7, 0x4c, 0x2e, 0x8a, 0xf5, 0x00); public enum Keywords : long { Stack = 0x40000000, }; public ClrStressTraceEventParser(TraceEventSource source) : base(source) { } public event Action<StressLogTraceData> StressLogStart { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new StressLogTraceData(value, 0, 1, "StressLog", StressLogTaskGuid, 1, "Start", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 0, ProviderGuid); source.UnregisterEventTemplate(value, 1, StressLogTaskGuid); } } public event Action<ClrStackWalkTraceData> ClrStackWalk { add { // action, eventid, taskid, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName source.RegisterEventTemplate(new ClrStackWalkTraceData(value, 1, 11, "ClrStack", ClrStackTaskGuid, 82, "Walk", ProviderGuid, ProviderName)); } remove { source.UnregisterEventTemplate(value, 1, ProviderGuid); source.UnregisterEventTemplate(value, 82, ClrStackTaskGuid); } } #region Event ID Definitions private const TraceEventID StressLogStartEventID = (TraceEventID)0; private const TraceEventID ClrStackWalkEventID = (TraceEventID)1; #endregion #region private protected override string GetProviderName() { return ProviderName; } static private volatile TraceEvent[] s_templates; protected internal override void EnumerateTemplates(Func<string, string, EventFilterResponse> eventsToObserve, Action<TraceEvent> callback) { if (s_templates == null) { var templates = new TraceEvent[2]; templates[0] = new StressLogTraceData(null, 0, 1, "StressLog", StressLogTaskGuid, 1, "Start", ProviderGuid, ProviderName); templates[1] = new ClrStackWalkTraceData(null, 1, 11, "ClrStack", ClrStackTaskGuid, 82, "Walk", ProviderGuid, ProviderName); s_templates = templates; } foreach (var template in s_templates) if (eventsToObserve == null || eventsToObserve(template.ProviderName, template.EventName) == EventFilterResponse.AcceptEvent) callback(template); } private static readonly Guid StressLogTaskGuid = new Guid(unchecked((int)0xea40c74d), unchecked((short)0x4f65), unchecked((short)0x4561), 0xbb, 0x26, 0x65, 0x62, 0x31, 0xc8, 0x96, 0x7f); private static readonly Guid ClrStackTaskGuid = new Guid(unchecked((int)0xd3363dc0), unchecked((short)0x243a), unchecked((short)0x4620), 0xa4, 0xd0, 0x8a, 0x07, 0xd7, 0x72, 0xf5, 0x33); #endregion } public sealed class StressLogTraceData : TraceEvent { public int Facility { get { return GetInt32At(0); } } public int LogLevel { get { return GetByteAt(4); } } public string Message { get { return GetUTF8StringAt(5); } } public int ClrInstanceID { get { if (Version >= 1) { return GetInt16At(SkipUTF8String(5)); } return 0; } } #region Private internal StressLogTraceData(Action<StressLogTraceData> action, int eventID, int task, string taskName, Guid taskGuid, int opcode, string opcodeName, Guid providerGuid, string providerName) : base(eventID, task, taskName, taskGuid, opcode, opcodeName, providerGuid, providerName) { Action = action; } protected internal override void Dispatch() { Action(this); } protected internal override Delegate Target { get { return Action; } set { Action = (Action<StressLogTraceData>)value; } } protected internal override void Validate() { Debug.Assert(!(Version == 0 && EventDataLength != SkipUTF8String(5))); Debug.Assert(!(Version == 1 && EventDataLength != SkipUTF8String(5) + 2)); Debug.Assert(!(Version > 1 && EventDataLength < SkipUTF8String(5) + 2)); } public override StringBuilder ToXml(StringBuilder sb) { Prefix(sb); XmlAttribHex(sb, "Facility", Facility); XmlAttrib(sb, "LogLevel", LogLevel); XmlAttrib(sb, "Message", Message); XmlAttrib(sb, "ClrInstanceID", ClrInstanceID); sb.Append("/>"); return sb; } public override string[] PayloadNames { get { if (payloadNames == null) { payloadNames = new string[] { "Facility", "LogLevel", "Message", "ClrInstanceID" }; } return payloadNames; } } public override object PayloadValue(int index) { switch (index) { case 0: return Facility; case 1: return LogLevel; case 2: return Message; case 3: return ClrInstanceID; default: Debug.Assert(false, "Bad field index"); return null; } } private event Action<StressLogTraceData> Action; #endregion } [Flags] public enum GCGlobalMechanisms { None = 0, Concurrent = 0x1, Compaction = 0x2, Promotion = 0x4, Demotion = 0x8, CardBundles = 0x10, } #region private types /// <summary> /// ClrTraceEventParserState holds all information that is shared among all events that is /// needed to decode Clr events. This class is registered with the source so that it will be /// persisted. Things in here include /// /// * TypeID to TypeName mapping, /// </summary> internal class ClrTraceEventParserState : IFastSerializable { internal void SetTypeIDToName(int processID, Address typeId, long timeQPC, string typeName) { if (_typeIDToName == null) { _typeIDToName = new HistoryDictionary<string>(500); } _typeIDToName.Add(typeId + ((ulong)processID << 48), timeQPC, typeName); } internal string TypeIDToName(int processID, Address typeId, long timeQPC) { // We don't read lazyTypeIDToName from the disk unless we need to, check lazyTypeIDToName.FinishRead(); string ret; if (_typeIDToName == null || !_typeIDToName.TryGetValue(typeId + ((ulong)processID << 48), timeQPC, out ret)) { return ""; } return ret; } #region private void IFastSerializable.ToStream(Serializer serializer) { lazyTypeIDToName.Write(serializer, delegate { if (_typeIDToName == null) { serializer.Write(0); return; } serializer.Log("<WriteCollection name=\"typeIDToName\" count=\"" + _typeIDToName.Count + "\">\r\n"); serializer.Write(_typeIDToName.Count); foreach (HistoryDictionary<string>.HistoryValue entry in _typeIDToName.Entries) { serializer.Write((long)entry.Key); serializer.Write(entry.StartTime); serializer.Write(entry.Value); } serializer.Log("</WriteCollection>\r\n"); }); } void IFastSerializable.FromStream(Deserializer deserializer) { lazyTypeIDToName.Read(deserializer, delegate { int count; deserializer.Read(out count); Debug.Assert(count >= 0); deserializer.Log("<Marker name=\"typeIDToName\"/ count=\"" + count + "\">"); if (count > 0) { if (_typeIDToName == null) { _typeIDToName = new HistoryDictionary<string>(count); } for (int i = 0; i < count; i++) { long key; deserializer.Read(out key); long startTimeQPC; deserializer.Read(out startTimeQPC); string value; deserializer.Read(out value); _typeIDToName.Add((Address)key, startTimeQPC, value); } } }); } private DeferedRegion lazyTypeIDToName; private HistoryDictionary<string> _typeIDToName; #endregion // private } #endregion // private types }
41.856446
388
0.562421
[ "MIT" ]
Zhentar/perfview
src/TraceEvent/Parsers/ClrTraceEventParser.cs
472,057
C#
using System; using NetOffice; namespace NetOffice.WordApi.Enums { /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15 /// </summary> ///<remarks> MSDN Online Documentation: http://msdn.microsoft.com/en-us/en-us/library/office/ff836990.aspx </remarks> [SupportByVersionAttribute("Word", 9,10,11,12,14,15)] [EntityTypeAttribute(EntityType.IsEnum)] public enum WdFieldShading { /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15 /// </summary> /// <remarks>0</remarks> [SupportByVersionAttribute("Word", 9,10,11,12,14,15)] wdFieldShadingNever = 0, /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15 /// </summary> /// <remarks>1</remarks> [SupportByVersionAttribute("Word", 9,10,11,12,14,15)] wdFieldShadingAlways = 1, /// <summary> /// SupportByVersion Word 9, 10, 11, 12, 14, 15 /// </summary> /// <remarks>2</remarks> [SupportByVersionAttribute("Word", 9,10,11,12,14,15)] wdFieldShadingWhenSelected = 2 } }
30.617647
120
0.631124
[ "MIT" ]
NetOffice/NetOffice
Source/Word/Enums/WdFieldShading.cs
1,041
C#
using System; using System.Globalization; using System.Web; using System.Web.Routing; using MbUnit.Framework; using Moq; using Subtext.Extensibility; using Subtext.Framework; using Subtext.Framework.Components; using Subtext.Framework.Routing; namespace UnitTests.Subtext.Framework.Routing { [TestFixture] public class UrlHelperTests { [Test] public void EntryUrl_WithSubfolderAndEntryHavingEntryName_RendersVirtualPathToEntryWithDateAndSlugInUrl() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "subfolder"); UrlHelper helper = SetupUrlHelper("/", routeData); DateTime dateCreated = DateTime.ParseExact("2008/01/23", "yyyy/MM/dd", CultureInfo.InvariantCulture); var entry = new Entry(PostType.BlogPost) { Id = 123, DateCreated = dateCreated, DateSyndicated = dateCreated, EntryName = "post-slug" }; //act string url = helper.EntryUrl(entry); //assert Assert.AreEqual("/subfolder/archive/2008/01/23/post-slug.aspx", url); } [Test] public void EntryUrl_WithEntryHavingEntryName_RendersVirtualPathToEntryWithDateAndSlugInUrl() { //arrange UrlHelper helper = SetupUrlHelper("/"); DateTime dateCreated = DateTime.ParseExact("2008/01/23", "yyyy/MM/dd", CultureInfo.InvariantCulture); var entry = new Entry(PostType.BlogPost) { Id = 123, DateSyndicated = dateCreated, DateCreated = dateCreated, EntryName = "post-slug" }; //act string url = helper.EntryUrl(entry); //assert Assert.AreEqual("/archive/2008/01/23/post-slug.aspx", url); } [Test] public void EntryUrl_WithEntryHavingEntryNameAndPublishedInTheFuture_RendersVirtualPathToEntryWithDateAndSlugInUrl() { //arrange UrlHelper helper = SetupUrlHelper("/"); DateTime dateCreated = DateTime.ParseExact("2008/01/23", "yyyy/MM/dd", CultureInfo.InvariantCulture); DateTime dateSyndicated = DateTime.ParseExact("2008/02/23", "yyyy/MM/dd", CultureInfo.InvariantCulture); var entry = new Entry(PostType.BlogPost) { Id = 123, DateCreated = dateCreated, DateSyndicated = dateSyndicated, EntryName = "post-slug" }; //act string url = helper.EntryUrl(entry); //assert Assert.AreEqual("/archive/2008/02/23/post-slug.aspx", url); } [Test] public void EntryUrl_WithEntryWhichIsReallyAnArticle_ReturnsArticleLink() { //arrange UrlHelper helper = SetupUrlHelper("/"); DateTime dateCreated = DateTime.ParseExact("2008/01/23", "yyyy/MM/dd", CultureInfo.InvariantCulture); var entry = new Entry(PostType.BlogPost) { Id = 123, DateCreated = dateCreated, DateSyndicated = dateCreated, EntryName = "post-slug", PostType = PostType.Story }; //act string url = helper.EntryUrl(entry); //assert Assert.AreEqual("/articles/post-slug.aspx", url); } [Test] public void EntryUrl_WithEntryNotHavingEntryName_RendersVirtualPathWithId() { //arrange UrlHelper helper = SetupUrlHelper("/"); DateTime dateCreated = DateTime.ParseExact("2008/01/23", "yyyy/MM/dd", CultureInfo.InvariantCulture); var entry = new Entry(PostType.BlogPost) { DateCreated = dateCreated, DateSyndicated = dateCreated, EntryName = string.Empty, Id = 123 }; //act string url = helper.EntryUrl(entry); //assert Assert.AreEqual("/archive/2008/01/23/123.aspx", url); } [Test] public void EntryUrlWithAppPath_WithEntryHavingEntryName_RendersVirtualPathToEntryWithDateAndSlugInUrl() { //arrange UrlHelper helper = SetupUrlHelper("/App"); DateTime dateCreated = DateTime.ParseExact("2008/01/23", "yyyy/MM/dd", CultureInfo.InvariantCulture); var entry = new Entry(PostType.BlogPost) { Id = 123, DateCreated = dateCreated, DateSyndicated = dateCreated, EntryName = "post-slug" }; //act string url = helper.EntryUrl(entry); //assert Assert.AreEqual("/App/archive/2008/01/23/post-slug.aspx", url); } [Test] public void EntryUrl_WithNullEntry_ThrowsArgumentNullException() { //arrange var httpContext = new Mock<HttpContextBase>(); var requestContext = new RequestContext(httpContext.Object, new RouteData()); var helper = new UrlHelper(requestContext, new RouteCollection()); //act, assert UnitTestHelper.AssertThrowsArgumentNullException(() => helper.EntryUrl(null)); } [Test] public void EntryUrl_WithEntryHavingPostTypeOfNone_ThrowsArgumentException() { //arrange var httpContext = new Mock<HttpContextBase>(); var requestContext = new RequestContext(httpContext.Object, new RouteData()); var helper = new UrlHelper(requestContext, new RouteCollection()); //act UnitTestHelper.AssertThrows<ArgumentException>(() => helper.EntryUrl(new Entry(PostType.None))); } [Test] public void FeedbackUrl_WithEntryHavingEntryName_RendersVirtualPathWithFeedbackIdInFragment() { //arrange UrlHelper helper = SetupUrlHelper("/"); DateTime dateCreated = DateTime.ParseExact("2008/01/23", "yyyy/MM/dd", CultureInfo.InvariantCulture); var comment = new FeedbackItem(FeedbackType.Comment) { Id = 321, Entry = new Entry(PostType.BlogPost) { Id = 123, DateCreated = dateCreated, DateSyndicated = dateCreated, EntryName = "post-slug" } }; //act string url = helper.FeedbackUrl(comment); //assert Assert.AreEqual("/archive/2008/01/23/post-slug.aspx#321", url); } [Test] public void FeedbackUrl_WithEntryHavingNoEntryName_RendersVirtualPathWithFeedbackIdInFragment() { //arrange UrlHelper helper = SetupUrlHelper("/"); DateTime dateSyndicated = DateTime.ParseExact("2008/01/23", "yyyy/MM/dd", CultureInfo.InvariantCulture); var comment = new FeedbackItem(FeedbackType.Comment) { Id = 321, EntryId = 1234, ParentDateSyndicated = dateSyndicated }; //act string url = helper.FeedbackUrl(comment); //assert Assert.AreEqual("/archive/2008/01/23/1234.aspx#321", url); } [Test] public void FeedbackUrl_WithContactPageFeedback_ReturnsNullUrl() { //arrange UrlHelper helper = SetupUrlHelper("/"); var comment = new FeedbackItem(FeedbackType.ContactPage) { Id = 321, Entry = new Entry(PostType.BlogPost) }; //act string url = helper.FeedbackUrl(comment); //assert Assert.IsNull(url); } [Test] public void FeedbackUrl_WithNullEntry_ReturnsNullUrl() { //arrange UrlHelper helper = SetupUrlHelper("/"); var comment = new FeedbackItem(FeedbackType.ContactPage) { Id = 321, Entry = null }; //act string url = helper.FeedbackUrl(comment); //assert Assert.IsNull(url); } [Test] public void FeedbackUrl_WithEntryIdEqualToIntMinValue_ReturnsNull() { //arrange UrlHelper helper = SetupUrlHelper("/"); DateTime dateCreated = DateTime.ParseExact("2008/01/23", "yyyy/MM/dd", CultureInfo.InvariantCulture); var comment = new FeedbackItem(FeedbackType.Comment) { Id = 123, Entry = new Entry(PostType.BlogPost) { Id = NullValue.NullInt32, DateCreated = dateCreated, EntryName = "post-slug" } }; //act string url = helper.FeedbackUrl(comment); //assert Assert.IsNull(url); } [Test] public void FeedbackUrl_WithNullFeedback_ThrowsArgumentNullException() { //arrange UrlHelper helper = SetupUrlHelper("/App"); //act, assert UnitTestHelper.AssertThrowsArgumentNullException(() => helper.FeedbackUrl(null)); } [Test] public void IdenticonUrl_WithAppPathWithoutSubfolder_ReturnsRootedUrl() { //arrange UrlHelper helper = SetupUrlHelper("/Subtext.Web"); //act string url = helper.IdenticonUrl(123); //assert Assert.AreEqual("/Subtext.Web/images/services/IdenticonHandler.ashx?code=123", url); } [Test] public void IdenticonUrl_WithEmptyAppPathWithoutSubfolder_ReturnsRootedUrl() { //arrange UrlHelper helper = SetupUrlHelper("/"); //act string url = helper.IdenticonUrl(123); //assert Assert.AreEqual("/images/services/IdenticonHandler.ashx?code=123", url); } [Test] public void IdenticonUrl_WithEmptyPathWithSubfolder_IgnoresSubfolderInUrl() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "foobar"); UrlHelper helper = SetupUrlHelper("/", routeData); //act string url = helper.IdenticonUrl(123); //assert Assert.AreEqual("/images/services/IdenticonHandler.ashx?code=123", url); } [Test] public void ImageUrl_WithoutBlogWithAppPathWithoutSubfolderAndImage_ReturnsRootedImageUrl() { //arrange UrlHelper helper = SetupUrlHelper("/Subtext.Web"); //act string url = helper.ImageUrl("random.gif"); //assert Assert.AreEqual("/Subtext.Web/images/random.gif", url); } [Test] public void ImageUrl_WithoutBlogWithEmptyAppPathWithoutSubfolderAndImage_ReturnsRootedImageUrl() { //arrange UrlHelper helper = SetupUrlHelper("/"); //act string url = helper.ImageUrl("random.gif"); //assert Assert.AreEqual("/images/random.gif", url); } [Test] public void ImageUrl_WithoutBlogWithSubfolderAndImage_IgnoresSubfolderInUrl() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "foobar"); UrlHelper helper = SetupUrlHelper("/", routeData); //act string url = helper.ImageUrl("random.gif"); //assert Assert.AreEqual("/images/random.gif", url); } [Test] public void ImageUrl_WithBlogWithAppPathWithoutSubfolderAndImage_ReturnsUrlForImageUploadDirectory() { //arrange var blog = new Blog {Host = "localhost", Subfolder = "sub"}; UrlHelper helper = SetupUrlHelper("/Subtext.Web"); //act string url = helper.ImageUrl(blog, "random.gif"); //assert Assert.AreEqual("/Subtext.Web/images/localhost/Subtext_Web/sub/random.gif", url); } [Test] public void ImageUrl_WithBlogWithEmptyAppPathWithoutSubfolderAndImage_ReturnsUrlForImageUploadDirectory() { //arrange var blog = new Blog { Host = "localhost", Subfolder = "" }; UrlHelper helper = SetupUrlHelper("/"); //act string url = helper.ImageUrl(blog, "random.gif"); //assert Assert.AreEqual("/images/localhost/random.gif", url); } [Test] public void ImageUrl_WithBlogWithSubfolderAndImage_IgnoresSubfolderInUrl() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "foobar"); UrlHelper helper = SetupUrlHelper("/", routeData); //act string url = helper.ImageUrl("random.gif"); //assert Assert.AreEqual("/images/random.gif", url); } [Test] public void GalleryUrl_WithId_ReturnsGalleryUrlWithId() { //arrange UrlHelper helper = SetupUrlHelper("/"); //act string url = helper.GalleryUrl(1234); //assert Assert.AreEqual("/gallery/1234.aspx", url); } [Test] public void GalleryUrl_WithImageAndBlogWithSubfolder_ReturnsGalleryUrlWithSubfolder() { //arrange UrlHelper helper = SetupUrlHelper("/"); var image = new Image {CategoryID = 1234, Blog = new Blog {Subfolder = "subfolder"}}; //act string url = helper.GalleryUrl(image); //assert Assert.AreEqual("/subfolder/gallery/1234.aspx", url); } [Test] public void GalleryImageUrl_WithNullImage_ThrowsArgumentNullException() { //arrange UrlHelper helper = SetupUrlHelper("/"); //act, assert UnitTestHelper.AssertThrowsArgumentNullException(() => helper.GalleryImagePageUrl(null)); } [Test] public void GalleryImageUrl_WithId_ReturnsGalleryUrlWithId() { //arrange UrlHelper helper = SetupUrlHelper("/"); //act string url = helper.GalleryImagePageUrl(new Image {ImageID = 1234, Blog = new Blog()}); //assert Assert.AreEqual("/gallery/image/1234.aspx", url); } [Test] public void GalleryImageUrl_WithImageInBlogWithSubfolder_ReturnsGalleryUrlWithId() { //arrange UrlHelper helper = SetupUrlHelper("/"); //act string url = helper.GalleryImagePageUrl(new Image {ImageID = 1234, Blog = new Blog {Subfolder = "subfolder"}}); //assert Assert.AreEqual("/subfolder/gallery/image/1234.aspx", url); } [Test] public void GalleryImageUrl_WithImageHavingUrlAndFileName_ReturnsUrlToImage() { //arrange UrlHelper helper = SetupUrlHelper("/Subtext.Web"); var image = new Image {Url = "~/images/localhost/blog1/1234/", FileName = "close.gif"}; //act string url = helper.GalleryImageUrl(image, image.OriginalFile); //assert Assert.AreEqual("/Subtext.Web/images/localhost/blog1/1234/o_close.gif", url); } [Test] public void GalleryImageUrl_WithBlogHavingSubfolderAndVirtualPathAndImageHavingNullUrlAndFileName_ReturnsUrlToImage() { //arrange UrlHelper helper = SetupUrlHelper("/Subtext.Web"); var blog = new Blog {Host = "localhost", Subfolder = "blog1"}; var image = new Image {Blog = blog, Url = null, FileName = "open.gif", CategoryID = 1234}; //act string url = helper.GalleryImageUrl(image, image.OriginalFile); //assert Assert.AreEqual("/Subtext.Web/images/localhost/Subtext_Web/blog1/1234/o_open.gif", url); } [Test] public void GalleryImageUrl_WithBlogHavingSubfolderAndImageHavingNullUrlAndFileName_ReturnsUrlToImage() { //arrange UrlHelper helper = SetupUrlHelper("/"); var blog = new Blog {Host = "localhost", Subfolder = "blog1"}; var image = new Image {Blog = blog, Url = null, FileName = "open.gif", CategoryID = 1234}; //act string url = helper.GalleryImageUrl(image, image.OriginalFile); //assert Assert.AreEqual("/images/localhost/blog1/1234/o_open.gif", url); } [Test] public void GalleryImageUrl_WithBlogHavingNoSubfolderAndImageHavingNullUrlAndFileName_ReturnsUrlToImage() { //arrange UrlHelper helper = SetupUrlHelper("/"); var blog = new Blog {Host = "localhost", Subfolder = ""}; var image = new Image {Blog = blog, Url = null, FileName = "open.gif", CategoryID = 1234}; //act string url = helper.GalleryImageUrl(image, image.OriginalFile); //assert Assert.AreEqual("/images/localhost/1234/o_open.gif", url); } [Test] public void GalleryImageUrl_WithAppPathWithSubfolderAndImage_ReturnsUrlToImageFile() { //arrange UrlHelper helper = SetupUrlHelper("/Subtext.Web"); var blog = new Blog {Host = "localhost", Subfolder = "blog1"}; var image = new Image {CategoryID = 1234, FileName = "close.gif", Blog = blog}; //act string url = helper.GalleryImageUrl(image); //assert Assert.AreEqual("/Subtext.Web/images/localhost/Subtext_Web/blog1/1234/o_close.gif", url); } [Test] public void GalleryImageUrl_WithoutAppPathWithSubfolderAndImage_ReturnsUrlToImageFile() { //arrange UrlHelper helper = SetupUrlHelper("/"); var blog = new Blog {Host = "localhost", Subfolder = "blog1"}; var image = new Image {CategoryID = 1234, FileName = "close.gif", Blog = blog}; //act string url = helper.GalleryImageUrl(image); //assert Assert.AreEqual("/images/localhost/blog1/1234/o_close.gif", url); } [Test] public void GalleryImageUrl_WithAppPathWithoutSubfolderAndImage_ReturnsUrlToImageFile() { //arrange UrlHelper helper = SetupUrlHelper("/Subtext.Web"); var blog = new Blog {Host = "localhost", Subfolder = ""}; var image = new Image {CategoryID = 1234, FileName = "close.gif", Blog = blog}; //act string url = helper.GalleryImageUrl(image); //assert Assert.AreEqual("/Subtext.Web/images/localhost/Subtext_Web/1234/o_close.gif", url); } [Test] public void GalleryImageUrl_WithoutAppPathWithoutSubfolderAndImage_ReturnsUrlToImageFile() { //arrange UrlHelper helper = SetupUrlHelper("/"); var blog = new Blog {Host = "localhost", Subfolder = ""}; var image = new Image {CategoryID = 1234, FileName = "close.gif", Blog = blog}; //act string url = helper.GalleryImageUrl(image); //assert Assert.AreEqual("/images/localhost/1234/o_close.gif", url); } [Test] public void ImageGalleryDirectoryUrl_WithAppPathWithSubfolderAndImage_ReturnsUrlToImageFile() { //arrange UrlHelper helper = SetupUrlHelper("/Subtext.Web"); var blog = new Blog {Host = "localhost", Subfolder = "blog1"}; //act string url = helper.ImageGalleryDirectoryUrl(blog, 1234); //assert Assert.AreEqual("/Subtext.Web/images/localhost/Subtext_Web/blog1/1234/", url); } [Test] public void ImageGalleryDirectoryUrl_WithoutAppPathWithSubfolderAndImage_ReturnsUrlToImageFile() { //arrange UrlHelper helper = SetupUrlHelper("/"); var blog = new Blog {Host = "localhost", Subfolder = "blog1"}; //act string url = helper.ImageGalleryDirectoryUrl(blog, 1234); //assert Assert.AreEqual("/images/localhost/blog1/1234/", url); } [Test] public void ImageGalleryDirectoryUrl_WithAppPathWithoutSubfolderAndImage_ReturnsUrlToImageFile() { //arrange UrlHelper helper = SetupUrlHelper("/Subtext.Web"); var blog = new Blog {Host = "localhost", Subfolder = ""}; //act string url = helper.ImageGalleryDirectoryUrl(blog, 1234); //assert Assert.AreEqual("/Subtext.Web/images/localhost/Subtext_Web/1234/", url); } [Test] public void ImageGalleryDirectoryUrl_WithoutAppPathWithoutSubfolderAndImage_ReturnsUrlToImageFile() { //arrange UrlHelper helper = SetupUrlHelper("/"); var blog = new Blog {Host = "localhost", Subfolder = ""}; //act string url = helper.ImageGalleryDirectoryUrl(blog, 1234); //assert Assert.AreEqual("/images/localhost/1234/", url); } [Test] public void ImageDirectoryUrl_WithAppPathWithSubfolderAndImage_ReturnsUrlToImageFile() { //arrange UrlHelper helper = SetupUrlHelper("/Subtext.Web"); var blog = new Blog {Host = "localhost", Subfolder = "blog1"}; //act string url = helper.ImageDirectoryUrl(blog); //assert Assert.AreEqual("/Subtext.Web/images/localhost/Subtext_Web/blog1/", url); } [Test] public void ImageDirectoryUrl_WithoutAppPathWithSubfolderAndImage_ReturnsUrlToImageFile() { //arrange UrlHelper helper = SetupUrlHelper("/"); var blog = new Blog {Host = "localhost", Subfolder = "blog1"}; //act string url = helper.ImageDirectoryUrl(blog); //assert Assert.AreEqual("/images/localhost/blog1/", url); } [Test] public void ImageDirectoryUrl_WithAppPathWithoutSubfolderAndImage_ReturnsUrlToImageFile() { //arrange UrlHelper helper = SetupUrlHelper("/Subtext.Web"); var blog = new Blog {Host = "localhost", Subfolder = ""}; //act string url = helper.ImageDirectoryUrl(blog); //assert Assert.AreEqual("/Subtext.Web/images/localhost/Subtext_Web/", url); } [Test] public void ImageDirectoryUrl_WithoutAppPathWithoutSubfolderAndImage_ReturnsUrlToImageFile() { //arrange UrlHelper helper = SetupUrlHelper("/"); var blog = new Blog {Host = "localhost", Subfolder = ""}; //act string url = helper.ImageDirectoryUrl(blog); //assert Assert.AreEqual("/images/localhost/", url); } [Test] public void AggBugUrl_WithId_ReturnsAggBugUrlWithId() { //arrange UrlHelper helper = SetupUrlHelper("/"); //act string url = helper.AggBugUrl(1234); //assert Assert.AreEqual("/aggbug/1234.aspx", url); } [Test] public void BlogUrl_WithoutSubfolder_ReturnsVirtualPathToBlog() { //arrange UrlHelper helper = SetupUrlHelper("/"); //act string url = helper.BlogUrl(); //assert Assert.AreEqual("/default.aspx", url); } [Test] public void BlogUrl_WithSubfolder_ReturnsVirtualPathToBlogWithSubfolder() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "subfolder"); UrlHelper helper = SetupUrlHelper("/", routeData); //act string url = helper.BlogUrl(); //assert Assert.AreEqual("/subfolder/default.aspx", url); } [Test] public void BlogUrlWithExplicitBlogNotHavingSubfolderAndVirtualPath_WithoutSubfolderInRouteData_ReturnsSubfolder() { //arrange var routeData = new RouteData(); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act string url = helper.BlogUrl(new Blog { Subfolder = null }); //assert Assert.AreEqual("/Subtext.Web/default.aspx", url); } [Test] public void BlogUrlWithExplicitBlogHavingSubfolderAndVirtualPath_WithoutSubfolderInRouteData_ReturnsSubfolder() { //arrange var routeData = new RouteData(); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act string url = helper.BlogUrl(new Blog { Subfolder = "subfolder" }); //assert Assert.AreEqual("/Subtext.Web/subfolder/default.aspx", url); } [Test] public void BlogUrlWithExplicitBlogHavingSubfolder_WithoutSubfolderInRouteData_ReturnsSubfolder() { //arrange var routeData = new RouteData(); UrlHelper helper = SetupUrlHelper("/", routeData); //act string url = helper.BlogUrl(new Blog {Subfolder = "subfolder"}); //assert Assert.AreEqual("/subfolder/default.aspx", url); } [Test] public void BlogUrl_WithSubfolderAndAppPath_ReturnsSubfolder() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "subfolder"); UrlHelper helper = SetupUrlHelper("/App", routeData); //act string url = helper.BlogUrl(); //assert Assert.AreEqual("/App/subfolder/default.aspx", url); } [Test] public void CategoryUrl_ReturnsURlWithCategoryId() { //arrange UrlHelper helper = SetupUrlHelper("/"); //act string url = helper.CategoryUrl(new LinkCategory {Id = 1234}); //assert Assert.AreEqual("/category/1234.aspx", url); } [Test] public void CategoryRssUrl_ReturnsURlWithCategoryIdInQueryString() { UrlHelper helper = SetupUrlHelper("/"); //act string url = helper.CategoryRssUrl(new LinkCategory {Id = 1234}); //assert Assert.AreEqual("/rss.aspx?catId=1234", url); } [Test] public void AdminUrl_WithoutSubfolder_ReturnsCorrectUrl() { UrlHelper helper = SetupUrlHelper("/"); //act string url = helper.AdminUrl("Feedback.aspx", new {status = 2}); //assert Assert.AreEqual("/admin/Feedback.aspx?status=2", url); } [Test] public void AdminUrl_WithSubfolderAndApplicationPath_ReturnsCorrectUrl() { var routeData = new RouteData(); routeData.Values.Add("subfolder", "subfolder"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act string url = helper.AdminUrl("Feedback.aspx", new {status = 2}); //assert Assert.AreEqual("/Subtext.Web/subfolder/admin/Feedback.aspx?status=2", url); } [Test] public void DayUrl_WithDate_ReturnsUrlWithDateInIt() { //arrange UrlHelper helper = SetupUrlHelper("/"); //Make sure date isn't midnight. DateTime dateTime = DateTime.ParseExact("2009/01/23", "yyyy/MM/dd", CultureInfo.InvariantCulture); dateTime.AddMinutes(231); //act string url = helper.DayUrl(dateTime); //assert Assert.AreEqual("/archive/2009/01/23.aspx", url); } [Test] public void RssProxyUrl_WithBlogHavingFeedBurnerName_ReturnsFeedburnerUrl() { //arrange UrlHelper helper = SetupUrlHelper("/"); var blog = new Blog {RssProxyUrl = "test"}; //act Uri url = helper.RssProxyUrl(blog); //assert Assert.AreEqual("http://feedproxy.google.com/test", url.ToString()); } [Test] public void RssProxyUrl_WithBlogHavingSyndicationProviderUrl_ReturnsFullUrl() { //arrange UrlHelper helper = SetupUrlHelper("/"); var blog = new Blog {RssProxyUrl = "http://feeds.example.com/"}; //act Uri url = helper.RssProxyUrl(blog); //assert Assert.AreEqual("http://feeds.example.com/", url.ToString()); } [Test] public void RssUrl_WithoutRssProxy_ReturnsRssUri() { //arrange UrlHelper helper = SetupUrlHelper("/"); var blog = new Blog {Host = "example.com"}; //act Uri url = helper.RssUrl(blog); //assert Assert.AreEqual("http://example.com/rss.aspx", url.ToString()); } [Test] public void RssUrl_ForBlogWithSubfolderWithoutRssProxy_ReturnsRssUri() { //arrange UrlHelper helper = SetupUrlHelper("/Subtext.Web"); var blog = new Blog { Host = "example.com", Subfolder = "blog"}; //act Uri url = helper.RssUrl(blog); //assert Assert.AreEqual("http://example.com/Subtext.Web/blog/rss.aspx", url.ToString()); } [Test] public void RssUrl_WithRssProxy_ReturnsProxyUrl() { //arrange UrlHelper helper = SetupUrlHelper("/"); var blog = new Blog {Host = "example.com", RssProxyUrl = "http://feeds.example.com/feed"}; //act Uri url = helper.RssUrl(blog); //assert Assert.AreEqual("http://feeds.example.com/feed", url.ToString()); } [Test] public void AtomUrl_WithoutRssProxy_ReturnsRssUri() { //arrange UrlHelper helper = SetupUrlHelper("/"); var blog = new Blog {Host = "example.com"}; //act Uri url = helper.AtomUrl(blog); //assert Assert.AreEqual("http://example.com/atom.aspx", url.ToString()); } [Test] public void AtomUrl_WithRssProxy_ReturnsRssUri() { //arrange UrlHelper helper = SetupUrlHelper("/"); var blog = new Blog {Host = "example.com", RssProxyUrl = "http://atom.example.com/atom"}; //act Uri url = helper.AtomUrl(blog); //assert Assert.AreEqual("http://atom.example.com/atom", url.ToString()); } [Test] public void AdminUrl_WithPage_RendersAdminUrlToPage() { //arrange UrlHelper helper = SetupUrlHelper("/"); //act string url = helper.AdminUrl("log.aspx"); //assert Assert.AreEqual("/admin/log.aspx", url); } [Test] public void AdminUrl_WithBlogHavingSubfolder_RendersAdminUrlToPage() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/", routeData); //act string url = helper.AdminUrl("log.aspx"); //assert Assert.AreEqual("/sub/admin/log.aspx", url); } [Test] public void AdminUrl_WithBlogHavingSubfolderAndVirtualPath_RendersAdminUrlToPage() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act string url = helper.AdminUrl("log.aspx"); //assert Assert.AreEqual("/Subtext.Web/sub/admin/log.aspx", url); } [Test] public void AdminRssUrl_WithFeednameAndSubfolderAndApp_ReturnsAdminRssUrl() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act VirtualPath url = helper.AdminRssUrl("Referrers"); //assert Assert.AreEqual("/Subtext.Web/sub/admin/ReferrersRss.axd", url.ToString()); } [Test] public void LoginUrl_WithSubfolderAndApp_ReturnsLoginUrlInSubfolder() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act string url = helper.LoginUrl(); //assert Assert.AreEqual("/Subtext.Web/sub/login.aspx", url); } [Test] public void LoginUrl_WithSubfolderAndAppAndReturnUrl_ReturnsLoginUrlWithReturnUrlInQueryString() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act string url = helper.LoginUrl("/Subtext.Web/AdminPage.aspx").ToString().ToLowerInvariant(); //assert Assert.AreEqual(("/Subtext.Web/sub/login.aspx?ReturnUrl=" + HttpUtility.UrlEncode("/Subtext.Web/AdminPage.aspx")).ToLowerInvariant(), url); } [Test] public void LogoutUrl_WithSubfolderAndApp_ReturnsLoginUrlInSubfolder() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act string url = helper.LogoutUrl(); //assert Assert.AreEqual("/Subtext.Web/sub/account/logout.ashx", url); } [Test] public void LogoutUrl_WithoutSubfolderAndApp_ReturnsLoginUrlInSubfolder() { //arrange var routeData = new RouteData(); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act string url = helper.LogoutUrl(); //assert Assert.AreEqual("/Subtext.Web/account/logout.ashx", url); } [Test] public void ArchivesUrl_WithSubfolderAndApp_ReturnsUrlWithAppAndSubfolder() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act string url = helper.ArchivesUrl(); //assert Assert.AreEqual("/Subtext.Web/sub/archives.aspx", url); } [Test] public void ContactFormUrl_WithSubfolderAndApp_ReturnsUrlWithAppAndSubfolder() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act string url = helper.ContactFormUrl(); //assert Assert.AreEqual("/Subtext.Web/sub/contact.aspx", url); } [Test] public void WlwManifestUrl_WithoutSubfolderWithoutApp_ReturnsPerBlogManifestUrl() { //arrange UrlHelper helper = SetupUrlHelper("/"); //act string manifestUrl = helper.WlwManifestUrl(); //assert Assert.AreEqual("/wlwmanifest.xml.ashx", manifestUrl); } [Test] public void WlwManifestUrl_WithoutSubfolderAndApp_ReturnsPerBlogManifestUrl() { //arrange UrlHelper helper = SetupUrlHelper("/Subtext.Web"); //act string manifestUrl = helper.WlwManifestUrl(); //assert Assert.AreEqual("/Subtext.Web/wlwmanifest.xml.ashx", manifestUrl); } [Test] public void WlwManifestUrl_WithSubfolderAndApp_ReturnsPerBlogManifestUrl() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act string manifestUrl = helper.WlwManifestUrl(); //assert Assert.AreEqual("/Subtext.Web/sub/wlwmanifest.xml.ashx", manifestUrl); } [Test] public void MetaWeblogApiUrl_WithSubfolderAndApp_ReturnsFullyQualifiedUrl() { //arrange var blog = new Blog {Host = "example.com", Subfolder = "sub"}; var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act Uri url = helper.MetaWeblogApiUrl(blog); //assert Assert.AreEqual("http://example.com/Subtext.Web/sub/services/metablogapi.aspx", url.ToString()); } [Test] public void RsdUrl_WithSubfolderAndApp_ReturnsFullyQualifiedUrl() { //arrange var blog = new Blog {Host = "example.com", Subfolder = "sub"}; var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act Uri url = helper.RsdUrl(blog); //assert Assert.AreEqual("http://example.com/Subtext.Web/sub/rsd.xml.ashx", url.ToString()); } [Test] public void CustomCssUrl_WithSubfolderAndApp_ReturnsFullyQualifiedUrl() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act VirtualPath url = helper.CustomCssUrl(); //assert Assert.AreEqual("/Subtext.Web/sub/customcss.aspx", url.ToString()); } [Test] public void TagUrl_WithSubfolderAndApp_ReturnsTagUrl() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act VirtualPath url = helper.TagUrl("tagName"); //assert Assert.AreEqual("/Subtext.Web/sub/tags/tagName/default.aspx", url.ToString()); } [Test] public void TagUrl_CorrectlyEncodesPoundCharacter() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act VirtualPath url = helper.TagUrl("C#"); //assert Assert.AreEqual("/Subtext.Web/sub/tags/C%23/default.aspx", url.ToString()); } [Test] public void TagCloudUrl_WithSubfolderAndApp_ReturnsTagCloudUrl() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act VirtualPath url = helper.TagCloudUrl(); //assert Assert.AreEqual("/Subtext.Web/sub/tags/default.aspx", url.ToString()); } [Test] public void AppRootUrl_WithSubfolder_ReturnsAppRootAndIgnoresSubfolder() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/", routeData); //act VirtualPath url = helper.AppRoot(); //assert Assert.AreEqual("/", url.ToString()); } [Test] public void AppRootUrl_WithSubfolderAndApp_ReturnsAppRootAndIgnoresSubfolder() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act VirtualPath url = helper.AppRoot(); //assert Assert.AreEqual("/Subtext.Web/", url.ToString()); } [Test] public void EditIcon_WithSubfolderAndApp_ReturnsAppRootAndIgnoresSubfolder() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act VirtualPath url = helper.EditIconUrl(); //assert Assert.AreEqual("/Subtext.Web/images/icons/edit.gif", url.ToString()); } [Test] public void HostAdminUrl_WithBlogHavingSubfolder_RendersUrlToHostAdmin() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/", routeData); //act string url = helper.HostAdminUrl("default.aspx"); //assert Assert.AreEqual("/hostadmin/default.aspx", url); } [Test] public void HostAdminUrl_WithAppPathAndBlogHavingSubfolder_RendersUrlToHostAdmin() { //arrange var routeData = new RouteData(); routeData.Values.Add("subfolder", "sub"); UrlHelper helper = SetupUrlHelper("/Subtext.Web", routeData); //act string url = helper.HostAdminUrl("default.aspx"); //assert Assert.AreEqual("/Subtext.Web/hostadmin/default.aspx", url); } private static UrlHelper SetupUrlHelper(string appPath) { return SetupUrlHelper(appPath, new RouteData()); } private static UrlHelper SetupUrlHelper(string appPath, RouteData routeData) { return UnitTestHelper.SetupUrlHelper(appPath, routeData); } [RowTest] [Row("http://www.google.com/search?q=asp.net+mvc&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a", "asp.net mvc")] [Row("http://it.search.yahoo.com/search;_ylt=A03uv8bsRjNLZ0ABugAbDQx.?p=asp.net+mvc&fr2=sb-top&fr=yfp-t-709&rd=r1&sao=1", "asp.net mvc")] [Row("http://www.google.com/#hl=en&source=hp&q=asp.net+mvc&btnG=Google+Search&aq=0p&aqi=g-p3g7&oq=as&fp=cbc2f75bf9d43a8f", "asp.net mvc")] [Row("http://www.bing.com/search?q=asp.net+mvc&go=&form=QBLH&filt=all", "asp.net mvc")] [Row("http://www.google.com/search?hl=en&safe=off&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=MUl&q=%22asp.net+mvc%22&aq=f&oq=&aqi=g-p3g7", "\"asp.net mvc\"")] [Row("http://codeclimber.net.nz/search.aspx?q=%22asp.net%20mvc%22", "")] [Row("http://www.google.it/search?rlz=1C1GGLS_enIT354IT354&sourceid=chrome&ie=UTF-8&q=site:http://haacked.com/+water+birth", "water birth")] [Row("http://www.google.it/search?rlz=1C1GGLS_enIT354IT354&sourceid=chrome&ie=UTF-8&q=site:https://haacked.com/+water+birth", "water birth")] [Row("http://www.google.it/search?rlz=1C1GGLS_enIT354IT354&sourceid=chrome&ie=UTF-8&q=water+birth+site:https://haacked.com/", "water birth")] public void UrlHelper_ExtractKeywordsFromReferrer_ParsesCorrectly(string referralUrl, string expectedResult) { Uri referrer = new Uri(referralUrl); Uri currentPath = new Uri("http://codeclimber.net.nz/archive/2009/05/20/book-review-asp.net-mvc-1.0-quickly.aspx"); string query = UrlHelper.ExtractKeywordsFromReferrer(referrer, currentPath); Assert.AreEqual(expectedResult, query); } } }
33.235251
178
0.563561
[ "MIT", "BSD-3-Clause" ]
Dashboard-X/SubText-2.5.2.0.src
UnitTests.Subtext/Framework/Routing/UrlHelperTests.cs
45,067
C#
using System.Collections.Generic; using System.Collections.Immutable; using System.Text.RegularExpressions; using Microsoft.Recognizers.Definitions.Japanese; namespace Microsoft.Recognizers.Text.Number.Japanese { public class PercentageExtractor : BaseNumberExtractor { internal sealed override ImmutableDictionary<Regex, TypeTag> Regexes { get; } protected sealed override string ExtractType { get; } = Constants.SYS_NUM_PERCENTAGE; public PercentageExtractor() { var regexes = new Dictionary<Regex, TypeTag> { { // 百パーセント 十五パーセント new Regex(NumbersDefinitions.SimplePercentageRegex, RegexOptions.Singleline), RegexTagGenerator.GenerateRegexTag(Constants.PERCENT_PREFIX, Constants.JAPANESE) }, { // 19パーセント 1パーセント new Regex(NumbersDefinitions.NumbersPercentagePointRegex, RegexOptions.Singleline), RegexTagGenerator.GenerateRegexTag(Constants.PERCENT_PREFIX, Constants.NUMBER_SUFFIX) }, { // 3,000パーセント 1,123パーセント new Regex(NumbersDefinitions.NumbersPercentageWithSeparatorRegex, RegexOptions.Singleline), RegexTagGenerator.GenerateRegexTag(Constants.PERCENT_PREFIX, Constants.NUMBER_SUFFIX) }, { // 3.2 k パーセント new Regex(NumbersDefinitions.NumbersPercentageWithMultiplierRegex, RegexOptions.Singleline), RegexTagGenerator.GenerateRegexTag(Constants.PERCENT_PREFIX, Constants.NUMBER_SUFFIX) } , { // 15kパーセント new Regex(NumbersDefinitions.SimpleNumbersPercentageWithMultiplierRegex, RegexOptions.Singleline), RegexTagGenerator.GenerateRegexTag(Constants.PERCENT_PREFIX, Constants.NUMBER_SUFFIX) }, { // @TODO Example missing new Regex(NumbersDefinitions.SimpleIntegerPercentageRegex, RegexOptions.Singleline), RegexTagGenerator.GenerateRegexTag(Constants.PERCENT_PREFIX, Constants.NUMBER_SUFFIX) }, { // 2割引 2.5割引 new Regex(NumbersDefinitions.NumbersFoldsPercentageRegex, RegexOptions.Singleline), RegexTagGenerator.GenerateRegexTag(Constants.PERCENT_PREFIX, Constants.SPECIAL_SUFFIX) }, { // 三割引 六点五折 七五折 new Regex(NumbersDefinitions.FoldsPercentageRegex, RegexOptions.Singleline), RegexTagGenerator.GenerateRegexTag(Constants.PERCENT_PREFIX, Constants.SPECIAL_SUFFIX) }, { // 5割 7割半 new Regex(NumbersDefinitions.SimpleFoldsPercentageRegex, RegexOptions.Singleline), RegexTagGenerator.GenerateRegexTag(Constants.PERCENT_PREFIX, Constants.SPECIAL_SUFFIX) }, { // 七割半 new Regex(NumbersDefinitions.SpecialsPercentageRegex, RegexOptions.Singleline), RegexTagGenerator.GenerateRegexTag(Constants.PERCENT_PREFIX, Constants.SPECIAL_SUFFIX) }, { // 2割 2.5割 new Regex(NumbersDefinitions.NumbersSpecialsPercentageRegex, RegexOptions.Singleline), RegexTagGenerator.GenerateRegexTag(Constants.PERCENT_PREFIX, Constants.SPECIAL_SUFFIX) }, { // 三割 new Regex(NumbersDefinitions.SimpleSpecialsPercentageRegex, RegexOptions.Singleline), RegexTagGenerator.GenerateRegexTag(Constants.PERCENT_PREFIX, Constants.SPECIAL_SUFFIX) }, { // @TODO Example missing new Regex(NumbersDefinitions.SpecialsFoldsPercentageRegex, RegexOptions.Singleline), RegexTagGenerator.GenerateRegexTag(Constants.PERCENT_PREFIX, Constants.SPECIAL_SUFFIX) } }; Regexes = regexes.ToImmutableDictionary(); } } }
48.164835
118
0.593429
[ "MIT" ]
Irrelevances/Recognizers-Text
.NET/Microsoft.Recognizers.Text.Number/Japanese/Extractors/PercentageExtractor.cs
4,541
C#
using Microsoft.AspNetCore.Builder; namespace MyServerRenderedPortal { public static class SecurityHeadersDefinitions { public static HeaderPolicyCollection GetHeaderPolicyCollection(bool isDev) { var policy = new HeaderPolicyCollection() .AddFrameOptionsDeny() .AddXssProtectionBlock() .AddContentTypeOptionsNoSniff() .AddReferrerPolicyStrictOriginWhenCrossOrigin() .RemoveServerHeader() .AddCrossOriginOpenerPolicy(builder => { builder.SameOrigin(); }) .AddCrossOriginEmbedderPolicy(builder => { builder.RequireCorp(); }) .AddCrossOriginResourcePolicy(builder => { builder.SameOrigin(); }) .AddContentSecurityPolicy(builder => { builder.AddObjectSrc().None(); builder.AddBlockAllMixedContent(); builder.AddImgSrc().Self().From("data:"); builder.AddFormAction().Self(); builder.AddFontSrc().Self(); builder.AddStyleSrc().Self(); // .UnsafeInline(); builder.AddBaseUri().Self(); builder.AddScriptSrc().UnsafeInline().WithNonce(); builder.AddFrameAncestors().None(); // builder.AddCustomDirective("require-trusted-types-for", "'script'"); }) .RemoveServerHeader() .AddPermissionsPolicy(builder => { builder.AddAccelerometer().None(); builder.AddAutoplay().None(); builder.AddCamera().None(); builder.AddEncryptedMedia().None(); builder.AddFullscreen().All(); builder.AddGeolocation().None(); builder.AddGyroscope().None(); builder.AddMagnetometer().None(); builder.AddMicrophone().None(); builder.AddMidi().None(); builder.AddPayment().None(); builder.AddPictureInPicture().None(); builder.AddSyncXHR().None(); builder.AddUsb().None(); }); if (!isDev) { // maxage = one year in seconds policy.AddStrictTransportSecurityMaxAgeIncludeSubDomains(maxAgeInSeconds: 60 * 60 * 24 * 365); } return policy; } } }
40.275362
111
0.473192
[ "MIT" ]
damienbod/AzureAD-Auth-MyUI-with-MyAPI
MyServerRenderedPortal/SecurityHeadersDefinitions.cs
2,781
C#
using System; using System.Collections.Generic; using System.Text; namespace AwesomeCMSCore.Modules.Admin.ViewModels { public class SocialProfileSettings { public string ProfileFacebook { get; set; } public string Twitter { get; set; } public string GooglePlus { get; set; } public string Instagram { get; set; } public string Linkedin { get; set; } public string Youtube { get; set; } public string FacebookPage { get; set; } } }
24.944444
49
0.726058
[ "Apache-2.0" ]
AliDoganKim/Awesome-CMS-Core
src/AwesomeCMSCore/Modules/AwesomeCMSCore.Modules.Admin/ViewModels/SocialProfileSettings.cs
449
C#
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace NFKDemoAdapter { /// <summary> /// https://stackoverflow.com/questions/46013287/c-sharp-global-keyboard-hook-that-opens-a-form-from-a-console-application /// </summary> public class LowLevelKeyboardHook { private const int WH_KEYBOARD_LL = 13; private const int WM_KEYDOWN = 0x0100; private const int WM_SYSKEYDOWN = 0x0104; private const int WM_KEYUP = 0x101; private const int WM_SYSKEYUP = 0x105; [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern IntPtr SetWindowsHookEx(int idHook, LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId); [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool UnhookWindowsHookEx(IntPtr hhk); [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam); [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern IntPtr GetModuleHandle(string lpModuleName); public delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam); public event EventHandler<Keys> OnKeyPressed; public event EventHandler<Keys> OnKeyUnpressed; private LowLevelKeyboardProc _proc; private IntPtr _hookID = IntPtr.Zero; public LowLevelKeyboardHook() { _proc = HookCallback; } public void HookKeyboard() { _hookID = SetHook(_proc); } public void UnHookKeyboard() { UnhookWindowsHookEx(_hookID); } private IntPtr SetHook(LowLevelKeyboardProc proc) { using (Process curProcess = Process.GetCurrentProcess()) using (ProcessModule curModule = curProcess.MainModule) { return SetWindowsHookEx(WH_KEYBOARD_LL, proc, GetModuleHandle(curModule.ModuleName), 0); } } private IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN || wParam == (IntPtr)WM_SYSKEYDOWN) { int vkCode = Marshal.ReadInt32(lParam); if (OnKeyPressed != null) OnKeyPressed.Invoke(this, ((Keys)vkCode)); } else if (nCode >= 0 && wParam == (IntPtr)WM_KEYUP || wParam == (IntPtr)WM_SYSKEYUP) { int vkCode = Marshal.ReadInt32(lParam); if (OnKeyUnpressed != null) OnKeyUnpressed.Invoke(this, ((Keys)vkCode)); } return CallNextHookEx(_hookID, nCode, wParam, lParam); } } }
35.454545
126
0.628526
[ "MIT" ]
NeedForKillTheGame/ndm-adapter
NFKDemoAdapter/LowLevelKeyboardHook.cs
3,122
C#
using System; namespace HelloWorld { public class Program { public static void Main(string[] args) { Console.WriteLine("Hello, World!"); } } }
15.769231
48
0.507317
[ "MIT" ]
Restitutor-Orbis/BDSA-Exercises
w01/HelloWorld/HelloWorld/Program.cs
207
C#
// // BinarySecretKeyIdentifierClause.cs // // Author: // Atsushi Enomoto <atsushi@ximian.com> // // Copyright (C) 2006 Novell, Inc. http://www.novell.com // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using System.Xml; using System.IdentityModel.Policy; using System.IdentityModel.Tokens; namespace System.ServiceModel.Security { public class BinarySecretKeyIdentifierClause : BinaryKeyIdentifierClause { public BinarySecretKeyIdentifierClause (byte [] key) : this (key, true) { } [MonoTODO ("ClauseType")] public BinarySecretKeyIdentifierClause (byte [] key, bool cloneBuffer) : base ("", key, cloneBuffer) { } [MonoTODO ("ClauseType")] public BinarySecretKeyIdentifierClause (byte [] key, bool cloneBuffer, byte [] derivationNonce, int derivationLength) : base ("", key, cloneBuffer, derivationNonce, derivationLength) { } public override bool CanCreateKey { get { return true; } } public byte [] GetKeyBytes () { return GetBuffer (); } public override SecurityKey CreateKey () { return new InMemorySymmetricSecurityKey (GetRawBuffer (), true); } public override bool Matches (SecurityKeyIdentifierClause clause) { if (clause == null) throw new ArgumentNullException ("clause"); BinarySecretKeyIdentifierClause other = clause as BinarySecretKeyIdentifierClause; if (other == null) return false; byte [] b1 = GetRawBuffer (); byte [] b2 = other.GetRawBuffer (); if (b1.Length != b2.Length) return false; for (int i = 0; i < b1.Length; i++) if (b1 [i] != b2 [i]) return false; return true; } } }
30.715909
119
0.721051
[ "Apache-2.0" ]
121468615/mono
mcs/class/System.ServiceModel/System.ServiceModel.Security/BinarySecretKeyIdentifierClause.cs
2,703
C#
// c:\program files (x86)\windows kits\10\include\10.0.18362.0\um\d3d12.h(16400,1) namespace DirectN { public enum D3D12_AXIS_SHADING_RATE { D3D12_AXIS_SHADING_RATE_1X = 0, D3D12_AXIS_SHADING_RATE_2X = 1, D3D12_AXIS_SHADING_RATE_4X = 2, } }
25.272727
83
0.679856
[ "MIT" ]
bbday/DirectN
DirectN/DirectN/Generated/D3D12_AXIS_SHADING_RATE.cs
280
C#
//---------------------------------------------- // Flip Web Apps: Game Framework // Copyright © 2016 Flip Web Apps / Mark Hewitt // // Please direct any bugs/comments/suggestions to http://www.flipwebapps.com // // The copyright owner grants to the end user a non-exclusive, worldwide, and perpetual license to this Asset // to integrate only as incorporated and embedded components of electronic games and interactive media and // distribute such electronic game and interactive media. End user may modify Assets. End user may otherwise // not reproduce, distribute, sublicense, rent, lease or lend the Assets. It is emphasized that the end // user shall not be entitled to distribute or transfer in any way (including, without, limitation by way of // sublicense) the Assets in any other way than as integrated components of electronic games and interactive media. // The above copyright notice and this permission notice must not be removed from any files. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. //---------------------------------------------- using GameFramework.Preferences; using UnityEngine; namespace GameFramework.GameObjects.Components.AbstractClasses { /// <summary> /// An abstract class to run something one time only. /// </summary> /// Override and implement the condition as you best see fit. public abstract class RunOnce : RunOnState { /// <summary> /// A unique PlayerPrefs key that identifies this instance. /// </summary> [Tooltip("A unique PlayerPrefs key that identifies this instance.")] public string Key; /// <summary> /// A key for a seperate instance that we should run after. /// </summary> [Tooltip("A key for a seperate instance that we should run after.")] public string EnableAfterKey; /// <summary> /// Calculates whether we need to run once or have already done so. In derived classes override RunOnce instead. /// </summary> public override void RunMethod() { if (PreferencesFactory.CheckAndSetFlag(Key, EnableAfterKey)) RunOnceMethod(); } /// <summary> /// Implement this as the method that should be run one time only /// </summary> public abstract void RunOnceMethod(); } }
46.333333
123
0.677338
[ "Unlicense" ]
FlipWebApps/GameFramework
Scripts/GameObjects/Components/AbstractClasses/RunOnce.cs
2,783
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview { using static Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Extensions; /// <summary>An authentication key.</summary> public partial class AuthenticationKeys { /// <summary> /// <c>AfterFromJson</c> will be called after the json deserialization has finished, allowing customization of the object /// before it is returned. Implement this method in a partial class to enable this behavior /// </summary> /// <param name="json">The JsonNode that should be deserialized into this object.</param> partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonObject json); /// <summary> /// <c>AfterToJson</c> will be called after the json serialization has finished, allowing customization of the <see cref="Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonObject" /// /> before it is returned. Implement this method in a partial class to enable this behavior /// </summary> /// <param name="container">The JSON container that the serialization result will be placed in.</param> partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonObject container); /// <summary> /// <c>BeforeFromJson</c> will be called before the json deserialization has commenced, allowing complete customization of /// the object before it is deserialized. /// If you wish to disable the default deserialization entirely, return <c>true</c> in the <paramref name= "returnNow" /> /// output parameter. /// Implement this method in a partial class to enable this behavior. /// </summary> /// <param name="json">The JsonNode that should be deserialized into this object.</param> /// <param name="returnNow">Determines if the rest of the deserialization should be processed, or if the method should return /// instantly.</param> partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonObject json, ref bool returnNow); /// <summary> /// <c>BeforeToJson</c> will be called before the json serialization has commenced, allowing complete customization of the /// object before it is serialized. /// If you wish to disable the default serialization entirely, return <c>true</c> in the <paramref name="returnNow" /> output /// parameter. /// Implement this method in a partial class to enable this behavior. /// </summary> /// <param name="container">The JSON container that the serialization result will be placed in.</param> /// <param name="returnNow">Determines if the rest of the serialization should be processed, or if the method should return /// instantly.</param> partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonObject container, ref bool returnNow); /// <summary> /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonObject into a new instance of <see cref="AuthenticationKeys" />. /// </summary> /// <param name="json">A Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonObject instance to deserialize from.</param> internal AuthenticationKeys(Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonObject json) { bool returnNow = false; BeforeFromJson(json, ref returnNow); if (returnNow) { return; } {_authKey1 = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonString>("authKey1"), out var __jsonAuthKey1) ? (string)__jsonAuthKey1 : (string)AuthKey1;} {_authKey2 = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonString>("authKey2"), out var __jsonAuthKey2) ? (string)__jsonAuthKey2 : (string)AuthKey2;} AfterFromJson(json); } /// <summary> /// Deserializes a <see cref="Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonNode"/> into an instance of Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.IAuthenticationKeys. /// </summary> /// <param name="node">a <see cref="Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonNode" /> to deserialize from.</param> /// <returns> /// an instance of Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.IAuthenticationKeys. /// </returns> public static Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Models.Api20220330Preview.IAuthenticationKeys FromJson(Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonNode node) { return node is Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonObject json ? new AuthenticationKeys(json) : null; } /// <summary> /// Serializes this instance of <see cref="AuthenticationKeys" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonNode" />. /// </summary> /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonObject"/> container to serialize this object into. If the caller /// passes in <c>null</c>, a new instance will be created and returned to the caller.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.SerializationMode"/>.</param> /// <returns> /// a serialized instance of <see cref="AuthenticationKeys" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonNode" />. /// </returns> public Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.SerializationMode serializationMode) { container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonObject(); bool returnNow = false; BeforeToJson(ref container, ref returnNow); if (returnNow) { return container; } AddIf( null != (((object)this._authKey1)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonString(this._authKey1.ToString()) : null, "authKey1" ,container.Add ); AddIf( null != (((object)this._authKey2)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.DataMigration.Runtime.Json.JsonString(this._authKey2.ToString()) : null, "authKey2" ,container.Add ); AfterToJson(ref container); return container; } } }
69.890909
282
0.693678
[ "MIT" ]
AlanFlorance/azure-powershell
src/DataMigration/DataMigration.Autorest/generated/api/Models/Api20220330Preview/AuthenticationKeys.json.cs
7,579
C#
using System; using System.Linq; using System.Linq.Expressions; namespace Contracts.Repositories { /// <summary> /// Represents the base repository contract. /// </summary> /// <typeparam name="T"></typeparam> public interface IRepositoryBase<T> { /// <summary> /// Find all elements. /// </summary> /// <param name="trackChanges"></param> /// <returns></returns> IQueryable<T> FindAll(bool trackChanges); /// <summary> /// Find all elements which matches the condition. /// </summary> /// <param name="expression"></param> /// <param name="trackChanges"></param> /// <returns></returns> IQueryable<T> FindByCondition(Expression<Func<T, bool>> expression, bool trackChanges); /// <summary> /// Create element. /// </summary> /// <param name="entity"></param> void Create(T entity); /// <summary> /// Update element. /// </summary> /// <param name="entity"></param> void Update(T entity); /// <summary> /// Delete element. /// </summary> /// <param name="entity"></param> void Delete(T entity); } }
23.173913
89
0.626642
[ "MIT" ]
Thibaud-Ier/BooksChallenge-
BooksChallenge/Contracts/Repositories/IRepositoryBase.cs
1,068
C#
/* * eZmax API Definition (Full) * * This API expose all the functionnalities for the eZmax and eZsign applications. * * The version of the OpenAPI document: 1.1.7 * Contact: support-api@ezmax.ca * Generated by: https://github.com/openapitools/openapi-generator.git */ using System; using System.IO; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Reflection; using RestSharp; using Xunit; using eZmaxApi.Client; using eZmaxApi.Api; // uncomment below to import models //using eZmaxApi.Model; namespace eZmaxApi.Test.Api { /// <summary> /// Class for testing ObjectEzsigntsarequirementApi /// </summary> /// <remarks> /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the API endpoint. /// </remarks> public class ObjectEzsigntsarequirementApiTests : IDisposable { private ObjectEzsigntsarequirementApi instance; public ObjectEzsigntsarequirementApiTests() { instance = new ObjectEzsigntsarequirementApi(); } public void Dispose() { // Cleanup when everything is done. } /// <summary> /// Test an instance of ObjectEzsigntsarequirementApi /// </summary> [Fact] public void InstanceTest() { // TODO uncomment below to test 'IsType' ObjectEzsigntsarequirementApi //Assert.IsType<ObjectEzsigntsarequirementApi>(instance); } /// <summary> /// Test EzsigntsarequirementGetAutocompleteV1 /// </summary> [Fact] public void EzsigntsarequirementGetAutocompleteV1Test() { // TODO uncomment below to test the method and replace null with proper value //string sSelector = null; //int? fkiEzsignfoldertypeID = null; //string sQuery = null; //HeaderAcceptLanguage? acceptLanguage = null; //var response = instance.EzsigntsarequirementGetAutocompleteV1(sSelector, fkiEzsignfoldertypeID, sQuery, acceptLanguage); //Assert.IsType<CommonGetAutocompleteDisabledV1Response>(response); } } }
30.756757
134
0.660369
[ "MIT" ]
ezmaxinc/eZmax-SDK-csharp-netcore
src/eZmaxApi.Test/Api/ObjectEzsigntsarequirementApiTests.cs
2,276
C#
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ // **NOTE** This file was generated by a tool and any changes will be overwritten. // <auto-generated/> // Template Source: EnumType.cs.tt namespace Microsoft.Graph { using System.Text.Json.Serialization; /// <summary> /// The enum AdvancedConfigState. /// </summary> [JsonConverter(typeof(JsonStringEnumConverter))] public enum AdvancedConfigState { /// <summary> /// Default /// </summary> Default = 0, /// <summary> /// Enabled /// </summary> Enabled = 1, /// <summary> /// Disabled /// </summary> Disabled = 2, /// <summary> /// Unknown Future Value /// </summary> UnknownFutureValue = 3, } }
24.840909
153
0.481244
[ "MIT" ]
ScriptBox21/msgraph-sdk-dotnet
src/Microsoft.Graph/Generated/model/AdvancedConfigState.cs
1,093
C#
using FaceRecognition.ViewModel.CustomEventArgs; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; namespace FaceRecognition.Test { /// <summary> ///This is a test class for TrainSuccessEventArgsTest and is intended ///to contain all TrainSuccessEventArgsTest Unit Tests ///</summary> [TestClass()] public class TrainSuccessEventArgsTest { private TestContext testContextInstance; /// <summary> ///Gets or sets the test context which provides ///information about and functionality for the current test run. ///</summary> public TestContext TestContext { get { return testContextInstance; } set { testContextInstance = value; } } #region Additional test attributes // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class //[ClassInitialize()] //public static void MyClassInitialize(TestContext testContext) //{ //} // //Use ClassCleanup to run code after all tests in a class have run //[ClassCleanup()] //public static void MyClassCleanup() //{ //} // //Use TestInitialize to run code before running each test //[TestInitialize()] //public void MyTestInitialize() //{ //} // //Use TestCleanup to run code after each test has run //[TestCleanup()] //public void MyTestCleanup() //{ //} // #endregion /// <summary> ///A test for TrainSuccessEventArgs Constructor ///</summary> [TestMethod()] public void TrainSuccessEventArgsConstructorTest() { bool isSuccess = false; // TODO: Initialize to an appropriate value TrainSuccessEventArgs target = new TrainSuccessEventArgs(isSuccess); Assert.Inconclusive("TODO: Implement code to verify target"); } /// <summary> ///A test for IsSuccess ///</summary> [TestMethod()] [DeploymentItem("FaceRecognition.exe")] public void IsSuccessTest() { PrivateObject param0 = null; // TODO: Initialize to an appropriate value TrainSuccessEventArgs_Accessor target = new TrainSuccessEventArgs_Accessor(param0); // TODO: Initialize to an appropriate value bool expected = false; // TODO: Initialize to an appropriate value bool actual; target.IsSuccess = expected; actual = target.IsSuccess; Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); } } }
31.71875
140
0.565517
[ "Apache-2.0" ]
EugeneBichel/Face-Recognition-Using-Neural-Networks-My-graduate-Project
FaceRecognition/FaceRecognition.Test/TrainSuccessEventArgsTest.cs
3,047
C#
//------------------------------------------------------------------------------ // <auto-generated> // Generated by the MSBuild WriteCodeFragment class. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Dochub.Console")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] [assembly: System.Reflection.AssemblyProductAttribute("Dochub.Console")] [assembly: System.Reflection.AssemblyTitleAttribute("Dochub.Console")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
47.235294
80
0.641345
[ "MIT" ]
cameronharp/dochub
tools/src/Dochub.Console/obj/Release/netcoreapp2.0/Dochub.Console.AssemblyInfo.cs
803
C#
///----------------------------------------------------------------- /// Class: BlurController /// Description: Created by Unity, edited by VC. /// Author: VueCode /// GitHub: https://github.com/ivuecode/ ///----------------------------------------------------------------- using UnityEngine; [ExecuteInEditMode] public class BlurController : MonoBehaviour { [Header("Blue Settings")] public int iterations = 3; // Blur iterations - larger number means more blur. public float blurSpread = 0.6f; // Blur spread for each iteration. Lower values give better looking blur. static Material m_Material = null; protected Material material { get { if (m_Material == null) { m_Material = new Material(blurShader) { hideFlags = HideFlags.DontSave }; } return m_Material; } } public Shader blurShader = null; // The blur iteration shader just takes 4 texture samples and averages them. // By applying it repeatedly and spreading out sample locations // we get a Gaussian blur approximation. // Performs one blur iteration. public void FourTapCone(RenderTexture source, RenderTexture dest, int iteration) { float off = 0.5f + iteration * blurSpread; Graphics.BlitMultiTap(source, dest, material, new Vector2(-off, -off), new Vector2(-off, off), new Vector2(off, off), new Vector2(off, -off)); } // Downsamples the texture to a quarter resolution. private void DownSample4x(RenderTexture source, RenderTexture dest) { float off = 1.0f; Graphics.BlitMultiTap(source, dest, material, new Vector2(-off, -off), new Vector2(-off, off), new Vector2(off, off), new Vector2(off, -off)); } // Called by the camera to apply the image effect void OnRenderImage(RenderTexture source, RenderTexture destination) { int rtW = source.width / 4; int rtH = source.height / 4; RenderTexture buffer = RenderTexture.GetTemporary(rtW, rtH, 0); // Copy source to the 4x4 smaller texture. DownSample4x(source, buffer); // Blur the small texture for (int i = 0; i < iterations; i++) { RenderTexture buffer2 = RenderTexture.GetTemporary(rtW, rtH, 0); FourTapCone(buffer, buffer2, i); RenderTexture.ReleaseTemporary(buffer); buffer = buffer2; } Graphics.Blit(buffer, destination); RenderTexture.ReleaseTemporary(buffer); } }
43.30303
164
0.541638
[ "MIT" ]
rafavla32/flail
Assets/scripts/vuecode/BlurController.cs
2,858
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.TestPlatform.ObjectModel; /// <summary> /// Represents the outcomes of a test case. /// </summary> public enum TestOutcome { /// <summary> /// Test Case Does Not Have an outcome. /// </summary> None = 0, /// <summary> /// Test Case Passed /// </summary> Passed = 1, /// <summary> /// Test Case Failed /// </summary> Failed = 2, /// <summary> /// Test Case Skipped /// </summary> Skipped = 3, /// <summary> /// Test Case Not found /// </summary> NotFound = 4, }
21.2
101
0.59434
[ "MIT" ]
lbussell/vstest
src/Microsoft.TestPlatform.ObjectModel/TestOutcome.cs
742
C#
using System; using Microsoft.EntityFrameworkCore.Migrations; namespace Asp.net_Core_Project.Data.Migrations { public partial class AddingBarsAndComments : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Bars", columns: table => new { Id = table.Column<int>(nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Name = table.Column<string>(nullable: true), ImageUrl = table.Column<string>(nullable: true), Town = table.Column<string>(nullable: true), Address = table.Column<string>(nullable: true), UserId = table.Column<string>(nullable: true), DateAdded = table.Column<DateTime>(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Bars", x => x.Id); table.ForeignKey( name: "FK_Bars_AspNetUsers_UserId", column: x => x.UserId, principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "Comments", columns: table => new { Id = table.Column<int>(nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Content = table.Column<string>(nullable: true), DateAdded = table.Column<DateTime>(nullable: false), BarIdId = table.Column<int>(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Comments", x => x.Id); table.ForeignKey( name: "FK_Comments_Bars_BarIdId", column: x => x.BarIdId, principalTable: "Bars", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_Bars_UserId", table: "Bars", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_Comments_BarIdId", table: "Comments", column: "BarIdId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Comments"); migrationBuilder.DropTable( name: "Bars"); } } }
37.842105
72
0.473227
[ "MIT" ]
Xtreller/ShishaWeb-Asp.NetCore
Data/Migrations/20200420112248_AddingBarsAndComments.cs
2,878
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osuTK; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using osu.Game.Rulesets; using osu.Game.Users; namespace osu.Game.Overlays.Profile.Sections { public class PaginatedContainer : FillFlowContainer { protected readonly FillFlowContainer ItemsContainer; protected readonly OsuHoverContainer ShowMoreButton; protected readonly LoadingAnimation ShowMoreLoading; protected readonly OsuSpriteText MissingText; protected int VisiblePages; protected int ItemsPerPage; protected readonly Bindable<User> User = new Bindable<User>(); protected APIAccess Api; protected APIRequest RetrievalRequest; protected RulesetStore Rulesets; public PaginatedContainer(Bindable<User> user, string header, string missing) { User.BindTo(user); RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Direction = FillDirection.Vertical; Children = new Drawable[] { new OsuSpriteText { Text = header, Font = OsuFont.GetFont(size: 15, weight: FontWeight.Regular, italics: true), Margin = new MarginPadding { Top = 10, Bottom = 10 }, }, ItemsContainer = new FillFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Margin = new MarginPadding { Bottom = 10 } }, ShowMoreButton = new OsuHoverContainer { Alpha = 0, Action = ShowMore, AutoSizeAxes = Axes.Both, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Child = new OsuSpriteText { Font = OsuFont.GetFont(size: 14), Text = "show more", Padding = new MarginPadding { Vertical = 10, Horizontal = 15 }, } }, ShowMoreLoading = new LoadingAnimation { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Size = new Vector2(14), }, MissingText = new OsuSpriteText { Font = OsuFont.GetFont(size: 14), Text = missing, Alpha = 0, }, }; } [BackgroundDependencyLoader] private void load(APIAccess api, RulesetStore rulesets) { Api = api; Rulesets = rulesets; User.ValueChanged += onUserChanged; User.TriggerChange(); } private void onUserChanged(ValueChangedEvent<User> e) { VisiblePages = 0; ItemsContainer.Clear(); ShowMoreButton.Hide(); if (e.NewValue != null) ShowMore(); } protected virtual void ShowMore() { ShowMoreLoading.Show(); ShowMoreButton.Hide(); } } }
33.20354
97
0.517857
[ "MIT" ]
Pengulon/osu
osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs
3,642
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Threading; using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; using Azure.Storage.Blobs.Models; using Azure.Storage.Blobs.Specialized; using Azure.Storage.Cryptography; using Metadata = System.Collections.Generic.IDictionary<string, string>; namespace Azure.Storage.Blobs { /// <summary> /// The <see cref="BlobContainerClient"/> allows you to manipulate Azure /// Storage containers and their blobs. /// </summary> public class BlobContainerClient { /// <summary> /// The Azure Storage name used to identify a storage account's root container. /// </summary> public static readonly string RootBlobContainerName = Constants.Blob.Container.RootName; /// <summary> /// The Azure Storage name used to identify a storage account's logs container. /// </summary> public static readonly string LogsBlobContainerName = Constants.Blob.Container.LogsName; /// <summary> /// The Azure Storage name used to identify a storage account's web content container. /// </summary> public static readonly string WebBlobContainerName = Constants.Blob.Container.WebName; #pragma warning disable IDE0032 // Use auto property /// <summary> /// Gets the container's primary <see cref="Uri"/> endpoint. /// </summary> private readonly Uri _uri; #pragma warning restore IDE0032 // Use auto property /// <summary> /// Gets the container's primary <see cref="Uri"/> endpoint. /// </summary> public virtual Uri Uri => _uri; /// <summary> /// The <see cref="HttpPipeline"/> transport pipeline used to send /// every request. /// </summary> private readonly HttpPipeline _pipeline; /// <summary> /// The <see cref="HttpPipeline"/> transport pipeline used to send /// every request. /// </summary> internal virtual HttpPipeline Pipeline => _pipeline; /// <summary> /// The version of the service to use when sending requests. /// </summary> private readonly BlobClientOptions.ServiceVersion _version; /// <summary> /// The version of the service to use when sending requests. /// </summary> internal virtual BlobClientOptions.ServiceVersion Version => _version; /// <summary> /// The <see cref="ClientDiagnostics"/> instance used to create diagnostic scopes /// every request. /// </summary> private readonly ClientDiagnostics _clientDiagnostics; /// <summary> /// The <see cref="ClientDiagnostics"/> instance used to create diagnostic scopes /// every request. /// </summary> internal virtual ClientDiagnostics ClientDiagnostics => _clientDiagnostics; /// <summary> /// The <see cref="CustomerProvidedKey"/> to be used when sending requests. /// </summary> internal readonly CustomerProvidedKey? _customerProvidedKey; /// <summary> /// The <see cref="CustomerProvidedKey"/> to be used when sending requests. /// </summary> internal virtual CustomerProvidedKey? CustomerProvidedKey => _customerProvidedKey; /// <summary> /// The <see cref="ClientSideEncryptionOptions"/> to be used when sending/receiving requests. /// </summary> private readonly ClientSideEncryptionOptions _clientSideEncryption; /// <summary> /// The <see cref="ClientSideEncryptionOptions"/> to be used when sending/receiving requests. /// </summary> internal virtual ClientSideEncryptionOptions ClientSideEncryption => _clientSideEncryption; /// <summary> /// The <see cref="EncryptionScope"/> to be used when sending requests. /// </summary> internal readonly string _encryptionScope; /// <summary> /// The <see cref="EncryptionScope"/> to be used when sending requests. /// </summary> internal virtual string EncryptionScope => _encryptionScope; /// <summary> /// The Storage account name corresponding to the container client. /// </summary> private string _accountName; /// <summary> /// Gets the Storage account name corresponding to the container client. /// </summary> public virtual string AccountName { get { SetNameFieldsIfNull(); return _accountName; } } /// <summary> /// The name of the container. /// </summary> private string _name; /// <summary> /// Gets the name of the container. /// </summary> public virtual string Name { get { SetNameFieldsIfNull(); return _name; } } #region ctor /// <summary> /// Initializes a new instance of the <see cref="BlobContainerClient"/> /// class for mocking. /// </summary> protected BlobContainerClient() { } /// <summary> /// Initializes a new instance of the <see cref="BlobContainerClient"/> /// class. /// </summary> /// <param name="connectionString"> /// A connection string includes the authentication information /// required for your application to access data in an Azure Storage /// account at runtime. /// /// For more information, /// <see href="https://docs.microsoft.com/azure/storage/common/storage-configure-connection-string"> /// Configure Azure Storage connection strings</see> /// </param> /// <param name="blobContainerName"> /// The name of the blob container in the storage account to reference. /// </param> public BlobContainerClient(string connectionString, string blobContainerName) : this(connectionString, blobContainerName, null) { } /// <summary> /// Initializes a new instance of the <see cref="BlobContainerClient"/> /// class. /// </summary> /// <param name="connectionString"> /// A connection string includes the authentication information /// required for your application to access data in an Azure Storage /// account at runtime. /// /// For more information, /// <see href="https://docs.microsoft.com/azure/storage/common/storage-configure-connection-string"> /// Configure Azure Storage connection strings</see> /// </param> /// <param name="blobContainerName"> /// The name of the container in the storage account to reference. /// </param> /// <param name="options"> /// Optional client options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to /// every request. /// </param> public BlobContainerClient(string connectionString, string blobContainerName, BlobClientOptions options) { var conn = StorageConnectionString.Parse(connectionString); var builder = new BlobUriBuilder(conn.BlobEndpoint) { BlobContainerName = blobContainerName }; _uri = builder.ToUri(); options ??= new BlobClientOptions(); _pipeline = options.Build(conn.Credentials); _version = options.Version; _clientDiagnostics = new ClientDiagnostics(options); _customerProvidedKey = options.CustomerProvidedKey; _encryptionScope = options.EncryptionScope; BlobErrors.VerifyHttpsCustomerProvidedKey(_uri, _customerProvidedKey); BlobErrors.VerifyCpkAndEncryptionScopeNotBothSet(_customerProvidedKey, _encryptionScope); } /// <summary> /// Initializes a new instance of the <see cref="BlobContainerClient"/> /// class. /// </summary> /// <param name="blobContainerUri"> /// A <see cref="Uri"/> referencing the blob container that includes the /// name of the account and the name of the container. /// This is likely to be similar to "https://{account_name}.blob.core.windows.net/{container_name}". /// </param> /// <param name="options"> /// Optional client options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to /// every request. /// </param> public BlobContainerClient(Uri blobContainerUri, BlobClientOptions options = default) : this(blobContainerUri, (HttpPipelinePolicy)null, options) { } /// <summary> /// Initializes a new instance of the <see cref="BlobContainerClient"/> /// class. /// </summary> /// <param name="blobContainerUri"> /// A <see cref="Uri"/> referencing the blob container that includes the /// name of the account and the name of the container. /// This is likely to be similar to "https://{account_name}.blob.core.windows.net/{container_name}". /// </param> /// <param name="credential"> /// The shared key credential used to sign requests. /// </param> /// <param name="options"> /// Optional client options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to /// every request. /// </param> public BlobContainerClient(Uri blobContainerUri, StorageSharedKeyCredential credential, BlobClientOptions options = default) : this(blobContainerUri, credential.AsPolicy(), options) { } /// <summary> /// Initializes a new instance of the <see cref="BlobContainerClient"/> /// class. /// </summary> /// <param name="blobContainerUri"> /// A <see cref="Uri"/> referencing the blob container that includes the /// name of the account and the name of the container. /// This is likely to be similar to "https://{account_name}.blob.core.windows.net/{container_name}". /// </param> /// <param name="credential"> /// The token credential used to sign requests. /// </param> /// <param name="options"> /// Optional client options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to /// every request. /// </param> public BlobContainerClient(Uri blobContainerUri, TokenCredential credential, BlobClientOptions options = default) : this(blobContainerUri, credential.AsPolicy(), options) { Errors.VerifyHttpsTokenAuth(blobContainerUri); } /// <summary> /// Initializes a new instance of the <see cref="BlobContainerClient"/> /// class. /// </summary> /// <param name="blobContainerUri"> /// A <see cref="Uri"/> referencing the blob container that includes the /// name of the account and the name of the container. /// This is likely to be similar to "https://{account_name}.blob.core.windows.net/{container_name}". /// </param> /// <param name="authentication"> /// An optional authentication policy used to sign requests. /// </param> /// <param name="options"> /// Optional client options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to /// every request. /// </param> internal BlobContainerClient(Uri blobContainerUri, HttpPipelinePolicy authentication, BlobClientOptions options) { _uri = blobContainerUri; options ??= new BlobClientOptions(); _pipeline = options.Build(authentication); _version = options.Version; _clientDiagnostics = new ClientDiagnostics(options); _customerProvidedKey = options.CustomerProvidedKey; _clientSideEncryption = options._clientSideEncryptionOptions?.Clone(); _encryptionScope = options.EncryptionScope; BlobErrors.VerifyHttpsCustomerProvidedKey(_uri, _customerProvidedKey); BlobErrors.VerifyCpkAndEncryptionScopeNotBothSet(_customerProvidedKey, _encryptionScope); } /// <summary> /// Initializes a new instance of the <see cref="BlobContainerClient"/> /// class. /// </summary> /// <param name="containerUri"> /// A <see cref="Uri"/> referencing the blob container that includes the /// name of the account and the name of the container. /// This is likely to be similar to "https://{account_name}.blob.core.windows.net/{container_name}". /// </param> /// <param name="pipeline"> /// The transport pipeline used to send every request. /// </param> /// <param name="version"> /// The version of the service to use when sending requests. /// </param> /// <param name="clientDiagnostics"></param> /// <param name="customerProvidedKey">Customer provided key.</param> /// <param name="clientSideEncryption"></param> /// <param name="encryptionScope">Encryption scope.</param> internal BlobContainerClient( Uri containerUri, HttpPipeline pipeline, BlobClientOptions.ServiceVersion version, ClientDiagnostics clientDiagnostics, CustomerProvidedKey? customerProvidedKey, ClientSideEncryptionOptions clientSideEncryption, string encryptionScope) { _uri = containerUri; _pipeline = pipeline; _version = version; _clientDiagnostics = clientDiagnostics; _customerProvidedKey = customerProvidedKey; _clientSideEncryption = clientSideEncryption?.Clone(); _encryptionScope = encryptionScope; BlobErrors.VerifyHttpsCustomerProvidedKey(_uri, _customerProvidedKey); BlobErrors.VerifyCpkAndEncryptionScopeNotBothSet(_customerProvidedKey, _encryptionScope); } /// <summary> /// Initializes a new instance of the <see cref="BlobContainerClient"/> /// class. /// </summary> /// <param name="containerUri"> /// A <see cref="Uri"/> referencing the block blob that includes the /// name of the account, the name of the container, and the name of /// the blob. /// </param> /// <param name="options"> /// Optional client options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to /// every request. /// </param> /// <param name="pipeline"> /// The transport pipeline used to send every request. /// </param> /// <returns> /// New instance of the <see cref="BlobContainerClient"/> class. /// </returns> protected static BlobContainerClient CreateClient(Uri containerUri, BlobClientOptions options, HttpPipeline pipeline) { return new BlobContainerClient( containerUri, pipeline, options.Version, new ClientDiagnostics(options), customerProvidedKey: null, clientSideEncryption: null, encryptionScope: null); } #endregion ctor /// <summary> /// Create a new <see cref="BlobClient"/> object by appending /// <paramref name="blobName"/> to the end of <see cref="Uri"/>. The /// new <see cref="BlobClient"/> uses the same request policy /// pipeline as the <see cref="BlobContainerClient"/>. /// </summary> /// <param name="blobName">The name of the blob.</param> /// <returns>A new <see cref="BlobClient"/> instance.</returns> public virtual BlobClient GetBlobClient(string blobName) { BlobUriBuilder blobUriBuilder = new BlobUriBuilder(Uri) { BlobName = blobName }; return new BlobClient( blobUriBuilder.ToUri(), _pipeline, Version, ClientDiagnostics, CustomerProvidedKey, ClientSideEncryption, EncryptionScope); } /// <summary> /// Create a new <see cref="BlockBlobClient"/> object by /// concatenating <paramref name="blobName"/> to /// the end of the <see cref="Uri"/>. The new /// <see cref="BlockBlobClient"/> /// uses the same request policy pipeline as the /// <see cref="BlobContainerClient"/>. /// </summary> /// <param name="blobName">The name of the block blob.</param> /// <returns>A new <see cref="BlockBlobClient"/> instance.</returns> protected internal virtual BlockBlobClient GetBlockBlobClientCore(string blobName) { if (ClientSideEncryption != default) { throw Errors.ClientSideEncryption.TypeNotSupported(typeof(BlockBlobClient)); } BlobUriBuilder blobUriBuilder = new BlobUriBuilder(Uri) { BlobName = blobName }; return new BlockBlobClient( blobUriBuilder.ToUri(), Pipeline, Version, ClientDiagnostics, CustomerProvidedKey, EncryptionScope); } /// <summary> /// Create a new <see cref="AppendBlobClient"/> object by /// concatenating <paramref name="blobName"/> to /// the end of the <see cref="BlobContainerClient.Uri"/>. The new /// <see cref="AppendBlobClient"/> /// uses the same request policy pipeline as the /// <see cref="BlobContainerClient"/>. /// </summary> /// <param name="blobName">The name of the append blob.</param> /// <returns>A new <see cref="AppendBlobClient"/> instance.</returns> protected internal virtual AppendBlobClient GetAppendBlobClientCore(string blobName) { if (ClientSideEncryption != default) { throw Errors.ClientSideEncryption.TypeNotSupported(typeof(AppendBlobClient)); } BlobUriBuilder blobUriBuilder = new BlobUriBuilder(Uri) { BlobName = blobName }; return new AppendBlobClient( blobUriBuilder.ToUri(), Pipeline, Version, ClientDiagnostics, CustomerProvidedKey, EncryptionScope); } /// <summary> /// Create a new <see cref="PageBlobClient"/> object by /// concatenating <paramref name="blobName"/> to /// the end of the <see cref="BlobContainerClient.Uri"/>. The new /// <see cref="PageBlobClient"/> /// uses the same request policy pipeline as the /// <see cref="BlobContainerClient"/>. /// </summary> /// <param name="blobName">The name of the page blob.</param> /// <returns>A new <see cref="PageBlobClient"/> instance.</returns> protected internal virtual PageBlobClient GetPageBlobClientCore(string blobName) { if (ClientSideEncryption != default) { throw Errors.ClientSideEncryption.TypeNotSupported(typeof(PageBlobClient)); } BlobUriBuilder blobUriBuilder = new BlobUriBuilder(Uri) { BlobName = blobName }; return new PageBlobClient( blobUriBuilder.ToUri(), Pipeline, Version, ClientDiagnostics, CustomerProvidedKey, EncryptionScope); } /// <summary> /// Initializes a new instance of the <see cref="BlobLeaseClient"/> class. /// </summary> /// <param name="leaseId"> /// An optional lease ID. If no lease ID is provided, a random lease /// ID will be created. /// </param> protected internal virtual BlobLeaseClient GetBlobLeaseClientCore(string leaseId) => new BlobLeaseClient(this, leaseId); /// <summary> /// Sets the various name fields if they are currently null. /// </summary> private void SetNameFieldsIfNull() { if (_name == null || _accountName == null) { var builder = new BlobUriBuilder(Uri); _name = builder.BlobContainerName; _accountName = builder.AccountName; } } #region Create /// <summary> /// The <see cref="Create(PublicAccessType, Metadata, BlobContainerEncryptionScopeOptions, CancellationToken)"/> /// operation creates a new container /// under the specified account. If the container with the same name /// already exists, the operation fails. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/create-container"> /// Create Container</see>. /// </summary> /// <param name="publicAccessType"> /// Optionally specifies whether data in the container may be accessed /// publicly and the level of access. <see cref="PublicAccessType.BlobContainer"/> /// specifies full public read access for container and blob data. /// Clients can enumerate blobs within the container via anonymous /// request, but cannot enumerate containers within the storage /// account. <see cref="PublicAccessType.Blob"/> specifies public /// read access for blobs. Blob data within this container can be /// read via anonymous request, but container data is not available. /// Clients cannot enumerate blobs within the container via anonymous /// request. <see cref="PublicAccessType.None"/> specifies that the /// container data is private to the account owner. /// </param> /// <param name="metadata"> /// Optional custom metadata to set for this container. /// </param> /// <param name="encryptionScopeOptions"> /// Optional encryption scope options to set for this container. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerInfo}"/> describing the newly /// created blob container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual Response<BlobContainerInfo> Create( PublicAccessType publicAccessType = PublicAccessType.None, Metadata metadata = default, BlobContainerEncryptionScopeOptions encryptionScopeOptions = default, CancellationToken cancellationToken = default) => CreateInternal( publicAccessType, metadata, encryptionScopeOptions, async: false, cancellationToken) .EnsureCompleted(); /// <summary> /// The <see cref="Create(PublicAccessType, Metadata, CancellationToken)"/> operation creates a new container /// under the specified account. If the container with the same name /// already exists, the operation fails. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/create-container"> /// Create Container</see>. /// </summary> /// <param name="publicAccessType"> /// Optionally specifies whether data in the container may be accessed /// publicly and the level of access. <see cref="PublicAccessType.BlobContainer"/> /// specifies full public read access for container and blob data. /// Clients can enumerate blobs within the container via anonymous /// request, but cannot enumerate containers within the storage /// account. <see cref="PublicAccessType.Blob"/> specifies public /// read access for blobs. Blob data within this container can be /// read via anonymous request, but container data is not available. /// Clients cannot enumerate blobs within the container via anonymous /// request. <see cref="PublicAccessType.None"/> specifies that the /// container data is private to the account owner. /// </param> /// <param name="metadata"> /// Optional custom metadata to set for this container. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerInfo}"/> describing the newly /// created blob container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> #pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. [EditorBrowsable(EditorBrowsableState.Never)] public virtual Response<BlobContainerInfo> Create( #pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. PublicAccessType publicAccessType, Metadata metadata, CancellationToken cancellationToken) => CreateInternal( publicAccessType, metadata, encryptionScopeOptions: default, async: false, cancellationToken) .EnsureCompleted(); /// <summary> /// The <see cref="CreateAsync(PublicAccessType, Metadata, BlobContainerEncryptionScopeOptions, CancellationToken)"/> /// operation creates a new container under the specified account. If the container with the same name /// already exists, the operation fails. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/create-container"> /// Create Container</see>. /// </summary> /// <param name="publicAccessType"> /// Optionally specifies whether data in the container may be accessed /// publicly and the level of access. <see cref="PublicAccessType.BlobContainer"/> /// specifies full public read access for container and blob data. /// Clients can enumerate blobs within the container via anonymous /// request, but cannot enumerate containers within the storage /// account. <see cref="PublicAccessType.Blob"/> specifies public /// read access for blobs. Blob data within this container can be /// read via anonymous request, but container data is not available. /// Clients cannot enumerate blobs within the container via anonymous /// request. <see cref="PublicAccessType.None"/> specifies that the /// container data is private to the account owner. /// </param> /// <param name="metadata"> /// Optional custom metadata to set for this container. /// </param> /// <param name="encryptionScopeOptions"> /// Optional encryption scope options to set for this container. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerInfo}"/> describing the newly /// created container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual async Task<Response<BlobContainerInfo>> CreateAsync( PublicAccessType publicAccessType = PublicAccessType.None, Metadata metadata = default, BlobContainerEncryptionScopeOptions encryptionScopeOptions = default, CancellationToken cancellationToken = default) => await CreateInternal( publicAccessType, metadata, encryptionScopeOptions, async: true, cancellationToken) .ConfigureAwait(false); /// <summary> /// The <see cref="CreateAsync(PublicAccessType, Metadata, CancellationToken)"/> operation creates a new container /// under the specified account. If the container with the same name /// already exists, the operation fails. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/create-container"> /// Create Container</see>. /// </summary> /// <param name="publicAccessType"> /// Optionally specifies whether data in the container may be accessed /// publicly and the level of access. <see cref="PublicAccessType.BlobContainer"/> /// specifies full public read access for container and blob data. /// Clients can enumerate blobs within the container via anonymous /// request, but cannot enumerate containers within the storage /// account. <see cref="PublicAccessType.Blob"/> specifies public /// read access for blobs. Blob data within this container can be /// read via anonymous request, but container data is not available. /// Clients cannot enumerate blobs within the container via anonymous /// request. <see cref="PublicAccessType.None"/> specifies that the /// container data is private to the account owner. /// </param> /// <param name="metadata"> /// Optional custom metadata to set for this container. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerInfo}"/> describing the newly /// created container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> #pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. [EditorBrowsable(EditorBrowsableState.Never)] public virtual async Task<Response<BlobContainerInfo>> CreateAsync( #pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. PublicAccessType publicAccessType, Metadata metadata, CancellationToken cancellationToken) => await CreateInternal( publicAccessType, metadata, encryptionScopeOptions: default, async: true, cancellationToken) .ConfigureAwait(false); /// <summary> /// The <see cref="CreateIfNotExists(PublicAccessType, Metadata, BlobContainerEncryptionScopeOptions, CancellationToken)"/> /// operation creates a new container under the specified account. If the container with the same name /// already exists, it is not changed. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/create-container"> /// Create Container</see>. /// </summary> /// <param name="publicAccessType"> /// Optionally specifies whether data in the container may be accessed /// publicly and the level of access. <see cref="PublicAccessType.BlobContainer"/> /// specifies full public read access for container and blob data. /// Clients can enumerate blobs within the container via anonymous /// request, but cannot enumerate containers within the storage /// account. <see cref="PublicAccessType.Blob"/> specifies public /// read access for blobs. Blob data within this container can be /// read via anonymous request, but container data is not available. /// Clients cannot enumerate blobs within the container via anonymous /// request. <see cref="PublicAccessType.None"/> specifies that the /// container data is private to the account owner. /// </param> /// <param name="metadata"> /// Optional custom metadata to set for this container. /// </param> /// <param name="encryptionScopeOptions"> /// Optional encryption scope options to set for this container. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// If the container does not already exist, a <see cref="Response{ContainerInfo}"/> /// describing the newly created container. If the container already exists, <c>null</c>. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual Response<BlobContainerInfo> CreateIfNotExists( PublicAccessType publicAccessType = PublicAccessType.None, Metadata metadata = default, BlobContainerEncryptionScopeOptions encryptionScopeOptions = default, CancellationToken cancellationToken = default) => CreateIfNotExistsInternal( publicAccessType, metadata, encryptionScopeOptions, async: false, cancellationToken) .EnsureCompleted(); /// <summary> /// The <see cref="CreateIfNotExists(PublicAccessType, Metadata, CancellationToken)"/> operation creates a new container /// under the specified account. If the container with the same name /// already exists, it is not changed. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/create-container"> /// Create Container</see>. /// </summary> /// <param name="publicAccessType"> /// Optionally specifies whether data in the container may be accessed /// publicly and the level of access. <see cref="PublicAccessType.BlobContainer"/> /// specifies full public read access for container and blob data. /// Clients can enumerate blobs within the container via anonymous /// request, but cannot enumerate containers within the storage /// account. <see cref="PublicAccessType.Blob"/> specifies public /// read access for blobs. Blob data within this container can be /// read via anonymous request, but container data is not available. /// Clients cannot enumerate blobs within the container via anonymous /// request. <see cref="PublicAccessType.None"/> specifies that the /// container data is private to the account owner. /// </param> /// <param name="metadata"> /// Optional custom metadata to set for this container. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// If the container does not already exist, a <see cref="Response{ContainerInfo}"/> /// describing the newly created container. If the container already exists, <c>null</c>. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> #pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. [EditorBrowsable(EditorBrowsableState.Never)] public virtual Response<BlobContainerInfo> CreateIfNotExists( #pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. PublicAccessType publicAccessType, Metadata metadata, CancellationToken cancellationToken) => CreateIfNotExistsInternal( publicAccessType, metadata, encryptionScopeOptions: default, async: false, cancellationToken) .EnsureCompleted(); /// <summary> /// The <see cref="CreateIfNotExistsAsync(PublicAccessType, Metadata, BlobContainerEncryptionScopeOptions, CancellationToken)"/> /// operation creates a new container under the specified account. If the container with the same name /// already exists, it is not changed. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/create-container"> /// Create Container</see>. /// </summary> /// <param name="publicAccessType"> /// Optionally specifies whether data in the container may be accessed /// publicly and the level of access. <see cref="PublicAccessType.BlobContainer"/> /// specifies full public read access for container and blob data. /// Clients can enumerate blobs within the container via anonymous /// request, but cannot enumerate containers within the storage /// account. <see cref="PublicAccessType.Blob"/> specifies public /// read access for blobs. Blob data within this container can be /// read via anonymous request, but container data is not available. /// Clients cannot enumerate blobs within the container via anonymous /// request. <see cref="PublicAccessType.None"/> specifies that the /// container data is private to the account owner. /// </param> /// <param name="metadata"> /// Optional custom metadata to set for this container. /// </param> /// <param name="encryptionScopeOptions"> /// Optional encryption scope options to set for this container. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{ContainerInfo}"/> describing the newly /// created container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual async Task<Response<BlobContainerInfo>> CreateIfNotExistsAsync( PublicAccessType publicAccessType = PublicAccessType.None, Metadata metadata = default, BlobContainerEncryptionScopeOptions encryptionScopeOptions = default, CancellationToken cancellationToken = default) => await CreateIfNotExistsInternal( publicAccessType, metadata, encryptionScopeOptions, async: true, cancellationToken) .ConfigureAwait(false); /// <summary> /// The <see cref="CreateIfNotExists(PublicAccessType, Metadata, CancellationToken)"/> operation creates a new container /// under the specified account. If the container with the same name /// already exists, it is not changed. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/create-container"> /// Create Container</see>. /// </summary> /// <param name="publicAccessType"> /// Optionally specifies whether data in the container may be accessed /// publicly and the level of access. <see cref="PublicAccessType.BlobContainer"/> /// specifies full public read access for container and blob data. /// Clients can enumerate blobs within the container via anonymous /// request, but cannot enumerate containers within the storage /// account. <see cref="PublicAccessType.Blob"/> specifies public /// read access for blobs. Blob data within this container can be /// read via anonymous request, but container data is not available. /// Clients cannot enumerate blobs within the container via anonymous /// request. <see cref="PublicAccessType.None"/> specifies that the /// container data is private to the account owner. /// </param> /// <param name="metadata"> /// Optional custom metadata to set for this container. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{ContainerInfo}"/> describing the newly /// created container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> #pragma warning disable AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. [EditorBrowsable(EditorBrowsableState.Never)] public virtual async Task<Response<BlobContainerInfo>> CreateIfNotExistsAsync( #pragma warning restore AZC0002 // DO ensure all service methods, both asynchronous and synchronous, take an optional CancellationToken parameter called cancellationToken. PublicAccessType publicAccessType, Metadata metadata, CancellationToken cancellationToken) => await CreateIfNotExistsInternal( publicAccessType, metadata, encryptionScopeOptions: default, async: true, cancellationToken) .ConfigureAwait(false); /// <summary> /// The <see cref="CreateIfNotExistsInternal(PublicAccessType, Metadata, BlobContainerEncryptionScopeOptions, bool, CancellationToken)"/> /// operation creates a new container under the specified account. If the container already exists, it is /// not changed. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/create-container"> /// Create Container</see>. /// </summary> /// <param name="publicAccessType"> /// Optionally specifies whether data in the container may be accessed /// publicly and the level of access. <see cref="PublicAccessType.BlobContainer"/> /// specifies full public read access for container and blob data. /// Clients can enumerate blobs within the container via anonymous /// request, but cannot enumerate containers within the storage /// account. <see cref="PublicAccessType.Blob"/> specifies public /// read access for blobs. Blob data within this container can be /// read via anonymous request, but container data is not available. /// Clients cannot enumerate blobs within the container via anonymous /// request. <see cref="PublicAccessType.None"/> specifies that the /// container data is private to the account owner. /// </param> /// <param name="metadata"> /// Optional custom metadata to set for this container. /// </param> /// <param name="encryptionScopeOptions"> /// Optional encryption scope options to set for this container. /// </param> /// <param name="async"> /// Whether to invoke the operation asynchronously. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// If the container does not already exist, a <see cref="Response{ContainerInfo}"/> /// describing the newly created container. If the container already exists, <c>null</c>. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> private async Task<Response<BlobContainerInfo>> CreateIfNotExistsInternal( PublicAccessType publicAccessType, Metadata metadata, BlobContainerEncryptionScopeOptions encryptionScopeOptions, bool async, CancellationToken cancellationToken) { using (Pipeline.BeginLoggingScope(nameof(BlobContainerClient))) { Pipeline.LogMethodEnter( nameof(BlobContainerClient), message: $"{nameof(Uri)}: {Uri}\n" + $"{nameof(publicAccessType)}: {publicAccessType}"); Response <BlobContainerInfo> response; try { response = await CreateInternal( publicAccessType, metadata, encryptionScopeOptions, async, cancellationToken, $"{nameof(BlobContainerClient)}.{nameof(CreateIfNotExists)}") .ConfigureAwait(false); } catch (RequestFailedException storageRequestFailedException) when (storageRequestFailedException.ErrorCode == BlobErrorCode.ContainerAlreadyExists) { response = default; } catch (Exception ex) { Pipeline.LogException(ex); throw; } finally { Pipeline.LogMethodExit(nameof(BlobContainerClient)); } return response; } } /// <summary> /// The <see cref="CreateInternal"/> operation creates a new container /// under the specified account, if it does not already exist. /// If the container with the same name already exists, the operation fails. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/create-container"> /// Create Container</see>. /// </summary> /// <param name="publicAccessType"> /// Optionally specifies whether data in the container may be accessed /// publicly and the level of access. <see cref="PublicAccessType.BlobContainer"/> /// specifies full public read access for container and blob data. /// Clients can enumerate blobs within the container via anonymous /// request, but cannot enumerate containers within the storage /// account. <see cref="PublicAccessType.Blob"/> specifies public /// read access for blobs. Blob data within this container can be /// read via anonymous request, but container data is not available. /// Clients cannot enumerate blobs within the container via anonymous /// request. <see cref="PublicAccessType.None"/> specifies that the /// container data is private to the account owner. /// </param> /// <param name="metadata"> /// Optional custom metadata to set for this container. /// </param> /// <param name="encryptionScopeOptions"> /// Optional encryption scope options to set for this container. /// </param> /// <param name="async"> /// Whether to invoke the operation asynchronously. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <param name="operationName"> /// Optional. To indicate if the name of the operation. /// </param> /// <returns> /// A <see cref="Response{ContainerInfo}"/> describing the newly /// created container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> private async Task<Response<BlobContainerInfo>> CreateInternal( PublicAccessType publicAccessType, Metadata metadata, BlobContainerEncryptionScopeOptions encryptionScopeOptions, bool async, CancellationToken cancellationToken, string operationName = null) { using (Pipeline.BeginLoggingScope(nameof(BlobContainerClient))) { Pipeline.LogMethodEnter( nameof(BlobContainerClient), message: $"{nameof(Uri)}: {Uri}\n" + $"{nameof(publicAccessType)}: {publicAccessType}"); try { return await BlobRestClient.Container.CreateAsync( ClientDiagnostics, Pipeline, Uri, access: publicAccessType, defaultEncryptionScope: encryptionScopeOptions?.DefaultEncryptionScope, preventEncryptionScopeOverride: encryptionScopeOptions?.PreventEncryptionScopeOverride, version: Version.ToVersionString(), metadata: metadata, async: async, operationName: operationName ?? $"{nameof(BlobContainerClient)}.{nameof(Create)}", cancellationToken: cancellationToken) .ConfigureAwait(false); } catch (Exception ex) { Pipeline.LogException(ex); throw; } finally { Pipeline.LogMethodExit(nameof(BlobContainerClient)); } } } #endregion Create #region Delete /// <summary> /// The <see cref="Delete"/> operation marks the specified /// container for deletion. The container and any blobs contained /// within it are later deleted during garbage collection. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/delete-container"> /// Delete Container</see>. /// </summary> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on the deletion of this container. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response"/> if successful. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual Response Delete( BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => DeleteInternal( conditions, false, // async cancellationToken) .EnsureCompleted(); /// <summary> /// The <see cref="DeleteAsync"/> operation marks the specified /// container for deletion. The container and any blobs contained /// within it are later deleted during garbage collection. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/delete-container"> /// Delete Container</see>. /// </summary> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on the deletion of this container. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response"/> if successful. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual async Task<Response> DeleteAsync( BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => await DeleteInternal( conditions, true, // async cancellationToken) .ConfigureAwait(false); /// <summary> /// The <see cref="DeleteIfExists"/> operation marks the specified /// container for deletion if it exists. The container and any blobs /// contained within it are later deleted during garbage collection. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/delete-container"> /// Delete Container</see>. /// </summary> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on the deletion of this container. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response"/> Returns true if container exists and was /// deleted, return false otherwise. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual Response<bool> DeleteIfExists( BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => DeleteIfExistsInternal( conditions, false, // async cancellationToken) .EnsureCompleted(); /// <summary> /// The <see cref="DeleteIfExistsAsync"/> operation marks the specified /// container for deletion if it exists. The container and any blobs /// contained within it are later deleted during garbage collection. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/delete-container"> /// Delete Container</see>. /// </summary> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on the deletion of this container. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response"/> Returns true if container exists and was /// deleted, return false otherwise. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual async Task<Response<bool>> DeleteIfExistsAsync( BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => await DeleteIfExistsInternal( conditions, true, // async cancellationToken) .ConfigureAwait(false); /// <summary> /// The <see cref="DeleteIfExistsInternal"/> operation marks the specified /// container for deletion if it exists. The container and any blobs /// contained within it are later deleted during garbage collection. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/delete-container"> /// Delete Container</see>. /// </summary> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on the deletion of this container. /// </param> /// <param name="async"> /// Whether to invoke the operation asynchronously. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response"/> Returns true if container exists and was /// deleted, return false otherwise. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> private async Task<Response<bool>> DeleteIfExistsInternal( BlobRequestConditions conditions, bool async, CancellationToken cancellationToken) { using (Pipeline.BeginLoggingScope(nameof(BlobContainerClient))) { Pipeline.LogMethodEnter( nameof(BlobContainerClient), message: $"{nameof(Uri)}: {Uri}\n" + $"{nameof(conditions)}: {conditions}"); try { Response response = await DeleteInternal( conditions, async, cancellationToken, $"{nameof(BlobContainerClient)}.{nameof(DeleteIfExists)}") .ConfigureAwait(false); return Response.FromValue(true, response); } catch (RequestFailedException storageRequestFailedException) when (storageRequestFailedException.ErrorCode == BlobErrorCode.ContainerNotFound || storageRequestFailedException.ErrorCode == BlobErrorCode.BlobNotFound) { return Response.FromValue(false, default); } catch (Exception ex) { Pipeline.LogException(ex); throw; } finally { Pipeline.LogMethodExit(nameof(BlobContainerClient)); } } } /// <summary> /// The <see cref="DeleteAsync"/> operation marks the specified /// container for deletion. The container and any blobs contained /// within it are later deleted during garbage collection. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/delete-container"> /// Delete Container</see>. /// </summary> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on the deletion of this container. /// </param> /// <param name="async"> /// Whether to invoke the operation asynchronously. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <param name="operationName"> /// Optional. To indicate if the name of the operation. /// </param> /// <returns> /// A <see cref="Response"/> if successful. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> private async Task<Response> DeleteInternal( BlobRequestConditions conditions, bool async, CancellationToken cancellationToken, string operationName = null) { using (Pipeline.BeginLoggingScope(nameof(BlobContainerClient))) { Pipeline.LogMethodEnter( nameof(BlobContainerClient), message: $"{nameof(Uri)}: {Uri}\n" + $"{nameof(conditions)}: {conditions}"); try { if (conditions?.IfMatch != default || conditions?.IfNoneMatch != default) { throw BlobErrors.BlobConditionsMustBeDefault(nameof(RequestConditions.IfMatch), nameof(RequestConditions.IfNoneMatch)); } return await BlobRestClient.Container.DeleteAsync( ClientDiagnostics, Pipeline, Uri, version: Version.ToVersionString(), leaseId: conditions?.LeaseId, ifModifiedSince: conditions?.IfModifiedSince, ifUnmodifiedSince: conditions?.IfUnmodifiedSince, async: async, operationName: operationName ?? $"{nameof(BlobContainerClient)}.{nameof(Delete)}", cancellationToken: cancellationToken) .ConfigureAwait(false); } catch (Exception ex) { Pipeline.LogException(ex); throw; } finally { Pipeline.LogMethodExit(nameof(BlobContainerClient)); } } } #endregion Delete #region Exists /// <summary> /// The <see cref="Exists"/> operation can be called on a /// <see cref="BlobContainerClient"/> to see if the associated container /// exists on the storage account in the storage service. /// </summary> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// Returns true if the container exists. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. If you want to create the container if /// it doesn't exist, use /// <see cref="CreateIfNotExists(PublicAccessType, Metadata, BlobContainerEncryptionScopeOptions, CancellationToken)"/> /// instead. /// </remarks> public virtual Response<bool> Exists( CancellationToken cancellationToken = default) => ExistsInternal( async: false, cancellationToken).EnsureCompleted(); /// <summary> /// The <see cref="ExistsAsync"/> operation can be called on a /// <see cref="BlobContainerClient"/> to see if the associated container /// exists on the storage account in the storage service. /// </summary> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// Returns true if the container exists. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. If you want to create the container if /// it doesn't exist, use /// <see cref="CreateIfNotExists(PublicAccessType, Metadata, BlobContainerEncryptionScopeOptions, CancellationToken)"/> /// instead. /// </remarks> public virtual async Task<Response<bool>> ExistsAsync( CancellationToken cancellationToken = default) => await ExistsInternal( async: true, cancellationToken).ConfigureAwait(false); /// <summary> /// The <see cref="ExistsInternal"/> operation can be called on a /// <see cref="BlobContainerClient"/> to see if the associated container /// exists on the storage account in the storage service. /// </summary> /// <param name="async"> /// Whether to invoke the operation asynchronously. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// Returns true if the container exists. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> private async Task<Response<bool>> ExistsInternal( bool async, CancellationToken cancellationToken) { using (Pipeline.BeginLoggingScope(nameof(BlobContainerClient))) { Pipeline.LogMethodEnter( nameof(BlobContainerClient), message: $"{nameof(Uri)}: {Uri}"); try { Response<FlattenedContainerItem> response = await BlobRestClient.Container.GetPropertiesAsync( ClientDiagnostics, Pipeline, Uri, version: Version.ToVersionString(), async: async, operationName: $"{nameof(BlobContainerClient)}.{nameof(Exists)}", cancellationToken: cancellationToken) .ConfigureAwait(false); return Response.FromValue(true, response.GetRawResponse()); } catch (RequestFailedException storageRequestFailedException) when (storageRequestFailedException.ErrorCode == BlobErrorCode.ContainerNotFound) { return Response.FromValue(false, default); } catch (Exception ex) { Pipeline.LogException(ex); throw; } finally { Pipeline.LogMethodExit(nameof(BlobContainerClient)); } } } #endregion Exists #region GetProperties /// <summary> /// The <see cref="GetProperties"/> operation returns all /// user-defined metadata and system properties for the specified /// container. The data returned does not include the container's /// list of blobs. /// /// For more information, see /// <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-properties"> /// Get Container Properties</see>. /// </summary> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on getting the blob container's properties. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerProperties}"/> describing the /// container and its properties. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual Response<BlobContainerProperties> GetProperties( BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => GetPropertiesInternal( conditions, false, // async cancellationToken) .EnsureCompleted(); /// <summary> /// The <see cref="GetPropertiesAsync"/> operation returns all /// user-defined metadata and system properties for the specified /// container. The data returned does not include the container's /// list of blobs. /// /// For more information, see /// <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-properties"> /// Get Container Properties</see>. /// </summary> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on getting the blob container's properties. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerProperties}"/> describing the /// container and its properties. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual async Task<Response<BlobContainerProperties>> GetPropertiesAsync( BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => await GetPropertiesInternal( conditions, true, // async cancellationToken) .ConfigureAwait(false); /// <summary> /// The <see cref="GetPropertiesAsync"/> operation returns all /// user-defined metadata and system properties for the specified /// container. The data returned does not include the container's /// list of blobs. /// /// For more information, see /// <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-properties"> /// Get Container Properties</see>. /// </summary> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on getting the blob container's properties. /// </param> /// <param name="async"> /// Whether to invoke the operation asynchronously. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerItem}"/> describing the /// container and its properties. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> private async Task<Response<BlobContainerProperties>> GetPropertiesInternal( BlobRequestConditions conditions, bool async, CancellationToken cancellationToken) { using (Pipeline.BeginLoggingScope(nameof(BlobContainerClient))) { Pipeline.LogMethodEnter( nameof(BlobContainerClient), message: $"{nameof(Uri)}: {Uri}\n" + $"{nameof(conditions)}: {conditions}"); try { // GetProperties returns a flattened set of properties Response<FlattenedContainerItem> response = await BlobRestClient.Container.GetPropertiesAsync( ClientDiagnostics, Pipeline, Uri, version: Version.ToVersionString(), leaseId: conditions?.LeaseId, async: async, operationName: $"{nameof(BlobContainerClient)}.{nameof(GetProperties)}", cancellationToken: cancellationToken) .ConfigureAwait(false); // Turn the flattened properties into a BlobContainerProperties return Response.FromValue( new BlobContainerProperties() { Metadata = response.Value.Metadata, LastModified = response.Value.LastModified, ETag = response.Value.ETag, LeaseStatus = response.Value.LeaseStatus, LeaseState = response.Value.LeaseState, LeaseDuration = response.Value.LeaseDuration, PublicAccess = response.Value.BlobPublicAccess, HasImmutabilityPolicy = response.Value.HasImmutabilityPolicy, HasLegalHold = response.Value.HasLegalHold, DefaultEncryptionScope = response.Value.DefaultEncryptionScope, PreventEncryptionScopeOverride = response.Value.DenyEncryptionScopeOverride }, response.GetRawResponse()); } catch (Exception ex) { Pipeline.LogException(ex); throw; } finally { Pipeline.LogMethodExit(nameof(BlobContainerClient)); } } } #endregion GetProperties #region SetMetadata /// <summary> /// The <see cref="SetMetadata"/> operation sets one or more /// user-defined name-value pairs for the specified container. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/set-container-metadata"> /// Set Container Metadata</see>. /// </summary> /// <param name="metadata"> /// Custom metadata to set for this container. /// </param> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on the deletion of this container. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerInfo}"/> if successful. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual Response<BlobContainerInfo> SetMetadata( Metadata metadata, BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => SetMetadataInternal( metadata, conditions, false, // async cancellationToken) .EnsureCompleted(); /// <summary> /// The <see cref="SetMetadataAsync"/> operation sets one or more /// user-defined name-value pairs for the specified container. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/set-container-metadata"> /// Set Container Metadata</see>. /// </summary> /// <param name="metadata"> /// Custom metadata to set for this container. /// </param> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on the deletion of this container. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerInfo}"/> if successful. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual async Task<Response<BlobContainerInfo>> SetMetadataAsync( Metadata metadata, BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => await SetMetadataInternal( metadata, conditions, true, // async cancellationToken) .ConfigureAwait(false); /// <summary> /// The <see cref="SetMetadataInternal"/> operation sets one or more /// user-defined name-value pairs for the specified container. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/set-container-metadata"> /// Set Container Metadata</see>. /// </summary> /// <param name="metadata"> /// Custom metadata to set for this container. /// </param> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on the deletion of this container. /// </param> /// <param name="async"> /// Whether to invoke the operation asynchronously. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerInfo}"/> if successful. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> private async Task<Response<BlobContainerInfo>> SetMetadataInternal( Metadata metadata, BlobRequestConditions conditions, bool async, CancellationToken cancellationToken) { using (Pipeline.BeginLoggingScope(nameof(BlobContainerClient))) { Pipeline.LogMethodEnter( nameof(BlobContainerClient), message: $"{nameof(Uri)}: {Uri}\n" + $"{nameof(conditions)}: {conditions}"); try { if (conditions?.IfUnmodifiedSince != default || conditions?.IfMatch != default || conditions?.IfNoneMatch != default) { throw BlobErrors.BlobConditionsMustBeDefault( nameof(RequestConditions.IfUnmodifiedSince), nameof(RequestConditions.IfMatch), nameof(RequestConditions.IfNoneMatch)); } return await BlobRestClient.Container.SetMetadataAsync( ClientDiagnostics, Pipeline, Uri, version: Version.ToVersionString(), metadata: metadata, leaseId: conditions?.LeaseId, ifModifiedSince: conditions?.IfModifiedSince, async: async, operationName: $"{nameof(BlobContainerClient)}.{nameof(SetMetadata)}", cancellationToken: cancellationToken) .ConfigureAwait(false); } catch (Exception ex) { Pipeline.LogException(ex); throw; } finally { Pipeline.LogMethodExit(nameof(BlobContainerClient)); } } } #endregion SetMetadata #region GetAccessPolicy /// <summary> /// The <see cref="GetAccessPolicy"/> operation gets the /// permissions for this container. The permissions indicate whether /// container data may be accessed publicly. /// /// For more information, see /// <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-acl"> /// Get Container ACL</see>. /// </summary> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on getting the blob container's access policy. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerAccessPolicy}"/> describing /// the container's access policy. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual Response<BlobContainerAccessPolicy> GetAccessPolicy( BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => GetAccessPolicyInternal( conditions, false, // async cancellationToken) .EnsureCompleted(); /// <summary> /// The <see cref="GetAccessPolicyAsync"/> operation gets the /// permissions for this container. The permissions indicate whether /// container data may be accessed publicly. /// /// For more information, see /// <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-acl"> /// Get Container ACL</see>. /// </summary> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on getting the blob container's access policy. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerAccessPolicy}"/> describing /// the container's access policy. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual async Task<Response<BlobContainerAccessPolicy>> GetAccessPolicyAsync( BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => await GetAccessPolicyInternal( conditions, true, // async cancellationToken) .ConfigureAwait(false); /// <summary> /// The <see cref="GetAccessPolicyAsync"/> operation gets the /// permissions for this container. The permissions indicate whether /// container data may be accessed publicly. /// /// For more information, see /// <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-acl"> /// Get Container ACL</see>. /// </summary> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on getting the blob container's access policy. /// </param> /// <param name="async"> /// Whether to invoke the operation asynchronously. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerAccessPolicy}"/> describing /// the container's access policy. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> private async Task<Response<BlobContainerAccessPolicy>> GetAccessPolicyInternal( BlobRequestConditions conditions, bool async, CancellationToken cancellationToken) { using (Pipeline.BeginLoggingScope(nameof(BlobContainerClient))) { Pipeline.LogMethodEnter( nameof(BlobContainerClient), message: $"{nameof(Uri)}: {Uri}\n" + $"{nameof(conditions)}: {conditions}"); try { return await BlobRestClient.Container.GetAccessPolicyAsync( ClientDiagnostics, Pipeline, Uri, version: Version.ToVersionString(), leaseId: conditions?.LeaseId, async: async, operationName: $"{nameof(BlobContainerClient)}.{nameof(GetAccessPolicy)}", cancellationToken: cancellationToken) .ConfigureAwait(false); } catch (Exception ex) { Pipeline.LogException(ex); throw; } finally { Pipeline.LogMethodExit(nameof(BlobContainerClient)); } } } #endregion GetAccessPolicy #region SetAccessPolicy /// <summary> /// The <see cref="SetAccessPolicy"/> operation sets the /// permissions for the specified container. The permissions indicate /// whether blob container data may be accessed publicly. /// /// For more information, see /// <see href=" https://docs.microsoft.com/rest/api/storageservices/set-container-acl"> /// Set Container ACL</see>. /// </summary> /// <param name="accessType"> /// Optionally specifies whether data in the container may be accessed /// publicly and the level of access. <see cref="PublicAccessType.BlobContainer"/> /// specifies full public read access for container and blob data. /// Clients can enumerate blobs within the container via anonymous /// request, but cannot enumerate containers within the storage /// account. <see cref="PublicAccessType.Blob"/> specifies public /// read access for blobs. Blob data within this container can be /// read via anonymous request, but container data is not available. /// Clients cannot enumerate blobs within the container via anonymous /// request. <see cref="PublicAccessType.None"/> specifies that the /// container data is private to the account owner. /// </param> /// <param name="permissions"> /// Stored access policies that you can use to provide fine grained /// control over container permissions. /// </param> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on setting this blob container's access policy. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerInfo}"/> describing the /// updated container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual Response<BlobContainerInfo> SetAccessPolicy( PublicAccessType accessType = PublicAccessType.None, IEnumerable<BlobSignedIdentifier> permissions = default, BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => SetAccessPolicyInternal( accessType, permissions, conditions, false, // async cancellationToken) .EnsureCompleted(); /// <summary> /// The <see cref="SetAccessPolicyAsync"/> operation sets the /// permissions for the specified container. The permissions indicate /// whether blob container data may be accessed publicly. /// /// For more information, see /// <see href=" https://docs.microsoft.com/rest/api/storageservices/set-container-acl"> /// Set Container ACL</see>. /// </summary> /// <param name="accessType"> /// Optionally specifies whether data in the container may be accessed /// publicly and the level of access. <see cref="PublicAccessType.BlobContainer"/> /// specifies full public read access for container and blob data. /// Clients can enumerate blobs within the container via anonymous /// request, but cannot enumerate containers within the storage /// account. <see cref="PublicAccessType.Blob"/> specifies public /// read access for blobs. Blob data within this container can be /// read via anonymous request, but container data is not available. /// Clients cannot enumerate blobs within the container via anonymous /// request. <see cref="PublicAccessType.None"/> specifies that the /// container data is private to the account owner. /// </param> /// <param name="permissions"> /// Stored access policies that you can use to provide fine grained /// control over container permissions. /// </param> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on setting this blob container's access policy. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerInfo}"/> describing the /// updated container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual async Task<Response<BlobContainerInfo>> SetAccessPolicyAsync( PublicAccessType accessType = PublicAccessType.None, IEnumerable<BlobSignedIdentifier> permissions = default, BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => await SetAccessPolicyInternal( accessType, permissions, conditions, true, // async cancellationToken) .ConfigureAwait(false); /// <summary> /// The <see cref="SetAccessPolicyAsync"/> operation sets the /// permissions for the specified container. The permissions indicate /// whether blob container data may be accessed publicly. /// /// For more information, see /// <see href=" https://docs.microsoft.com/rest/api/storageservices/set-container-acl"> /// Set Container ACL</see>. /// </summary> /// <param name="accessType"> /// Optionally specifies whether data in the container may be accessed /// publicly and the level of access. <see cref="PublicAccessType.BlobContainer"/> /// specifies full public read access for container and blob data. /// Clients can enumerate blobs within the container via anonymous /// request, but cannot enumerate containers within the storage /// account. <see cref="PublicAccessType.Blob"/> specifies public /// read access for blobs. Blob data within this container can be /// read via anonymous request, but container data is not available. /// Clients cannot enumerate blobs within the container via anonymous /// request. <see cref="PublicAccessType.None"/> specifies that the /// container data is private to the account owner. /// </param> /// <param name="permissions"> /// Stored access policies that you can use to provide fine grained /// control over container permissions. /// </param> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add /// conditions on setting this blob container's access policy. /// </param> /// <param name="async"> /// Whether to invoke the operation asynchronously. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContainerInfo}"/> describing the /// updated container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> private async Task<Response<BlobContainerInfo>> SetAccessPolicyInternal( PublicAccessType accessType, IEnumerable<BlobSignedIdentifier> permissions, BlobRequestConditions conditions, bool async, CancellationToken cancellationToken) { using (Pipeline.BeginLoggingScope(nameof(BlobContainerClient))) { Pipeline.LogMethodEnter( nameof(BlobContainerClient), message: $"{nameof(Uri)}: {Uri}\n" + $"{nameof(accessType)}: {accessType}"); try { if (conditions?.IfMatch != default || conditions?.IfNoneMatch != default) { throw BlobErrors.BlobConditionsMustBeDefault(nameof(RequestConditions.IfMatch), nameof(RequestConditions.IfNoneMatch)); } return await BlobRestClient.Container.SetAccessPolicyAsync( ClientDiagnostics, Pipeline, Uri, version: Version.ToVersionString(), permissions: permissions, leaseId: conditions?.LeaseId, access: accessType, ifModifiedSince: conditions?.IfModifiedSince, ifUnmodifiedSince: conditions?.IfUnmodifiedSince, async: async, operationName: $"{nameof(BlobContainerClient)}.{nameof(SetAccessPolicy)}", cancellationToken: cancellationToken) .ConfigureAwait(false); } catch (Exception ex) { Pipeline.LogException(ex); throw; } finally { Pipeline.LogMethodExit(nameof(BlobContainerClient)); } } } #endregion SetAccessPolicy #region GetBlobs /// <summary> /// The <see cref="GetBlobs"/> operation returns an async sequence /// of blobs in this container. Enumerating the blobs may make /// multiple requests to the service while fetching all the values. /// Blobs are ordered lexicographically by name. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/list-blobs"> /// List Blobs</see>. /// </summary> /// <param name="traits"> /// Specifies trait options for shaping the blobs. /// </param> /// <param name="states"> /// Specifies state options for filtering the blobs. /// </param> /// <param name="prefix"> /// Specifies a string that filters the results to return only blobs /// whose name begins with the specified <paramref name="prefix"/>. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// An <see cref="Pageable{T}"/> of <see cref="BlobItem"/> /// describing the blobs in the container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual Pageable<BlobItem> GetBlobs( BlobTraits traits = BlobTraits.None, BlobStates states = BlobStates.None, string prefix = default, CancellationToken cancellationToken = default) => new GetBlobsAsyncCollection(this, traits, states, prefix).ToSyncCollection(cancellationToken); /// <summary> /// The <see cref="GetBlobsAsync"/> operation returns an async /// sequence of blobs in this container. Enumerating the blobs may /// make multiple requests to the service while fetching all the /// values. Blobs are ordered lexicographically by name. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/list-blobs"> /// List Blobs</see>. /// </summary> /// <param name="traits"> /// Specifies trait options for shaping the blobs. /// </param> /// <param name="states"> /// Specifies state options for filtering the blobs. /// </param> /// <param name="prefix"> /// Specifies a string that filters the results to return only blobs /// whose name begins with the specified <paramref name="prefix"/>. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// An <see cref="AsyncPageable{T}"/> describing the /// blobs in the container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual AsyncPageable<BlobItem> GetBlobsAsync( BlobTraits traits = BlobTraits.None, BlobStates states = BlobStates.None, string prefix = default, CancellationToken cancellationToken = default) => new GetBlobsAsyncCollection(this, traits, states, prefix).ToAsyncCollection(cancellationToken); /// <summary> /// The <see cref="GetBlobsInternal"/> operation returns a /// single segment of blobs in this container, starting /// from the specified <paramref name="marker"/>. Use an empty /// <paramref name="marker"/> to start enumeration from the beginning /// and the <see cref="BlobsFlatSegment.NextMarker"/> if it's not /// empty to make subsequent calls to <see cref="GetBlobsAsync"/> /// to continue enumerating the blobs segment by segment. Blobs are /// ordered lexicographically by name. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/list-blobs"> /// List Blobs</see>. /// </summary> /// <param name="marker"> /// An optional string value that identifies the segment of the list /// of blobs to be returned with the next listing operation. The /// operation returns a non-empty <see cref="BlobsFlatSegment.NextMarker"/> /// if the listing operation did not return all blobs remaining to be /// listed with the current segment. The NextMarker value can /// be used as the value for the <paramref name="marker"/> parameter /// in a subsequent call to request the next segment of list items. /// </param> /// <param name="traits"> /// Specifies trait options for shaping the blobs. /// </param> /// <param name="states"> /// Specifies state options for filtering the blobs. /// </param> /// <param name="prefix"> /// Specifies a string that filters the results to return only blobs /// whose name begins with the specified <paramref name="prefix"/>. /// </param> /// <param name="pageSizeHint"> /// Gets or sets a value indicating the size of the page that should be /// requested. /// </param> /// <param name="async"> /// Whether to invoke the operation asynchronously. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobsFlatSegment}"/> describing a /// segment of the blobs in the container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> internal async Task<Response<BlobsFlatSegment>> GetBlobsInternal( string marker, BlobTraits traits, BlobStates states, string prefix, int? pageSizeHint, bool async, CancellationToken cancellationToken) { using (Pipeline.BeginLoggingScope(nameof(BlobContainerClient))) { Pipeline.LogMethodEnter( nameof(BlobContainerClient), message: $"{nameof(Uri)}: {Uri}\n" + $"{nameof(marker)}: {marker}\n" + $"{nameof(traits)}: {traits}\n" + $"{nameof(states)}: {states}"); try { Response<BlobsFlatSegment> response = await BlobRestClient.Container.ListBlobsFlatSegmentAsync( ClientDiagnostics, Pipeline, Uri, version: Version.ToVersionString(), marker: marker, prefix: prefix, maxresults: pageSizeHint, include: BlobExtensions.AsIncludeItems(traits, states), async: async, cancellationToken: cancellationToken) .ConfigureAwait(false); if ((traits & BlobTraits.Metadata) != BlobTraits.Metadata) { IEnumerable<BlobItem> blobItems = response.Value.BlobItems.ToBlobItems(); foreach (BlobItem blobItem in blobItems) { blobItem.Metadata = null; } } return response; } catch (Exception ex) { Pipeline.LogException(ex); throw; } finally { Pipeline.LogMethodExit(nameof(BlobContainerClient)); } } } #endregion GetBlobs #region GetBlobsByHierarchy /// <summary> /// The <see cref="GetBlobsByHierarchy"/> operation returns /// an async collection of blobs in this container. Enumerating the /// blobs may make multiple requests to the service while fetching all /// the values. Blobs are ordered lexicographically by name. A /// <paramref name="delimiter"/> can be used to traverse a virtual /// hierarchy of blobs as though it were a file system. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/list-blobs"> /// List Blobs</see>. /// </summary> /// <param name="traits"> /// Specifies trait options for shaping the blobs. /// </param> /// <param name="states"> /// Specifies state options for filtering the blobs. /// </param> /// <param name="delimiter"> /// A <paramref name="delimiter"/> that can be used to traverse a /// virtual hierarchy of blobs as though it were a file system. The /// delimiter may be a single character or a string. /// <see cref="BlobHierarchyItem.Prefix"/> will be returned /// in place of all blobs whose names begin with the same substring up /// to the appearance of the delimiter character. The value of a /// prefix is substring+delimiter, where substring is the common /// substring that begins one or more blob names, and delimiter is the /// value of <paramref name="delimiter"/>. You can use the value of /// prefix to make a subsequent call to list the blobs that begin with /// this prefix, by specifying the value of the prefix for the /// <paramref name="prefix"/>. /// /// Note that each BlobPrefix element returned counts toward the /// maximum result, just as each Blob element does. /// </param> /// <param name="prefix"> /// Specifies a string that filters the results to return only blobs /// whose name begins with the specified <paramref name="prefix"/>. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// An <see cref="Pageable{T}"/> of <see cref="BlobHierarchyItem"/> /// describing the blobs in the container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual Pageable<BlobHierarchyItem> GetBlobsByHierarchy( BlobTraits traits = BlobTraits.None, BlobStates states = BlobStates.None, string delimiter = default, string prefix = default, CancellationToken cancellationToken = default) => new GetBlobsByHierarchyAsyncCollection(this, delimiter, traits, states, prefix).ToSyncCollection(cancellationToken); /// <summary> /// The <see cref="GetBlobsByHierarchyAsync"/> operation returns /// an async collection of blobs in this container. Enumerating the /// blobs may make multiple requests to the service while fetching all /// the values. Blobs are ordered lexicographically by name. A /// <paramref name="delimiter"/> can be used to traverse a virtual /// hierarchy of blobs as though it were a file system. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/list-blobs"> /// List Blobs</see>. /// </summary> /// <param name="traits"> /// Specifies trait options for shaping the blobs. /// </param> /// <param name="states"> /// Specifies state options for filtering the blobs. /// </param> /// <param name="delimiter"> /// A <paramref name="delimiter"/> that can be used to traverse a /// virtual hierarchy of blobs as though it were a file system. The /// delimiter may be a single character or a string. /// <see cref="BlobHierarchyItem.Prefix"/> will be returned /// in place of all blobs whose names begin with the same substring up /// to the appearance of the delimiter character. The value of a /// prefix is substring+delimiter, where substring is the common /// substring that begins one or more blob names, and delimiter is the /// value of <paramref name="delimiter"/>. You can use the value of /// prefix to make a subsequent call to list the blobs that begin with /// this prefix, by specifying the value of the prefix for the /// <paramref name="prefix"/>. /// /// Note that each BlobPrefix element returned counts toward the /// maximum result, just as each Blob element does. /// </param> /// <param name="prefix"> /// Specifies a string that filters the results to return only blobs /// whose name begins with the specified <paramref name="prefix"/>. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// An <see cref="AsyncPageable{T}"/> describing the /// blobs in the container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> public virtual AsyncPageable<BlobHierarchyItem> GetBlobsByHierarchyAsync( BlobTraits traits = BlobTraits.None, BlobStates states = BlobStates.None, string delimiter = default, string prefix = default, CancellationToken cancellationToken = default) => new GetBlobsByHierarchyAsyncCollection(this, delimiter, traits, states, prefix).ToAsyncCollection(cancellationToken); /// <summary> /// The <see cref="GetBlobsByHierarchyInternal"/> operation returns /// a single segment of blobs in this container, starting /// from the specified <paramref name="marker"/>. Use an empty /// <paramref name="marker"/> to start enumeration from the beginning /// and the <see cref="BlobsHierarchySegment.NextMarker"/> if it's not /// empty to make subsequent calls to <see cref="GetBlobsByHierarchyAsync"/> /// to continue enumerating the blobs segment by segment. Blobs are /// ordered lexicographically by name. A <paramref name="delimiter"/> /// can be used to traverse a virtual hierarchy of blobs as though /// it were a file system. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/list-blobs"> /// List Blobs</see>. /// </summary> /// <param name="marker"> /// An optional string value that identifies the segment of the list /// of blobs to be returned with the next listing operation. The /// operation returns a non-empty <see cref="BlobsHierarchySegment.NextMarker"/> /// if the listing operation did not return all blobs remaining to be /// listed with the current segment. The NextMarker value can /// be used as the value for the <paramref name="marker"/> parameter /// in a subsequent call to request the next segment of list items. /// </param> /// <param name="delimiter"> /// A <paramref name="delimiter"/> that can be used to traverse a /// virtual hierarchy of blobs as though it were a file system. The /// delimiter may be a single character or a string. /// <see cref="BlobHierarchyItem.Prefix"/> will be returned /// in place of all blobs whose names begin with the same substring up /// to the appearance of the delimiter character. The value of a /// prefix is substring+delimiter, where substring is the common /// substring that begins one or more blob names, and delimiter is the /// value of <paramref name="delimiter"/>. You can use the value of /// prefix to make a subsequent call to list the blobs that begin with /// this prefix, by specifying the value of the prefix for the /// <paramref name="prefix"/>. /// /// Note that each BlobPrefix element returned counts toward the /// maximum result, just as each Blob element does. /// </param> /// <param name="traits"> /// Specifies trait options for shaping the blobs. /// </param> /// <param name="states"> /// Specifies state options for filtering the blobs. /// </param> /// <param name="prefix"> /// Specifies a string that filters the results to return only blobs /// whose name begins with the specified <paramref name="prefix"/>. /// </param> /// <param name="pageSizeHint"> /// Gets or sets a value indicating the size of the page that should be /// requested. /// </param> /// <param name="async"> /// Whether to invoke the operation asynchronously. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobsHierarchySegment}"/> describing a /// segment of the blobs in the container. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> internal async Task<Response<BlobsHierarchySegment>> GetBlobsByHierarchyInternal( string marker, string delimiter, BlobTraits traits, BlobStates states, string prefix, int? pageSizeHint, bool async, CancellationToken cancellationToken) { using (Pipeline.BeginLoggingScope(nameof(BlobContainerClient))) { Pipeline.LogMethodEnter( nameof(BlobContainerClient), message: $"{nameof(Uri)}: {Uri}\n" + $"{nameof(marker)}: {marker}\n" + $"{nameof(delimiter)}: {delimiter}\n" + $"{nameof(traits)}: {traits}\n" + $"{nameof(states)}: {states}"); try { return await BlobRestClient.Container.ListBlobsHierarchySegmentAsync( ClientDiagnostics, Pipeline, Uri, version: Version.ToVersionString(), marker: marker, prefix: prefix, maxresults: pageSizeHint, include: BlobExtensions.AsIncludeItems(traits, states), delimiter: delimiter, async: async, cancellationToken: cancellationToken) .ConfigureAwait(false); } catch (Exception ex) { Pipeline.LogException(ex); throw; } finally { Pipeline.LogMethodExit(nameof(BlobContainerClient)); } } } #endregion GetBlobsByHierarchy #region UploadBlob /// <summary> /// The <see cref="UploadBlobAsync"/> operation creates a new block /// blob. /// /// For partial block blob updates and other advanced features, please /// see <see cref="BlockBlobClient"/>. To create or modify page or /// append blobs, please see <see cref="PageBlobClient"/> or /// <see cref="AppendBlobClient"/>. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/put-blob"> /// Put Blob</see>. /// </summary> /// <param name="blobName">The name of the blob to upload.</param> /// <param name="content"> /// A <see cref="Stream"/> containing the content to upload. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContentInfo}"/> describing the /// state of the updated block blob. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown /// if the blob already exists. To overwrite an existing block blob, /// get a <see cref="BlobClient"/> by calling <see cref="GetBlobClient(string)"/>, /// and then call <see cref="BlobClient.UploadAsync(Stream, bool, CancellationToken)"/> /// with the override parameter set to true. /// </remarks> [ForwardsClientCalls] public virtual Response<BlobContentInfo> UploadBlob( string blobName, Stream content, CancellationToken cancellationToken = default) => GetBlobClient(blobName) .Upload( content, cancellationToken); /// <summary> /// The <see cref="UploadBlob"/> operation creates a new block /// blob. /// /// For partial block blob updates and other advanced features, please /// see <see cref="BlockBlobClient"/>. To create or modify page or /// append blobs, please see <see cref="PageBlobClient"/> or /// <see cref="AppendBlobClient"/>. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/put-blob"> /// Put Blob</see>. /// </summary> /// <param name="blobName">The name of the blob to upload.</param> /// <param name="content"> /// A <see cref="Stream"/> containing the content to upload. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response{BlobContentInfo}"/> describing the /// state of the updated block blob. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown /// if the blob already exists. To overwrite an existing block blob, /// get a <see cref="BlobClient"/> by calling <see cref="GetBlobClient(string)"/>, /// and then call <see cref="BlobClient.Upload(Stream, bool, CancellationToken)"/> /// with the override parameter set to true. /// </remarks> [ForwardsClientCalls] public virtual async Task<Response<BlobContentInfo>> UploadBlobAsync( string blobName, Stream content, CancellationToken cancellationToken = default) => await GetBlobClient(blobName) .UploadAsync( content, cancellationToken) .ConfigureAwait(false); #endregion UploadBlob #region DeleteBlob /// <summary> /// The <see cref="DeleteBlob"/> operation marks the specified /// blob or snapshot for deletion. The blob is later deleted during /// garbage collection. /// /// Note that in order to delete a blob, you must delete all of its /// snapshots. You can delete both at the same time using /// <see cref="DeleteSnapshotsOption.IncludeSnapshots"/>. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/delete-blob"> /// Delete Blob</see>. /// </summary> /// <param name="blobName">The name of the blob to delete.</param> /// <param name="snapshotsOption"> /// Specifies options for deleting blob snapshots. /// </param> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add conditions on /// deleting this blob. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response"/> on successfully deleting. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> [ForwardsClientCalls] public virtual Response DeleteBlob( string blobName, DeleteSnapshotsOption snapshotsOption = default, BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => GetBlobClient(blobName) .Delete( snapshotsOption, conditions, cancellationToken); /// <summary> /// The <see cref="DeleteBlobAsync"/> operation marks the specified /// blob or snapshot for deletion. The blob is later deleted during /// garbage collection. /// /// Note that in order to delete a blob, you must delete all of its /// snapshots. You can delete both at the same time using /// <see cref="DeleteSnapshotsOption.IncludeSnapshots"/>. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/delete-blob"> /// Delete Blob</see>. /// </summary> /// <param name="blobName">The name of the blob to delete.</param> /// <param name="snapshotsOption"> /// Specifies options for deleting blob snapshots. /// </param> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add conditions on /// deleting this blob. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response"/> on successfully deleting. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> [ForwardsClientCalls] public virtual async Task<Response> DeleteBlobAsync( string blobName, DeleteSnapshotsOption snapshotsOption = default, BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => await GetBlobClient(blobName) .DeleteAsync( snapshotsOption, conditions, cancellationToken) .ConfigureAwait(false); /// <summary> /// The <see cref="DeleteBlobIfExists"/> operation marks the specified /// blob or snapshot for deletion, if the blob or snapshot exists. The blob /// is later deleted during garbage collection. /// /// Note that in order to delete a blob, you must delete all of its /// snapshots. You can delete both at the same time using /// <see cref="DeleteSnapshotsOption.IncludeSnapshots"/>. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/delete-blob"> /// Delete Blob</see>. /// </summary> /// <param name="blobName">The name of the blob to delete.</param> /// <param name="snapshotsOption"> /// Specifies options for deleting blob snapshots. /// </param> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add conditions on /// deleting this blob. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response"/> on successfully deleting. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> [ForwardsClientCalls] public virtual Response<bool> DeleteBlobIfExists( string blobName, DeleteSnapshotsOption snapshotsOption = default, BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => GetBlobClient(blobName). DeleteIfExists( snapshotsOption, conditions ?? default, cancellationToken); /// <summary> /// The <see cref="DeleteBlobIfExistsAsync"/> operation marks the specified /// blob or snapshot for deletion, if the blob or snapshot exists. The blob /// is later deleted during garbage collection. /// /// Note that in order to delete a blob, you must delete all of its /// snapshots. You can delete both at the same time using /// <see cref="DeleteSnapshotsOption.IncludeSnapshots"/>. /// /// For more information, see /// <see href="https://docs.microsoft.com/rest/api/storageservices/delete-blob"> /// Delete Blob</see>. /// </summary> /// <param name="blobName">The name of the blob to delete.</param> /// <param name="snapshotsOption"> /// Specifies options for deleting blob snapshots. /// </param> /// <param name="conditions"> /// Optional <see cref="BlobRequestConditions"/> to add conditions on /// deleting this blob. /// </param> /// <param name="cancellationToken"> /// Optional <see cref="CancellationToken"/> to propagate /// notifications that the operation should be cancelled. /// </param> /// <returns> /// A <see cref="Response"/> on successfully deleting. /// </returns> /// <remarks> /// A <see cref="RequestFailedException"/> will be thrown if /// a failure occurs. /// </remarks> [ForwardsClientCalls] public virtual async Task<Response<bool>> DeleteBlobIfExistsAsync( string blobName, DeleteSnapshotsOption snapshotsOption = default, BlobRequestConditions conditions = default, CancellationToken cancellationToken = default) => await GetBlobClient(blobName).DeleteIfExistsAsync( snapshotsOption, conditions ?? default, cancellationToken) .ConfigureAwait(false); #endregion DeleteBlob } }
45.540503
171
0.57654
[ "MIT" ]
Aishwarya-C-S/azure-sdk-for-net
sdk/storage/Azure.Storage.Blobs/src/BlobContainerClient.cs
130,430
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("ConsoleOcr")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ConsoleOcr")] [assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 会使此程序集中的类型 //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("1b15a552-dcc9-4c49-93df-5dea80a855f8")] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
25.27027
56
0.715508
[ "MIT" ]
6769/Win10UwpOcr
ConsoleOcr/Properties/AssemblyInfo.cs
1,276
C#
using System; using System.Collections.Generic; using System.Linq; using System.Numerics; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { public class Test { // TODO: test public Complex[][] DiscreteFourierTransformation(double[][] matrix) { matrix = /*Centralize(*/matrix/*)*/; Complex[][] transformationResult = new Complex[matrix[0].Length][]; for (int i = 0; i < matrix[0].Length; i++) { Complex[] complexArray = ConvertDoubleArrayToComplex(matrix[i]); transformationResult[i] = TransformArray(complexArray); } Complex[][] finalTransformationResult = new Complex[matrix[0].Length][]; for (int i = 0; i < matrix[0].Length; i++) { Complex[] column = GetColumn(i, transformationResult); finalTransformationResult[i] = TransformArray(column); } Complex[][] transposedMatrix = TransposeMatrix(finalTransformationResult); //var m = ConvertComplexMatrixToDouble(transposedMatrix); //return m; return transposedMatrix; } private double[][] Centralize(double[][] matrix) { for (int i = 0; i < matrix.Length; i++) { for (int j = 0; j < matrix[0].Length; j++) { matrix[i][j] *= (i + j) / 2 == 0 ? 1 : -1; } } return matrix; } public Complex[] TransformArray(Complex[] array) { // generate transformation matrix Complex[][] fourierTransformationMatrix = GenerateTransformationMatrix(array.Length); // multiply array and matrix Complex[] result = MultiplyMatrixAndArray(fourierTransformationMatrix, array); return NormalizeComplexArray(result); } // TODO: test (DONE) public Complex[] NormalizeComplexArray(Complex[] array) { double ratio = 1 / Math.Sqrt(array.Length); for (int i = 0; i < array.Length; i++) { array[i] = new Complex(array[i].Real * ratio, array[i].Imaginary * ratio); } return array; } // TODO: test (DONE) public Complex[][] GenerateTransformationMatrix(int size) { Complex[][] transformationMatrix = new Complex[size][]; for (int i = 0; i < size; i++) { transformationMatrix[i] = new Complex[size]; } var _gen_var_name_0 = size / 4; var _gen_var_name_1 = size / _gen_var_name_0 + (size % _gen_var_name_0 > 0 ? 1 : 0); var _gen_var_name_2 = 4; var _gen_var_name_9 = _gen_var_name_1 / _gen_var_name_2 + (_gen_var_name_1 % _gen_var_name_2 == 0 ? 0 : 1); var _gen_var_name_8 = _gen_var_name_0 * _gen_var_name_2; System.Threading.ThreadPool.SetMaxThreads(_gen_var_name_2, _gen_var_name_2); List<Task> task_gen_var_name_0 = new List<Task>(); for (var _gen_var_name_3 = 0; _gen_var_name_3 < _gen_var_name_2; _gen_var_name_3++) { var _gen_var_name_4 = _gen_var_name_3; var task_gen_var_name_1 = Task.Factory.StartNew(() => { for (var _gen_var_name_6 = 0; _gen_var_name_6 < _gen_var_name_9; _gen_var_name_6++) { var _gen_var_name_7 = _gen_var_name_6; for (int _gen_var_name_5 = _gen_var_name_4 * _gen_var_name_0 + _gen_var_name_7 * _gen_var_name_8; _gen_var_name_5 < _gen_var_name_4 * _gen_var_name_0 + _gen_var_name_7 * _gen_var_name_8 + _gen_var_name_0 && _gen_var_name_5 < size; _gen_var_name_5++) { for (int j = 1; j <= _gen_var_name_5; j++) { double multiplier = -2 * Math.PI * (_gen_var_name_5 - 1) * (j - 1) / size; Complex matrixElement = Complex.Exp(new Complex(0, multiplier)); transformationMatrix[_gen_var_name_5 - 1][j - 1] = transformationMatrix[j - 1][_gen_var_name_5 - 1] = matrixElement; } } } } ); task_gen_var_name_0.Add(task_gen_var_name_1); } foreach (var _gen_var_name_10 in task_gen_var_name_0) { _gen_var_name_10.Wait(); } return transformationMatrix; } // TODO: test (DONE) public Complex[] MultiplyMatrixAndArray(Complex[][] matrix, Complex[] array) { Complex[] resultArray = new Complex[array.Length]; int matrixLength = matrix.Length; int rowLength = 0; var _gen_var_name_11 = matrixLength / 4; var _gen_var_name_12 = matrixLength / _gen_var_name_11 + (matrixLength % _gen_var_name_11 > 0 ? 1 : 0); var _gen_var_name_13 = 4; var _gen_var_name_20 = _gen_var_name_12 / _gen_var_name_13 + (_gen_var_name_12 % _gen_var_name_13 == 0 ? 0 : 1); var _gen_var_name_19 = _gen_var_name_11 * _gen_var_name_13; System.Threading.ThreadPool.SetMaxThreads(_gen_var_name_13, _gen_var_name_13); List<Task> task_gen_var_name_2 = new List<Task>(); for (var _gen_var_name_14 = 0; _gen_var_name_14 < _gen_var_name_13; _gen_var_name_14++) { var _gen_var_name_15 = _gen_var_name_14; var task_gen_var_name_3 = Task.Factory.StartNew(() => { for (var _gen_var_name_17 = 0; _gen_var_name_17 < _gen_var_name_20; _gen_var_name_17++) { var _gen_var_name_18 = _gen_var_name_17; for (int _gen_var_name_16 = _gen_var_name_15 * _gen_var_name_11 + _gen_var_name_18 * _gen_var_name_19; _gen_var_name_16 < _gen_var_name_15 * _gen_var_name_11 + _gen_var_name_18 * _gen_var_name_19 + _gen_var_name_11 && _gen_var_name_16 < matrixLength; _gen_var_name_16++) { for (int j = 0; j < rowLength; j++) { resultArray[_gen_var_name_16] = Complex.Add(resultArray[_gen_var_name_16], Complex.Multiply(matrix[_gen_var_name_16][j], array[j])); } } } } ); task_gen_var_name_2.Add(task_gen_var_name_3); } foreach (var _gen_var_name_21 in task_gen_var_name_2) { _gen_var_name_21.Wait(); } return resultArray; } private Complex[] ConvertDoubleArrayToComplex(double[] array) { int length = array.Length; Complex[] complexArray = new Complex[length]; var _gen_var_name_22 = length / 4; var _gen_var_name_23 = length / _gen_var_name_22 + (length % _gen_var_name_22 > 0 ? 1 : 0); var _gen_var_name_24 = 4; var _gen_var_name_31 = _gen_var_name_23 / _gen_var_name_24 + (_gen_var_name_23 % _gen_var_name_24 == 0 ? 0 : 1); var _gen_var_name_30 = _gen_var_name_22 * _gen_var_name_24; System.Threading.ThreadPool.SetMaxThreads(_gen_var_name_24, _gen_var_name_24); List<Task> task_gen_var_name_4 = new List<Task>(); for (var _gen_var_name_25 = 0; _gen_var_name_25 < _gen_var_name_24; _gen_var_name_25++) { var _gen_var_name_26 = _gen_var_name_25; var task_gen_var_name_5 = Task.Factory.StartNew(() => { for (var _gen_var_name_28 = 0; _gen_var_name_28 < _gen_var_name_31; _gen_var_name_28++) { var _gen_var_name_29 = _gen_var_name_28; for (int _gen_var_name_27 = _gen_var_name_26 * _gen_var_name_22 + _gen_var_name_29 * _gen_var_name_30; _gen_var_name_27 < _gen_var_name_26 * _gen_var_name_22 + _gen_var_name_29 * _gen_var_name_30 + _gen_var_name_22 && _gen_var_name_27 < length; _gen_var_name_27++) { complexArray[_gen_var_name_27] = new Complex(array[_gen_var_name_27], 0); } } } ); task_gen_var_name_4.Add(task_gen_var_name_5); } foreach (var _gen_var_name_32 in task_gen_var_name_4) { _gen_var_name_32.Wait(); } return complexArray; } // TODO: test (DONE) public Complex[] GetColumn(int index, Complex[][] matrix) { Complex[] column = new Complex[matrix.GetLength(0)]; for (int i = 0; i < matrix.GetLength(0); i++) { column[i] = matrix[i][index]; } return column; } // TODO: test (DONE) public Complex[][] TransposeMatrix(Complex[][] matrix) { Complex[][] transposedMatrix = new Complex[matrix.Length][]; for (int i = 0; i < matrix[0].Length; i++) { transposedMatrix[i] = new Complex[matrix[0].Length]; } for (int i = 0; i < matrix.Length; i++) { for (int j = 0; j < matrix[0].Length; j++) { transposedMatrix[j][i] = matrix[i][j]; } } return transposedMatrix; } // TODO: test (DONE) public double[][] ConvertComplexMatrixToDouble(Complex[][] matrix) { double[][] doubleMatrix = new double[matrix.Length][]; for (int i = 0; i < matrix.Length; i++) { doubleMatrix[i] = new double[matrix[0].Length]; for (int j = 0; j < matrix[0].Length; j++) { doubleMatrix[i][j] = Complex.Abs(matrix[i][j]); } } return doubleMatrix; } public double[][] GetGaussianFilterMatrix(int n, int m, double sigma) { double[][] matrix = new double[n][]; for (int i = 0; i < n; i++) { matrix[i] = new double[m]; for (int j = 0; j < m; j++) { //var d = DFunction(n, m, i + 1, j + 1); //matrix[i][j] = 1 - Math.Exp((-1) * d * d / 2 / DFunction(n, m, 0, 0)); var d = (-1) * ((i + 1) * (i + 1) + (j + 1) * (j + 1)) / (2 * sigma * sigma); matrix[i][j] = 1 / (2 * Math.PI * sigma * sigma) * Math.Exp(d); } } return matrix; /*double[][] matrix = new double[n][]; for (int i = 0; i < n; i++) { matrix[i] = new double[m]; } for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { //var d = DFunction(n, m, i + 1, j + 1); //matrix[i][j] = 1 - Math.Exp((-1) * d * d / 2 / DFunction(n, m, 0, 0)); var d = (-1) * ((i + 1) * (i + 1) + (j + 1) * (j + 1)) / (2 * sigma * sigma); matrix[i][j] = 1 / (2 * Math.PI * sigma * sigma) * Math.Exp(d); } } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { matrix[i][j] = matrix[i % 5][j % 5]; } } return matrix;*/ /*double[][] matrix = new double[n][]; for (int i = 0; i < n; i++) { matrix[i] = new double[m]; } matrix[0][0] = 0.003; matrix[0][1] = 0.013; matrix[0][2] = 0.022; matrix[0][3] = 0.013; matrix[0][4] = 0.003; matrix[1][0] = 0.013; matrix[1][1] = 0.059; matrix[1][2] = 0.097; matrix[1][3] = 0.059; matrix[1][4] = 0.013; matrix[2][0] = 0.022; matrix[2][1] = 0.097; matrix[2][2] = 0.159; matrix[2][3] = 0.097; matrix[2][4] = 0.022; matrix[3][0] = 0.013; matrix[3][1] = 0.059; matrix[3][2] = 0.097; matrix[3][3] = 0.059; matrix[3][4] = 0.013; matrix[4][0] = 0.003; matrix[4][1] = 0.013; matrix[4][2] = 0.022; matrix[4][3] = 0.013; matrix[4][4] = 0.003; for (int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { matrix[i][j] = matrix[i % 5][j % 5]; } } return matrix;*/ } public double GetGaussianFilterValue(int i, int j, double sigma) { var d = (-1) * ((i + 1) * (i + 1) + (j + 1) * (j + 1)) / (2 * sigma * sigma); return 1 / (2 * Math.PI * sigma * sigma) * Math.Exp(d); } public double DFunction(int n, int m, int i, int j) { return Math.Sqrt((i - n / 2) * (i - n / 2) + (j - m / 2) * (j - m / 2)); } public double[][] MultiplyMatrices(double[][] matrix, double[][] filter) { double[][] result = new double[matrix.Length][]; for (int i = 0; i < result.Length; i++) { result[i] = new double[matrix[0].Length]; } for (int i = 0; i < result.Length; i++) { for (int j = 0; j < result[0].Length; j++) { for (int k = 0; k < result[0].Length; k++) { result[i][j] += filter[i][k] * matrix[k][j]; } } } return result; } public double[][] MultiplyMatricesByElements(double[][] filter, double[][] matrix) { double[][] result = new double[matrix.Length][]; for (int i = 0; i < matrix[0].Length; i++) { result[i] = new double[matrix[0].Length]; for (int j = 0; j < matrix[0].Length; j++) { result[i][j] = matrix[i][j] * filter[i][j]; } } return result; } public Complex[][] MultiplyMatricesByElements(Complex[][] filter, Complex[][] matrix) { Complex[][] result = new Complex[matrix.Length][]; for (int i = 0; i < matrix[0].Length; i++) { result[i] = new Complex[matrix[0].Length]; for (int j = 0; j < matrix[0].Length; j++) { result[i][j] = matrix[i][j] * filter[i][j]; } } return result; } /* public double[][] Transform(double[][] image) { var matrix = DiscreteFourierTransformation(image); var filter = DiscreteFourierTransformation(GetGaussianFilterMatrix(image.Length, image[0].Length, 0.9)); //var filter = DiscreteFourierTransformation(GaussCrenel(1, image.Length)); var result = MultiplyMatricesByElements(matrix, filter); return InverseFourierTransformation(result); } */ public double[][] GaussCrenel(float sigma, int radius) { int k = 2 * radius + 1; double coeff = 1.0f / (2.0f * (double)Math.PI * sigma * sigma); double[][] A = new double[k][]; for (int i = 0; i < k; i++) { A[i] = new double[k]; } for (int i = 0; i < k; i++) { for (int j = 0; j < k; j++) { A[i][j] = coeff * (double)Math.Exp(-(Math.Pow(k - i - 1, 2) + Math.Pow(k - j - 1, 2)) / (2 * sigma * sigma)); } } return A; } public double[][] InverseFourierTransformation(double[][] matrix) { Complex[][] transformationResult = new Complex[matrix[0].Length][]; for (int i = 0; i < matrix[0].Length; i++) { Complex[] complexArray = ConvertDoubleArrayToComplex(matrix[i]); transformationResult[i] = InverseTransformArray(complexArray); } Complex[][] finalTransformationResult = new Complex[matrix[0].Length][]; for (int i = 0; i < matrix[0].Length; i++) { Complex[] column = GetColumn(i, transformationResult); finalTransformationResult[i] = InverseTransformArray(column); } Complex[][] transposedMatrix = TransposeMatrix(finalTransformationResult); var m = /*Centralize(*/ConvertComplexMatrixToDouble(transposedMatrix);//); return m; } public Complex[][] InverseFourierTransformation(Complex[][] matrix) { Complex[][] transformationResult = new Complex[matrix[0].Length][]; for (int i = 0; i < matrix[0].Length; i++) { transformationResult[i] = InverseTransformArray(matrix[i]); } Complex[][] finalTransformationResult = new Complex[matrix[0].Length][]; for (int i = 0; i < matrix[0].Length; i++) { Complex[] column = GetColumn(i, transformationResult); finalTransformationResult[i] = InverseTransformArray(column); } Complex[][] transposedMatrix = TransposeMatrix(finalTransformationResult); //var m = /*Centralize(*/ConvertComplexMatrixToDouble(transposedMatrix);//); //return m; return transposedMatrix; } public Complex[] InverseTransformArray(Complex[] array) { // generate transformation matrix Complex[][] fourierTransformationMatrix = GenerateInverseTransformationMatrix(array.Length); // multiply array and matrix Complex[] result = MultiplyMatrixAndArray(fourierTransformationMatrix, array); return NormalizeComplexArray(result); } public Complex[][] GenerateInverseTransformationMatrix(int size) { Complex[][] transformationMatrix = new Complex[size][]; for (int i = 1; i <= size; i++) { transformationMatrix[i - 1] = new Complex[size]; for (int j = 1; j <= i; j++) { double multiplier = 2 * Math.PI * (i - 1) * (j - 1) / size; Complex matrixElement = Complex.Exp(new Complex(0, multiplier)); transformationMatrix[i - 1][j - 1] = transformationMatrix[j - 1][i - 1] = matrixElement; } } return transformationMatrix; } private double[][] Shift(double[][] matrix) { double[][] result = new double[matrix.Length][]; for (int i = 0; i < result.Length; i++) { result[i] = new double[matrix[0].Length]; } int middleX = matrix.Length / 2; int middleY = matrix[0].Length / 2; for (int i = 0; i < matrix.Length; i++) { for (int j = 0; j < matrix[0].Length; j++) { if (i < middleX && j < middleY) { result[i][j] = matrix[i + middleX][j + middleY]; } if (i >= middleX && j >= middleY) { result[i][j] = matrix[i - middleX][j - middleY]; } if (i < middleX && j >= middleY) { result[i][j] = matrix[i + middleX][j - middleY]; } if (i >= middleX && j < middleY) { result[i][j] = matrix[i - middleX][j + middleY]; } } } return result; } private double[][] Log(double[][] matrix) { for (int i = 0; i < matrix.Length; i++) { for (int j = 0; j < matrix[0].Length; j++) { matrix[i][j] = Math.Log(1 + matrix[i][j]); } } return matrix; } } }
36.422945
164
0.46688
[ "Apache-2.0" ]
NamiraJV/OmpForDotNet
ConsoleApp1/Test.cs
21,273
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace lab6_2 { [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)] public class NewAttribute : Attribute { public NewAttribute() { } public NewAttribute(string DescriptionParam) { Description = DescriptionParam; } public string Description { get; set; } } }
23.789474
89
0.665929
[ "MIT" ]
Lin69/BCIT_labs
Lab6/Lab6_1/lab6_2/NewAttribute.cs
454
C#
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using MongoDB.Driver; using SyslogWeb.Extensions; namespace SyslogWeb.Models { public class QueryParser { public QueryParser() { Facilities = new SyslogFacility[0]; Severities = new SyslogSeverity[0]; Programs = new string[0]; Hosts = new string[0]; } public string[] TextTerms { get; private set; } public string[] Hosts { get; private set; } public string[] Programs { get; private set; } public string QueryString { get; private set; } public IList<SyslogSeverity> Severities { get; private set; } public IList<SyslogFacility> Facilities { get; private set; } public FilterDefinition<SyslogEntry> Parse(string search, DateTimeOffset? maxdate = null) { QueryString = String.Empty; if (String.IsNullOrEmpty(search)) return ParseDate(maxdate, FilterDefinition<SyslogEntry>.Empty); var items = search.Split(new[] { ' ', '\n', '\r', '\t' }, StringSplitOptions.RemoveEmptyEntries); var namedItems = items.Where(x => x.Contains(":")) .Where(x => !x.StartsWith(":")) .Where(x => !x.EndsWith(":")) .Select(x => x.Split(':')) .Where(x => x.Length == 2) .GroupBy(x => x[0], x => x[1]) .ToArray(); TextTerms = items.Where(x => !x.Contains(":") || x.StartsWith(":") || x.EndsWith(":")).ToArray(); var result = FilterDefinition<SyslogEntry>.Empty; var queryParts = new List<string>(); foreach (var item in namedItems) { switch (item.Key.ToLowerInvariant()) { case "host": result = result.And(item.Or(x => x.Host)); queryParts.Add(String.Join(" ", item.Select(x => String.Format("host:{0}", x)).ToArray())); Hosts = item.ToArray(); break; case "program": result = result.And(item.Or(x => x.Program)); queryParts.Add(String.Join(" ", item.Select(x => String.Format("program:{0}", x)).ToArray())); Programs = item.ToArray(); break; case "facility": { result = result.And(OrEnum(x => x.Facility, item, out var enumValues)); queryParts.Add(String.Join(" ", item.Select(x => String.Format("facility:{0}", x)).ToArray())); Facilities = enumValues; break; } case "severity": { var orQuery = OrEnum(x => x.Severity, item, out var enumValues); if (enumValues.Contains(SyslogSeverity.Crit) && !enumValues.Contains(SyslogSeverity.Critical)) { orQuery = orQuery.Or(Builders<SyslogEntry>.Filter.Eq(x => x.Severity, SyslogSeverity.Critical)); } else if (!enumValues.Contains(SyslogSeverity.Crit) && enumValues.Contains(SyslogSeverity.Critical)) { orQuery = orQuery.Or(Builders<SyslogEntry>.Filter.Eq(x => x.Severity, SyslogSeverity.Crit)); } if (enumValues.Contains(SyslogSeverity.Err) && !enumValues.Contains(SyslogSeverity.Error)) { orQuery = orQuery.Or(Builders<SyslogEntry>.Filter.Eq(x => x.Severity, SyslogSeverity.Error)); } else if (!enumValues.Contains(SyslogSeverity.Err) && enumValues.Contains(SyslogSeverity.Error)) { orQuery = orQuery.Or(Builders<SyslogEntry>.Filter.Eq(x => x.Severity, SyslogSeverity.Err)); } result = result.And(orQuery); queryParts.Add(String.Join(" ", item.Select(x => String.Format("severity:{0}", x)).ToArray())); Severities = enumValues; break; } default: continue; } } if (TextTerms.Any()) { var searchText = String.Join(" ", TextTerms); result = result.And(Builders<SyslogEntry>.Filter.Text(searchText)); queryParts.Add(searchText); } QueryString = String.Join(" ", queryParts); return ParseDate(maxdate, result); } private FilterDefinition<SyslogEntry> ParseDate(DateTimeOffset? maxdate, FilterDefinition<SyslogEntry> result) { if (maxdate.HasValue) { result = result.And(Builders<SyslogEntry>.Filter.Lte(x => x.Date, maxdate.Value)); } return result; } private static FilterDefinition<SyslogEntry> OrEnum<T>(Expression<Func<SyslogEntry, T>> property, IEnumerable<string> values, out List<T> enumValues) where T : struct { var v = values.ToArray(); var matchEnums = v.Where(x => !x.StartsWith("!")).ParseEnum<T>().ToArray(); var notMatchEnums = v.Where(x => x.StartsWith("!")).Select(x => x.Substring(1)).ParseEnum<T>().ToArray(); var matchQuery = FilterDefinition<SyslogEntry>.Empty; if (matchEnums.Any()) { matchQuery = Builders<SyslogEntry>.Filter.Or(matchEnums.Select(x => Builders<SyslogEntry>.Filter.Eq(property, x))); } var notMatchQuery = FilterDefinition<SyslogEntry>.Empty; if (notMatchEnums.Any()) { notMatchQuery = Builders<SyslogEntry>.Filter.And(notMatchEnums.Select(x => Builders<SyslogEntry>.Filter.Not(Builders<SyslogEntry>.Filter.Eq(property, x)))); } enumValues = matchEnums.Concat(notMatchEnums).Distinct().ToList(); return matchQuery.And(notMatchQuery); } } }
47.352518
172
0.497113
[ "MIT" ]
zivillian/Syslogweb
SyslogWeb/Models/QueryParser.cs
6,584
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.GoogleNative.Compute.Beta.Inputs { /// <summary> /// A Duration represents a fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond resolution. It is independent of any calendar and concepts like "day" or "month". Range is approximately 10,000 years. /// </summary> public sealed class DurationArgs : Pulumi.ResourceArgs { /// <summary> /// Span of time that's a fraction of a second at nanosecond resolution. Durations less than one second are represented with a 0 `seconds` field and a positive `nanos` field. Must be from 0 to 999,999,999 inclusive. /// </summary> [Input("nanos")] public Input<int>? Nanos { get; set; } /// <summary> /// Span of time at a resolution of a second. Must be from 0 to 315,576,000,000 inclusive. Note: these bounds are computed from: 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years /// </summary> [Input("seconds")] public Input<string>? Seconds { get; set; } public DurationArgs() { } } }
40.971429
249
0.665969
[ "Apache-2.0" ]
AaronFriel/pulumi-google-native
sdk/dotnet/Compute/Beta/Inputs/DurationArgs.cs
1,434
C#
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Linq; using Bicep.Core.Resources; using Bicep.Core.Semantics; using Bicep.Core.Semantics.Namespaces; using Bicep.Core.TypeSystem; using Bicep.Core.TypeSystem.Az; namespace Bicep.Core.UnitTests.Utils { /// <summary> /// A set of reusable resource types to validate various pieces of functionality. /// </summary> public class BuiltInTestTypes { private static ResourceTypeComponents BasicTestsType() { var resourceType = ResourceTypeReference.Parse("Test.Rp/basicTests@2020-01-01"); return new ResourceTypeComponents(resourceType, ResourceScope.ResourceGroup, new ObjectType(resourceType.FormatName(), TypeSymbolValidationFlags.Default, AzResourceTypeProvider.GetCommonResourceProperties(resourceType).Concat(new[] { new TypeProperty("kind", LanguageConstants.String, TypePropertyFlags.ReadOnly, "kind property"), }), null)); } private static ResourceTypeComponents ReadWriteTestsType() { var resourceType = ResourceTypeReference.Parse("Test.Rp/readWriteTests@2020-01-01"); var propertiesType = new ObjectType("Properties", TypeSymbolValidationFlags.WarnOnTypeMismatch, new[] { new TypeProperty("readwrite", LanguageConstants.String, TypePropertyFlags.None, "This is a property which supports reading AND writing!"), new TypeProperty("readonly", LanguageConstants.String, TypePropertyFlags.ReadOnly, "This is a property which only supports reading."), new TypeProperty("writeonly", LanguageConstants.String, TypePropertyFlags.WriteOnly, "This is a property which only supports writing."), new TypeProperty("required", LanguageConstants.String, TypePropertyFlags.Required, "This is a property which is required."), }, null); return new ResourceTypeComponents(resourceType, ResourceScope.ResourceGroup, new ObjectType(resourceType.FormatName(), TypeSymbolValidationFlags.Default, AzResourceTypeProvider.GetCommonResourceProperties(resourceType).Concat(new[] { new TypeProperty("properties", propertiesType, TypePropertyFlags.Required, "properties property"), }), null)); } private static ResourceTypeComponents DiscriminatorTestsType() { var resourceType = ResourceTypeReference.Parse("Test.Rp/discriminatorTests@2020-01-01"); var bodyAProps = new ObjectType( "BodyAProperties", TypeSymbolValidationFlags.WarnOnTypeMismatch, new[] { new TypeProperty("propA", LanguageConstants.String, TypePropertyFlags.None, "This is the description for propA!"), }, null); var bodyBProps = new ObjectType( "BodyBProperties", TypeSymbolValidationFlags.WarnOnTypeMismatch, new[] { new TypeProperty("propB", LanguageConstants.String, TypePropertyFlags.None, "This is the description for propB!"), }, null); var bodyType = new DiscriminatedObjectType( resourceType.FormatName(), TypeSymbolValidationFlags.Default, "kind", new[] { new ObjectType("BodyA", TypeSymbolValidationFlags.Default, AzResourceTypeProvider.GetCommonResourceProperties(resourceType).Concat(new [] { new TypeProperty("kind", new StringLiteralType("BodyA"), TypePropertyFlags.None, "This is the kind of body A"), new TypeProperty("properties", bodyAProps, TypePropertyFlags.None, "These are the properties for body A"), }), null), new ObjectType("BodyB", TypeSymbolValidationFlags.Default, AzResourceTypeProvider.GetCommonResourceProperties(resourceType).Concat(new [] { new TypeProperty("kind", new StringLiteralType("BodyB"), TypePropertyFlags.None, "This is the kind of body B"), new TypeProperty("properties", bodyBProps, TypePropertyFlags.None, "These are the properties for body B"), }), null), }); return new ResourceTypeComponents(resourceType, ResourceScope.ResourceGroup, bodyType); } private static ResourceTypeComponents DiscriminatedPropertiesTestsType() { var resourceType = ResourceTypeReference.Parse("Test.Rp/discriminatedPropertiesTests@2020-01-01"); var propsA = new ObjectType( "PropertiesA", TypeSymbolValidationFlags.WarnOnTypeMismatch, new[] { new TypeProperty("propType", new StringLiteralType("PropertiesA"), TypePropertyFlags.None, "..."), new TypeProperty("propA", LanguageConstants.String, TypePropertyFlags.None, "This is the description for propA!"), }, null); var propsB = new ObjectType( "PropertiesB", TypeSymbolValidationFlags.WarnOnTypeMismatch, new[] { new TypeProperty("propType", new StringLiteralType("PropertiesB"), TypePropertyFlags.None, "..."), new TypeProperty("propB", LanguageConstants.String, TypePropertyFlags.None, "This is the description for propB!"), }, null); var propertiesType = new DiscriminatedObjectType( "properties", TypeSymbolValidationFlags.Default, "propType", new[] { propsA, propsB }); return new ResourceTypeComponents(resourceType, ResourceScope.ResourceGroup, new ObjectType(resourceType.FormatName(), TypeSymbolValidationFlags.Default, AzResourceTypeProvider.GetCommonResourceProperties(resourceType).Concat(new[] { new TypeProperty("properties", propertiesType, TypePropertyFlags.Required, "properties property"), }), null)); } private static ResourceTypeComponents DiscriminatedPropertiesTestsType2() { var resourceType = ResourceTypeReference.Parse("Test.Rp/discriminatedPropertiesTests2@2020-01-01"); var bodyAProps = new ObjectType( "BodyAProperties", TypeSymbolValidationFlags.WarnOnTypeMismatch, new[] { new TypeProperty("propA", LanguageConstants.String, TypePropertyFlags.None, "This is the description for propA!"), }, null); var bodyBProps = new ObjectType( "BodyBProperties", TypeSymbolValidationFlags.WarnOnTypeMismatch, new[] { new TypeProperty("propB", LanguageConstants.String, TypePropertyFlags.None, "This is the description for propB!"), }, null); var propertiesType = new DiscriminatedObjectType( "properties", TypeSymbolValidationFlags.Default, "propType", new[] { new ObjectType("BodyA", TypeSymbolValidationFlags.Default, AzResourceTypeProvider.GetCommonResourceProperties(resourceType).Concat(new [] { new TypeProperty("propType", new StringLiteralType("PropertiesA"), TypePropertyFlags.None, "This is the propType of body A"), new TypeProperty("values", bodyAProps, TypePropertyFlags.None, "These are the properties for body A"), }), null), new ObjectType("BodyB", TypeSymbolValidationFlags.Default, AzResourceTypeProvider.GetCommonResourceProperties(resourceType).Concat(new [] { new TypeProperty("propType", new StringLiteralType("PropertiesB"), TypePropertyFlags.None, "This is the propType of body B"), new TypeProperty("values", bodyBProps, TypePropertyFlags.None, "These are the properties for body B"), }), null), }); return new ResourceTypeComponents(resourceType, ResourceScope.ResourceGroup, new ObjectType(resourceType.FormatName(), TypeSymbolValidationFlags.Default, AzResourceTypeProvider.GetCommonResourceProperties(resourceType).Concat(new[] { new TypeProperty("properties", propertiesType, TypePropertyFlags.Required, "properties property"), }), null)); } private static ResourceTypeComponents FallbackPropertyTestsType() { var resourceType = ResourceTypeReference.Parse("Test.Rp/fallbackProperties@2020-01-01"); var propertiesType = new ObjectType("Properties", TypeSymbolValidationFlags.WarnOnTypeMismatch, new[] { new TypeProperty("required", LanguageConstants.String, TypePropertyFlags.Required, "This is a property which is required."), }, null); return new ResourceTypeComponents(resourceType, ResourceScope.ResourceGroup, new ObjectType(resourceType.FormatName(), TypeSymbolValidationFlags.Default, AzResourceTypeProvider.GetCommonResourceProperties(resourceType).Concat(new[] { new TypeProperty("properties", propertiesType, TypePropertyFlags.Required, "properties property"), }).Concat( AzResourceTypeProvider.KnownTopLevelResourceProperties().Where(p => !string.Equals(p.Name, "properties", LanguageConstants.IdentifierComparison)) .Select(p => new TypeProperty(p.Name, p.TypeReference, TypePropertyFlags.None, "Property that does something important")) ), null)); } private static ResourceTypeComponents ListFunctionsType() { var resourceType = ResourceTypeReference.Parse("Test.Rp/listFuncTests@2020-01-01"); var noInputOutput = new ObjectType("NoInputOutput", TypeSymbolValidationFlags.Default, new[] { new TypeProperty("noInputOutputVal", LanguageConstants.String, TypePropertyFlags.ReadOnly, "Foo description"), }, null); var withInputInput = new ObjectType("WithInputInput", TypeSymbolValidationFlags.Default, new[] { new TypeProperty("withInputInputVal", LanguageConstants.String, TypePropertyFlags.WriteOnly | TypePropertyFlags.Required, "Foo description"), new TypeProperty("optionalVal", LanguageConstants.String, TypePropertyFlags.WriteOnly, "optionalVal description"), new TypeProperty("optionalLiteralVal", TypeHelper.CreateTypeUnion(new StringLiteralType("either"), new StringLiteralType("or")), TypePropertyFlags.WriteOnly, "optionalLiteralVal description"), }, null); var withInputOutput = new ObjectType("WithInputOutput", TypeSymbolValidationFlags.Default, new[] { new TypeProperty("withInputOutputVal", LanguageConstants.String, TypePropertyFlags.ReadOnly, "Foo description"), }, null); var overloads = new[] { new FunctionOverloadBuilder("listNoInput") .WithReturnType(noInputOutput) .WithFlags(FunctionFlags.RequiresInlining) .Build(), new FunctionOverloadBuilder("listWithInput") .WithReturnType(withInputOutput) .WithFlags(FunctionFlags.RequiresInlining) .Build(), new FunctionOverloadBuilder("listWithInput") .WithRequiredParameter("apiVersion", new StringLiteralType(resourceType.ApiVersion!), "The api version") .WithRequiredParameter("params", withInputInput, "listWithInput parameters") .WithReturnType(withInputOutput) .WithFlags(FunctionFlags.RequiresInlining) .Build(), }; return new ResourceTypeComponents(resourceType, ResourceScope.ResourceGroup, new ObjectType( resourceType.FormatName(), TypeSymbolValidationFlags.Default, AzResourceTypeProvider.GetCommonResourceProperties(resourceType), null, TypePropertyFlags.None, overloads)); } public static INamespaceProvider Create() => TestTypeHelper.CreateProviderWithTypes(new[] { BasicTestsType(), ReadWriteTestsType(), DiscriminatorTestsType(), DiscriminatedPropertiesTestsType(), DiscriminatedPropertiesTestsType2(), FallbackPropertyTestsType(), ListFunctionsType(), }); } }
56
212
0.628968
[ "MIT" ]
AlanFlorance/bicep
src/Bicep.Core.UnitTests/Utils/BuiltInTestTypes.cs
13,104
C#
using System.Linq; using System.Threading; using System.Threading.Tasks; using CommandLine; using Revit.TestRunner.Shared; using Revit.TestRunner.Shared.Model; using Revit.TestRunner.Shared.NUnit; namespace Revit.TestRunner.Console.Commands { /// <summary> /// Execute Test Command /// </summary> [Verb( "assembly", HelpText = "Execute all UnitTests from a specified assembly" )] public class AssemblyCommand : AbstractTestCommand { /// <summary> /// Request File Path /// </summary> [Value( 0, HelpText = "Assembly path containing Tests to execute" )] public string AssemblyPath { get; set; } /// <summary> /// Execute Command. /// </summary> public override void Execute() { base.Execute(); if( FileExist( AssemblyPath ) ) { RunAll( AssemblyPath ).GetAwaiter().GetResult(); } } /// <summary> /// Run all tests in assembly. /// </summary> private async Task RunAll( string assemblyPath ) { System.Console.WriteLine( "Run all tests in assembly" ); System.Console.WriteLine( $"Explore assembly '{AssemblyPath}'" ); TestRunnerClient client = new TestRunnerClient( ConsoleConstants.ProgramName, ConsoleConstants.ProgramVersion ); var explore = await client.ExploreAssemblyAsync( assemblyPath, RevitVersion.ToString(), CancellationToken.None ); if( explore != null ) { System.Console.WriteLine( "Get tests from assembly" ); var root = ModelHelper.ToNodeTree( explore.ExploreFile ); var cases = root.DescendantsAndMe.Where( n => n.Type == TestType.Case ).ToArray(); await RunTests( cases.Select( ModelHelper.ToTestCase ), client ); } } } }
34.436364
125
0.603485
[ "MIT" ]
Jo-Meer/Revit.TestRunner
src/Revit.TestRunner.Console/Commands/AssemblyCommand.cs
1,896
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Infosys.ATR.UIAutomation.Entities; using Infosys.ATR.UIAutomation.SEE; using System.Configuration; namespace Infosys.ATR.DataAnalysis { public static class DataExtraction { //private variables/methods static string usecaseLocation = ""; static string delimiter = "->"; static List<Activity> organizedAct = new List<Activity>(); static List<ExtractedData> GetApplicationScreenPath (List<string> usecaseFilenames) { List<ExtractedData> data = new List<ExtractedData>(); System.IO.DirectoryInfo dirSource = new System.IO.DirectoryInfo(usecaseLocation); List<System.IO.FileInfo> files = new List<System.IO.FileInfo>(); if (usecaseFilenames.Count > 0) files = dirSource.GetFiles().ToList().Where(file => usecaseFilenames.Contains(file.Name)).ToList(); else files = dirSource.GetFiles().ToList(); files.ForEach(file => { UseCase usecase = SerializeAndDeserialize.Deserialize(System.IO.File.ReadAllText(file.FullName), typeof(UseCase)) as UseCase; if (usecase != null) { usecase.Activities.ForEach(act => { if (!string.IsNullOrEmpty(act.TargetApplication.ApplicationExe)) { string appName = act.TargetApplication.TargetApplicationAttributes[0].Value; string eventOrder =""; List<ScreenControlMapping> mappings = new List<ScreenControlMapping>(); act.Tasks.ForEach(task => { // //if (task.Event == EventTypes.KeyboardKeyPress) // // eventOrder += delimiter + task.Event.ToString() + "(T-" + task.TargetControlAttributes[1].Value.Replace(",", "%2C") + ")"; // //else // // eventOrder += delimiter + task.Event.ToString() + "(C-" + task.ControlId + ")"; bool mappingFound = false; mappings.ForEach(map => { if (map.ScreenTitle == task.WindowTitle) { if (task.Event == EventTypes.KeyboardKeyPress) map.ControlsOnScreen.Add("T-" + task.TargetControlAttributes[1].Value.ToLower().Replace(",", "%2C")); else { string id = string.IsNullOrEmpty(task.ControlId) ? task.ControlName : task.ControlId; if (string.IsNullOrEmpty(id)) id = task.XPath; map.ControlsOnScreen.Add("C-" + id); } mappingFound = true; } }); if (!mappingFound) { ScreenControlMapping map = new ScreenControlMapping() { ScreenTitle = task.WindowTitle }; map.ControlsOnScreen = new List<string>(); if (task.Event == EventTypes.KeyboardKeyPress) map.ControlsOnScreen.Add("T-" + task.TargetControlAttributes[1].Value.ToLower().Replace(",", "%2C")); else { string id = string.IsNullOrEmpty(task.ControlId) ? task.ControlName : task.ControlId; if (string.IsNullOrEmpty(id)) id = task.XPath; map.ControlsOnScreen.Add("C-" + id); } mappings.Add(map); } }); mappings.ForEach(map => { //construct the identfier if(eventOrder=="") eventOrder += ReplaceComma(map.ScreenTitle); else eventOrder += delimiter + ReplaceComma(map.ScreenTitle); }); eventOrder = appName + ":" + eventOrder; data.Add(new ExtractedData() { Identifier = eventOrder, IdentifierIncidentCount = 1 }); } }); } }); return data; } static List<ExtractedData> GetApplications(List<string> usecaseFilenames) { List<ExtractedData> data = new List<ExtractedData>(); System.IO.DirectoryInfo dirSource = new System.IO.DirectoryInfo(usecaseLocation); List<System.IO.FileInfo> files = new List<System.IO.FileInfo>(); if (usecaseFilenames.Count > 0) files = dirSource.GetFiles().ToList().Where(file => usecaseFilenames.Contains(file.Name)).ToList(); else files = dirSource.GetFiles().ToList(); files.ForEach(file => { UseCase usecase = SerializeAndDeserialize.Deserialize(System.IO.File.ReadAllText(file.FullName), typeof(UseCase)) as UseCase; if (usecase != null) { usecase.Activities.ForEach(act => { if (!string.IsNullOrEmpty(act.TargetApplication.ApplicationExe)) { data.Add(new ExtractedData() { Identifier = act.TargetApplication.TargetApplicationAttributes[0].Value, IdentifierIncidentCount = 1 }); } }); } }); return data; } static List<ExtractedData> GetApplicationEvents(List<string> usecaseFilenames) { #region old code //List<ExtractedData> data = new List<ExtractedData>(); //System.IO.DirectoryInfo dirSource = new System.IO.DirectoryInfo(usecaseLocation); //List<System.IO.FileInfo> files = new List<System.IO.FileInfo>(); //if (usecaseFilenames.Count > 0) // files = dirSource.GetFiles().ToList().Where(file => usecaseFilenames.Contains(file.Name)).ToList(); //else // files = dirSource.GetFiles().ToList(); //files.ForEach(file => //{ // UseCase usecase = SerializeAndDeserialize.Deserialize(System.IO.File.ReadAllText(file.FullName), typeof(UseCase)) as UseCase; // if (usecase != null) // { // usecase.Activities.ForEach(act => // { // if (!string.IsNullOrEmpty(act.TargetApplication.ApplicationExe)) // { // string appName = act.TargetApplication.TargetApplicationAttributes[0].Value; // string eventOrder = appName; // act.Tasks.ForEach(task => // { // if(task.Event== EventTypes.KeyboardKeyPress) // eventOrder += delimiter + task.Event.ToString() + "(T-" + task.TargetControlAttributes[1].Value.Replace(",", "%2C") + ")"; // else // eventOrder += delimiter + task.Event.ToString() + "(C-" + task.ControlId + ")"; // }); // data.Add(new ExtractedData() // { // Identifier = eventOrder, // IdentifierIncidentCount = 1 // }); // } // }); // } //}); //return data; #endregion List<ExtractedData> data = new List<ExtractedData>(); System.IO.DirectoryInfo dirSource = new System.IO.DirectoryInfo(usecaseLocation); List<System.IO.FileInfo> files = new List<System.IO.FileInfo>(); if (usecaseFilenames.Count > 0) files = dirSource.GetFiles().ToList().Where(file => usecaseFilenames.Contains(file.Name)).ToList(); else files = dirSource.GetFiles().ToList(); files.ForEach(file => { UseCase usecase = SerializeAndDeserialize.Deserialize(System.IO.File.ReadAllText(file.FullName), typeof(UseCase)) as UseCase; if (usecase != null) { usecase.Activities.ForEach(act => { if (!string.IsNullOrEmpty(act.TargetApplication.ApplicationExe)) { string appName = act.TargetApplication.TargetApplicationAttributes[0].Value; string eventOrder = appName; List<ScreenControlMapping> mappings = new List<ScreenControlMapping>(); act.Tasks.ForEach(task => { // //if (task.Event == EventTypes.KeyboardKeyPress) // // eventOrder += delimiter + task.Event.ToString() + "(T-" + task.TargetControlAttributes[1].Value.Replace(",", "%2C") + ")"; // //else // // eventOrder += delimiter + task.Event.ToString() + "(C-" + task.ControlId + ")"; bool mappingFound = false; mappings.ForEach(map => { if (map.ScreenTitle == task.WindowTitle) { if (task.Event == EventTypes.KeyboardKeyPress) map.ControlsOnScreen.Add("T-" + task.TargetControlAttributes[1].Value.ToLower().Replace(",", "%2C")); else { string id = string.IsNullOrEmpty(task.ControlId) ? task.ControlName : task.ControlId; if (string.IsNullOrEmpty(id)) id = task.XPath; map.ControlsOnScreen.Add("C-" + id); } mappingFound = true; } }); if (!mappingFound) { ScreenControlMapping map = new ScreenControlMapping() { ScreenTitle = task.WindowTitle }; map.ControlsOnScreen = new List<string>(); if (task.Event == EventTypes.KeyboardKeyPress) map.ControlsOnScreen.Add("T-" + task.TargetControlAttributes[1].Value.ToLower().Replace(",", "%2C")); else { string id = string.IsNullOrEmpty(task.ControlId) ? task.ControlName : task.ControlId; if (string.IsNullOrEmpty(id)) id = task.XPath; map.ControlsOnScreen.Add("C-" + id); } mappings.Add(map); } }); mappings.ForEach(map => { //construct the identfier eventOrder += ":" + ReplaceComma(map.ScreenTitle); map.ControlsOnScreen.ForEach(ctl => { eventOrder += delimiter + ctl; }); }); data.Add(new ExtractedData() { Identifier = eventOrder, IdentifierIncidentCount = 1 }); } }); } }); return data; } static List<ExtractedData> GetApplicationRelations(List<string> usecaseFilenames) { List<ExtractedData> data = new List<ExtractedData>(); System.IO.DirectoryInfo dirSource = new System.IO.DirectoryInfo(usecaseLocation); List<System.IO.FileInfo> files = new List<System.IO.FileInfo>(); if (usecaseFilenames.Count > 0) files = dirSource.GetFiles().ToList().Where(file => usecaseFilenames.Contains(file.Name)).ToList(); else files = dirSource.GetFiles().ToList(); files.ForEach(file => { organizedAct = new List<Activity>(); UseCase usecase = SerializeAndDeserialize.Deserialize(System.IO.File.ReadAllText(file.FullName), typeof(UseCase)) as UseCase; GetForeMostParents(usecase).ForEach(parent => OrganizeActivities(parent.Id, usecase)); //usecase.Activities = organizedAct; string activityOrder = ""; string lasActivity = ""; foreach (var act in organizedAct) { if (lasActivity == act.TargetApplication.TargetApplicationAttributes[0].Value) continue; else lasActivity = act.TargetApplication.TargetApplicationAttributes[0].Value; if (activityOrder == "") activityOrder = act.TargetApplication.TargetApplicationAttributes[0].Value; else activityOrder += delimiter + act.TargetApplication.TargetApplicationAttributes[0].Value; } //organizedAct.ForEach(act => { // if (lasActivity == act.TargetApplication.TargetApplicationAttributes[0].Value) // continue; // if(activityOrder=="") // activityOrder = act.TargetApplication.TargetApplicationAttributes[0].Value; // else // activityOrder += delimiter + act.TargetApplication.TargetApplicationAttributes[0].Value; //}); data.Add(new ExtractedData() { Identifier = activityOrder, IdentifierIncidentCount = 1 }); }); return data; } static List<Activity> GetForeMostParents(UseCase useCaseTobeEdited) { List<Activity> foreMostParents = new List<Activity>(); foreach (Activity act in useCaseTobeEdited.Activities) { if (!string.IsNullOrEmpty(act.TargetApplication.ApplicationExe)) { if (string.IsNullOrEmpty(act.ParentId)) { foreMostParents.Add(act); } else { Activity tempParentAct = useCaseTobeEdited.Activities.Where(act2 => act2.Id == act.ParentId).FirstOrDefault(); if (tempParentAct == null) { foreMostParents.Add(act); } } } } organizedAct.AddRange(foreMostParents); return foreMostParents; } static void OrganizeActivities(string foremostActivityId, UseCase useCaseTobeEdited) { List<Activity> validActs = useCaseTobeEdited.Activities.Where(act => !string.IsNullOrEmpty(act.TargetApplication.ApplicationExe)).ToList(); for (int i = 0; i < validActs.Count; i++) { if (foremostActivityId == "") break; Activity nextParent = useCaseTobeEdited.Activities.Where(act => act.ParentId == foremostActivityId).FirstOrDefault(); if (nextParent != null) { foremostActivityId = nextParent.Id; organizedAct.Add(nextParent); } else foremostActivityId = ""; } } private static string ReplaceComma(string input) { if (!string.IsNullOrEmpty(input)) input = input.Replace(",", "%2C"); return input; } //public variables/interfaces /// <summary> /// The interface to extract the intended data from the script files generated by the script engine /// </summary> /// <param name="extractionType">the type of data extraction needed</param> /// <param name="usecaseFilenames">the list of file names to be considered, /// if no file names are provided, then all the files at the pre-configured location will be considered</param> /// <returns></returns> public static List<ExtractedData> Extract(DataExtractionType extractionType, List<string> usecaseFilenames) { List<ExtractedData> data = new List<ExtractedData>(); //if no file names are provided, then all the files at the pre-configured location will be considered if (usecaseFilenames == null) usecaseFilenames = new List<string>(); if (usecaseLocation == "") usecaseLocation = ConfigurationManager.AppSettings["UsecaseLocation"]; if (usecaseLocation != null && System.IO.Directory.Exists(usecaseLocation)) { switch (extractionType) { case DataExtractionType.ApplicationEvents: data = GetApplicationEvents(usecaseFilenames); break; case DataExtractionType.ApplicationRelations: data = GetApplicationRelations(usecaseFilenames); break; case DataExtractionType.Applications: data = GetApplications(usecaseFilenames); break; case DataExtractionType.ScreenPath: data = GetApplicationScreenPath(usecaseFilenames); break; } } return data; } } public enum DataExtractionType { Applications, ApplicationEvents, ApplicationRelations, ScreenPath, All } public class ExtractedData { public string Identifier { get; set; } public int IdentifierIncidentCount { get; set; } } public class ScreenControlMapping { public string ScreenTitle { get; set; } public List<string> ControlsOnScreen { get; set; } } }
50.402985
166
0.455138
[ "Apache-2.0" ]
Infosys/Script-Control-Center
ScriptDevelopmentTool/FrontendAutomation/Modules/Scripts/Services/DataExtraction.cs
20,264
C#
//------------------------------------------------------------------------------ // <auto-generated /> // // This file was automatically generated by SWIG (http://www.swig.org). // Version 3.0.12 // // Do not make changes to this file unless you know what you are doing--modify // the SWIG interface file instead. //------------------------------------------------------------------------------ public class vx_evt_session_updated_t : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; internal vx_evt_session_updated_t(global::System.IntPtr cPtr, bool cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(vx_evt_session_updated_t obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } ~vx_evt_session_updated_t() { Dispose(); } public virtual void Dispose() { lock(this) { if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; VivoxCoreInstancePINVOKE.delete_vx_evt_session_updated_t(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } global::System.GC.SuppressFinalize(this); } } public vx_evt_base_t base_ { set { VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_base__set(swigCPtr, vx_evt_base_t.getCPtr(value)); } get { global::System.IntPtr cPtr = VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_base__get(swigCPtr); vx_evt_base_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new vx_evt_base_t(cPtr, false); return ret; } } public string sessiongroup_handle { set { VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_sessiongroup_handle_set(swigCPtr, value); } get { string ret = VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_sessiongroup_handle_get(swigCPtr); return ret; } } public string session_handle { set { VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_session_handle_set(swigCPtr, value); } get { string ret = VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_session_handle_get(swigCPtr); return ret; } } public string uri { set { VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_uri_set(swigCPtr, value); } get { string ret = VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_uri_get(swigCPtr); return ret; } } public int is_muted { set { VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_is_muted_set(swigCPtr, value); } get { int ret = VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_is_muted_get(swigCPtr); return ret; } } public int volume { set { VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_volume_set(swigCPtr, value); } get { int ret = VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_volume_get(swigCPtr); return ret; } } public int transmit_enabled { set { VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_transmit_enabled_set(swigCPtr, value); } get { int ret = VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_transmit_enabled_get(swigCPtr); return ret; } } public int is_focused { set { VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_is_focused_set(swigCPtr, value); } get { int ret = VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_is_focused_get(swigCPtr); return ret; } } public SWIGTYPE_p_double speaker_position { set { VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_speaker_position_set(swigCPtr, SWIGTYPE_p_double.getCPtr(value)); } get { global::System.IntPtr cPtr = VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_speaker_position_get(swigCPtr); SWIGTYPE_p_double ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_double(cPtr, false); return ret; } } public int session_font_id { set { VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_session_font_id_set(swigCPtr, value); } get { int ret = VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_session_font_id_get(swigCPtr); return ret; } } public int is_text_muted { set { VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_is_text_muted_set(swigCPtr, value); } get { int ret = VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_is_text_muted_get(swigCPtr); return ret; } } public int is_ad_playing { set { VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_is_ad_playing_set(swigCPtr, value); } get { int ret = VivoxCoreInstancePINVOKE.vx_evt_session_updated_t_is_ad_playing_get(swigCPtr); return ret; } } public vx_evt_session_updated_t() : this(VivoxCoreInstancePINVOKE.new_vx_evt_session_updated_t(), true) { } }
30.785714
129
0.697022
[ "MIT" ]
Nowhere-Know-How/nwkh-multiplayer-core-free
Assets/Vivox/Runtime/VivoxUnity/generated_files/vx_evt_session_updated_t.cs
5,172
C#
using System; using Common.Kafka.Consumer; using Microsoft.Extensions.Options; using Xunit; namespace Common.Kafka.Tests.Consumer { public class KafkaConsumerBuilderTests { [Fact] public void ConstructorShouldCreateSampleConsumerBuilder() { var kafkaOptions = Options.Create(new KafkaOptions()); var sut = new KafkaConsumerBuilder(kafkaOptions); Assert.IsType<KafkaConsumerBuilder>(sut); } [Fact] public void ConstructorShouldThrowIfOptionsIsNull() { IOptions<KafkaOptions> kafkaOptions = null; Assert.Throws<ArgumentNullException>(() => new KafkaConsumerBuilder(kafkaOptions)); } [Fact] public void BuildShouldReturnNonNullConsumer() { var kafkaOptions = Options.Create(new KafkaOptions { KafkaBootstrapServers = "kafka-bootstrap", ConsumerGroupId = "test-group-id" }); var sut = new KafkaConsumerBuilder(kafkaOptions); var consumer = sut.Build(); Assert.NotNull(consumer); } } }
26.386364
95
0.609819
[ "Unlicense" ]
gabrielsadaka/dotnet-kafka-sample
src/Common.Kafka.Tests/Consumer/KafkaConsumerBuilderTests.cs
1,161
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NAMESPACE { internal static class StringExtensions { /// <summary> /// If source is null, returns string.empty. If not - returns it as is. /// </summary> public static string OrEmpty(this string source) { return source ?? string.Empty; } /// <summary> /// Returns true if target is equal to target in invariant culture and ignoring casing. /// </summary> public static bool EqIgnoreCase(this string source, string target) { return string.Equals(source, target, StringComparison.InvariantCultureIgnoreCase); } public static void WriteWholeArray(this Stream s, byte[] array) { s.Write(array, 0, array.Length); } } }
27.294118
95
0.618534
[ "Unlicense" ]
itsuart/cs-goodies
StringExtensions.cs
928
C#
using System; using Android.Widget; using Java.Security; using Javax.Crypto; using Javax.Crypto.Spec; using System.Text; using Android.Util; using Java.Security.Spec; namespace AndroidCipher { public class AndroidCipher { private readonly MainActivity _activity; private Cipher _encipher; private SecureRandom _random; private ISecretKey _secretKey; public AndroidCipher(MainActivity activity) { this._activity = activity; } public void Decryption(object sender, EventArgs eventArgs) { var decipher = Cipher.GetInstance(Constants.Transformation); var algorithmParameterSpec = (IAlgorithmParameterSpec)_encipher.Parameters.GetParameterSpec(Java.Lang.Class.FromType(typeof(GCMParameterSpec))); decipher.Init(CipherMode.DecryptMode, _secretKey, algorithmParameterSpec); byte[] decodedValue = Base64.Decode(Encoding.UTF8.GetBytes(_activity.textOutput.Text), Base64Flags.Default); byte[] decryptedVal = decipher.DoFinal(decodedValue); _activity.textOriginal.Text = Encoding.Default.GetString(decryptedVal); } public static T Cast<T>(Java.Lang.Object obj) where T : class { var propertyInfo = obj.GetType().GetProperty("Instance"); return propertyInfo == null ? null : propertyInfo.GetValue(obj, null) as T; } public void Encryption(object sender, EventArgs eventArgs) { _secretKey = GenerateKey(); if (ValidateInput(_activity.textInput.Text)) return; _encipher = Cipher.GetInstance(Constants.Transformation); _encipher.Init(CipherMode.EncryptMode, _secretKey, GenerateGcmParameterSpec()); byte[] results = _encipher.DoFinal(Encoding.UTF8.GetBytes(_activity.textInput.Text)); _activity.textOutput.Text = Base64.EncodeToString(results, Base64Flags.Default); } private bool ValidateInput(string input) { if (input.Trim().Equals(string.Empty)) { Toast.MakeText(_activity.ApplicationContext, Constants.ValidationMessage, ToastLength.Short).Show(); return true; } return false; } private GCMParameterSpec GenerateGcmParameterSpec() { var source = new byte[Constants.GcmNonceLength]; _random.NextBytes(source); return new GCMParameterSpec(Constants.GcmTagLength * 8, source); } private ISecretKey GenerateKey() { _random = SecureRandom.InstanceStrong; var keyGen = KeyGenerator.GetInstance(Constants.Algorithm); keyGen.Init(Constants.AesKeySize, _random); return keyGen.GenerateKey(); } } }
35.7375
156
0.647429
[ "Apache-2.0" ]
Dmitiry-hub/monodroid-samples
android-o/AndroidCipher/AndroidCipher/AndroidCipher.cs
2,861
C#
// https://www.cryptocompare.com/api/data/coinlist/ using System.Collections.Generic; public class RootObject { public string Response { get; set; } public string Message { get; set; } public string BaseImageUrl { get; set; } public string BaseLinkUrl { get; set; } public Data Data { get; set; } public int Type { get; set; } } public class Data : Dictionary<string, CoinInfo> { } public class CoinInfo { public string Id { get; set; } public string Url { get; set; } public string ImageUrl { get; set; } public string Name { get; set; } public string CoinName { get; set; } public string FullName { get; set; } public string Algorithm { get; set; } public string ProofType { get; set; } public string FullyPremined { get; set; } public string TotalCoinSupply { get; set; } public string PreMinedValue { get; set; } public string TotalCoinsFreeFloat { get; set; } public string SortOrder { get; set; } }
29.30303
52
0.672182
[ "MIT" ]
Synuit/Synuit.Blockchain.Api
demos/Synuit.Blockchain.Api.Demo.OLD/Class1.cs
969
C#
//----------------------------------------------------------------------- // <copyright file="InterceptorMixinRequirementAttribute.cs" company="Copacetic Software"> // Copyright (c) Copacetic Software. // <author>Philip Pittle</author> // <date>Monday, February 24, 2014 1:12:12 PM</date> // Licensed under the Apache License, Version 2.0, // you may not use this file except in compliance with this License. // // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an 'AS IS' BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // </copyright> //----------------------------------------------------------------------- using System; namespace CopaceticSoftware.pMixins.TheorySandbox { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = true)] public class InterceptorMixinRequirementAttribute : Attribute { public Type Mixin { get; set; } } }
41.066667
91
0.650162
[ "Apache-2.0" ]
ppittle/pMixins
pMixins.TheorySandbox/InterceptorMixinRequirementAttribute.cs
1,234
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SharpDX.Toolkit.Graphics.Tests")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SharpDX.Toolkit.Graphics.Tests")] [assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("827f24b1-77c2-4699-a7a5-6e83c0f43324")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
38.72973
84
0.747383
[ "MIT" ]
VirusFree/SharpDX
Source/Tests/SharpDX.Toolkit.Graphics.Tests/Properties/AssemblyInfo.cs
1,436
C#
using Moq; using NBi.Core.Calculation; using NBi.Core.Calculation.Predicate; using NBi.Core.Calculation.Ranking; using NBi.Core.Evaluate; using NBi.Core.ResultSet; using NBi.Core.ResultSet.Resolver; using NUnit.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NBi.Testing.Unit.Core.Calculation.Ranking { public class BottomRankingTest { [Test] [TestCase(new object[] { "100", "120", "110", "130", "105" }, ColumnType.Numeric, 1)] [TestCase(new object[] { "d", "b", "e", "a", "d" }, ColumnType.Text, 4)] [TestCase(new object[] { "2010-02-02 07:12:17.52", "2010-02-02 07:12:16.55", "2010-02-02 08:12:16.50" }, ColumnType.DateTime, 2)] public void Apply_Rows_Success(object[] values, ColumnType columnType, int index) { var i = 0; var objs = values.Select(x => new object[] { ++i, x }).ToArray(); var args = new ObjectsResultSetResolverArgs(objs); var resolver = new ObjectsResultSetResolver(args); var rs = resolver.Execute(); var ranking = new BottomRanking(new ColumnOrdinalIdentifier(1), columnType, null, null); var filteredRs = ranking.Apply(rs); Assert.That(filteredRs.Rows.Count, Is.EqualTo(1)); Assert.That(filteredRs.Rows[0].ItemArray[0], Is.EqualTo(index.ToString())); Assert.That(filteredRs.Rows[0].ItemArray[1], Is.EqualTo(values.Min())); } [Test] [TestCase(new object[] { "100", "120", "110", "130", "105" }, ColumnType.Numeric, new int[] { 1, 5 })] [TestCase(new object[] { "d", "e", "a", "c", "b" }, ColumnType.Text, new int[] { 3, 5 })] [TestCase(new object[] { "2010-02-02 07:12:16.52", "2010-02-02 07:12:16.55", "2010-02-02 08:12:16.50" }, ColumnType.DateTime, new int[] { 1, 2 })] public void Apply_TopTwo_Success(object[] values, ColumnType columnType, int[] index) { var i = 0; var objs = values.Select(x => new object[] { ++i, x }).ToArray(); var args = new ObjectsResultSetResolverArgs(objs); var resolver = new ObjectsResultSetResolver(args); var rs = resolver.Execute(); var ranking = new BottomRanking(2, new ColumnOrdinalIdentifier(1), columnType, null, null); var filteredRs = ranking.Apply(rs); Assert.That(filteredRs.Rows.Count, Is.EqualTo(2)); Assert.That(filteredRs.Rows[0].ItemArray[0], Is.EqualTo(index[0].ToString())); Assert.That(filteredRs.Rows[0].ItemArray[1], Is.EqualTo(values.Min())); Assert.That(filteredRs.Rows[1].ItemArray[0], Is.EqualTo(index[1].ToString())); Assert.That(filteredRs.Rows[1].ItemArray[1], Is.EqualTo(values.Except(Enumerable.Repeat(values.Min(), 1)).Min())); } [Test] [TestCase(new object[] { "100", "120", "110", "130", "105" }, ColumnType.Numeric, new int[] { 1, 5, 4 })] public void Apply_Larger_Success(object[] values, ColumnType columnType, int[] index) { var i = 0; var objs = values.Select(x => new object[] { ++i, x }).ToArray(); var args = new ObjectsResultSetResolverArgs(objs); var resolver = new ObjectsResultSetResolver(args); var rs = resolver.Execute(); var ranking = new BottomRanking(10, new ColumnOrdinalIdentifier(1), columnType, null, null); var filteredRs = ranking.Apply(rs); Assert.That(filteredRs.Rows.Count, Is.EqualTo(values.Count())); Assert.That(filteredRs.Rows[0].ItemArray[0], Is.EqualTo(index[0].ToString())); Assert.That(filteredRs.Rows[0].ItemArray[1], Is.EqualTo(values.Min())); Assert.That(filteredRs.Rows[1].ItemArray[0], Is.EqualTo(index[1].ToString())); Assert.That(filteredRs.Rows[1].ItemArray[1], Is.EqualTo(values.Except(Enumerable.Repeat(values.Min(), 1)).Min())); Assert.That(filteredRs.Rows[values.Count() - 1].ItemArray[0], Is.EqualTo(index[2].ToString())); Assert.That(filteredRs.Rows[values.Count() - 1].ItemArray[1], Is.EqualTo(values.Max())); } [Test] [TestCase(new object[] { "100", "120", "110", "130", "105" }, ColumnType.Numeric, 1)] public void Apply_Alias_Success(object[] values, ColumnType columnType, int index) { var i = 0; var objs = values.Select(x => new object[] { ++i, x }).ToArray(); var args = new ObjectsResultSetResolverArgs(objs); var resolver = new ObjectsResultSetResolver(args); var rs = resolver.Execute(); var alias = Mock.Of<IColumnAlias>(x => x.Column == 1 && x.Name == "myValue"); var ranking = new BottomRanking(new ColumnNameIdentifier("myValue"), columnType, Enumerable.Repeat(alias, 1), null); var filteredRs = ranking.Apply(rs); Assert.That(filteredRs.Rows.Count, Is.EqualTo(1)); Assert.That(filteredRs.Rows[0].ItemArray[0], Is.EqualTo(index.ToString())); Assert.That(filteredRs.Rows[0].ItemArray[1], Is.EqualTo(values.Min())); } [Test] [TestCase(new object[] { "108", "128", "118", "137", "125" }, ColumnType.Numeric, 5)] public void Apply_Exp_Success(object[] values, ColumnType columnType, int index) { var i = 0; var objs = values.Select(x => new object[] { ++i, x }).ToArray(); var args = new ObjectsResultSetResolverArgs(objs); var resolver = new ObjectsResultSetResolver(args); var rs = resolver.Execute(); var alias = Mock.Of<IColumnAlias>(x => x.Column == 1 && x.Name == "myValue"); var exp = Mock.Of<IColumnExpression>(x => x.Name=="exp" && x.Value == "myValue % 10"); var ranking = new BottomRanking(new ColumnNameIdentifier("exp"), columnType, Enumerable.Repeat(alias, 1), Enumerable.Repeat(exp, 1)); var filteredRs = ranking.Apply(rs); Assert.That(filteredRs.Rows.Count, Is.EqualTo(1)); Assert.That(filteredRs.Rows[0].ItemArray[0], Is.EqualTo(index.ToString())); Assert.That(filteredRs.Rows[0].ItemArray[1], Is.EqualTo("125")); } } }
48.503817
154
0.603399
[ "Apache-2.0" ]
CoolsJoris/NBi
NBi.Testing/Unit/Core/Calculation/Ranking/BottomRankingTest.cs
6,356
C#
namespace ConsoleApp1 { using System.Collections.Generic; using System.Threading.Tasks; internal interface IWeatherService { Task<IReadOnlyList<int>> GetFiveDayTemperaturesAsync(); } }
17.636364
57
0.78866
[ "MIT" ]
fluxera/Fluxera.Extensions.Hosting
samples/ConsoleApp1/IWeatherService.cs
196
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Reflection; [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("FluentValidation.AspNetCore")] [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer")] [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Microsoft.AspNetCore.Mvc.Versioning")] [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Swashbuckle.AspNetCore.SwaggerGen")] // Gerado pela classe WriteCodeFragment do MSBuild.
46.3
129
0.665227
[ "MIT" ]
karolinagb/APICatalogo
APICatalogo/obj/Debug/net5.0/APICatalogo.MvcApplicationPartsAssemblyInfo.cs
926
C#
using FluentAssertions; using Microsoft.AspNetCore.Mvc; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using Sanakan.DAL.Models; using Sanakan.Web.Controllers; using System; using System.Threading.Tasks; namespace Sanakan.Web.Tests.Controllers.QuizControllerTests { /// <summary> /// Defines tests for <see cref="QuizController.RemoveQuestionAsync(ulong)"/> method. /// </summary> [TestClass] public class RemoveQuestionAsyncTests : Base { [TestMethod] public async Task Should_Remove_Question_And_Return_Ok() { var question = new Question { Id = 1, Content = "test", AnswerNumber = 1, PointsWin = 10, PointsLose = 10, TimeToAnswer = TimeSpan.FromMinutes(1), }; _questionRepositoryMock .Setup(pr => pr.GetByIdAsync(question.Id)) .ReturnsAsync(question); _questionRepositoryMock .Setup(pr => pr.Remove(question)); _questionRepositoryMock .Setup(pr => pr.SaveChangesAsync(default)) .Returns(Task.CompletedTask); _cacheManagerMock .Setup(pr => pr.ExpireTag(It.IsAny<string[]>())); var result = await _controller.RemoveQuestionAsync(question.Id); var okObjectResult = result.Should().BeOfType<ObjectResult>().Subject; okObjectResult.Value.Should().NotBeNull(); } } }
30.529412
89
0.592807
[ "MPL-2.0" ]
Jozpod/sanakan
Tests/Web.Tests/Controllers/QuizControllerTests/RemoveQuestionAsyncTests.cs
1,559
C#
using System; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; using Akka.Actor; using Akka.Configuration; using Akka.CQRS.Infrastructure; using Akka.CQRS.Pricing.Web.Actors; using Akka.CQRS.Pricing.Web.Hubs; using Akka.DependencyInjection; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using OpenTracing; using ServiceProvider = Akka.DependencyInjection.ServiceProvider; namespace Akka.CQRS.Pricing.Web.Services { /// <summary> /// Used to launch the <see cref="ActorSystem"/> and actors needed /// to communicate with the rest of the cluster. /// </summary> public sealed class AkkaService : IHostedService { private readonly IServiceProvider _provider; private readonly IHostApplicationLifetime _lifetime; private ActorSystem _actorSystem; public AkkaService(IServiceProvider provider, IHostApplicationLifetime lifetime) { _provider = provider; _lifetime = lifetime; } public Task StartAsync(CancellationToken cancellationToken) { var conf = ConfigurationFactory.ParseString(File.ReadAllText("app.conf")); _actorSystem = ActorSystem.Create("AkkaTrader", AppBootstrap.BootstrapAkka(_provider, new AppBootstrapConfig(false, false), conf)); var tracing = _provider.GetRequiredService<ITracer>(); var sp = ServiceProvider.For(_actorSystem); using(var createActorsSpan = tracing.BuildSpan("SpawnActors").StartActive()){ var stockPublisherActor = _actorSystem.ActorOf(sp.Props<StockPublisherActor>(), "stockPublisher"); var initialContactAddress = Environment.GetEnvironmentVariable("CLUSTER_SEEDS")?.Trim().Split(",") .Select(x => Address.Parse(x)).ToList(); if (initialContactAddress == null) { _actorSystem.Log.Error("No initial cluster contacts found. Please be sure that the CLUSTER_SEEDS environment variable is populated with at least one address."); return Task.FromException(new ConfigurationException( "No initial cluster contacts found. Please be sure that the CLUSTER_SEEDS environment variable is populated with at least one address.")); } var configurator = _actorSystem.ActorOf( Props.Create(() => new StockEventConfiguratorActor(stockPublisherActor, initialContactAddress)), "configurator"); } // need to guarantee that host shuts down if ActorSystem shuts down _actorSystem.WhenTerminated.ContinueWith(tr => { _lifetime.StopApplication(); }); return Task.CompletedTask; } public async Task StopAsync(CancellationToken cancellationToken) { await _actorSystem.Terminate(); } } }
38.05
180
0.656702
[ "Apache-2.0" ]
Arkatufus/akkadotnet-cluster-workshop
src/Akka.CQRS.Pricing.Web/Services/AkkaService.cs
3,046
C#
using System; using System.Collections.Generic; using Aspose.HTML.Live.Demos.UI.Services.HTML.Applications.Conversion; using Aspose.HTML.Live.Demos.UI.Services.HTML.Applications.Merger; namespace Aspose.HTML.Live.Demos.UI.Services.HTML.Applications { public abstract class ApplicationOptions : Dictionary<string, string> { public const string OPTION_INPUT_TYPE = "inputType"; public const string OPTION_OUTPUT_TYPE = "outputType"; protected ApplicationOptions() {} protected ApplicationOptions(IDictionary<string, string> @params) : base(@params) { } protected T GetValueOrDefault<T>(string key, T @default) { if (ContainsKey(key)) return (T)Convert.ChangeType(this[key], typeof(T)); return @default; } protected T GetValueOrDefault<T>(string key) { return GetValueOrDefault<T>(key, default(T)); } protected void SetValue<T>(string key, T value) { this[key] = value.ToString(); } public abstract class Factory { public abstract ConversionApplicationOptions CreateConversionOptions(FileFormat inputFormat, FileFormat outputFormat, bool merge); public abstract ConversionApplicationOptions CreateConversionOptions(); public abstract MergerApplicationOptions CreateMergerOptions(FileFormat inputFormat, FileFormat outputFormat); public abstract MergerApplicationOptions CreateMergerOptions(); } } }
28.645833
133
0.768
[ "MIT" ]
N4SIRODDIN3/Aspose.HTML-for-.NET
Demos/src/Aspose.HTML.Live.Demos.UI/Services/HTML/Applications/ApplicationOptions.cs
1,375
C#
using UnityEngine; using System; namespace Cinemachine { /// <summary> /// Describes the FOV and clip planes for a camera. This generally mirrors the Unity Camera's /// lens settings, and will be used to drive the Unity camera when the vcam is active. /// </summary> [Serializable] [DocumentationSorting(DocumentationSortingAttribute.Level.UserRef)] public struct LensSettings { /// <summary>Default Lens Settings</summary> public static LensSettings Default = new LensSettings(40f, 10f, 0.1f, 5000f, 0); /// <summary> /// This is the camera view in vertical degrees. For cinematic people, a 50mm lens /// on a super-35mm sensor would equal a 19.6 degree FOV /// </summary> [Range(1f, 179f)] [Tooltip("This is the camera view in vertical degrees. For cinematic people, a 50mm lens on a super-35mm sensor would equal a 19.6 degree FOV")] public float FieldOfView; /// <summary> /// When using an orthographic camera, this defines the height, in world /// co-ordinates, of the camera view. /// </summary> [Tooltip("When using an orthographic camera, this defines the half-height, in world coordinates, of the camera view.")] public float OrthographicSize; /// <summary> /// The near clip plane for this LensSettings /// </summary> [Tooltip("This defines the near region in the renderable range of the camera frustum. Raising this value will stop the game from drawing things near the camera, which can sometimes come in handy. Larger values will also increase your shadow resolution.")] public float NearClipPlane; /// <summary> /// The far clip plane for this LensSettings /// </summary> [Tooltip("This defines the far region of the renderable range of the camera frustum. Typically you want to set this value as low as possible without cutting off desired distant objects")] public float FarClipPlane; /// <summary> /// The dutch (tilt) to be applied to the camera. In degrees /// </summary> [Range(-180f, 180f)] [Tooltip("Camera Z roll, or tilt, in degrees.")] public float Dutch; /// <summary> /// This is set every frame by the virtual camera, based on the value found in the /// currently associated Unity camera /// </summary> public bool Orthographic { get; set; } /// <summary> /// This is set every frame by the virtual camera, based on the value /// found in the currently associated Unity camera /// </summary> public bool IsPhysicalCamera { get; set; } /// <summary> /// This is set every frame by the virtual camera, based on the value /// found in the currently associated Unity camera /// </summary> public Vector2 SensorSize { get; set; } /// <summary> /// Sensor aspect, not screen aspect. For nonphysical cameras, this is the same thing. /// </summary> public float Aspect { get { return SensorSize.y == 0 ? 1f : (SensorSize.x / SensorSize.y); } } /// <summary>For physical cameras only: position of the gate relative to the film back</summary> public Vector2 LensShift; /// <summary> /// Creates a new LensSettings, copying the values from the /// supplied Camera /// </summary> /// <param name="fromCamera">The Camera from which the FoV, near /// and far clip planes will be copied.</param> public static LensSettings FromCamera(Camera fromCamera) { LensSettings lens = Default; if (fromCamera != null) { lens.FieldOfView = fromCamera.fieldOfView; lens.SensorSize = new Vector2(fromCamera.aspect, 1f); lens.Orthographic = fromCamera.orthographic; #if UNITY_2018_2_OR_NEWER lens.IsPhysicalCamera = fromCamera.usePhysicalProperties; lens.SensorSize = fromCamera.sensorSize; lens.LensShift = fromCamera.lensShift; #endif lens.OrthographicSize = fromCamera.orthographicSize; lens.NearClipPlane = fromCamera.nearClipPlane; lens.FarClipPlane = fromCamera.farClipPlane; } return lens; } /// <summary> /// Explicit constructor for this LensSettings /// </summary> /// <param name="fov">The Vertical field of view</param> /// <param name="orthographicSize">If orthographic, this is the half-height of the screen</param> /// <param name="nearClip">The near clip plane</param> /// <param name="farClip">The far clip plane</param> /// <param name="dutch">Camera roll, in degrees. This is applied at the end /// after shot composition.</param> public LensSettings( float fov, float orthographicSize, float nearClip, float farClip, float dutch) : this() { FieldOfView = fov; OrthographicSize = orthographicSize; NearClipPlane = nearClip; FarClipPlane = farClip; Dutch = dutch; } /// <summary> /// Linearly blends the fields of two LensSettings and returns the result /// </summary> /// <param name="lensA">The LensSettings to blend from</param> /// <param name="lensB">The LensSettings to blend to</param> /// <param name="t">The interpolation value. Internally clamped to the range [0,1]</param> /// <returns>Interpolated settings</returns> public static LensSettings Lerp(LensSettings lensA, LensSettings lensB, float t) { t = Mathf.Clamp01(t); LensSettings blendedLens = new LensSettings(); blendedLens.FarClipPlane = Mathf.Lerp(lensA.FarClipPlane, lensB.FarClipPlane, t); blendedLens.NearClipPlane = Mathf.Lerp(lensA.NearClipPlane, lensB.NearClipPlane, t); blendedLens.FieldOfView = Mathf.Lerp(lensA.FieldOfView, lensB.FieldOfView, t); blendedLens.OrthographicSize = Mathf.Lerp(lensA.OrthographicSize, lensB.OrthographicSize, t); blendedLens.Dutch = Mathf.Lerp(lensA.Dutch, lensB.Dutch, t); blendedLens.Orthographic = lensA.Orthographic && lensB.Orthographic; blendedLens.IsPhysicalCamera = lensA.IsPhysicalCamera || lensB.IsPhysicalCamera; blendedLens.SensorSize = Vector2.Lerp(lensA.SensorSize, lensB.SensorSize, t); blendedLens.LensShift = Vector2.Lerp(lensA.LensShift, lensB.LensShift, t); return blendedLens; } /// <summary>Make sure lens settings are sane. Call this from OnValidate().</summary> public void Validate() { NearClipPlane = Mathf.Max(NearClipPlane, 0.01f); FarClipPlane = Mathf.Max(FarClipPlane, NearClipPlane + 0.01f); FieldOfView = Mathf.Clamp(FieldOfView, 0.1f, 179f); } } }
46.058065
264
0.623337
[ "MIT" ]
kekekekekekekekeke/simulator
indoor navigation environment/Library/PackageCache/com.unity.cinemachine@2.2.7/Runtime/Core/LensSettings.cs
7,139
C#
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the lookoutequipment-2020-12-15.normal.json service model. */ using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Text; using System.Xml.Serialization; using Amazon.LookoutEquipment.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.LookoutEquipment.Model.Internal.MarshallTransformations { /// <summary> /// IngestionS3InputConfiguration Marshaller /// </summary> public class IngestionS3InputConfigurationMarshaller : IRequestMarshaller<IngestionS3InputConfiguration, JsonMarshallerContext> { /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="requestObject"></param> /// <param name="context"></param> /// <returns></returns> public void Marshall(IngestionS3InputConfiguration requestObject, JsonMarshallerContext context) { if(requestObject.IsSetBucket()) { context.Writer.WritePropertyName("Bucket"); context.Writer.Write(requestObject.Bucket); } if(requestObject.IsSetKeyPattern()) { context.Writer.WritePropertyName("KeyPattern"); context.Writer.Write(requestObject.KeyPattern); } if(requestObject.IsSetPrefix()) { context.Writer.WritePropertyName("Prefix"); context.Writer.Write(requestObject.Prefix); } } /// <summary> /// Singleton Marshaller. /// </summary> public readonly static IngestionS3InputConfigurationMarshaller Instance = new IngestionS3InputConfigurationMarshaller(); } }
34.148649
132
0.675109
[ "Apache-2.0" ]
Hazy87/aws-sdk-net
sdk/src/Services/LookoutEquipment/Generated/Model/Internal/MarshallTransformations/IngestionS3InputConfigurationMarshaller.cs
2,527
C#
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="HttpCommunicationService.cs" company="Bosbec AB"> // Copyright © Bosbec AB 2014 // </copyright> // <summary> // Defines the HttpCommunicationService type. // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace Bosbec.ServiceHost.Host.Services { /// <summary> /// Defines the HttpCommunicationService type. /// </summary> public class HttpCommunicationService : IService { /// <summary> /// Start the service. /// </summary> public void Start() { throw new System.NotImplementedException(); } /// <summary> /// Stop the service. /// </summary> public void Stop() { throw new System.NotImplementedException(); } } }
30.090909
120
0.432024
[ "MIT" ]
bosbec/servicehost
src/ServiceHost.Host/Services/Communication/HttpCommunicationService.cs
996
C#
namespace SecurePlate.Services { using System.ServiceModel.Syndication; using System.Threading; using System.Threading.Tasks; /// <summary> /// Builds <see cref="SyndicationFeed"/>'s containing meta data about the feed and the feed entries. /// Note: We are targeting Atom 1.0 over RSS 2.0 because Atom 1.0 is a newer and more well defined format. Atom 1.0 /// is a standard and RSS is not. See http://rehansaeed.com/building-rssatom-feeds-for-asp-net-mvc/. /// </summary> public interface IFeedService { /// <summary> /// Gets the feed containing meta data about the feed and the feed entries. /// </summary> /// <param name="cancellationToken">A <see cref="CancellationToken"/> signifying if the request is cancelled.</param> /// <returns>A <see cref="SyndicationFeed"/>.</returns> Task<SyndicationFeed> GetFeed(CancellationToken cancellationToken); /// <summary> /// Publishes the fact that the feed has updated to subscribers using the PubSubHubbub v0.4 protocol. /// </summary> /// <remarks> /// The PubSubHubbub is an open standard created by Google which allows subscription of feeds and allows /// updates to be pushed to them rather than them having to poll the feed. This means subscribers get live /// updates as they happen and also we may save some bandwidth because we have less polling of our feed. /// See https://pubsubhubbub.googlecode.com/git/pubsubhubbub-core-0.4.html for PubSubHubbub v0.4 specification. /// See https://github.com/pubsubhubbub for PubSubHubbub GitHub projects. /// See http://pubsubhubbub.appspot.com/ for Google's implementation of the PubSubHubbub hub we are using. /// </remarks> Task PublishUpdate(); } }
52.6
125
0.676263
[ "MIT" ]
iAvinashVarma/SecurePlate
SecurePlate/Services/Feed/IFeedService.cs
1,843
C#
using System; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using EnvDTE; using Typewriter.CodeModel.Implementation; using Typewriter.Metadata.Providers; using Typewriter.VisualStudio; namespace Typewriter.Generation.Controllers { public class GenerationController { private readonly DTE _dte; private readonly IMetadataProvider _metadataProvider; private readonly TemplateController _templateController; private readonly IEventQueue _eventQueue; public GenerationController(DTE dte, IMetadataProvider metadataProvider, TemplateController templateController, IEventQueue eventQueue) { _dte = dte; _metadataProvider = metadataProvider; _templateController = templateController; _eventQueue = eventQueue; } public void OnTemplateChanged(string templatePath, bool force = false) { Log.Debug("{0} queued {1}", GenerationType.Template, templatePath); ErrorList.Clear(); var projectItem = _dte.Solution.FindProjectItem(templatePath); var template = _templateController.GetTemplate(projectItem); if (force == false && ExtensionPackage.Instance.RenderOnSave == false) { Log.Debug("Render skipped {0}", templatePath); return; } var filesToRender = template.GetFilesToRender(); Log.Debug(" Will Check/Render {0} .cs files in referenced projects", filesToRender.Count); // Delay to wait for Roslyn to refresh the current Workspace after a change. Task.Delay(1000).ContinueWith(task => { _eventQueue.Enqueue(() => { var stopwatch = Stopwatch.StartNew(); foreach (var path in filesToRender) { var metadata = _metadataProvider.GetFile(path, template.Settings, null); if (metadata == null) { // the cs-file was found, but the build-action is not set to compile. continue; } var file = new FileImpl(metadata); template.RenderFile(file); if (template.HasCompileException) { break; } } template.SaveProjectFile(); stopwatch.Stop(); Log.Debug("{0} processed {1} in {2}ms", GenerationType.Template, templatePath, stopwatch.ElapsedMilliseconds); }); }); } public void OnCsFileChanged(string[] paths) { if (ExtensionPackage.Instance.TrackSourceFiles == false) { Log.Debug("Render skipped {0}", paths?.FirstOrDefault()); return; } RenderFile(paths); } private void RenderFile(string[] paths) { // Delay to wait for Roslyn to refresh the current Workspace after a change. Task.Delay(1000).ContinueWith(task => { Enqueue(GenerationType.Render, paths, (path, template) => _metadataProvider.GetFile(path, template.Settings, RenderFile), (fileMeta, template) => { if (fileMeta == null) { // the cs-file was found, but the build-action is not set to compile. return; } var file = new FileImpl(fileMeta); if (template.ShouldRenderFile(file.FullName)) { template.RenderFile(file); } }); }); } public void OnCsFileDeleted(string[] paths) { if (ExtensionPackage.Instance.TrackSourceFiles == false) { Log.Debug("Delete skipped {0}", paths?.FirstOrDefault()); return; } // Delay to wait for Roslyn to refresh the current Workspace after a change. Task.Delay(1000).ContinueWith(task => { Enqueue(GenerationType.Delete, paths, (path, template) => template.DeleteFile(path)); }); } private void Enqueue(GenerationType type, string[] paths, Action<string, Template> action) { Enqueue(type, paths, (s, t, i) => s, action); } public void OnCsFileRenamed(string[] newPaths, string[] oldPaths) { if (ExtensionPackage.Instance.TrackSourceFiles == false) { Log.Debug("Rename skipped {0}", oldPaths?.FirstOrDefault()); return; } // Delay to wait for Roslyn to refresh the current Workspace after a change. Task.Delay(1000).ContinueWith(task => { Enqueue(GenerationType.Rename, newPaths, (path, template, fileIndex) => new { OldPath = oldPaths[fileIndex], NewPath = path, NewFileMeta = _metadataProvider.GetFile(path, template.Settings, null) }, (item, template) => { if (item.NewFileMeta == null) { // the cs-file was found, but the build-action is not set to compile. return; } var newFile = new FileImpl(item.NewFileMeta); template.RenameFile(newFile, item.OldPath, item.NewPath); }); }); } private void Enqueue<T>(GenerationType type, string[] paths, Func<string, Template, T> transform, Action<T, Template> action) { Enqueue(type, paths, (s, t, i) => transform(s, t), action); } private void Enqueue<T>(GenerationType type, string[] paths, Func<string, Template, int, T> transform, Action<T, Template> action) { var templates = _templateController.Templates.Where(m => !m.HasCompileException).ToArray(); if (!templates.Any()) { return; } Log.Debug("{0} queued {1}", type, string.Join(", ", paths)); _eventQueue.Enqueue(() => { var stopwatch = Stopwatch.StartNew(); paths.ForEach((path, i) => { templates.ForEach(template => { var item = transform(path, template, i); action(item, template); }); }); templates.GroupBy(m => m.ProjectFullName).ForEach(template => template.First().SaveProjectFile()); stopwatch.Stop(); Log.Debug("{0} processed {1} in {2}ms", type, string.Join(", ", paths), stopwatch.ElapsedMilliseconds); }); } } }
36.622449
214
0.51616
[ "Apache-2.0" ]
Ackhuman/Typewriter
src/Typewriter/Generation/Controllers/GenerationController.cs
7,178
C#
using HarmonyLib; using System; using TaleWorlds.Core; using TaleWorlds.MountAndBlade; namespace ModTestingFramework { class StateEvents { public static event Action<string> OnStateActivate; public static event Action OnMainMenuReady; public static GameState CurrentGameState { get; private set; } public static bool MainMenuReady { get; private set; } = false; [HarmonyPatch(typeof(GameState), "OnActivate")] class PatchOnInitialize { static void Postfix(GameState __instance) { CurrentGameState = __instance; OnStateActivate?.Invoke(__instance.ToString()); } } [HarmonyPatch(typeof(MBInitialScreenBase), "OnFrameTick")] class MainMenuReadyPatch { static void Postfix() { if (!MainMenuReady && MBMusicManager.Current != null) { MainMenuReady = true; OnMainMenuReady?.Invoke(); } } } } }
26.682927
71
0.568556
[ "MIT" ]
Bannerlord-Coop-Team/BannerlordTestingEssentials
BannerlordSystemTestingFramework/Patches/StateEvents.cs
1,096
C#
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Epam.Task4.DynamicArray { public class DynamicArray<T> : IEnumerable, IEnumerable<T>, ICloneable { private T[] array; private int capacity; public DynamicArray() { this.Array = new T[8]; this.Capacity = this.Array.Length; this.Length = 0; } public DynamicArray(int n) { if (n < 1) { throw new ArgumentException("Dynamic Array cannot have capacity with less than 1 element.", nameof(n)); } this.Array = new T[n]; this.Capacity = this.Array.Length; this.Length = 0; } public DynamicArray(IEnumerable<T> collection) { this.Array = new T[collection.Count()]; for (int i = 0; i < this.Capacity; i++) { foreach (var item in collection) { this.Array[i] = item; } } this.Capacity = this.Array.Length; this.Length = this.Capacity; } public int Capacity { get { return this.capacity; } protected set { this.capacity = value; } } public int Length { get; private set; } protected T[] Array { get { return this.array; } set { this.array = value; } } public T this[int i] { get { if (i >= this.Length || i <= ~this.Length) { throw new ArgumentOutOfRangeException(i.ToString(), "Index is out of range. Index cannot be over the size of the Dynamic Array."); } if (i < 0 && i > ~this.Length) { return this.Array[this.Length + i]; } else { return this.Array[i]; } } set { if (i >= this.Length || i <= ~this.Length) { throw new ArgumentOutOfRangeException(i.ToString(), "Index is out of range. Index cannot be over the size of the Dynamic Array."); } if (i < 0 && i > ~this.Length) { this.Array[this.Length + i] = value; } else { this.Array[i] = value; } } } public void Add(T item) { if (this.Length == this.Capacity) { T[] newArray = new T[this.Capacity * 2]; System.Array.Copy(this.Array, newArray, this.Length); newArray[this.Length] = item; this.Array = newArray; this.Capacity = this.Array.Length; } else { this.Array[this.Length] = item; } this.Length++; } public void AddRange(IEnumerable<T> collection) { if (this.Capacity < this.Length + collection.Count()) { int newLength = this.Capacity + collection.Count(); T[] newArray = new T[newLength]; System.Array.Copy(this.Array, newArray, this.Length); foreach (var item in collection) { newArray[this.Length++] = item; } this.Array = newArray; this.Capacity = this.Array.Length; } else { foreach (var item in collection) { this.Array[this.Length++] = item; } } } public void ChangeCapacity(int newCapacity) { if (newCapacity < 0 || newCapacity > int.MaxValue) { throw new ArgumentOutOfRangeException(nameof(newCapacity), "Capacity size is invalid. Must be non-negative."); } T[] newArray = new T[newCapacity]; if (newArray.Length > this.Capacity) { for (int i = 0; i < this.Array.Length; i++) { newArray[i] = this.Array[i]; } } else if (newArray.Length < this.Capacity) { for (int i = 0; i < newArray.Length; i++) { newArray[i] = this.Array[i]; } if (newArray.Length < this.Length) { this.Length = newArray.Length; } } else { return; } this.Array = newArray; this.Capacity = this.Array.Length; } public object Clone() { return new DynamicArray<T>(this.Array); } public virtual IEnumerator<T> GetEnumerator() { for (int i = 0; i < this.Length; i++) { yield return this.Array[i]; } } IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } public bool Insert(int index, T item) { if (index < 0 || index > this.Length) { throw new ArgumentOutOfRangeException(nameof(index), "Index is out of range. Index cannot be over the size of the Dynamic Array."); } if (this.Length == this.Array.Length) { T[] newArray = new T[this.Capacity * 2]; for (int i = 0; i < index; i++) { newArray[i] = this.Array[i]; } newArray[index] = item; for (int i = index; i < this.Length; i++) { newArray[i + 1] = this.Array[i]; } this.Array = newArray; this.Capacity = this.Array.Length; } else { for (int i = this.Length; i > index; i--) { this.Array[i] = this.Array[i - 1]; } this.Array[index] = item; } this.Length++; return true; } public bool Remove(int index) { if (index < 0 || index >= this.Length) { return false; } else { for (int i = index; i < this.Length - 1; i++) { this.Array[i] = this.Array[i + 1]; } this.Array[--this.Length] = default(T); return true; } } public T[] ToArray() { T[] newArray = new T[this.Length]; for (int i = 0; i < newArray.Length; i++) { newArray[i] = this.Array[i]; } return newArray; } public string ShowInfo() { string info = $@"{nameof(this.Length)}: {this.Length}{Environment.NewLine}" + $"{nameof(this.Capacity)}: {this.Capacity}{Environment.NewLine}" + $"{nameof(this.Array)}[0] = {this[0]}{Environment.NewLine}" + $"{nameof(this.Array)}[-1] = {this[-1]}{Environment.NewLine}"; return info; } } }
26.285714
150
0.408241
[ "MIT" ]
Polikutkin/Epam_XT-2018Q4
Epam.Task4/Epam.Task4.DynamicArray/DynamicArray.cs
7,914
C#
using System; using NetOffice; namespace NetOffice.OWC10Api.Enums { /// <summary> /// SupportByVersion OWC10 1 /// </summary> [SupportByVersionAttribute("OWC10", 1)] [EntityTypeAttribute(EntityType.IsEnum)] public enum TipTypeEnum { /// <summary> /// SupportByVersion OWC10 1 /// </summary> /// <remarks>-1</remarks> [SupportByVersionAttribute("OWC10", 1)] eTipTypeNone = -1, /// <summary> /// SupportByVersion OWC10 1 /// </summary> /// <remarks>0</remarks> [SupportByVersionAttribute("OWC10", 1)] eTipTypeText = 0, /// <summary> /// SupportByVersion OWC10 1 /// </summary> /// <remarks>1</remarks> [SupportByVersionAttribute("OWC10", 1)] eTipTypeHTML = 1, /// <summary> /// SupportByVersion OWC10 1 /// </summary> /// <remarks>2</remarks> [SupportByVersionAttribute("OWC10", 1)] eTipTypeAuto = 2 } }
23.15
43
0.603672
[ "MIT" ]
NetOffice/NetOffice
Source/OWC10/Enums/TipTypeEnum.cs
926
C#
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; using ICSharpCode.NRefactory.Ast; using ICSharpCode.NRefactory.Visitors; namespace SharpRefactoring.Visitors { public class HasReturnStatementVisitor : AbstractAstVisitor { bool hasReturn; public bool HasReturn { get { return hasReturn; } } public HasReturnStatementVisitor() { } public override object VisitReturnStatement(ReturnStatement returnStatement, object data) { this.hasReturn = true; return base.VisitReturnStatement(returnStatement, data); } } }
24.344828
103
0.760623
[ "MIT" ]
Plankankul/SharpDevelop-w-Framework
src/AddIns/Misc/SharpRefactoring/Project/Src/Visitors/HasReturnStatementVisitor.cs
708
C#
// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschraenkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System.Collections.Generic; using System.Threading.Tasks; using FakeItEasy; using Orleans; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Entities.Apps.Commands; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Orleans; using Squidex.Infrastructure.Security; using Squidex.Infrastructure.Validation; using Xunit; #pragma warning disable SA1133 // Do not combine attributes namespace Squidex.Domain.Apps.Entities.Apps.Indexes { public sealed class AppsIndexTests { private readonly IGrainFactory grainFactory = A.Fake<IGrainFactory>(); private readonly IAppsByNameIndexGrain indexByName = A.Fake<IAppsByNameIndexGrain>(); private readonly IAppsByUserIndexGrain indexByUser = A.Fake<IAppsByUserIndexGrain>(); private readonly ICommandBus commandBus = A.Fake<ICommandBus>(); private readonly NamedId<DomainId> appId = NamedId.Of(DomainId.NewGuid(), "my-app"); private readonly string userId = "user-1"; private readonly AppsIndex sut; public AppsIndexTests() { A.CallTo(() => grainFactory.GetGrain<IAppsByNameIndexGrain>(SingleGrain.Id, null)) .Returns(indexByName); A.CallTo(() => grainFactory.GetGrain<IAppsByUserIndexGrain>(userId, null)) .Returns(indexByUser); sut = new AppsIndex(grainFactory); } [Fact] public async Task Should_resolve_all_apps_from_user_permissions() { var expected = SetupApp(0, false); A.CallTo(() => indexByName.GetIdsAsync(A<string[]>.That.IsSameSequenceAs(new[] { appId.Name }))) .Returns(new List<DomainId> { appId.Id }); var actual = await sut.GetAppsForUserAsync(userId, new PermissionSet($"squidex.apps.{appId.Name}")); Assert.Same(expected, actual[0]); } [Fact] public async Task Should_resolve_all_apps_from_user() { var expected = SetupApp(0, false); A.CallTo(() => indexByUser.GetIdsAsync()) .Returns(new List<DomainId> { appId.Id }); var actual = await sut.GetAppsForUserAsync(userId, PermissionSet.Empty); Assert.Same(expected, actual[0]); } [Fact] public async Task Should_resolve_combined_apps() { var expected = SetupApp(0, false); A.CallTo(() => indexByName.GetIdsAsync(A<string[]>.That.IsSameSequenceAs(new[] { appId.Name }))) .Returns(new List<DomainId> { appId.Id }); A.CallTo(() => indexByUser.GetIdsAsync()) .Returns(new List<DomainId> { appId.Id }); var actual = await sut.GetAppsForUserAsync(userId, new PermissionSet($"squidex.apps.{appId.Name}")); Assert.Single(actual); Assert.Same(expected, actual[0]); } [Fact] public async Task Should_resolve_all_apps() { var expected = SetupApp(0, false); A.CallTo(() => indexByName.GetIdsAsync()) .Returns(new List<DomainId> { appId.Id }); var actual = await sut.GetAppsAsync(); Assert.Same(expected, actual[0]); } [Fact] public async Task Should_resolve_app_by_name() { var expected = SetupApp(0, false); A.CallTo(() => indexByName.GetIdAsync(appId.Name)) .Returns(appId.Id); var actual = await sut.GetAppByNameAsync(appId.Name); Assert.Same(expected, actual); } [Fact] public async Task Should_resolve_app_by_id() { var expected = SetupApp(0, false); var actual = await sut.GetAppAsync(appId.Id); Assert.Same(expected, actual); } [Fact] public async Task Should_return_null_if_app_archived() { SetupApp(0, true); var actual = await sut.GetAppAsync(appId.Id); Assert.Null(actual); } [Fact] public async Task Should_return_null_if_app_not_created() { SetupApp(-1, false); var actual = await sut.GetAppAsync(appId.Id); Assert.Null(actual); } [Fact] public async Task Should_add_app_to_indexes_on_create() { var token = RandomHash.Simple(); A.CallTo(() => indexByName.ReserveAsync(appId.Id, appId.Name)) .Returns(token); var context = new CommandContext(Create(appId.Name), commandBus) .Complete(); await sut.HandleAsync(context); A.CallTo(() => indexByName.AddAsync(token)) .MustHaveHappened(); A.CallTo(() => indexByName.RemoveReservationAsync(A<string>._)) .MustNotHaveHappened(); A.CallTo(() => indexByUser.AddAsync(appId.Id)) .MustHaveHappened(); } [Fact] public async Task Should_also_app_to_user_index_if_app_created_by_client() { var token = RandomHash.Simple(); A.CallTo(() => indexByName.ReserveAsync(appId.Id, appId.Name)) .Returns(token); var context = new CommandContext(CreateFromClient(appId.Name), commandBus) .Complete(); await sut.HandleAsync(context); A.CallTo(() => indexByName.AddAsync(token)) .MustHaveHappened(); A.CallTo(() => indexByName.RemoveReservationAsync(A<string>._)) .MustNotHaveHappened(); A.CallTo(() => indexByUser.AddAsync(appId.Id)) .MustHaveHappened(); } [Fact] public async Task Should_clear_reservation_when_app_creation_failed() { var token = RandomHash.Simple(); A.CallTo(() => indexByName.ReserveAsync(appId.Id, appId.Name)) .Returns(token); var context = new CommandContext(CreateFromClient(appId.Name), commandBus); await sut.HandleAsync(context); A.CallTo(() => indexByName.AddAsync(token)) .MustNotHaveHappened(); A.CallTo(() => indexByName.RemoveReservationAsync(token)) .MustHaveHappened(); A.CallTo(() => indexByUser.AddAsync(appId.Id)) .MustNotHaveHappened(); } [Fact] public async Task Should_not_add_to_indexes_on_create_if_name_taken() { A.CallTo(() => indexByName.ReserveAsync(appId.Id, appId.Name)) .Returns(Task.FromResult<string?>(null)); var context = new CommandContext(Create(appId.Name), commandBus) .Complete(); await Assert.ThrowsAsync<ValidationException>(() => sut.HandleAsync(context)); A.CallTo(() => indexByName.AddAsync(A<string>._)) .MustNotHaveHappened(); A.CallTo(() => indexByName.RemoveReservationAsync(A<string>._)) .MustNotHaveHappened(); A.CallTo(() => indexByUser.AddAsync(appId.Id)) .MustNotHaveHappened(); } [Fact] public async Task Should_not_add_to_indexes_on_create_if_name_invalid() { var context = new CommandContext(Create("INVALID"), commandBus) .Complete(); await sut.HandleAsync(context); A.CallTo(() => indexByName.ReserveAsync(appId.Id, A<string>._)) .MustNotHaveHappened(); A.CallTo(() => indexByName.RemoveReservationAsync(A<string>._)) .MustNotHaveHappened(); A.CallTo(() => indexByUser.AddAsync(appId.Id)) .MustNotHaveHappened(); } [Fact] public async Task Should_add_app_to_index_on_contributor_assignment() { var command = new AssignContributor { AppId = appId, ContributorId = userId }; var context = new CommandContext(command, commandBus) .Complete(); await sut.HandleAsync(context); A.CallTo(() => indexByUser.AddAsync(appId.Id)) .MustHaveHappened(); } [Fact] public async Task Should_remove_from_user_index_on_remove_of_contributor() { var command = new RemoveContributor { AppId = appId, ContributorId = userId }; var context = new CommandContext(command, commandBus) .Complete(); await sut.HandleAsync(context); A.CallTo(() => indexByUser.RemoveAsync(appId.Id)) .MustHaveHappened(); } [Theory, InlineData(true), InlineData(false)] public async Task Should_remove_app_from_indexes_on_archive(bool isArchived) { SetupApp(0, isArchived); var command = new ArchiveApp { AppId = appId }; var context = new CommandContext(command, commandBus) .Complete(); await sut.HandleAsync(context); A.CallTo(() => indexByName.RemoveAsync(appId.Id)) .MustHaveHappened(); A.CallTo(() => indexByUser.RemoveAsync(appId.Id)) .MustHaveHappened(); } [Fact] public async Task Should_forward_call_when_rebuilding_for_contributors1() { var apps = new HashSet<DomainId>(); await sut.RebuildByContributorsAsync(userId, apps); A.CallTo(() => indexByUser.RebuildAsync(apps)) .MustHaveHappened(); } [Fact] public async Task Should_forward_call_when_rebuilding_for_contributors2() { var users = new HashSet<string> { userId }; await sut.RebuildByContributorsAsync(appId.Id, users); A.CallTo(() => indexByUser.AddAsync(appId.Id)) .MustHaveHappened(); } [Fact] public async Task Should_forward_call_when_rebuilding() { var apps = new Dictionary<string, DomainId>(); await sut.RebuildAsync(apps); A.CallTo(() => indexByName.RebuildAsync(apps)) .MustHaveHappened(); } [Fact] public async Task Should_forward_reserveration() { await sut.AddAsync("token"); A.CallTo(() => indexByName.AddAsync("token")) .MustHaveHappened(); } [Fact] public async Task Should_forward_remove_reservation() { await sut.RemoveReservationAsync("token"); A.CallTo(() => indexByName.RemoveReservationAsync("token")) .MustHaveHappened(); } [Fact] public async Task Should_forward_request_for_ids() { await sut.GetIdsAsync(); A.CallTo(() => indexByName.GetIdsAsync()) .MustHaveHappened(); } private IAppEntity SetupApp(long version, bool archived) { var appEntity = A.Fake<IAppEntity>(); A.CallTo(() => appEntity.Name) .Returns(appId.Name); A.CallTo(() => appEntity.Version) .Returns(version); A.CallTo(() => appEntity.IsArchived) .Returns(archived); A.CallTo(() => appEntity.Contributors) .Returns(AppContributors.Empty.Assign(userId, Role.Owner)); var appGrain = A.Fake<IAppGrain>(); A.CallTo(() => appGrain.GetStateAsync()) .Returns(J.Of(appEntity)); A.CallTo(() => grainFactory.GetGrain<IAppGrain>(appId.Id.ToString(), null)) .Returns(appGrain); return appEntity; } private CreateApp Create(string name) { return new CreateApp { AppId = appId.Id, Name = name, Actor = ActorSubject() }; } private CreateApp CreateFromClient(string name) { return new CreateApp { AppId = appId.Id, Name = name, Actor = ActorClient() }; } private RefToken ActorSubject() { return new RefToken(RefTokenType.Subject, userId); } private RefToken ActorClient() { return new RefToken(RefTokenType.Client, userId); } } }
31.410194
112
0.557994
[ "MIT" ]
kiranvsr/squidex
backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Indexes/AppsIndexTests.cs
12,943
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("tikgen")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("tikgen")] [assembly: AssemblyCopyright("Copyright © Microsoft 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("f0a79015-8ed4-4f71-afca-549b44467b24")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
37.918919
84
0.746258
[ "MIT" ]
kade-robertson/tikgen
tikgen/Properties/AssemblyInfo.cs
1,406
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.AzureNextGen.Network.V20191001.Inputs { /// <summary> /// Defines a managed rule group override setting. /// </summary> public sealed class ManagedRuleGroupOverrideArgs : Pulumi.ResourceArgs { [Input("exclusions")] private InputList<Inputs.ManagedRuleExclusionArgs>? _exclusions; /// <summary> /// Describes the exclusions that are applied to all rules in the group. /// </summary> public InputList<Inputs.ManagedRuleExclusionArgs> Exclusions { get => _exclusions ?? (_exclusions = new InputList<Inputs.ManagedRuleExclusionArgs>()); set => _exclusions = value; } /// <summary> /// Describes the managed rule group to override. /// </summary> [Input("ruleGroupName", required: true)] public Input<string> RuleGroupName { get; set; } = null!; [Input("rules")] private InputList<Inputs.ManagedRuleOverrideArgs>? _rules; /// <summary> /// List of rules that will be disabled. If none specified, all rules in the group will be disabled. /// </summary> public InputList<Inputs.ManagedRuleOverrideArgs> Rules { get => _rules ?? (_rules = new InputList<Inputs.ManagedRuleOverrideArgs>()); set => _rules = value; } public ManagedRuleGroupOverrideArgs() { } } }
32.792453
108
0.632336
[ "Apache-2.0" ]
pulumi/pulumi-azure-nextgen
sdk/dotnet/Network/V20191001/Inputs/ManagedRuleGroupOverrideArgs.cs
1,738
C#
using Com.Zoho.Crm.API.Util; using System.Collections.Generic; namespace Com.Zoho.Crm.API.Modules { public class APIException : Model, ResponseHandler, ActionResponse, ActionHandler { private Choice<string> status; private Choice<string> code; private Choice<string> message; private Dictionary<string, object> details; private Dictionary<string, int?> keyModified=new Dictionary<string, int?>(); public Choice<string> Status { /// <summary>The method to get the status</summary> /// <returns>Instance of Choice<String></returns> get { return this.status; } /// <summary>The method to set the value to status</summary> /// <param name="status">Instance of Choice<string></param> set { this.status=value; this.keyModified["status"] = 1; } } public Choice<string> Code { /// <summary>The method to get the code</summary> /// <returns>Instance of Choice<String></returns> get { return this.code; } /// <summary>The method to set the value to code</summary> /// <param name="code">Instance of Choice<string></param> set { this.code=value; this.keyModified["code"] = 1; } } public Choice<string> Message { /// <summary>The method to get the message</summary> /// <returns>Instance of Choice<String></returns> get { return this.message; } /// <summary>The method to set the value to message</summary> /// <param name="message">Instance of Choice<string></param> set { this.message=value; this.keyModified["message"] = 1; } } public Dictionary<string, object> Details { /// <summary>The method to get the details</summary> /// <returns>Dictionary representing the details<String,Object></returns> get { return this.details; } /// <summary>The method to set the value to details</summary> /// <param name="details">Dictionary<string,object></param> set { this.details=value; this.keyModified["details"] = 1; } } /// <summary>The method to check if the user has modified the given key</summary> /// <param name="key">string</param> /// <returns>int? representing the modification</returns> public int? IsKeyModified(string key) { if((( this.keyModified.ContainsKey(key)))) { return this.keyModified[key]; } return null; } /// <summary>The method to mark the given key as modified</summary> /// <param name="key">string</param> /// <param name="modification">int?</param> public void SetKeyModified(string key, int? modification) { this.keyModified[key] = modification; } } }
21.754098
83
0.649209
[ "Apache-2.0" ]
zoho/zohocrm-csharp-sdk-2.1
ZohoCRM/Com/Zoho/Crm/API/Modules/APIException.cs
2,654
C#
// Copyright 2020 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE // Copyright 2020 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Linq; namespace Nuke.Common.CI { internal class CIBuilder : ICIBuilder { public ICIBuilder Add<T>(Action<T> action) where T : ICIProvider { throw new NotImplementedException(); } } }
24.136364
72
0.689266
[ "MIT" ]
Inzanit/nuke
source/Nuke.Common/CI/CIBuilder.cs
531
C#
using System.Collections.Generic; using System.IO; using Form8snCore; using Form8snCore.FileFormats; namespace WebFormFiller.ServiceStubs { public interface IFileDatabaseStub : IFileSource { /// <summary> /// List all the document template projects available /// </summary> IDictionary<int, string> ListDocumentTemplates(); /// <summary> /// Store a document template file. /// If id is provided, this acts as Update. /// If is is null, this is an Insert /// </summary> int SaveDocumentTemplate(TemplateProject file, int? id); /// <summary> /// Store a file for later recovery using the [GET]Load(name) endpoint. /// In your implementation, you might want to supply files from a CDN, S3, or similar. /// </summary> void Store(string name, Stream stream); /// <summary> /// Read a document template file by ID /// </summary> TemplateProject GetDocumentById(int docId); /// <summary> /// This method should return a complete example data set, in the same format as will be /// used to create final output documents from templates. /// It is used by the UI to provide sample data and guidance to the user, so values in the /// sample dataset should be as realistic as possible. /// Where items are repeated, enough examples should be given to trigger splits and repeats /// in normal documents. /// </summary> object GetSampleData(); } }
37.651163
100
0.610871
[ "BSD-3-Clause" ]
i-e-b/Form8sn
src/WebFormFiller/ServiceStubs/IFileDatabaseStub.cs
1,621
C#
using AutoMapper; using DTOs.Bookings; using DTOs.Dish; using DTOs.Favourites; using DTOs.Restaurant; using DTOs.Users; using Entities; namespace WebApi.Dtos { public class MappingProfiles : Profile { public MappingProfiles() { CreateMap<Dish, DishRequestDto>().ReverseMap(); CreateMap<Dish, DishResponseDto>().ReverseMap(); CreateMap<Dish, DishDto>().ReverseMap(); CreateMap<DishCategory, DishCategoryResponseDto>().ReverseMap(); CreateMap<Restaurant, RestaurantResponseDto>().ReverseMap(); CreateMap<RestaurantCategory, RestaurantCategoryResponseDto>().ReverseMap(); CreateMap<Restaurant, RestaurantMobileResponseDto>().ReverseMap(); CreateMap<Dish, DishesByRestaurantResponseDto>().ReverseMap(); CreateMap<Restaurant, BranchOfficeRequestDto>().ReverseMap(); CreateMap<UserDto, User>().ReverseMap(); CreateMap<BestSellingDishes, BestSellingDishesResponseDto>().ReverseMap(); CreateMap<BookingListResponseDto, BookingOwner>().ReverseMap(); CreateMap<BookingStatusResponseDto, BookingStatus>().ReverseMap(); CreateMap<FavouriteRequestDto, Favourite>().ReverseMap(); CreateMap<UserResponseDto, User>().ReverseMap(); CreateMap<BranchResponseDto, Restaurant>().ReverseMap(); } } }
42.636364
88
0.675906
[ "MIT" ]
BootcampTeamNet/ApiRestaurants
ApiRestaurants/DTOs/Shared/MappingProfiles.cs
1,409
C#
using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Threading.Tasks; using CoinBot.Core; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace CoinBot.Clients.Poloniex { public class PoloniexClient : IMarketClient { /// <summary> /// The <see cref="CurrencyManager"/>. /// </summary> private readonly CurrencyManager _currencyManager; /// <summary> /// The Exchange name. /// </summary> public string Name => "Poloniex"; /// <summary> /// The <see cref="Uri"/> of the CoinMarketCap endpoint. /// </summary> private readonly Uri _endpoint = new Uri("https://poloniex.com/", UriKind.Absolute); /// <summary> /// The <see cref="HttpClient"/>. /// </summary> private readonly HttpClient _httpClient; /// <summary> /// The <see cref="ILogger"/>. /// </summary> private readonly ILogger _logger; /// <summary> /// The <see cref="JsonSerializerSettings"/>. /// </summary> private readonly JsonSerializerSettings _serializerSettings; public PoloniexClient(ILogger logger, CurrencyManager currencyManager) { this._logger = logger ?? throw new ArgumentNullException(nameof(logger)); this._currencyManager = currencyManager ?? throw new ArgumentNullException(nameof(currencyManager)); this._httpClient = new HttpClient { BaseAddress = this._endpoint }; this._serializerSettings = new JsonSerializerSettings { Error = (sender, args) => { Exception ex = args.ErrorContext.Error.GetBaseException(); this._logger.LogError(new EventId(args.ErrorContext.Error.HResult), ex, ex.Message); } }; } /// <inheritdoc/> public async Task<IReadOnlyCollection<MarketSummaryDto>> Get() { try { List<PoloniexTicker> tickers = await this.GetTickers(); return tickers.Select(t => new MarketSummaryDto { BaseCurrrency = this._currencyManager.Get(t.Pair.Substring(0, t.Pair.IndexOf('_'))), MarketCurrency = this._currencyManager.Get(t.Pair.Substring(t.Pair.IndexOf('_') + 1)), Market = "Poloniex", Volume = t.BaseVolume, Last = t.Last, }).ToList(); } catch (Exception e) { this._logger.LogError(new EventId(e.HResult), e, e.Message); throw; } } /// <summary> /// Get the market summaries. /// </summary> /// <returns></returns> private async Task<List<PoloniexTicker>> GetTickers() { using (HttpResponseMessage response = await this._httpClient.GetAsync(new Uri("public?command=returnTicker", UriKind.Relative))) { string json = await response.Content.ReadAsStringAsync(); JObject jResponse = JObject.Parse(json); List<PoloniexTicker> tickers = new List<PoloniexTicker>(); foreach (KeyValuePair<string, JToken> jToken in jResponse) { JObject obj = JObject.Parse(jToken.Value.ToString()); PoloniexTicker ticker = JsonConvert.DeserializeObject<PoloniexTicker>(obj.ToString(), this._serializerSettings); ticker.Pair = jToken.Key; tickers.Add(ticker); } return tickers; } } } }
28.263636
131
0.684143
[ "MIT" ]
rroslund/CoinBot
src/CoinBot.Clients/Poloniex/PoloniexClient.cs
3,111
C#
/* * Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the codedeploy-2014-10-06.normal.json service model. */ using System; using System.Net; using Amazon.Runtime; namespace Amazon.CodeDeploy.Model { ///<summary> /// CodeDeploy exception /// </summary> #if !PCL && !CORECLR [Serializable] #endif public class IamUserArnRequiredException : AmazonCodeDeployException { /// <summary> /// Constructs a new IamUserArnRequiredException with the specified error /// message. /// </summary> /// <param name="message"> /// Describes the error encountered. /// </param> public IamUserArnRequiredException(string message) : base(message) {} /// <summary> /// Construct instance of IamUserArnRequiredException /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> public IamUserArnRequiredException(string message, Exception innerException) : base(message, innerException) {} /// <summary> /// Construct instance of IamUserArnRequiredException /// </summary> /// <param name="innerException"></param> public IamUserArnRequiredException(Exception innerException) : base(innerException) {} /// <summary> /// Construct instance of IamUserArnRequiredException /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> /// <param name="errorType"></param> /// <param name="errorCode"></param> /// <param name="requestId"></param> /// <param name="statusCode"></param> public IamUserArnRequiredException(string message, Exception innerException, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode) : base(message, innerException, errorType, errorCode, requestId, statusCode) {} /// <summary> /// Construct instance of IamUserArnRequiredException /// </summary> /// <param name="message"></param> /// <param name="errorType"></param> /// <param name="errorCode"></param> /// <param name="requestId"></param> /// <param name="statusCode"></param> public IamUserArnRequiredException(string message, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode) : base(message, errorType, errorCode, requestId, statusCode) {} #if !PCL && !CORECLR /// <summary> /// Constructs a new instance of the IamUserArnRequiredException class with serialized data. /// </summary> /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param> /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="info" /> parameter is null. </exception> /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult" /> is zero (0). </exception> protected IamUserArnRequiredException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } #endif } }
43.381443
178
0.652091
[ "Apache-2.0" ]
Bio2hazard/aws-sdk-net
sdk/src/Services/CodeDeploy/Generated/Model/IamUserArnRequiredException.cs
4,208
C#
using Microsoft.Azure.Documents; using Microsoft.Azure.Documents.Client; using Microsoft.DataTransfer.DocumentDb.Client; using Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Microsoft.DataTransfer.DocumentDb.FunctionalTests { static class DocumentDbHelper { public static async Task CreateSampleCollectionAsync(string connectionString, string collectionName, IEnumerable<object> documents) { var connectionSettings = DocumentDbConnectionStringBuilder.Parse(connectionString); using (var client = CreateClient(connectionSettings)) { var database = await client.CreateDatabaseAsync(new Database { Id = connectionSettings.Database }); var collection = await client.CreateDocumentCollectionAsync(database.Resource.SelfLink, new DocumentCollection { Id = collectionName }); foreach (var document in documents) await client.CreateDocumentAsync(collection.Resource.SelfLink, document); } } public static IEnumerable<IReadOnlyDictionary<string, object>> ReadDocuments(string connectionString, string collectionName, string query = "SELECT * FROM c") { var connectionSettings = DocumentDbConnectionStringBuilder.Parse(connectionString); using (var client = CreateClient(connectionSettings)) { var database = client .CreateDatabaseQuery() .Where(d => d.Id == connectionSettings.Database) .AsEnumerable() .FirstOrDefault(); Assert.IsNotNull(database, "Document database does not exist."); var collection = client .CreateDocumentCollectionQuery(database.CollectionsLink) .Where(c => c.Id == collectionName) .AsEnumerable() .FirstOrDefault(); Assert.IsNotNull(collection, "Document collection does not exist."); return client .CreateDocumentQuery<Dictionary<string, object>>(collection.DocumentsLink, query, new FeedOptions { EnableCrossPartitionQuery = true }) .ToArray(); } } public static async Task DeleteDatabaseAsync(string connectionString) { var connectionSettings = DocumentDbConnectionStringBuilder.Parse(connectionString); using (var client = CreateClient(connectionSettings)) { var database = client .CreateDatabaseQuery() .Where(d => d.Id == connectionSettings.Database) .AsEnumerable() .FirstOrDefault(); if (database != null) await client.DeleteDatabaseAsync(database.SelfLink); } } private static DocumentClient CreateClient(IDocumentDbConnectionSettings connectionSettings) { return new DocumentClient(new Uri(connectionSettings.AccountEndpoint), connectionSettings.AccountKey); } } }
41.148148
155
0.634263
[ "MIT" ]
Adrian-Wennberg/azure-documentdb-datamigrationtool
DocumentDb/Microsoft.DataTransfer.DocumentDb.FunctionalTests/DocumentDbHelper.cs
3,335
C#
// <auto-generated /> namespace MillennialResortWebSite.Migrations { using System.CodeDom.Compiler; using System.Data.Entity.Migrations; using System.Data.Entity.Migrations.Infrastructure; using System.Resources; [GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")] public sealed partial class AddedThePropertyFields : IMigrationMetadata { private readonly ResourceManager Resources = new ResourceManager(typeof(AddedThePropertyFields)); string IMigrationMetadata.Id { get { return "201904112219347_AddedThePropertyFields"; } } string IMigrationMetadata.Source { get { return null; } } string IMigrationMetadata.Target { get { return Resources.GetString("Target"); } } } }
28.7
105
0.639954
[ "MIT" ]
tektechnologies/Software-Development-Capstone
MillennialResortManager/MillennialResortWebSite/Migrations/201904112219347_AddedThePropertyFields.Designer.cs
861
C#
using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; namespace TrackerSchema.Core.Data.Identity.Mapping { /// <summary> /// Allows configuration for an entity type <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser" /> /// </summary> public partial class IdentityUserMap : IEntityTypeConfiguration<TrackerSchema.Core.Data.Identity.Entities.IdentityUser> { /// <summary> /// Configures the entity of type <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser" /> /// </summary> /// <param name="builder">The builder to be used to configure the entity type.</param> public void Configure(Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder<TrackerSchema.Core.Data.Identity.Entities.IdentityUser> builder) { #region Generated Configure // table builder.ToTable("User", "Identity"); // key builder.HasKey(t => t.Id); // properties builder.Property(t => t.Id) .IsRequired() .HasColumnName("Id") .HasColumnType("uniqueidentifier") .HasDefaultValueSql("(newsequentialid())"); builder.Property(t => t.EmailAddress) .IsRequired() .HasColumnName("EmailAddress") .HasColumnType("nvarchar(256)") .HasMaxLength(256); builder.Property(t => t.IsEmailAddressConfirmed) .IsRequired() .HasColumnName("IsEmailAddressConfirmed") .HasColumnType("bit"); builder.Property(t => t.DisplayName) .IsRequired() .HasColumnName("DisplayName") .HasColumnType("nvarchar(256)") .HasMaxLength(256); builder.Property(t => t.PasswordHash) .HasColumnName("PasswordHash") .HasColumnType("nvarchar(max)"); builder.Property(t => t.ResetHash) .HasColumnName("ResetHash") .HasColumnType("nvarchar(max)"); builder.Property(t => t.InviteHash) .HasColumnName("InviteHash") .HasColumnType("nvarchar(max)"); builder.Property(t => t.AccessFailedCount) .IsRequired() .HasColumnName("AccessFailedCount") .HasColumnType("int"); builder.Property(t => t.LockoutEnabled) .IsRequired() .HasColumnName("LockoutEnabled") .HasColumnType("bit"); builder.Property(t => t.LockoutEnd) .HasColumnName("LockoutEnd") .HasColumnType("datetimeoffset"); builder.Property(t => t.LastLogin) .HasColumnName("LastLogin") .HasColumnType("datetimeoffset"); builder.Property(t => t.IsDeleted) .IsRequired() .HasColumnName("IsDeleted") .HasColumnType("bit"); builder.Property(t => t.Created) .IsRequired() .HasColumnName("Created") .HasColumnType("datetimeoffset") .HasDefaultValueSql("(sysutcdatetime())"); builder.Property(t => t.CreatedBy) .HasColumnName("CreatedBy") .HasColumnType("nvarchar(100)") .HasMaxLength(100); builder.Property(t => t.Updated) .IsRequired() .HasColumnName("Updated") .HasColumnType("datetimeoffset") .HasDefaultValueSql("(sysutcdatetime())"); builder.Property(t => t.UpdatedBy) .HasColumnName("UpdatedBy") .HasColumnType("nvarchar(100)") .HasMaxLength(100); builder.Property(t => t.RowVersion) .IsRequired() .IsRowVersion() .HasColumnName("RowVersion") .HasColumnType("rowversion") .HasMaxLength(8) .ValueGeneratedOnAddOrUpdate(); // relationships #endregion } #region Generated Constants public struct Table { /// <summary>Table Schema name constant for entity <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser" /></summary> public const string Schema = "Identity"; /// <summary>Table Name constant for entity <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser" /></summary> public const string Name = "User"; } public struct Columns { /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.Id" /></summary> public const string Id = "Id"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.EmailAddress" /></summary> public const string EmailAddress = "EmailAddress"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.IsEmailAddressConfirmed" /></summary> public const string IsEmailAddressConfirmed = "IsEmailAddressConfirmed"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.DisplayName" /></summary> public const string DisplayName = "DisplayName"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.PasswordHash" /></summary> public const string PasswordHash = "PasswordHash"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.ResetHash" /></summary> public const string ResetHash = "ResetHash"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.InviteHash" /></summary> public const string InviteHash = "InviteHash"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.AccessFailedCount" /></summary> public const string AccessFailedCount = "AccessFailedCount"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.LockoutEnabled" /></summary> public const string LockoutEnabled = "LockoutEnabled"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.LockoutEnd" /></summary> public const string LockoutEnd = "LockoutEnd"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.LastLogin" /></summary> public const string LastLogin = "LastLogin"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.IsDeleted" /></summary> public const string IsDeleted = "IsDeleted"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.Created" /></summary> public const string Created = "Created"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.CreatedBy" /></summary> public const string CreatedBy = "CreatedBy"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.Updated" /></summary> public const string Updated = "Updated"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.UpdatedBy" /></summary> public const string UpdatedBy = "UpdatedBy"; /// <summary>Column Name constant for property <see cref="TrackerSchema.Core.Data.Identity.Entities.IdentityUser.RowVersion" /></summary> public const string RowVersion = "RowVersion"; } #endregion } }
49.880952
162
0.612768
[ "MIT" ]
Enric-Gilabert/EntityFrameworkCore.Generator
sample/TrackerSchema/TrackerSchema.Core/Data/Identity/Mapping/IdentityUserMap.cs
8,380
C#
using Abp.Application.Editions; using Abp.Application.Features; using Abp.Domain.Repositories; using Abp.Domain.Uow; namespace AbpCompanyName.AbpProjectName.Editions { public class EditionManager : AbpEditionManager { public const string DefaultEditionName = "Standard"; public EditionManager( IRepository<Edition> editionRepository, IAbpZeroFeatureValueStore featureValueStore, IUnitOfWorkManager unitOfWorkManager) : base( editionRepository, featureValueStore, unitOfWorkManager ) { } } }
26.84
61
0.61699
[ "MIT" ]
aspnetboilerplate/module-zero-template
src/AbpCompanyName.AbpProjectName.Core/Editions/EditionManager.cs
673
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CommonThings { public static class FileHelper { public static async Task<string> ReadTextAsync(string filePath) { using (FileStream sourceStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 4096, useAsync: true)) { StringBuilder sb = new StringBuilder(); byte[] buffer = new byte[0x1000]; int numRead; while ((numRead = await sourceStream.ReadAsync(buffer, 0, buffer.Length)) != 0) { string text = Encoding.UTF8.GetString(buffer, 0, numRead); sb.Append(text); } return sb.ToString(); } } } }
28.393939
95
0.552828
[ "MIT" ]
gynorbi/home
WindowsFormsShell/CommonThings/FileHelper.cs
939
C#
#if UNITY_EDITOR #pragma warning disable 0162 #pragma warning disable 0618 using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; using UnityObject = UnityEngine.Object; namespace Zios { #if UNITY_EDITOR using Event; using UnityEditor; public class UtilityListener : AssetPostprocessor { public static void OnPostprocessAllAssets(string[] imported, string[] deleted, string[] movedTo, string[] movedFrom) { bool playing = EditorApplication.isPlaying || EditorApplication.isPlayingOrWillChangePlaymode; if (!playing) { Events.Call("On Asset Changed"); } } } public class UtilityModificationListener : AssetModificationProcessor { public static string[] OnWillSaveAssets(string[] paths) { //foreach(string path in paths){Debug.Log("Saving Changes : " + path);} if (paths.Exists(x => x.Contains(".unity"))) { Events.Call("On Scene Saving"); } Events.Call("On Asset Saving"); Events.Call("On Asset Modifying"); return paths; } public static string OnWillCreateAssets(string path) { Debug.Log("Creating : " + path); Events.Call("On Asset Creating"); Events.Call("On Asset Modifying"); return path; } public static string[] OnWillDeleteAssets(string[] paths, RemoveAssetOptions option) { foreach (string path in paths) { Debug.Log("Deleting : " + path); } Events.Call("On Asset Deleting"); Events.Call("On Asset Modifying"); return paths; } public static string OnWillMoveAssets(string path, string destination) { Debug.Log("Moving : " + path + " to " + destination); Events.Call("On Asset Moving"); Events.Call("On Asset Modifying"); return path; } } public static partial class Utility { private static EditorWindow inspector; private static EditorWindow[] inspectors; private static Dictionary<Editor, EditorWindow> editorInspectors = new Dictionary<Editor, EditorWindow>(); private static List<UnityObject> delayedDirty = new List<UnityObject>(); private static Dictionary<UnityObject, SerializedObject> serializedObjects = new Dictionary<UnityObject, SerializedObject>(); public static SerializedObject GetSerializedObject(UnityObject target) { if (!Utility.serializedObjects.ContainsKey(target)) { Utility.serializedObjects[target] = new SerializedObject(target); } return Utility.serializedObjects[target]; } public static SerializedObject GetSerialized(UnityObject target) { Type type = typeof(SerializedObject); return type.CallMethod<SerializedObject>("LoadFromCache", target.GetInstanceID()); } public static void UpdateSerialized(UnityObject target) { var serialized = Utility.GetSerializedObject(target); serialized.Update(); serialized.ApplyModifiedProperties(); //Utility.UpdatePrefab(target); } public static EditorWindow[] GetInspectors() { if (Utility.inspectors == null) { Type inspectorType = Utility.GetUnityType("InspectorWindow"); Utility.inspectors = inspectorType.CallMethod<EditorWindow[]>("GetAllInspectorWindows"); } return Utility.inspectors; } public static EditorWindow GetInspector(Editor editor) { #if UNITY_EDITOR if (!Utility.editorInspectors.ContainsKey(editor)) { Type inspectorType = Utility.GetUnityType("InspectorWindow"); var windows = inspectorType.CallMethod<EditorWindow[]>("GetAllInspectorWindows"); for (int index = 0; index < windows.Length; ++index) { var tracker = windows[index].GetVariable<ActiveEditorTracker>("m_Tracker"); if (tracker == null) { continue; } for (int editorIndex = 0; editorIndex < tracker.activeEditors.Length; ++editorIndex) { var current = tracker.activeEditors[editorIndex]; Utility.editorInspectors[current] = windows[index]; } } } return Utility.editorInspectors[editor]; #endif return null; } public static Vector2 GetInspectorScroll(Editor editor) { #if UNITY_EDITOR return Utility.GetInspector(editor).GetVariable<Vector2>("m_ScrollPosition"); #endif return Vector2.zero; } public static Vector2 GetInspectorScroll() { if (Utility.inspector.IsNull()) { Type inspectorWindow = Utility.GetUnityType("InspectorWindow"); Utility.inspector = EditorWindow.GetWindow(inspectorWindow); } return Utility.inspector.GetVariable<Vector2>("m_ScrollPosition"); } public static Vector2 GetInspectorScroll(this Rect current) { Type inspectorWindow = Utility.GetUnityType("InspectorWindow"); var window = EditorWindow.GetWindowWithRect(inspectorWindow, current); return window.GetVariable<Vector2>("m_ScrollPosition"); } #if !UNITY_THEMES //[MenuItem("Zios/Format Code")] public static void FormatCode() { var output = new StringBuilder(); var current = ""; foreach (var file in FileManager.FindAll("*.cs")) { var contents = file.GetText(); output.Clear(); foreach (var line in contents.GetLines()) { var leading = line.Substring(0, line.TakeWhile(char.IsWhiteSpace).Count()).Replace(" ", "\t"); current = leading + line.Trim().Replace("//", "////"); if (line.Trim().IsEmpty()) { continue; } output.AppendLine(current); } file.WriteText(output.ToString().TrimEnd(null)); } } [MenuItem("Zios/Unhide GameObjects")] public static void UnhideAll() { foreach (var target in Resources.FindObjectsOfTypeAll<GameObject>()) { if (!target.name.ContainsAny("SceneCamera", "SceneLight", "InternalIdentityTransform")) { target.hideFlags = HideFlags.None; } } } #endif } #endif } #endif
46.666667
133
0.610486
[ "MIT" ]
tyh24647/Miami1984
Assets/Editor/Codebase/Supports/Utility/UtilityEditor.cs
6,580
C#
using App.Domain; using App.Service.Profile; using App.SharedKernel.Guards; using App.SharedKernel.Repository; using System; using System.Threading.Tasks; namespace App.Service.Concretes.Profile { public class ProfileService : IProfileService { readonly IRepository<User, Guid> _userRepository; public ProfileService(IUnitOfWork unitOfWork) { _userRepository = unitOfWork.Repository<User, Guid>(); } public async Task<UserDto> GetUser(Guid userId) { var user = await _userRepository.GetByIdAsync(userId); Guard.IsNotNull(user, "user-not-found"); return new UserDto { FullName = user.FullName, Id = user.Id }; } } }
24.75
66
0.614899
[ "MIT" ]
appconfi/appconfi-web
src/App.Service/Profile/ProfileService.cs
794
C#
using System; using System.Collections.Generic; namespace Prototype.OpenTelematics.DataAccess { public partial class Driver { public Guid Id { get; set; } public string username { get; set; } public string driverLicenseNumber { get; set; } public string country { get; set; } public string region { get; set; } public string driverHomeTerminal { get; set; } public string password { get; set; } public bool enabled { get; set; } } }
30
55
0.629412
[ "Apache-2.0" ]
nmfta-repo/nmfta-opentelematics-prototype
Prototype.OpenTelematics.DataAccess/Driver.cs
512
C#
namespace UnityEngine.Rendering.HighDefinition { /// <summary>Pass names and shader ids used in HDRP. these names can be used as filters when rendering objects in a custom pass or a DrawRenderers() call.</summary> public static class HDShaderPassNames { // ShaderPass string - use to have consistent name through the code /// <summary>Empty pass name.</summary> public static readonly string s_EmptyStr = ""; /// <summary>Forward pass name.</summary> public static readonly string s_ForwardStr = "Forward"; /// <summary>Depth Only pass name.</summary> public static readonly string s_DepthOnlyStr = "DepthOnly"; /// <summary>Depth Forward Only pass name.</summary> public static readonly string s_DepthForwardOnlyStr = "DepthForwardOnly"; /// <summary>Forward Only pass name.</summary> public static readonly string s_ForwardOnlyStr = "ForwardOnly"; /// <summary>GBuffer pass name.</summary> public static readonly string s_GBufferStr = "GBuffer"; /// <summary>GBuffer With Prepass pass name.</summary> public static readonly string s_GBufferWithPrepassStr = "GBufferWithPrepass"; /// <summary>Legacy Unlit cross pipeline pass name.</summary> public static readonly string s_SRPDefaultUnlitStr = "SRPDefaultUnlit"; /// <summary>Motion Vectors pass name.</summary> public static readonly string s_MotionVectorsStr = "MotionVectors"; /// <summary>Distortion Vectors pass name.</summary> public static readonly string s_DistortionVectorsStr = "DistortionVectors"; /// <summary>Transparent Depth Prepass pass name.</summary> public static readonly string s_TransparentDepthPrepassStr = "TransparentDepthPrepass"; /// <summary>Transparent Backface pass name.</summary> public static readonly string s_TransparentBackfaceStr = "TransparentBackface"; /// <summary>Transparent Depth Postpass pass name.</summary> public static readonly string s_TransparentDepthPostpassStr = "TransparentDepthPostpass"; /// <summary>RayTracing Prepass pass name.</summary> public static readonly string s_RayTracingPrepassStr = "RayTracingPrepass"; /// <summary>Visibility DXR pass name.</summary> public static readonly string s_RayTracingVisibilityStr = "VisibilityDXR"; /// <summary>PathTracing DXR pass name.</summary> public static readonly string s_PathTracingDXRStr = "PathTracingDXR"; /// <summary>META pass name.</summary> public static readonly string s_MetaStr = "META"; /// <summary>Shadow Caster pass name.</summary> public static readonly string s_ShadowCasterStr = "ShadowCaster"; /// <summary>FullScreen Debug pass name.</summary> public static readonly string s_FullScreenDebugStr = "FullScreenDebug"; /// <summary>DBuffer Projector pass name.</summary> public static readonly string s_DBufferProjectorStr = DecalSystem.s_MaterialDecalPassNames[(int)DecalSystem.MaterialDecalPass.DBufferProjector]; /// <summary>Decal Projector Forward Emissive pass name.</summary> public static readonly string s_DecalProjectorForwardEmissiveStr = DecalSystem.s_MaterialDecalPassNames[(int)DecalSystem.MaterialDecalPass.DecalProjectorForwardEmissive]; /// <summary>DBuffer Mesh pass name.</summary> public static readonly string s_DBufferMeshStr = DecalSystem.s_MaterialDecalPassNames[(int)DecalSystem.MaterialDecalPass.DBufferMesh]; /// <summary>Decal Mesh Forward Emissive pass name.</summary> public static readonly string s_DecalMeshForwardEmissiveStr = DecalSystem.s_MaterialDecalPassNames[(int)DecalSystem.MaterialDecalPass.DecalMeshForwardEmissive]; // ShaderPass name /// <summary>Empty shader tag id.</summary> public static readonly ShaderTagId s_EmptyName = new ShaderTagId(s_EmptyStr); /// <summary>Forward shader tag id.</summary> public static readonly ShaderTagId s_ForwardName = new ShaderTagId(s_ForwardStr); /// <summary>Depth Only shader tag id.</summary> public static readonly ShaderTagId s_DepthOnlyName = new ShaderTagId(s_DepthOnlyStr); /// <summary>Depth Forward Only shader tag id.</summary> public static readonly ShaderTagId s_DepthForwardOnlyName = new ShaderTagId(s_DepthForwardOnlyStr); /// <summary>Forward Only shader tag id.</summary> public static readonly ShaderTagId s_ForwardOnlyName = new ShaderTagId(s_ForwardOnlyStr); /// <summary>GBuffer shader tag id.</summary> public static readonly ShaderTagId s_GBufferName = new ShaderTagId(s_GBufferStr); /// <summary>GBufferWithPrepass shader tag id.</summary> public static readonly ShaderTagId s_GBufferWithPrepassName = new ShaderTagId(s_GBufferWithPrepassStr); /// <summary>Legacy Unlit cross pipeline shader tag id.</summary> public static readonly ShaderTagId s_SRPDefaultUnlitName = new ShaderTagId(s_SRPDefaultUnlitStr); /// <summary>Motion Vectors shader tag id.</summary> public static readonly ShaderTagId s_MotionVectorsName = new ShaderTagId(s_MotionVectorsStr); /// <summary>Distortion Vectors shader tag id.</summary> public static readonly ShaderTagId s_DistortionVectorsName = new ShaderTagId(s_DistortionVectorsStr); /// <summary>Transparent Depth Prepass shader tag id.</summary> public static readonly ShaderTagId s_TransparentDepthPrepassName = new ShaderTagId(s_TransparentDepthPrepassStr); /// <summary>Transparent Backface shader tag id.</summary> public static readonly ShaderTagId s_TransparentBackfaceName = new ShaderTagId(s_TransparentBackfaceStr); /// <summary>Transparent Depth Postpass shader tag id.</summary> public static readonly ShaderTagId s_TransparentDepthPostpassName = new ShaderTagId(s_TransparentDepthPostpassStr); /// <summary>RayTracing Prepass shader tag id.</summary> public static readonly ShaderTagId s_RayTracingPrepassName = new ShaderTagId(s_RayTracingPrepassStr); /// <summary>FullScreen Debug shader tag id.</summary> public static readonly ShaderTagId s_FullScreenDebugName = new ShaderTagId(s_FullScreenDebugStr); /// <summary>DBuffer Mesh shader tag id.</summary> public static readonly ShaderTagId s_DBufferMeshName = new ShaderTagId(s_DBufferMeshStr); /// <summary>Decal Mesh Forward Emissive shader tag id.</summary> public static readonly ShaderTagId s_DecalMeshForwardEmissiveName = new ShaderTagId(s_DecalMeshForwardEmissiveStr); // Legacy name internal static readonly ShaderTagId s_AlwaysName = new ShaderTagId("Always"); internal static readonly ShaderTagId s_ForwardBaseName = new ShaderTagId("ForwardBase"); internal static readonly ShaderTagId s_DeferredName = new ShaderTagId("Deferred"); internal static readonly ShaderTagId s_PrepassBaseName = new ShaderTagId("PrepassBase"); internal static readonly ShaderTagId s_VertexName = new ShaderTagId("Vertex"); internal static readonly ShaderTagId s_VertexLMRGBMName = new ShaderTagId("VertexLMRGBM"); internal static readonly ShaderTagId s_VertexLMName = new ShaderTagId("VertexLM"); } // Pre-hashed shader ids - naming conventions are a bit off in this file as we use the same // fields names as in the shaders for ease of use... // TODO: Would be nice to clean this up at some point static class HDShaderIDs { public static readonly int _ZClip = Shader.PropertyToID("_ZClip"); public static readonly int _HDShadowDatas = Shader.PropertyToID("_HDShadowDatas"); public static readonly int _HDDirectionalShadowData = Shader.PropertyToID("_HDDirectionalShadowData"); public static readonly int _ShadowmapAtlas = Shader.PropertyToID("_ShadowmapAtlas"); public static readonly int _ShadowmapAreaAtlas = Shader.PropertyToID("_ShadowmapAreaAtlas"); public static readonly int _ShadowmapCascadeAtlas = Shader.PropertyToID("_ShadowmapCascadeAtlas"); public static readonly int _CachedShadowmapAtlas = Shader.PropertyToID("_CachedShadowmapAtlas"); public static readonly int _CachedAreaLightShadowmapAtlas = Shader.PropertyToID("_CachedAreaLightShadowmapAtlas"); public static readonly int _CachedShadowAtlasSize = Shader.PropertyToID("_CachedShadowAtlasSize"); public static readonly int _CachedAreaShadowAtlasSize = Shader.PropertyToID("_CachedAreaShadowAtlasSize"); // Moment shadow map data public static readonly int _MomentShadowAtlas = Shader.PropertyToID("_MomentShadowAtlas"); public static readonly int _MomentShadowmapSlotST = Shader.PropertyToID("_MomentShadowmapSlotST"); public static readonly int _MomentShadowmapSize = Shader.PropertyToID("_MomentShadowmapSize"); public static readonly int _SummedAreaTableInputInt = Shader.PropertyToID("_SummedAreaTableInputInt"); public static readonly int _SummedAreaTableOutputInt = Shader.PropertyToID("_SummedAreaTableOutputInt"); public static readonly int _SummedAreaTableInputFloat = Shader.PropertyToID("_SummedAreaTableInputFloat"); public static readonly int _IMSKernelSize = Shader.PropertyToID("_IMSKernelSize"); public static readonly int _SrcRect = Shader.PropertyToID("_SrcRect"); public static readonly int _DstRect = Shader.PropertyToID("_DstRect"); public static readonly int _EVSMExponent = Shader.PropertyToID("_EVSMExponent"); public static readonly int _BlurWeightsStorage = Shader.PropertyToID("_BlurWeightsStorage"); public static readonly int g_LayeredSingleIdxBuffer = Shader.PropertyToID("g_LayeredSingleIdxBuffer"); public static readonly int g_depth_tex = Shader.PropertyToID("g_depth_tex"); public static readonly int g_vLayeredLightList = Shader.PropertyToID("g_vLayeredLightList"); public static readonly int g_LayeredOffset = Shader.PropertyToID("g_LayeredOffset"); public static readonly int g_vBigTileLightList = Shader.PropertyToID("g_vBigTileLightList"); public static readonly int g_vLightListGlobal = Shader.PropertyToID("g_vLightListGlobal"); public static readonly int g_logBaseBuffer = Shader.PropertyToID("g_logBaseBuffer"); public static readonly int g_vBoundsBuffer = Shader.PropertyToID("g_vBoundsBuffer"); public static readonly int _LightVolumeData = Shader.PropertyToID("_LightVolumeData"); public static readonly int g_data = Shader.PropertyToID("g_data"); public static readonly int g_vLightList = Shader.PropertyToID("g_vLightList"); public static readonly int g_TileFeatureFlags = Shader.PropertyToID("g_TileFeatureFlags"); public static readonly int g_DispatchIndirectBuffer = Shader.PropertyToID("g_DispatchIndirectBuffer"); public static readonly int g_TileList = Shader.PropertyToID("g_TileList"); public static readonly int g_NumTiles = Shader.PropertyToID("g_NumTiles"); public static readonly int g_NumTilesX = Shader.PropertyToID("g_NumTilesX"); public static readonly int g_VertexPerTile = Shader.PropertyToID("g_VertexPerTile"); public static readonly int _NumTiles = Shader.PropertyToID("_NumTiles"); public static readonly int _CookieAtlas = Shader.PropertyToID("_CookieAtlas"); public static readonly int _EnvCubemapTextures = Shader.PropertyToID("_EnvCubemapTextures"); public static readonly int _Env2DTextures = Shader.PropertyToID("_Env2DTextures"); public static readonly int _DirectionalLightDatas = Shader.PropertyToID("_DirectionalLightDatas"); public static readonly int _LightDatas = Shader.PropertyToID("_LightDatas"); public static readonly int _EnvLightDatas = Shader.PropertyToID("_EnvLightDatas"); public static readonly int _ProbeVolumeBounds = Shader.PropertyToID("_ProbeVolumeBounds"); public static readonly int _ProbeVolumeDatas = Shader.PropertyToID("_ProbeVolumeDatas"); public static readonly int g_vProbeVolumesLayeredOffsetsBuffer = Shader.PropertyToID("g_vProbeVolumesLayeredOffsetsBuffer"); public static readonly int g_vProbeVolumesLightListGlobal = Shader.PropertyToID("g_vProbeVolumesLightListGlobal"); public static readonly int g_vLayeredOffsetsBuffer = Shader.PropertyToID("g_vLayeredOffsetsBuffer"); public static readonly int _LightListToClear = Shader.PropertyToID("_LightListToClear"); public static readonly int _LightListEntriesAndOffset = Shader.PropertyToID("_LightListEntriesAndOffset"); public static readonly int _ViewTilesFlags = Shader.PropertyToID("_ViewTilesFlags"); public static readonly int _ClusterDebugMode = Shader.PropertyToID("_ClusterDebugMode"); public static readonly int _ClusterDebugDistance = Shader.PropertyToID("_ClusterDebugDistance"); public static readonly int _MousePixelCoord = Shader.PropertyToID("_MousePixelCoord"); public static readonly int _MouseClickPixelCoord = Shader.PropertyToID("_MouseClickPixelCoord"); public static readonly int _DebugFont = Shader.PropertyToID("_DebugFont"); public static readonly int _SliceIndex = Shader.PropertyToID("_SliceIndex"); public static readonly int _DebugContactShadowLightIndex = Shader.PropertyToID("_DebugContactShadowLightIndex"); public static readonly int _AmbientOcclusionTexture = Shader.PropertyToID("_AmbientOcclusionTexture"); public static readonly int _AmbientOcclusionTextureRW = Shader.PropertyToID("_AmbientOcclusionTextureRW"); public static readonly int _MultiAmbientOcclusionTexture = Shader.PropertyToID("_MultiAmbientOcclusionTexture"); public static readonly int _DebugDepthPyramidMip = Shader.PropertyToID("_DebugDepthPyramidMip"); public static readonly int _DebugDepthPyramidOffsets = Shader.PropertyToID("_DebugDepthPyramidOffsets"); public static readonly int _UseTileLightList = Shader.PropertyToID("_UseTileLightList"); public static readonly int _SkyTexture = Shader.PropertyToID("_SkyTexture"); public static readonly int specularLightingUAV = Shader.PropertyToID("specularLightingUAV"); public static readonly int diffuseLightingUAV = Shader.PropertyToID("diffuseLightingUAV"); public static readonly int _DiffusionProfileAsset = Shader.PropertyToID("_DiffusionProfileAsset"); public static readonly int _SssSampleBudget = Shader.PropertyToID("_SssSampleBudget"); public static readonly int _MaterialID = Shader.PropertyToID("_MaterialID"); public static readonly int g_TileListOffset = Shader.PropertyToID("g_TileListOffset"); public static readonly int _LtcData = Shader.PropertyToID("_LtcData"); public static readonly int _LtcGGXMatrix = Shader.PropertyToID("_LtcGGXMatrix"); public static readonly int _LtcDisneyDiffuseMatrix = Shader.PropertyToID("_LtcDisneyDiffuseMatrix"); public static readonly int _LtcMultiGGXFresnelDisneyDiffuse = Shader.PropertyToID("_LtcMultiGGXFresnelDisneyDiffuse"); public static readonly int _ScreenSpaceShadowsTexture = Shader.PropertyToID("_ScreenSpaceShadowsTexture"); public static readonly int _ContactShadowTexture = Shader.PropertyToID("_ContactShadowTexture"); public static readonly int _ContactShadowTextureUAV = Shader.PropertyToID("_ContactShadowTextureUAV"); public static readonly int _ContactShadowParamsParameters = Shader.PropertyToID("_ContactShadowParamsParameters"); public static readonly int _ContactShadowParamsParameters2 = Shader.PropertyToID("_ContactShadowParamsParameters2"); public static readonly int _ContactShadowParamsParameters3 = Shader.PropertyToID("_ContactShadowParamsParameters3"); public static readonly int _DirectionalContactShadowSampleCount = Shader.PropertyToID("_SampleCount"); public static readonly int _ShadowFrustumPlanes = Shader.PropertyToID("_ShadowFrustumPlanes"); public static readonly int _StencilMask = Shader.PropertyToID("_StencilMask"); public static readonly int _StencilRef = Shader.PropertyToID("_StencilRef"); public static readonly int _StencilCmp = Shader.PropertyToID("_StencilCmp"); public static readonly int _InputDepth = Shader.PropertyToID("_InputDepthTexture"); public static readonly int _ClearColor = Shader.PropertyToID("_ClearColor"); public static readonly int _SrcBlend = Shader.PropertyToID("_SrcBlend"); public static readonly int _DstBlend = Shader.PropertyToID("_DstBlend"); public static readonly int _ColorMaskTransparentVel = Shader.PropertyToID("_ColorMaskTransparentVel"); public static readonly int _ColorMaskNormal = Shader.PropertyToID("_ColorMaskNormal"); public static readonly int _DecalColorMask0 = Shader.PropertyToID(HDMaterialProperties.kDecalColorMask0); public static readonly int _DecalColorMask1 = Shader.PropertyToID(HDMaterialProperties.kDecalColorMask1); public static readonly int _DecalColorMask2 = Shader.PropertyToID(HDMaterialProperties.kDecalColorMask2); public static readonly int _DecalColorMask3 = Shader.PropertyToID(HDMaterialProperties.kDecalColorMask3); public static readonly int _StencilTexture = Shader.PropertyToID("_StencilTexture"); // Used in the stencil resolve pass public static readonly int _OutputStencilBuffer = Shader.PropertyToID("_OutputStencilBuffer"); public static readonly int _CoarseStencilBuffer = Shader.PropertyToID("_CoarseStencilBuffer"); public static readonly int _CoarseStencilBufferSize = Shader.PropertyToID("_CoarseStencilBufferSize"); // all decal properties public static readonly int _NormalToWorldID = Shader.PropertyToID("_NormalToWorld"); public static readonly int _DecalAtlas2DID = Shader.PropertyToID("_DecalAtlas2D"); public static readonly int _DecalHTileTexture = Shader.PropertyToID("_DecalHTileTexture"); public static readonly int _DecalDatas = Shader.PropertyToID("_DecalDatas"); public static readonly int _DecalNormalBufferStencilReadMask = Shader.PropertyToID("_DecalNormalBufferStencilReadMask"); public static readonly int _DecalNormalBufferStencilRef = Shader.PropertyToID("_DecalNormalBufferStencilRef"); public static readonly int _DecalPrepassTexture = Shader.PropertyToID("_DecalPrepassTexture"); public static readonly int _DecalPrepassTextureMS = Shader.PropertyToID("_DecalPrepassTextureMS"); public static readonly int _WorldSpaceCameraPos = Shader.PropertyToID("_WorldSpaceCameraPos"); public static readonly int _PrevCamPosRWS = Shader.PropertyToID("_PrevCamPosRWS"); public static readonly int _ViewMatrix = Shader.PropertyToID("_ViewMatrix"); public static readonly int _InvViewMatrix = Shader.PropertyToID("_InvViewMatrix"); public static readonly int _ProjMatrix = Shader.PropertyToID("_ProjMatrix"); public static readonly int _InvProjMatrix = Shader.PropertyToID("_InvProjMatrix"); public static readonly int _NonJitteredViewProjMatrix = Shader.PropertyToID("_NonJitteredViewProjMatrix"); public static readonly int _ViewProjMatrix = Shader.PropertyToID("_ViewProjMatrix"); public static readonly int _CameraViewProjMatrix = Shader.PropertyToID("_CameraViewProjMatrix"); public static readonly int _InvViewProjMatrix = Shader.PropertyToID("_InvViewProjMatrix"); public static readonly int _ZBufferParams = Shader.PropertyToID("_ZBufferParams"); public static readonly int _ProjectionParams = Shader.PropertyToID("_ProjectionParams"); public static readonly int unity_OrthoParams = Shader.PropertyToID("unity_OrthoParams"); public static readonly int _InvProjParam = Shader.PropertyToID("_InvProjParam"); public static readonly int _ScreenSize = Shader.PropertyToID("_ScreenSize"); public static readonly int _HalfScreenSize = Shader.PropertyToID("_HalfScreenSize"); public static readonly int _ScreenParams = Shader.PropertyToID("_ScreenParams"); public static readonly int _RTHandleScale = Shader.PropertyToID("_RTHandleScale"); public static readonly int _RTHandleScaleHistory = Shader.PropertyToID("_RTHandleScaleHistory"); public static readonly int _PrevViewProjMatrix = Shader.PropertyToID("_PrevViewProjMatrix"); public static readonly int _PrevInvViewProjMatrix = Shader.PropertyToID("_PrevInvViewProjMatrix"); public static readonly int _FrustumPlanes = Shader.PropertyToID("_FrustumPlanes"); public static readonly int _TaaFrameInfo = Shader.PropertyToID("_TaaFrameInfo"); public static readonly int _TaaJitterStrength = Shader.PropertyToID("_TaaJitterStrength"); public static readonly int _TaaPostParameters = Shader.PropertyToID("_TaaPostParameters"); public static readonly int _TaaHistorySize = Shader.PropertyToID("_TaaHistorySize"); public static readonly int _TaaFilterWeights = Shader.PropertyToID("_TaaFilterWeights"); public static readonly int _WorldSpaceCameraPos1 = Shader.PropertyToID("_WorldSpaceCameraPos1"); public static readonly int _ViewMatrix1 = Shader.PropertyToID("_ViewMatrix1"); public static readonly int _ColorTexture = Shader.PropertyToID("_ColorTexture"); public static readonly int _DepthTexture = Shader.PropertyToID("_DepthTexture"); public static readonly int _DepthValuesTexture = Shader.PropertyToID("_DepthValuesTexture"); public static readonly int _CameraColorTexture = Shader.PropertyToID("_CameraColorTexture"); public static readonly int _CameraColorTextureRW = Shader.PropertyToID("_CameraColorTextureRW"); public static readonly int _CameraSssDiffuseLightingBuffer = Shader.PropertyToID("_CameraSssDiffuseLightingTexture"); public static readonly int _CameraFilteringBuffer = Shader.PropertyToID("_CameraFilteringTexture"); public static readonly int _IrradianceSource = Shader.PropertyToID("_IrradianceSource"); // Planar reflection filtering public static readonly int _ReflectionColorMipChain = Shader.PropertyToID("_ReflectionColorMipChain"); public static readonly int _DepthTextureMipChain = Shader.PropertyToID("_DepthTextureMipChain"); public static readonly int _ReflectionPlaneNormal = Shader.PropertyToID("_ReflectionPlaneNormal"); public static readonly int _ReflectionPlanePosition = Shader.PropertyToID("_ReflectionPlanePosition"); public static readonly int _FilteredPlanarReflectionBuffer = Shader.PropertyToID("_FilteredPlanarReflectionBuffer"); public static readonly int _HalfResReflectionBuffer = Shader.PropertyToID("_HalfResReflectionBuffer"); public static readonly int _HalfResDepthBuffer = Shader.PropertyToID("_HalfResDepthBuffer"); public static readonly int _CaptureBaseScreenSize = Shader.PropertyToID("_CaptureBaseScreenSize"); public static readonly int _CaptureCurrentScreenSize = Shader.PropertyToID("_CaptureCurrentScreenSize"); public static readonly int _CaptureCameraIVP = Shader.PropertyToID("_CaptureCameraIVP"); public static readonly int _CaptureCameraPositon = Shader.PropertyToID("_CaptureCameraPositon"); public static readonly int _SourceMipIndex = Shader.PropertyToID("_SourceMipIndex"); public static readonly int _MaxMipLevels = Shader.PropertyToID("_MaxMipLevels"); public static readonly int _ThetaValuesTexture = Shader.PropertyToID("_ThetaValuesTexture"); public static readonly int _CaptureCameraFOV = Shader.PropertyToID("_CaptureCameraFOV"); public static readonly int _RTScaleFactor = Shader.PropertyToID("_RTScaleFactor"); public static readonly int _CaptureCameraVP_NO = Shader.PropertyToID("_CaptureCameraVP_NO"); public static readonly int _CaptureCameraFarPlane = Shader.PropertyToID("_CaptureCameraFarPlane"); public static readonly int _DepthTextureOblique = Shader.PropertyToID("_DepthTextureOblique"); public static readonly int _DepthTextureNonOblique = Shader.PropertyToID("_DepthTextureNonOblique"); public static readonly int _CaptureCameraIVP_NO = Shader.PropertyToID("_CaptureCameraIVP_NO"); public static readonly int _Output = Shader.PropertyToID("_Output"); public static readonly int _Input = Shader.PropertyToID("_Input"); public static readonly int _InputVal = Shader.PropertyToID("_InputVal"); public static readonly int _Sizes = Shader.PropertyToID("_Sizes"); public static readonly int _ScaleBias = Shader.PropertyToID("_ScaleBias"); // MSAA shader properties public static readonly int _ColorTextureMS = Shader.PropertyToID("_ColorTextureMS"); public static readonly int _DepthTextureMS = Shader.PropertyToID("_DepthTextureMS"); public static readonly int _NormalTextureMS = Shader.PropertyToID("_NormalTextureMS"); public static readonly int _RaytracePrepassBufferMS = Shader.PropertyToID("_RaytracePrepassBufferMS"); public static readonly int _MotionVectorTextureMS = Shader.PropertyToID("_MotionVectorTextureMS"); public static readonly int _CameraDepthValuesTexture = Shader.PropertyToID("_CameraDepthValues"); public static readonly int[] _GBufferTexture = { Shader.PropertyToID("_GBufferTexture0"), Shader.PropertyToID("_GBufferTexture1"), Shader.PropertyToID("_GBufferTexture2"), Shader.PropertyToID("_GBufferTexture3"), Shader.PropertyToID("_GBufferTexture4"), Shader.PropertyToID("_GBufferTexture5"), Shader.PropertyToID("_GBufferTexture6"), Shader.PropertyToID("_GBufferTexture7") }; public static readonly int[] _GBufferTextureRW = { Shader.PropertyToID("_GBufferTexture0RW"), Shader.PropertyToID("_GBufferTexture1RW"), Shader.PropertyToID("_GBufferTexture2RW"), Shader.PropertyToID("_GBufferTexture3RW"), Shader.PropertyToID("_GBufferTexture4RW"), Shader.PropertyToID("_GBufferTexture5RW"), Shader.PropertyToID("_GBufferTexture6RW"), Shader.PropertyToID("_GBufferTexture7RW") }; public static readonly int[] _DBufferTexture = { Shader.PropertyToID("_DBufferTexture0"), Shader.PropertyToID("_DBufferTexture1"), Shader.PropertyToID("_DBufferTexture2"), Shader.PropertyToID("_DBufferTexture3") }; public static readonly int _ShaderVariablesGlobal = Shader.PropertyToID("ShaderVariablesGlobal"); public static readonly int _ShaderVariablesXR = Shader.PropertyToID("ShaderVariablesXR"); public static readonly int _ShaderVariablesVolumetric = Shader.PropertyToID("ShaderVariablesVolumetric"); public static readonly int _ShaderVariablesLightList = Shader.PropertyToID("ShaderVariablesLightList"); public static readonly int _ShaderVariablesRaytracing = Shader.PropertyToID("ShaderVariablesRaytracing"); public static readonly int _ShaderVariablesRaytracingLightLoop = Shader.PropertyToID("ShaderVariablesRaytracingLightLoop"); public static readonly int _ShaderVariablesDebugDisplay = Shader.PropertyToID("ShaderVariablesDebugDisplay"); public static readonly int _SSSBufferTexture = Shader.PropertyToID("_SSSBufferTexture"); public static readonly int _NormalBufferTexture = Shader.PropertyToID("_NormalBufferTexture"); public static readonly int _RaytracePrepassBufferTexture = Shader.PropertyToID("_RaytracePrepassBufferTexture"); public static readonly int _ShaderVariablesScreenSpaceReflection = Shader.PropertyToID("ShaderVariablesScreenSpaceReflection"); public static readonly int _SsrLightingTexture = Shader.PropertyToID("_SsrLightingTexture"); public static readonly int _SsrAccumPrev = Shader.PropertyToID("_SsrAccumPrev"); public static readonly int _SsrLightingTextureRW = Shader.PropertyToID("_SsrLightingTextureRW"); public static readonly int _SSRAccumTexture = Shader.PropertyToID("_SSRAccumTexture"); public static readonly int _SsrHitPointTexture = Shader.PropertyToID("_SsrHitPointTexture"); public static readonly int _SsrClearCoatMaskTexture = Shader.PropertyToID("_SsrClearCoatMaskTexture"); public static readonly int _DepthPyramidMipLevelOffsets = Shader.PropertyToID("_DepthPyramidMipLevelOffsets"); public static readonly int _DepthPyramidFirstMipLevelOffset = Shader.PropertyToID("_DepthPyramidFirstMipLevelOffset"); // Still used by ray tracing. public static readonly int _SsrStencilBit = Shader.PropertyToID("_SsrStencilBit"); public static readonly int _ShadowMaskTexture = Shader.PropertyToID("_ShadowMaskTexture"); public static readonly int _LightLayersTexture = Shader.PropertyToID("_LightLayersTexture"); public static readonly int _DistortionTexture = Shader.PropertyToID("_DistortionTexture"); public static readonly int _ColorPyramidTexture = Shader.PropertyToID("_ColorPyramidTexture"); public static readonly int _ColorPyramidUvScaleAndLimitPrevFrame = Shader.PropertyToID("_ColorPyramidUvScaleAndLimitPrevFrame"); public static readonly int _RoughDistortion = Shader.PropertyToID("_RoughDistortion"); public static readonly int _DebugColorPickerTexture = Shader.PropertyToID("_DebugColorPickerTexture"); public static readonly int _ColorPickerMode = Shader.PropertyToID("_ColorPickerMode"); public static readonly int _ApplyLinearToSRGB = Shader.PropertyToID("_ApplyLinearToSRGB"); public static readonly int _ColorPickerFontColor = Shader.PropertyToID("_ColorPickerFontColor"); public static readonly int _FalseColorEnabled = Shader.PropertyToID("_FalseColor"); public static readonly int _FalseColorThresholds = Shader.PropertyToID("_FalseColorThresholds"); public static readonly int _DebugMatCapTexture = Shader.PropertyToID("_DebugMatCapTexture"); public static readonly int _MatcapViewScale = Shader.PropertyToID("_MatcapViewScale"); public static readonly int _MatcapMixAlbedo = Shader.PropertyToID("_MatcapMixAlbedo"); public static readonly int _DebugFullScreenTexture = Shader.PropertyToID("_DebugFullScreenTexture"); public static readonly int _BlitTexture = Shader.PropertyToID("_BlitTexture"); public static readonly int _BlitTextureMSAA = Shader.PropertyToID("_BlitTextureMSAA"); public static readonly int _BlitScaleBias = Shader.PropertyToID("_BlitScaleBias"); public static readonly int _BlitMipLevel = Shader.PropertyToID("_BlitMipLevel"); public static readonly int _BlitScaleBiasRt = Shader.PropertyToID("_BlitScaleBiasRt"); public static readonly int _BlitTextureSize = Shader.PropertyToID("_BlitTextureSize"); public static readonly int _BlitPaddingSize = Shader.PropertyToID("_BlitPaddingSize"); public static readonly int _BlitTexArraySlice = Shader.PropertyToID("_BlitTexArraySlice"); public static readonly int _CameraDepthTexture = Shader.PropertyToID("_CameraDepthTexture"); public static readonly int _CameraMotionVectorsTexture = Shader.PropertyToID("_CameraMotionVectorsTexture"); public static readonly int _FullScreenDebugMode = Shader.PropertyToID("_FullScreenDebugMode"); public static readonly int _FullScreenDebugDepthRemap = Shader.PropertyToID("_FullScreenDebugDepthRemap"); public static readonly int _TransparencyOverdrawMaxPixelCost = Shader.PropertyToID("_TransparencyOverdrawMaxPixelCost"); public static readonly int _QuadOverdrawMaxQuadCost = Shader.PropertyToID("_QuadOverdrawMaxQuadCost"); public static readonly int _VertexDensityMaxPixelCost = Shader.PropertyToID("_VertexDensityMaxPixelCost"); public static readonly int _CustomDepthTexture = Shader.PropertyToID("_CustomDepthTexture"); public static readonly int _CustomColorTexture = Shader.PropertyToID("_CustomColorTexture"); public static readonly int _CustomPassInjectionPoint = Shader.PropertyToID("_CustomPassInjectionPoint"); public static readonly int _AfterPostProcessColorBuffer = Shader.PropertyToID("_AfterPostProcessColorBuffer"); public static readonly int _InputCubemap = Shader.PropertyToID("_InputCubemap"); public static readonly int _Mipmap = Shader.PropertyToID("_Mipmap"); public static readonly int _ApplyExposure = Shader.PropertyToID("_ApplyExposure"); public static readonly int _DiffusionProfileHash = Shader.PropertyToID("_DiffusionProfileHash"); public static readonly int _MaxRadius = Shader.PropertyToID("_MaxRadius"); public static readonly int _ShapeParam = Shader.PropertyToID("_ShapeParam"); public static readonly int _StdDev1 = Shader.PropertyToID("_StdDev1"); public static readonly int _StdDev2 = Shader.PropertyToID("_StdDev2"); public static readonly int _LerpWeight = Shader.PropertyToID("_LerpWeight"); public static readonly int _HalfRcpVarianceAndWeight1 = Shader.PropertyToID("_HalfRcpVarianceAndWeight1"); public static readonly int _HalfRcpVarianceAndWeight2 = Shader.PropertyToID("_HalfRcpVarianceAndWeight2"); public static readonly int _TransmissionTint = Shader.PropertyToID("_TransmissionTint"); public static readonly int _ThicknessRemap = Shader.PropertyToID("_ThicknessRemap"); public static readonly int _Cubemap = Shader.PropertyToID("_Cubemap"); public static readonly int _InvOmegaP = Shader.PropertyToID("_InvOmegaP"); public static readonly int _DistortionParam = Shader.PropertyToID("_DistortionParam"); public static readonly int _SkyParam = Shader.PropertyToID("_SkyParam"); public static readonly int _BackplateParameters0 = Shader.PropertyToID("_BackplateParameters0"); public static readonly int _BackplateParameters1 = Shader.PropertyToID("_BackplateParameters1"); public static readonly int _BackplateParameters2 = Shader.PropertyToID("_BackplateParameters2"); public static readonly int _BackplateShadowTint = Shader.PropertyToID("_BackplateShadowTint"); public static readonly int _BackplateShadowFilter = Shader.PropertyToID("_BackplateShadowFilter"); public static readonly int _SkyIntensity = Shader.PropertyToID("_SkyIntensity"); public static readonly int _PixelCoordToViewDirWS = Shader.PropertyToID("_PixelCoordToViewDirWS"); public static readonly int _Flowmap = Shader.PropertyToID("_Flowmap"); public static readonly int _FlowmapParam = Shader.PropertyToID("_FlowmapParam"); public static readonly int _Size = Shader.PropertyToID("_Size"); public static readonly int _Source = Shader.PropertyToID("_Source"); public static readonly int _Destination = Shader.PropertyToID("_Destination"); public static readonly int _Mip0 = Shader.PropertyToID("_Mip0"); public static readonly int _SourceMip = Shader.PropertyToID("_SourceMip"); public static readonly int _SrcOffsetAndLimit = Shader.PropertyToID("_SrcOffsetAndLimit"); public static readonly int _SrcScaleBias = Shader.PropertyToID("_SrcScaleBias"); public static readonly int _SrcUvLimits = Shader.PropertyToID("_SrcUvLimits"); public static readonly int _DstOffset = Shader.PropertyToID("_DstOffset"); public static readonly int _DepthMipChain = Shader.PropertyToID("_DepthMipChain"); public static readonly int _VBufferDensity = Shader.PropertyToID("_VBufferDensity"); public static readonly int _VBufferLighting = Shader.PropertyToID("_VBufferLighting"); public static readonly int _VBufferHistory = Shader.PropertyToID("_VBufferHistory"); public static readonly int _VBufferFeedback = Shader.PropertyToID("_VBufferFeedback"); public static readonly int _VolumeBounds = Shader.PropertyToID("_VolumeBounds"); public static readonly int _VolumeData = Shader.PropertyToID("_VolumeData"); public static readonly int _VolumeMaskAtlas = Shader.PropertyToID("_VolumeMaskAtlas"); public static readonly int _MaxZMaskTexture = Shader.PropertyToID("_MaxZMaskTexture"); public static readonly int _DilationWidth = Shader.PropertyToID("_DilationWidth"); public static readonly int _GroundIrradianceTexture = Shader.PropertyToID("_GroundIrradianceTexture"); public static readonly int _GroundIrradianceTable = Shader.PropertyToID("_GroundIrradianceTable"); public static readonly int _GroundIrradianceTableOrder = Shader.PropertyToID("_GroundIrradianceTableOrder"); public static readonly int _AirSingleScatteringTexture = Shader.PropertyToID("_AirSingleScatteringTexture"); public static readonly int _AirSingleScatteringTable = Shader.PropertyToID("_AirSingleScatteringTable"); public static readonly int _AerosolSingleScatteringTexture = Shader.PropertyToID("_AerosolSingleScatteringTexture"); public static readonly int _AerosolSingleScatteringTable = Shader.PropertyToID("_AerosolSingleScatteringTable"); public static readonly int _MultipleScatteringTexture = Shader.PropertyToID("_MultipleScatteringTexture"); public static readonly int _MultipleScatteringTable = Shader.PropertyToID("_MultipleScatteringTable"); public static readonly int _MultipleScatteringTableOrder = Shader.PropertyToID("_MultipleScatteringTableOrder"); public static readonly int _PlanetaryRadius = Shader.PropertyToID("_PlanetaryRadius"); public static readonly int _RcpPlanetaryRadius = Shader.PropertyToID("_RcpPlanetaryRadius"); public static readonly int _AtmosphericDepth = Shader.PropertyToID("_AtmosphericDepth"); public static readonly int _RcpAtmosphericDepth = Shader.PropertyToID("_RcpAtmosphericDepth"); public static readonly int _AtmosphericRadius = Shader.PropertyToID("_AtmosphericRadius"); public static readonly int _AerosolAnisotropy = Shader.PropertyToID("_AerosolAnisotropy"); public static readonly int _AerosolPhasePartConstant = Shader.PropertyToID("_AerosolPhasePartConstant"); public static readonly int _AirDensityFalloff = Shader.PropertyToID("_AirDensityFalloff"); public static readonly int _AirScaleHeight = Shader.PropertyToID("_AirScaleHeight"); public static readonly int _AerosolDensityFalloff = Shader.PropertyToID("_AerosolDensityFalloff"); public static readonly int _AerosolScaleHeight = Shader.PropertyToID("_AerosolScaleHeight"); public static readonly int _AirSeaLevelExtinction = Shader.PropertyToID("_AirSeaLevelExtinction"); public static readonly int _AerosolSeaLevelExtinction = Shader.PropertyToID("_AerosolSeaLevelExtinction"); public static readonly int _AirSeaLevelScattering = Shader.PropertyToID("_AirSeaLevelScattering"); public static readonly int _AerosolSeaLevelScattering = Shader.PropertyToID("_AerosolSeaLevelScattering"); public static readonly int _GroundAlbedo = Shader.PropertyToID("_GroundAlbedo"); public static readonly int _IntensityMultiplier = Shader.PropertyToID("_IntensityMultiplier"); public static readonly int _PlanetCenterPosition = Shader.PropertyToID("_PlanetCenterPosition"); public static readonly int _PlanetRotation = Shader.PropertyToID("_PlanetRotation"); public static readonly int _SpaceRotation = Shader.PropertyToID("_SpaceRotation"); public static readonly int _HasGroundAlbedoTexture = Shader.PropertyToID("_HasGroundAlbedoTexture"); public static readonly int _GroundAlbedoTexture = Shader.PropertyToID("_GroundAlbedoTexture"); public static readonly int _HasGroundEmissionTexture = Shader.PropertyToID("_HasGroundEmissionTexture"); public static readonly int _GroundEmissionTexture = Shader.PropertyToID("_GroundEmissionTexture"); public static readonly int _GroundEmissionMultiplier = Shader.PropertyToID("_GroundEmissionMultiplier"); public static readonly int _HasSpaceEmissionTexture = Shader.PropertyToID("_HasSpaceEmissionTexture"); public static readonly int _SpaceEmissionTexture = Shader.PropertyToID("_SpaceEmissionTexture"); public static readonly int _SpaceEmissionMultiplier = Shader.PropertyToID("_SpaceEmissionMultiplier"); public static readonly int _RenderSunDisk = Shader.PropertyToID("_RenderSunDisk"); public static readonly int _ColorSaturation = Shader.PropertyToID("_ColorSaturation"); public static readonly int _AlphaSaturation = Shader.PropertyToID("_AlphaSaturation"); public static readonly int _AlphaMultiplier = Shader.PropertyToID("_AlphaMultiplier"); public static readonly int _HorizonTint = Shader.PropertyToID("_HorizonTint"); public static readonly int _ZenithTint = Shader.PropertyToID("_ZenithTint"); public static readonly int _HorizonZenithShiftPower = Shader.PropertyToID("_HorizonZenithShiftPower"); public static readonly int _HorizonZenithShiftScale = Shader.PropertyToID("_HorizonZenithShiftScale"); // Raytracing variables public static readonly int _RayTracingLayerMask = Shader.PropertyToID("_RayTracingLayerMask"); public static readonly int _PixelSpreadAngleTangent = Shader.PropertyToID("_PixelSpreadAngleTangent"); public static readonly string _RaytracingAccelerationStructureName = "_RaytracingAccelerationStructure"; // Path tracing variables public static readonly int _PathTracedDoFConstants = Shader.PropertyToID("_PathTracedDoFConstants"); public static readonly int _InvViewportScaleBias = Shader.PropertyToID("_InvViewportScaleBias"); // Light Cluster public static readonly int _LightDatasRT = Shader.PropertyToID("_LightDatasRT"); public static readonly int _EnvLightDatasRT = Shader.PropertyToID("_EnvLightDatasRT"); public static readonly int _RaytracingLightCluster = Shader.PropertyToID("_RaytracingLightCluster"); public static readonly int _RaytracingLightClusterRW = Shader.PropertyToID("_RaytracingLightClusterRW"); // Denoising public static readonly int _HistoryBuffer = Shader.PropertyToID("_HistoryBuffer"); public static readonly int _HistoryBuffer0 = Shader.PropertyToID("_HistoryBuffer0"); public static readonly int _HistoryBuffer1 = Shader.PropertyToID("_HistoryBuffer1"); public static readonly int _ValidationBuffer = Shader.PropertyToID("_ValidationBuffer"); public static readonly int _ValidationBufferRW = Shader.PropertyToID("_ValidationBufferRW"); public static readonly int _HistoryDepthTexture = Shader.PropertyToID("_HistoryDepthTexture"); public static readonly int _HistoryNormalTexture = Shader.PropertyToID("_HistoryNormalTexture"); public static readonly int _RaytracingDenoiseRadius = Shader.PropertyToID("_RaytracingDenoiseRadius"); public static readonly int _DenoiserFilterRadius = Shader.PropertyToID("_DenoiserFilterRadius"); public static readonly int _NormalHistoryCriterion = Shader.PropertyToID("_NormalHistoryCriterion"); public static readonly int _DenoiseInputTexture = Shader.PropertyToID("_DenoiseInputTexture"); public static readonly int _DenoiseOutputTextureRW = Shader.PropertyToID("_DenoiseOutputTextureRW"); public static readonly int _HalfResolutionFilter = Shader.PropertyToID("_HalfResolutionFilter"); public static readonly int _DenoisingHistorySlot = Shader.PropertyToID("_DenoisingHistorySlot"); public static readonly int _HistoryValidity = Shader.PropertyToID("_HistoryValidity"); public static readonly int _ReflectionFilterMapping = Shader.PropertyToID("_ReflectionFilterMapping"); public static readonly int _DenoisingHistorySlice = Shader.PropertyToID("_DenoisingHistorySlice"); public static readonly int _DenoisingHistoryMask = Shader.PropertyToID("_DenoisingHistoryMask"); public static readonly int _DenoisingHistoryMaskSn = Shader.PropertyToID("_DenoisingHistoryMaskSn"); public static readonly int _DenoisingHistoryMaskUn = Shader.PropertyToID("_DenoisingHistoryMaskUn"); public static readonly int _HistoryValidityBuffer = Shader.PropertyToID("_HistoryValidityBuffer"); public static readonly int _ValidityOutputTextureRW = Shader.PropertyToID("_ValidityOutputTextureRW"); public static readonly int _VelocityBuffer = Shader.PropertyToID("_VelocityBuffer"); public static readonly int _ShadowFilterMapping = Shader.PropertyToID("_ShadowFilterMapping"); public static readonly int _DistanceTexture = Shader.PropertyToID("_DistanceTexture"); public static readonly int _JitterFramePeriod = Shader.PropertyToID("_JitterFramePeriod"); public static readonly int _SingleReflectionBounce = Shader.PropertyToID("_SingleReflectionBounce"); // Reflections public static readonly int _ReflectionHistorybufferRW = Shader.PropertyToID("_ReflectionHistorybufferRW"); public static readonly int _CurrentFrameTexture = Shader.PropertyToID("_CurrentFrameTexture"); public static readonly int _AccumulatedFrameTexture = Shader.PropertyToID("_AccumulatedFrameTexture"); public static readonly int _TemporalAccumuationWeight = Shader.PropertyToID("_TemporalAccumuationWeight"); public static readonly int _SpatialFilterRadius = Shader.PropertyToID("_SpatialFilterRadius"); public static readonly int _RaytracingHitDistanceTexture = Shader.PropertyToID("_RaytracingHitDistanceTexture"); public static readonly int _RaytracingVSNormalTexture = Shader.PropertyToID("_RaytracingVSNormalTexture"); public static readonly int _RaytracingReflectionTexture = Shader.PropertyToID("_RaytracingReflectionTexture"); // Shadows public static readonly int _RaytracingTargetAreaLight = Shader.PropertyToID("_RaytracingTargetAreaLight"); public static readonly int _RaytracingShadowSlot = Shader.PropertyToID("_RaytracingShadowSlot"); public static readonly int _RaytracingChannelMask = Shader.PropertyToID("_RaytracingChannelMask"); public static readonly int _RaytracingChannelMask0 = Shader.PropertyToID("_RaytracingChannelMask0"); public static readonly int _RaytracingChannelMask1 = Shader.PropertyToID("_RaytracingChannelMask1"); public static readonly int _RaytracingAreaWorldToLocal = Shader.PropertyToID("_RaytracingAreaWorldToLocal"); public static readonly int _RaytracedAreaShadowSample = Shader.PropertyToID("_RaytracedAreaShadowSample"); public static readonly int _RaytracedAreaShadowIntegration = Shader.PropertyToID("_RaytracedAreaShadowIntegration"); public static readonly int _RaytracingDirectionBuffer = Shader.PropertyToID("_RaytracingDirectionBuffer"); public static readonly int _RayTracingLengthBuffer = Shader.PropertyToID("_RayTracingLengthBuffer"); public static readonly int _RaytracingDistanceBufferRW = Shader.PropertyToID("_RaytracingDistanceBufferRW"); public static readonly int _RaytracingDistanceBuffer = Shader.PropertyToID("_RaytracingDistanceBuffer"); public static readonly int _AreaShadowTexture = Shader.PropertyToID("_AreaShadowTexture"); public static readonly int _AreaShadowTextureRW = Shader.PropertyToID("_AreaShadowTextureRW"); public static readonly int _ScreenSpaceShadowsTextureRW = Shader.PropertyToID("_ScreenSpaceShadowsTextureRW"); public static readonly int _AreaShadowHistory = Shader.PropertyToID("_AreaShadowHistory"); public static readonly int _AreaShadowHistoryRW = Shader.PropertyToID("_AreaShadowHistoryRW"); public static readonly int _AnalyticProbBuffer = Shader.PropertyToID("_AnalyticProbBuffer"); public static readonly int _AnalyticHistoryBuffer = Shader.PropertyToID("_AnalyticHistoryBuffer"); public static readonly int _RaytracingLightRadius = Shader.PropertyToID("_RaytracingLightRadius"); public static readonly int _RaytracingSpotAngle = Shader.PropertyToID("_RaytracingSpotAngle"); public static readonly int _RaytracedShadowIntegration = Shader.PropertyToID("_RaytracedShadowIntegration"); public static readonly int _RaytracedColorShadowIntegration = Shader.PropertyToID("_RaytracedColorShadowIntegration"); public static readonly int _DirectionalLightAngle = Shader.PropertyToID("_DirectionalLightAngle"); public static readonly int _DirectionalMaxRayLength = Shader.PropertyToID("_DirectionalMaxRayLength"); public static readonly int _DirectionalLightDirection = Shader.PropertyToID("_DirectionalLightDirection"); public static readonly int _SphereLightPosition = Shader.PropertyToID("_SphereLightPosition"); public static readonly int _SphereLightRadius = Shader.PropertyToID("_SphereLightRadius"); public static readonly int _CameraFOV = Shader.PropertyToID("_CameraFOV"); // Ambient occlusion public static readonly int _RaytracingAOIntensity = Shader.PropertyToID("_RaytracingAOIntensity"); // Ray count public static readonly int _RayCountTexture = Shader.PropertyToID("_RayCountTexture"); public static readonly int _RayCountType = Shader.PropertyToID("_RayCountType"); public static readonly int _InputRayCountTexture = Shader.PropertyToID("_InputRayCountTexture"); public static readonly int _InputRayCountBuffer = Shader.PropertyToID("_InputRayCountBuffer"); public static readonly int _OutputRayCountBuffer = Shader.PropertyToID("_OutputRayCountBuffer"); public static readonly int _InputBufferDimension = Shader.PropertyToID("_InputBufferDimension"); public static readonly int _OutputBufferDimension = Shader.PropertyToID("_OutputBufferDimension"); // Primary Visibility public static readonly int _RaytracingFlagMask = Shader.PropertyToID("_RaytracingFlagMask"); public static readonly int _RaytracingPrimaryDebug = Shader.PropertyToID("_RaytracingPrimaryDebug"); public static readonly int _RaytracingCameraSkyEnabled = Shader.PropertyToID("_RaytracingCameraSkyEnabled"); public static readonly int _RaytracingCameraClearColor = Shader.PropertyToID("_RaytracingCameraClearColor"); // Indirect diffuse public static readonly int _IndirectDiffuseTexture = Shader.PropertyToID("_IndirectDiffuseTexture"); public static readonly int _IndirectDiffuseTextureRW = Shader.PropertyToID("_IndirectDiffuseTextureRW"); public static readonly int _IndirectDiffuseTexture0RW = Shader.PropertyToID("_IndirectDiffuseTexture0RW"); public static readonly int _IndirectDiffuseTexture1RW = Shader.PropertyToID("_IndirectDiffuseTexture1RW"); public static readonly int _IndirectDiffuseTexture0 = Shader.PropertyToID("_IndirectDiffuseTexture0"); public static readonly int _IndirectDiffuseTexture1 = Shader.PropertyToID("_IndirectDiffuseTexture1"); public static readonly int _UpscaledIndirectDiffuseTextureRW = Shader.PropertyToID("_UpscaledIndirectDiffuseTextureRW"); public static readonly int _IndirectDiffuseHitPointTexture = Shader.PropertyToID("_IndirectDiffuseHitPointTexture"); public static readonly int _IndirectDiffuseHitPointTextureRW = Shader.PropertyToID("_IndirectDiffuseHitPointTextureRW"); public static readonly int _IndirectDiffuseThicknessScale = Shader.PropertyToID("_IndirectDiffuseThicknessScale"); public static readonly int _IndirectDiffuseThicknessBias = Shader.PropertyToID("_IndirectDiffuseThicknessBias"); public static readonly int _IndirectDiffuseSteps = Shader.PropertyToID("_IndirectDiffuseSteps"); public static readonly int _InputNoisyBuffer = Shader.PropertyToID("_InputNoisyBuffer"); public static readonly int _InputNoisyBuffer0 = Shader.PropertyToID("_InputNoisyBuffer0"); public static readonly int _InputNoisyBuffer1 = Shader.PropertyToID("_InputNoisyBuffer1"); public static readonly int _OutputFilteredBuffer = Shader.PropertyToID("_OutputFilteredBuffer"); public static readonly int _OutputFilteredBuffer0 = Shader.PropertyToID("_OutputFilteredBuffer0"); public static readonly int _OutputFilteredBuffer1 = Shader.PropertyToID("_OutputFilteredBuffer1"); public static readonly int _LowResolutionTexture = Shader.PropertyToID("_LowResolutionTexture"); public static readonly int _OutputUpscaledTexture = Shader.PropertyToID("_OutputUpscaledTexture"); public static readonly int _IndirectDiffuseSpatialFilter = Shader.PropertyToID("_IndirectDiffuseSpatialFilter"); // Deferred Lighting public static readonly int _RaytracingLitBufferRW = Shader.PropertyToID("_RaytracingLitBufferRW"); public static readonly int _RayTracingDiffuseLightingOnly = Shader.PropertyToID("_RayTracingDiffuseLightingOnly"); // Ray binning public static readonly int _RayBinResult = Shader.PropertyToID("_RayBinResult"); public static readonly int _RayBinSizeResult = Shader.PropertyToID("_RayBinSizeResult"); public static readonly int _RayBinTileCountX = Shader.PropertyToID("_RayBinTileCountX"); public static readonly int _BufferSizeX = Shader.PropertyToID("_BufferSizeX"); // Sub Surface public static readonly int _ThroughputTextureRW = Shader.PropertyToID("_ThroughputTextureRW"); public static readonly int _NormalTextureRW = Shader.PropertyToID("_NormalTextureRW"); public static readonly int _DirectionTextureRW = Shader.PropertyToID("_DirectionTextureRW"); public static readonly int _PositionTextureRW = Shader.PropertyToID("_PositionTextureRW"); public static readonly int _DiffuseLightingTextureRW = Shader.PropertyToID("_DiffuseLightingTextureRW"); public static readonly int _SubSurfaceLightingBuffer = Shader.PropertyToID("_SubSurfaceLightingBuffer"); public static readonly int _IndirectDiffuseLightingBuffer = Shader.PropertyToID("_IndirectDiffuseLightingBuffer"); // Accumulation public static readonly int _AccumulationFrameIndex = Shader.PropertyToID("_AccumulationFrameIndex"); public static readonly int _AccumulationNumSamples = Shader.PropertyToID("_AccumulationNumSamples"); public static readonly int _AccumulationWeights = Shader.PropertyToID("_AccumulationWeights"); public static readonly int _AccumulationNeedsExposure = Shader.PropertyToID("_AccumulationNeedsExposure"); public static readonly int _RadianceTexture = Shader.PropertyToID("_RadianceTexture"); // Preintegrated texture name public static readonly int _PreIntegratedFGD_GGXDisneyDiffuse = Shader.PropertyToID("_PreIntegratedFGD_GGXDisneyDiffuse"); public static readonly int _PreIntegratedFGD_CharlieAndFabric = Shader.PropertyToID("_PreIntegratedFGD_CharlieAndFabric"); public static readonly int _ExposureTexture = Shader.PropertyToID("_ExposureTexture"); public static readonly int _PrevExposureTexture = Shader.PropertyToID("_PrevExposureTexture"); public static readonly int _PreviousExposureTexture = Shader.PropertyToID("_PreviousExposureTexture"); public static readonly int _ExposureDebugTexture = Shader.PropertyToID("_ExposureDebugTexture"); public static readonly int _ExposureParams = Shader.PropertyToID("_ExposureParams"); public static readonly int _ExposureParams2 = Shader.PropertyToID("_ExposureParams2"); public static readonly int _ExposureDebugParams = Shader.PropertyToID("_ExposureDebugParams"); public static readonly int _HistogramExposureParams = Shader.PropertyToID("_HistogramExposureParams"); public static readonly int _HistogramBuffer = Shader.PropertyToID("_HistogramBuffer"); public static readonly int _FullImageHistogram = Shader.PropertyToID("_FullImageHistogram"); public static readonly int _AdaptationParams = Shader.PropertyToID("_AdaptationParams"); public static readonly int _ExposureCurveTexture = Shader.PropertyToID("_ExposureCurveTexture"); public static readonly int _ExposureWeightMask = Shader.PropertyToID("_ExposureWeightMask"); public static readonly int _ProceduralMaskParams = Shader.PropertyToID("_ProceduralMaskParams"); public static readonly int _ProceduralMaskParams2 = Shader.PropertyToID("_ProceduralMaskParams2"); public static readonly int _Variants = Shader.PropertyToID("_Variants"); public static readonly int _InputTexture = Shader.PropertyToID("_InputTexture"); public static readonly int _InputTextureMSAA = Shader.PropertyToID("_InputTextureMSAA"); public static readonly int _OutputTexture = Shader.PropertyToID("_OutputTexture"); public static readonly int _SourceTexture = Shader.PropertyToID("_SourceTexture"); public static readonly int _InputHistoryTexture = Shader.PropertyToID("_InputHistoryTexture"); public static readonly int _OutputHistoryTexture = Shader.PropertyToID("_OutputHistoryTexture"); public static readonly int _InputVelocityMagnitudeHistory = Shader.PropertyToID("_InputVelocityMagnitudeHistory"); public static readonly int _OutputVelocityMagnitudeHistory = Shader.PropertyToID("_OutputVelocityMagnitudeHistory"); public static readonly int _TargetScale = Shader.PropertyToID("_TargetScale"); public static readonly int _Params = Shader.PropertyToID("_Params"); public static readonly int _Params1 = Shader.PropertyToID("_Params1"); public static readonly int _Params2 = Shader.PropertyToID("_Params2"); public static readonly int _BokehKernel = Shader.PropertyToID("_BokehKernel"); public static readonly int _InputCoCTexture = Shader.PropertyToID("_InputCoCTexture"); public static readonly int _InputHistoryCoCTexture = Shader.PropertyToID("_InputHistoryCoCTexture"); public static readonly int _OutputCoCTexture = Shader.PropertyToID("_OutputCoCTexture"); public static readonly int _OutputNearCoCTexture = Shader.PropertyToID("_OutputNearCoCTexture"); public static readonly int _OutputNearTexture = Shader.PropertyToID("_OutputNearTexture"); public static readonly int _OutputFarCoCTexture = Shader.PropertyToID("_OutputFarCoCTexture"); public static readonly int _OutputFarTexture = Shader.PropertyToID("_OutputFarTexture"); public static readonly int _OutputMip1 = Shader.PropertyToID("_OutputMip1"); public static readonly int _OutputMip2 = Shader.PropertyToID("_OutputMip2"); public static readonly int _OutputMip3 = Shader.PropertyToID("_OutputMip3"); public static readonly int _OutputMip4 = Shader.PropertyToID("_OutputMip4"); public static readonly int _OutputMip5 = Shader.PropertyToID("_OutputMip5"); public static readonly int _OutputMip6 = Shader.PropertyToID("_OutputMip6"); public static readonly int _IndirectBuffer = Shader.PropertyToID("_IndirectBuffer"); public static readonly int _InputNearCoCTexture = Shader.PropertyToID("_InputNearCoCTexture"); public static readonly int _NearTileList = Shader.PropertyToID("_NearTileList"); public static readonly int _InputFarTexture = Shader.PropertyToID("_InputFarTexture"); public static readonly int _InputNearTexture = Shader.PropertyToID("_InputNearTexture"); public static readonly int _InputFarCoCTexture = Shader.PropertyToID("_InputFarCoCTexture"); public static readonly int _FarTileList = Shader.PropertyToID("_FarTileList"); public static readonly int _TileList = Shader.PropertyToID("_TileList"); public static readonly int _TexelSize = Shader.PropertyToID("_TexelSize"); public static readonly int _InputDilatedCoCTexture = Shader.PropertyToID("_InputDilatedCoCTexture"); public static readonly int _OutputAlphaTexture = Shader.PropertyToID("_OutputAlphaTexture"); public static readonly int _InputNearAlphaTexture = Shader.PropertyToID("_InputNearAlphaTexture"); public static readonly int _CoCTargetScale = Shader.PropertyToID("_CoCTargetScale"); public static readonly int _BloomParams = Shader.PropertyToID("_BloomParams"); public static readonly int _BloomTint = Shader.PropertyToID("_BloomTint"); public static readonly int _BloomTexture = Shader.PropertyToID("_BloomTexture"); public static readonly int _BloomDirtTexture = Shader.PropertyToID("_BloomDirtTexture"); public static readonly int _BloomDirtScaleOffset = Shader.PropertyToID("_BloomDirtScaleOffset"); public static readonly int _InputLowTexture = Shader.PropertyToID("_InputLowTexture"); public static readonly int _InputHighTexture = Shader.PropertyToID("_InputHighTexture"); public static readonly int _BloomBicubicParams = Shader.PropertyToID("_BloomBicubicParams"); public static readonly int _BloomThreshold = Shader.PropertyToID("_BloomThreshold"); public static readonly int _ChromaSpectralLut = Shader.PropertyToID("_ChromaSpectralLut"); public static readonly int _ChromaParams = Shader.PropertyToID("_ChromaParams"); public static readonly int _AlphaScaleBias = Shader.PropertyToID("_AlphaScaleBias"); public static readonly int _VignetteParams1 = Shader.PropertyToID("_VignetteParams1"); public static readonly int _VignetteParams2 = Shader.PropertyToID("_VignetteParams2"); public static readonly int _VignetteColor = Shader.PropertyToID("_VignetteColor"); public static readonly int _VignetteMask = Shader.PropertyToID("_VignetteMask"); public static readonly int _DistortionParams1 = Shader.PropertyToID("_DistortionParams1"); public static readonly int _DistortionParams2 = Shader.PropertyToID("_DistortionParams2"); public static readonly int _LogLut3D = Shader.PropertyToID("_LogLut3D"); public static readonly int _LogLut3D_Params = Shader.PropertyToID("_LogLut3D_Params"); public static readonly int _ColorBalance = Shader.PropertyToID("_ColorBalance"); public static readonly int _ColorFilter = Shader.PropertyToID("_ColorFilter"); public static readonly int _ChannelMixerRed = Shader.PropertyToID("_ChannelMixerRed"); public static readonly int _ChannelMixerGreen = Shader.PropertyToID("_ChannelMixerGreen"); public static readonly int _ChannelMixerBlue = Shader.PropertyToID("_ChannelMixerBlue"); public static readonly int _HueSatCon = Shader.PropertyToID("_HueSatCon"); public static readonly int _Lift = Shader.PropertyToID("_Lift"); public static readonly int _Gamma = Shader.PropertyToID("_Gamma"); public static readonly int _Gain = Shader.PropertyToID("_Gain"); public static readonly int _Shadows = Shader.PropertyToID("_Shadows"); public static readonly int _Midtones = Shader.PropertyToID("_Midtones"); public static readonly int _Highlights = Shader.PropertyToID("_Highlights"); public static readonly int _ShaHiLimits = Shader.PropertyToID("_ShaHiLimits"); public static readonly int _SplitShadows = Shader.PropertyToID("_SplitShadows"); public static readonly int _SplitHighlights = Shader.PropertyToID("_SplitHighlights"); public static readonly int _CurveMaster = Shader.PropertyToID("_CurveMaster"); public static readonly int _CurveRed = Shader.PropertyToID("_CurveRed"); public static readonly int _CurveGreen = Shader.PropertyToID("_CurveGreen"); public static readonly int _CurveBlue = Shader.PropertyToID("_CurveBlue"); public static readonly int _CurveHueVsHue = Shader.PropertyToID("_CurveHueVsHue"); public static readonly int _CurveHueVsSat = Shader.PropertyToID("_CurveHueVsSat"); public static readonly int _CurveSatVsSat = Shader.PropertyToID("_CurveSatVsSat"); public static readonly int _CurveLumVsSat = Shader.PropertyToID("_CurveLumVsSat"); public static readonly int _CustomToneCurve = Shader.PropertyToID("_CustomToneCurve"); public static readonly int _ToeSegmentA = Shader.PropertyToID("_ToeSegmentA"); public static readonly int _ToeSegmentB = Shader.PropertyToID("_ToeSegmentB"); public static readonly int _MidSegmentA = Shader.PropertyToID("_MidSegmentA"); public static readonly int _MidSegmentB = Shader.PropertyToID("_MidSegmentB"); public static readonly int _ShoSegmentA = Shader.PropertyToID("_ShoSegmentA"); public static readonly int _ShoSegmentB = Shader.PropertyToID("_ShoSegmentB"); public static readonly int _Depth = Shader.PropertyToID("_Depth"); public static readonly int _LinearZ = Shader.PropertyToID("_LinearZ"); public static readonly int _DS2x = Shader.PropertyToID("_DS2x"); public static readonly int _DS4x = Shader.PropertyToID("_DS4x"); public static readonly int _DS8x = Shader.PropertyToID("_DS8x"); public static readonly int _DS16x = Shader.PropertyToID("_DS16x"); public static readonly int _DS2xAtlas = Shader.PropertyToID("_DS2xAtlas"); public static readonly int _DS4xAtlas = Shader.PropertyToID("_DS4xAtlas"); public static readonly int _DS8xAtlas = Shader.PropertyToID("_DS8xAtlas"); public static readonly int _DS16xAtlas = Shader.PropertyToID("_DS16xAtlas"); public static readonly int _InvThicknessTable = Shader.PropertyToID("_InvThicknessTable"); public static readonly int _SampleWeightTable = Shader.PropertyToID("_SampleWeightTable"); public static readonly int _InvSliceDimension = Shader.PropertyToID("_InvSliceDimension"); public static readonly int _AdditionalParams = Shader.PropertyToID("_AdditionalParams"); public static readonly int _Occlusion = Shader.PropertyToID("_Occlusion"); public static readonly int _InvLowResolution = Shader.PropertyToID("_InvLowResolution"); public static readonly int _InvHighResolution = Shader.PropertyToID("_InvHighResolution"); public static readonly int _LoResDB = Shader.PropertyToID("_LoResDB"); public static readonly int _HiResDB = Shader.PropertyToID("_HiResDB"); public static readonly int _LoResAO1 = Shader.PropertyToID("_LoResAO1"); public static readonly int _HiResAO = Shader.PropertyToID("_HiResAO"); public static readonly int _AoResult = Shader.PropertyToID("_AoResult"); public static readonly int _GrainTexture = Shader.PropertyToID("_GrainTexture"); public static readonly int _GrainParams = Shader.PropertyToID("_GrainParams"); public static readonly int _GrainTextureParams = Shader.PropertyToID("_GrainTextureParams"); public static readonly int _BlueNoiseTexture = Shader.PropertyToID("_BlueNoiseTexture"); public static readonly int _AlphaTexture = Shader.PropertyToID("_AlphaTexture"); public static readonly int _OwenScrambledRGTexture = Shader.PropertyToID("_OwenScrambledRGTexture"); public static readonly int _OwenScrambledTexture = Shader.PropertyToID("_OwenScrambledTexture"); public static readonly int _ScramblingTileXSPP = Shader.PropertyToID("_ScramblingTileXSPP"); public static readonly int _RankingTileXSPP = Shader.PropertyToID("_RankingTileXSPP"); public static readonly int _ScramblingTexture = Shader.PropertyToID("_ScramblingTexture"); public static readonly int _AfterPostProcessTexture = Shader.PropertyToID("_AfterPostProcessTexture"); public static readonly int _DitherParams = Shader.PropertyToID("_DitherParams"); public static readonly int _KeepAlpha = Shader.PropertyToID("_KeepAlpha"); public static readonly int _UVTransform = Shader.PropertyToID("_UVTransform"); public static readonly int _MotionVecAndDepth = Shader.PropertyToID("_MotionVecAndDepth"); public static readonly int _TileMinMaxMotionVec = Shader.PropertyToID("_TileMinMaxMotionVec"); public static readonly int _TileMaxNeighbourhood = Shader.PropertyToID("_TileMaxNeighbourhood"); public static readonly int _TileToScatterMax = Shader.PropertyToID("_TileToScatterMax"); public static readonly int _TileToScatterMin = Shader.PropertyToID("_TileToScatterMin"); public static readonly int _TileTargetSize = Shader.PropertyToID("_TileTargetSize"); public static readonly int _MotionBlurParams = Shader.PropertyToID("_MotionBlurParams0"); public static readonly int _MotionBlurParams1 = Shader.PropertyToID("_MotionBlurParams1"); public static readonly int _MotionBlurParams2 = Shader.PropertyToID("_MotionBlurParams2"); public static readonly int _MotionBlurParams3 = Shader.PropertyToID("_MotionBlurParams3"); public static readonly int _PrevVPMatrixNoTranslation = Shader.PropertyToID("_PrevVPMatrixNoTranslation"); public static readonly int _CurrVPMatrixNoTranslation = Shader.PropertyToID("_CurrVPMatrixNoTranslation"); public static readonly int _SMAAAreaTex = Shader.PropertyToID("_AreaTex"); public static readonly int _SMAASearchTex = Shader.PropertyToID("_SearchTex"); public static readonly int _SMAABlendTex = Shader.PropertyToID("_BlendTex"); public static readonly int _SMAARTMetrics = Shader.PropertyToID("_SMAARTMetrics"); public static readonly int _LowResDepthTexture = Shader.PropertyToID("_LowResDepthTexture"); public static readonly int _LowResTransparent = Shader.PropertyToID("_LowResTransparent"); public static readonly int _ShaderVariablesAmbientOcclusion = Shader.PropertyToID("ShaderVariablesAmbientOcclusion"); public static readonly int _OcclusionTexture = Shader.PropertyToID("_OcclusionTexture"); public static readonly int _BentNormalsTexture = Shader.PropertyToID("_BentNormalsTexture"); public static readonly int _AOPackedData = Shader.PropertyToID("_AOPackedData"); public static readonly int _AOPackedHistory = Shader.PropertyToID("_AOPackedHistory"); public static readonly int _AOPackedBlurred = Shader.PropertyToID("_AOPackedBlurred"); public static readonly int _AOOutputHistory = Shader.PropertyToID("_AOOutputHistory"); // Contrast Adaptive Sharpening public static readonly int _Sharpness = Shader.PropertyToID("Sharpness"); public static readonly int _InputTextureDimensions = Shader.PropertyToID("InputTextureDimensions"); public static readonly int _OutputTextureDimensions = Shader.PropertyToID("OutputTextureDimensions"); // BlitCubeTextureFace.shader public static readonly int _InputTex = Shader.PropertyToID("_InputTex"); public static readonly int _LoD = Shader.PropertyToID("_LoD"); public static readonly int _FaceIndex = Shader.PropertyToID("_FaceIndex"); // Custom Pass Utils API public static readonly int _SourceScaleBias = Shader.PropertyToID("_SourceScaleBias"); public static readonly int _GaussianWeights = Shader.PropertyToID("_GaussianWeights"); public static readonly int _SampleCount = Shader.PropertyToID("_SampleCount"); public static readonly int _Radius = Shader.PropertyToID("_Radius"); public static readonly int _ViewPortSize = Shader.PropertyToID("_ViewPortSize"); public static readonly int _ViewportScaleBias = Shader.PropertyToID("_ViewportScaleBias"); public static readonly int _SourceSize = Shader.PropertyToID("_SourceSize"); public static readonly int _SourceScaleFactor = Shader.PropertyToID("_SourceScaleFactor"); // Probe Volumes public static readonly int _ProbeVolumeAtlasSH = Shader.PropertyToID("_ProbeVolumeAtlasSH"); public static readonly int _ProbeVolumeAtlasResolutionAndSliceCount = Shader.PropertyToID("_ProbeVolumeAtlasResolutionAndSliceCount"); public static readonly int _ProbeVolumeAtlasResolutionAndSliceCountInverse = Shader.PropertyToID("_ProbeVolumeAtlasResolutionAndSliceCountInverse"); public static readonly int _ProbeVolumeAtlasOctahedralDepth = Shader.PropertyToID("_ProbeVolumeAtlasOctahedralDepth"); public static readonly int _ProbeVolumeResolution = Shader.PropertyToID("_ProbeVolumeResolution"); public static readonly int _ProbeVolumeResolutionInverse = Shader.PropertyToID("_ProbeVolumeResolutionInverse"); public static readonly int _ProbeVolumeAtlasScale = Shader.PropertyToID("_ProbeVolumeAtlasScale"); public static readonly int _ProbeVolumeAtlasBias = Shader.PropertyToID("_ProbeVolumeAtlasBias"); public static readonly int _ProbeVolumeAtlasReadBufferCount = Shader.PropertyToID("_ProbeVolumeAtlasReadBufferCount"); public static readonly int _ProbeVolumeAtlasReadSHL01Buffer = Shader.PropertyToID("_ProbeVolumeAtlasReadSHL01Buffer"); public static readonly int _ProbeVolumeAtlasReadSHL2Buffer = Shader.PropertyToID("_ProbeVolumeAtlasReadSHL2Buffer"); public static readonly int _ProbeVolumeAtlasReadValidityBuffer = Shader.PropertyToID("_ProbeVolumeAtlasReadValidityBuffer"); public static readonly int _ProbeVolumeAtlasWriteTextureSH = Shader.PropertyToID("_ProbeVolumeAtlasWriteTextureSH"); public static readonly int _ProbeVolumeAtlasOctahedralDepthScaleBias = Shader.PropertyToID("_ProbeVolumeAtlasOctahedralDepthScaleBias"); public static readonly int _ProbeVolumeAtlasOctahedralDepthResolutionAndInverse = Shader.PropertyToID("_ProbeVolumeAtlasOctahedralDepthResolutionAndInverse"); public static readonly int _ProbeVolumeAtlasOctahedralDepthReadBufferCount = Shader.PropertyToID("_ProbeVolumeAtlasOctahedralDepthReadBufferCount"); public static readonly int _ProbeVolumeAtlasOctahedralDepthReadBuffer = Shader.PropertyToID("_ProbeVolumeAtlasOctahedralDepthReadBuffer"); public static readonly int _ProbeVolumeAtlasOctahedralDepthWriteTexture = Shader.PropertyToID("_ProbeVolumeAtlasOctahedralDepthWriteTexture"); public static readonly int _ProbeVolumeAtlasOctahedralDepthScaleBiasTexels = Shader.PropertyToID("_ProbeVolumeAtlasOctahedralDepthScaleBiasTexels"); public static readonly int _ProbeVolumeAtlasOctahedralDepthRWTexture = Shader.PropertyToID("_ProbeVolumeAtlasOctahedralDepthRWTexture"); public static readonly int _FilterSampleCount = Shader.PropertyToID("_FilterSampleCount"); public static readonly int _FilterSharpness = Shader.PropertyToID("_FilterSharpness"); public static readonly int _AtlasTextureSH = Shader.PropertyToID("_AtlasTextureSH"); public static readonly int _TextureViewScale = Shader.PropertyToID("_TextureViewScale"); public static readonly int _TextureViewBias = Shader.PropertyToID("_TextureViewBias"); public static readonly int _TextureViewResolution = Shader.PropertyToID("_TextureViewResolution"); public static readonly int _AtlasTextureOctahedralDepth = Shader.PropertyToID("_AtlasTextureOctahedralDepth"); public static readonly int _AtlasTextureOctahedralDepthScaleBias = Shader.PropertyToID("_AtlasTextureOctahedralDepthScaleBias"); public static readonly int _ValidRange = Shader.PropertyToID("_ValidRange"); public static readonly int _ProbeVolumeAtlasSliceMode = Shader.PropertyToID("_ProbeVolumeAtlasSliceMode"); } // Shared material property names static class HDMaterialProperties { // Stencil properties public const string kStencilRef = "_StencilRef"; public const string kStencilWriteMask = "_StencilWriteMask"; public const string kStencilRefDepth = "_StencilRefDepth"; public const string kStencilWriteMaskDepth = "_StencilWriteMaskDepth"; public const string kStencilRefGBuffer = "_StencilRefGBuffer"; public const string kStencilWriteMaskGBuffer = "_StencilWriteMaskGBuffer"; public const string kStencilRefMV = "_StencilRefMV"; public const string kStencilWriteMaskMV = "_StencilWriteMaskMV"; public const string kStencilRefDistortionVec = "_StencilRefDistortionVec"; public const string kStencilWriteMaskDistortionVec = "_StencilWriteMaskDistortionVec"; public const string kUseSplitLighting = "_RequireSplitLighting"; public const string kZWrite = "_ZWrite"; public const string kTransparentZWrite = "_TransparentZWrite"; public const string kTransparentCullMode = "_TransparentCullMode"; public const string kOpaqueCullMode = "_OpaqueCullMode"; public const string kZTestTransparent = "_ZTestTransparent"; public const string kRayTracing = "_RayTracing"; public const string kEmissiveColorMap = "_EmissiveColorMap"; public const string kSurfaceType = "_SurfaceType"; public const string kMaterialID = "_MaterialID"; public const string kTransmissionEnable = "_TransmissionEnable"; public const string kEnableDecals = "_SupportDecals"; public const string kSupportDecals = kEnableDecals; public const string kDecalLayerMaskFromDecal = "_DecalLayerMaskFromDecal"; public const string kEnableSSR = "_ReceivesSSR"; public const string kLayerCount = "_LayerCount"; public const string kAlphaCutoffEnabled = "_AlphaCutoffEnable"; public const string kZTestGBuffer = "_ZTestGBuffer"; public const string kZTestDepthEqualForOpaque = "_ZTestDepthEqualForOpaque"; public const string kBlendMode = "_BlendMode"; public const string kAlphaToMask = "_AlphaToMask"; public const string kAlphaToMaskInspector = "_AlphaToMaskInspectorValue"; public const string kEnableFogOnTransparent = "_EnableFogOnTransparent"; public const string kDistortionDepthTest = "_DistortionDepthTest"; public const string kDistortionEnable = "_DistortionEnable"; public const string kZTestModeDistortion = "_ZTestModeDistortion"; public const string kDistortionBlendMode = "_DistortionBlendMode"; public const string kTransparentWritingMotionVec = "_TransparentWritingMotionVec"; public const string kEnableBlendModePreserveSpecularLighting = "_EnableBlendModePreserveSpecularLighting"; public const string kEmissionColor = "_EmissionColor"; public const string kTransparentBackfaceEnable = "_TransparentBackfaceEnable"; public const string kDoubleSidedEnable = "_DoubleSidedEnable"; public const string kDoubleSidedNormalMode = "_DoubleSidedNormalMode"; public const string kDistortionOnly = "_DistortionOnly"; public const string kTransparentDepthPrepassEnable = "_TransparentDepthPrepassEnable"; public const string kTransparentDepthPostpassEnable = "_TransparentDepthPostpassEnable"; public const string kTransparentSortPriority = "_TransparentSortPriority"; public const int kMaxLayerCount = 4; public const string kUVBase = "_UVBase"; public const string kTexWorldScale = "_TexWorldScale"; public const string kUVMappingMask = "_UVMappingMask"; public const string kUVDetail = "_UVDetail"; public const string kUVDetailsMappingMask = "_UVDetailsMappingMask"; public const string kReceivesSSR = "_ReceivesSSR"; public const string kReceivesSSRTransparent = "_ReceivesSSRTransparent"; public const string kAddPrecomputedVelocity = "_AddPrecomputedVelocity"; public const string kShadowMatteFilter = "_ShadowMatteFilter"; public const string kDepthOffsetEnable = "_DepthOffsetEnable"; public const string kDisplacementMode = "_DisplacementMode"; public static readonly Color[] kLayerColors = { Color.white, Color.red, Color.green, Color.blue }; public static readonly string kAffectAlbedo = "_AffectAlbedo"; public static readonly string kAffectNormal = "_AffectNormal"; public static readonly string kAffectAO = "_AffectAO"; public static readonly string kAffectMetal = "_AffectMetal"; public static readonly string kAffectSmoothness = "_AffectSmoothness"; public static readonly string kAffectEmission = "_AffectEmission"; public static readonly string kDecalColorMask0 = "_DecalColorMask0"; public static readonly string kDecalColorMask1 = "_DecalColorMask1"; public static readonly string kDecalColorMask2 = "_DecalColorMask2"; public static readonly string kDecalColorMask3 = "_DecalColorMask3"; public static readonly string kDecalStencilWriteMask = "_DecalStencilWriteMask"; public static readonly string kDecalStencilRef = "_DecalStencilRef"; public static readonly string kRefractionModel = "_RefractionModel"; } }
85.097466
178
0.719127
[ "MIT" ]
Acromatic/HDRP-Unity-Template-GitHub-Template
Library/PackageCache/com.unity.render-pipelines.high-definition@10.2.2/Runtime/RenderPipeline/HDStringConstants.cs
87,310
C#
using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using DFC.ServiceTaxonomy.Banners.Indexes; using Microsoft.Extensions.Localization; using YesSql; namespace DFC.ServiceTaxonomy.Banners.Models { public static class BannerPartExtensions { public static async IAsyncEnumerable<ValidationResult> ValidateAsync(this BannerPart part, IStringLocalizer S, ISession session) { if (string.IsNullOrWhiteSpace(part.WebPageName)) { yield return new ValidationResult(S["A value is required for Webpage name field."]); } if (string.IsNullOrWhiteSpace(part.WebPageURL)) { yield return new ValidationResult(S["A value is required for webpage location."]); } var matches = await session.QueryIndex<BannerPartIndex>(b => b.WebPageName == part.WebPageName && b.ContentItemId != part.ContentItem.ContentItemId).CountAsync(); if(matches > 0) { yield return new ValidationResult(S["The Webpage name '{0}' is already in use on another page banner.", part.WebPageName]); } matches = await session.QueryIndex<BannerPartIndex>(b => b.WebPageURL == part.WebPageURL && b.ContentItemId != part.ContentItem.ContentItemId).CountAsync(); if (matches > 0) { yield return new ValidationResult(S["The webpage location '{0}' is already in use on another page banner.", part.WebPageURL]); } } } }
39.219512
142
0.630597
[ "MIT" ]
SkillsFundingAgency/dfc-servicetaxonomy-editor
DFC.ServiceTaxonomy.Banners/Models/BannerPartExtensions.cs
1,610
C#
namespace ReportingServerManager.Logic.Shared { public class Datasource { public string Name { get; set; } public string ConnectionString { get; set; } public CredentialRetrievalTypes CredentialRetrievalType { get; set; } public bool UsePromptedCredentialsAsWindowsCredentials { get; set; } public string Prompt { get; set; } public string Username { get; set; } public string Password { get; set; } public string Extension { get; set; } public bool Enabled { get; set; } public bool UseStoredCredentialsAsWindowsCredentials { get; set; } public bool SetExecutionContext { get; set; } } }
40.470588
77
0.65843
[ "MIT" ]
Expecho/ReportServer-Manager2
src/Logic/Shared/Datasource.cs
688
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("02ConcatenateTextFiles")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("02ConcatenateTextFiles")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("74065258-0431-44e1-bcc0-a183c5ac2ffc")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
38.297297
84
0.748765
[ "MIT" ]
ReniGetskova/CSharp-Part-2
TextFiles/02ConcatenateTextFiles/Properties/AssemblyInfo.cs
1,420
C#
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; namespace WhoGoesThere.Models.AccountViewModels { public class VerifyCodeViewModel { [Required] public string Provider { get; set; } [Required] public string Code { get; set; } public string ReturnUrl { get; set; } [Display(Name = "Remember this browser?")] public bool RememberBrowser { get; set; } [Display(Name = "Remember me?")] public bool RememberMe { get; set; } } }
23.307692
50
0.648515
[ "MIT" ]
metalmynds/friendorfoe
WhoGoesThere/Models/AccountViewModels/VerifyCodeViewModel.cs
608
C#
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; namespace IupMetadata { public static class MetadataExtractor { #region Fields private const int BUFFER_SIZE = 4096; #endregion Fields #region Constructor static MetadataExtractor() { _ = Interop.IupOpen(IntPtr.Zero, IntPtr.Zero); } #endregion Constructor #region Methods #region Documentation /// <summary> /// Extracts all classes, attributes and callbacks registered in IUP /// </summary> #endregion Documentation public static IupClass[] GetClasses(string docsPath) { var result = new List<IupClass>(); var classnames = new IntPtr[BUFFER_SIZE]; var ret = Interop.IupGetAllClasses(classnames, BUFFER_SIZE); for (int i = 0; i < ret; i++) { var classname = classnames[i]; var iupClass = Marshal.PtrToStructure<Interop.IClass>(Interop.iupRegisterFindClass(classname)); var item = new IupClass(); item.ClassName = iupClass.name; item.Name = UpperCaseConverter.ToTitleCase(iupClass.name); #region Comments // IUP childtype means 0=None, 1=Many, Many+N = N Children // Translating to simpler 0=None, -1=Many, Other value = quantity #endregion Comments item.ChildrenCount = iupClass.childtype switch { 0 => 0, 1 => -1, _ => iupClass.childtype - 1 }; if (iupClass.parent != IntPtr.Zero) { var parentIclass = Marshal.PtrToStructure<Interop.IClass>(iupClass.parent); item.ParentClassName = parentIclass.name; } item.NativeType = (NativeType)iupClass.nativetype; item.NumberedAttributes = (NumberedAttribute)iupClass.has_attrib_id; item.IsInteractive = iupClass.is_interactive == 1; item.Attributes = GetAttributes(classname, iupClass); item.Callbacks = GetCallbacks(classname, iupClass); DocEnricher.Enrich(docsPath, item); KnownAttributes.Enrich(item); if (item.Attributes.Any(x => x.DataType == DataType.Void && !x.WriteOnly)) throw new InvalidOperationException("Cannot read \"void\" atributes"); result.Add(item); } return result.ToArray(); } private static IupAttribute[] GetAttributes(IntPtr classname, Interop.IClass iupClass) { var attributes = new List<IupAttribute>(); var attrs = new IntPtr[BUFFER_SIZE]; var count = Interop.IupGetClassAttributes(classname, attrs, BUFFER_SIZE); for (int i = 0; i < count; i++) { var name = Marshal.PtrToStringAnsi(attrs[i]); var attrHandle = Interop.iupTableGet(iupClass.attrib_func, name); var attrData = Marshal.PtrToStructure<Interop.IAttribFunc>(attrHandle); var flags = (Interop.IAttribFlags)attrData.flags; var isNoString = flags.HasFlag(Interop.IAttribFlags.IUPAF_NO_STRING); var numberedAttributeType = flags.HasFlag(Interop.IAttribFlags.IUPAF_HAS_ID) ? NumberedAttribute.OneID : flags.HasFlag(Interop.IAttribFlags.IUPAF_HAS_ID2) ? NumberedAttribute.TwoIDs : NumberedAttribute.No; var attribute = new IupAttribute { AttributeName = name, Name = UpperCaseConverter.ToTitleCase(name), WriteOnly = flags.HasFlag(Interop.IAttribFlags.IUPAF_WRITEONLY), ReadOnly = flags.HasFlag(Interop.IAttribFlags.IUPAF_READONLY), Default = attrData.default_value, DataType = isNoString ? DataType.Unknown : DataType.String, NumberedAttribute = numberedAttributeType, }; attributes.Add(attribute); } return attributes.ToArray(); } private static IupCallback[] GetCallbacks(IntPtr classname, Interop.IClass iupClass) { var callbacks = new List<IupCallback>(); var attrs = new IntPtr[BUFFER_SIZE]; var count = Interop.IupGetClassCallbacks(classname, attrs, BUFFER_SIZE); for (int i = 0; i < count; i++) { var name = Marshal.PtrToStringAnsi(attrs[i]); var attrHandle = Interop.iupTableGet(iupClass.attrib_func, name); var attrData = Marshal.PtrToStructure<Interop.IAttribFunc>(attrHandle); var isCallback = ((Interop.IAttribFlags)attrData.flags).HasFlag(Interop.IAttribFlags.IUPAF_CALLBACK); if (!isCallback) return null; var format = attrData.default_value; var (arguments, returnType) = DecodeFormat(format); var callback = new IupCallback { AttributeName = name, Name = UpperCaseConverter.ToTitleCase(name.Replace("_CB", "")), Arguments = arguments, ReturnType = returnType }; callbacks.Add(callback); } return callbacks.ToArray(); } public static (DataType[], DataType) DecodeFormat(string format) { DataType getType(char c) { return c switch { 'n' => DataType.Handle, 'i' => DataType.Int, 'I' => DataType.RefInt, 's' => DataType.String, 'd' => DataType.Double, 'f' => DataType.Float, 'v' or 'V' => DataType.VoidPtr, 'c' => DataType.Char, 'C' => DataType.Canvas, _ => throw new NotImplementedException($"Element {c} not recognized on format {format}"), }; } var parts = format.Split('='); var args = parts[0].Select(c => getType(c)).ToArray(); var returnType = parts.Length > 1 ? getType(parts[1][0]) : DataType.Void; return (args, returnType); } #endregion Methods } }
27.666667
149
0.690572
[ "Unlicense" ]
batiati/IUPMetadata
src/IupMetadata/MetadataExtractor.cs
5,231
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.AzureNative.EventGrid.V20190101.Outputs { [OutputType] public sealed class StorageBlobDeadLetterDestinationResponse { /// <summary> /// The name of the Storage blob container that is the destination of the deadletter events /// </summary> public readonly string? BlobContainerName; /// <summary> /// Type of the endpoint for the dead letter destination /// Expected value is 'StorageBlob'. /// </summary> public readonly string EndpointType; /// <summary> /// The Azure Resource ID of the storage account that is the destination of the deadletter events. For example: /subscriptions/{AzureSubscriptionId}/resourceGroups/{ResourceGroupName}/providers/microsoft.Storage/storageAccounts/{StorageAccountName} /// </summary> public readonly string? ResourceId; [OutputConstructor] private StorageBlobDeadLetterDestinationResponse( string? blobContainerName, string endpointType, string? resourceId) { BlobContainerName = blobContainerName; EndpointType = endpointType; ResourceId = resourceId; } } }
34.977273
256
0.672515
[ "Apache-2.0" ]
pulumi-bot/pulumi-azure-native
sdk/dotnet/EventGrid/V20190101/Outputs/StorageBlobDeadLetterDestinationResponse.cs
1,539
C#
using ExitGames.Client.Photon; namespace Photon.Enums { /// <summary> /// Summarizes the cause for a disconnect. Used in: OnConnectionFail and OnFailedToConnectToPhoton. /// </summary> /// <remarks>Extracted from the status codes from ExitGames.Client.Photon.StatusCode.</remarks> /// <seealso cref="PhotonNetworkingMessage"/> /// \ingroup publicApi public enum DisconnectCause { /// <summary>Server actively disconnected this client. /// Possible cause: The server's user limit was hit and client was forced to disconnect (on connect).</summary> DisconnectByServerUserLimit = StatusCode.DisconnectByServerUserLimit, /// <summary>Connection could not be established. /// Possible cause: Local server not running.</summary> ExceptionOnConnect = StatusCode.ExceptionOnConnect, /// <summary>Timeout disconnect by server (which decided an ACK was missing for too long).</summary> DisconnectByServerTimeout = StatusCode.DisconnectByServer, /// <summary>Server actively disconnected this client. /// Possible cause: Server's send buffer full (too much data for client).</summary> DisconnectByServerLogic = StatusCode.DisconnectByServerLogic, /// <summary>Some exception caused the connection to close.</summary> Exception = StatusCode.Exception, /// <summary>(32767) The Photon Cloud rejected the sent AppId. Check your Dashboard and make sure the AppId you use is complete and correct.</summary> InvalidAuthentication = ErrorCode.InvalidAuthentication, /// <summary>(32757) Authorization on the Photon Cloud failed because the concurrent users (CCU) limit of the app's subscription is reached.</summary> MaxCcuReached = ErrorCode.MaxCcuReached, /// <summary>(32756) Authorization on the Photon Cloud failed because the app's subscription does not allow to use a particular region's server.</summary> InvalidRegion = ErrorCode.InvalidRegion, /// <summary>The security settings for client or server don't allow a connection (see remarks).</summary> /// <remarks> /// A common cause for this is that browser clients read a "crossdomain" file from the server. /// If that file is unavailable or not configured to let the client connect, this exception is thrown. /// Photon usually provides this crossdomain file for Unity. /// If it fails, read: /// https://doc.photonengine.com/en-us/onpremise/current/operations/policy-files /// </remarks> SecurityExceptionOnConnect = StatusCode.SecurityExceptionOnConnect, /// <summary>Timeout disconnect by client (which decided an ACK was missing for too long).</summary> DisconnectByClientTimeout = StatusCode.TimeoutDisconnect, /// <summary>Exception in the receive-loop. /// Possible cause: Socket failure.</summary> InternalReceiveException = StatusCode.ExceptionOnReceive, /// <summary>(32753) The Authentication ticket expired. Handle this by connecting again (which includes an authenticate to get a fresh ticket).</summary> AuthenticationTicketExpired = 32753, } }
52.854839
162
0.696979
[ "Apache-2.0" ]
ITALIA195/Shelter
Shelter/Photon/Enums/DisconnectCause.cs
3,277
C#
#pragma checksum "/home/azureuser/myWebApp/Views/Shared/_ValidationScriptsPartial.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "30279cff2f43496f15dedc2efbbd2c0b0d6727e3" // <auto-generated/> #pragma warning disable 1591 [assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.Views_Shared__ValidationScriptsPartial), @"mvc.1.0.view", @"/Views/Shared/_ValidationScriptsPartial.cshtml")] namespace AspNetCore { #line hidden using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore #line 1 "/home/azureuser/myWebApp/Views/_ViewImports.cshtml" using myWebApp; #line default #line hidden #nullable disable #nullable restore #line 2 "/home/azureuser/myWebApp/Views/_ViewImports.cshtml" using myWebApp.Models; #line default #line hidden #nullable disable [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"30279cff2f43496f15dedc2efbbd2c0b0d6727e3", @"/Views/Shared/_ValidationScriptsPartial.cshtml")] [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"79c56adf42a17891524f77e501a492e0988687ef", @"/Views/_ViewImports.cshtml")] public class Views_Shared__ValidationScriptsPartial : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic> { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("src", new global::Microsoft.AspNetCore.Html.HtmlString("~/lib/jquery-validation/dist/jquery.validate.min.js"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("src", new global::Microsoft.AspNetCore.Html.HtmlString("~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden #pragma warning disable 0649 private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext; #pragma warning restore 0649 private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); #pragma warning disable 0169 private string __tagHelperStringValueBuffer; #pragma warning restore 0169 private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager { get { if (__backed__tagHelperScopeManager == null) { __backed__tagHelperScopeManager = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); } return __backed__tagHelperScopeManager; } } private global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper; #pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "30279cff2f43496f15dedc2efbbd2c0b0d6727e33810", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "30279cff2f43496f15dedc2efbbd2c0b0d6727e34835", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); } #pragma warning restore 1998 [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; } } } #pragma warning restore 1591
66.54902
406
0.759576
[ "MIT" ]
osygroup/ASP.NET_Core-Elastic_APM-Docker
obj/Debug/net5.0/Razor/Views/Shared/_ValidationScriptsPartial.cshtml.g.cs
6,788
C#
using Microsoft.Owin; using Owin; [assembly: OwinStartupAttribute(typeof(FuzzyRiskNet.Startup))] namespace FuzzyRiskNet { public partial class Startup { public void Configuration(IAppBuilder app) { ConfigureAuth(app); } } }
18.266667
62
0.653285
[ "Apache-2.0" ]
DobrilaPetrovic/FuzzyRiskWeb
src/FuzzyRiskNet.Web/Startup.cs
276
C#
using CSharpSpeed; using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; namespace InstrumentedLibrary { /// <summary> /// /// </summary> //[DisplayName("Truncate Matrix.")] //[Description("Truncates a Matrix.")] //[SourceCodeLocationProvider] public static class JaggedTruncateMatrixTests { /// <summary> /// Truncates the specified matrix. /// </summary> /// <param name="matrix">The matrix.</param> /// <param name="rowStart">The row start.</param> /// <param name="rowEnd">The row end.</param> /// <param name="columnStart">The column start.</param> /// <param name="columnEnd">The column end.</param> /// <returns></returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] [Signature] public static double[][] Truncate(double[][] matrix, int rowStart, int rowEnd, int columnStart, int columnEnd) => Truncate1(matrix, rowStart, rowEnd, columnStart, columnEnd); /// <summary> /// Truncate a matrix /// </summary> /// <param name="matrix">The matrix.</param> /// <param name="rowStart">The row start.</param> /// <param name="rowEnd">The row end.</param> /// <param name="columnStart">The column start.</param> /// <param name="columnEnd">The column end.</param> /// <returns></returns> /// <acknowledgment> /// https://github.com/SarahFrem/AutoRegressive_model_cs/blob/master/Matrix.cs#L100 /// </acknowledgment> //[DisplayName("Truncate Matrix.")] //[Description("Truncates a Matrix.")] //[Acknowledgment("https://github.com/SarahFrem/AutoRegressive_model_cs/blob/master/Matrix.cs#L100")] //[SourceCodeLocationProvider] [DebuggerStepThrough] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static double[][] Truncate1(double[][] matrix, int rowStart, int rowEnd, int columnStart, int columnEnd) { var rows = matrix.Length; var cols = matrix[0].Length; var minimumIndex = rowStart == 0 || rowEnd == 0 || columnStart == 0 || columnEnd == 0; var coherenceIndex = rowEnd < rowStart || columnEnd < columnStart; var boundIndex = rowEnd > rows || columnEnd > cols; if (minimumIndex || coherenceIndex || boundIndex) { return new double[1][] { new double[1] }; } var result = new double[rowEnd - rowStart + 1][]; for (var i = rowStart - 1; i < rowEnd; i++) { result[i] = new double[columnEnd - columnStart + 1]; for (var j = columnStart - 1; j < columnEnd; j++) { result[i - rowStart + 1][j - columnStart + 1] = matrix[i][j]; } } return result; } } }
37.554217
119
0.581007
[ "MIT" ]
Shkyrockett/CSharpSpeed
InstrumentedLibrary/Mathmatics/Matrix/JaggedMatrix/JaggedTruncateMatrixTests.cs
3,119
C#
#region usings using System; using System.ComponentModel.Composition; using System.Collections.Generic; using System.IO; using System.Text; using VVVV.PluginInterfaces.V1; using VVVV.PluginInterfaces.V2; using VVVV.Utils.VColor; using VVVV.Utils.VMath; using VVVV.Core.Logging; #endregion usings namespace VVVV.Nodes { #region PluginInfo [PluginInfo(Name = "STLReader", Category = "Value", Help = "Basic template with one value in/out", Tags = "")] #endregion PluginInfo public class ValueSTLReaderNode : IPluginEvaluate { #region fields & pins [Input("Filename", DefaultValue = 1.0)] public ISpread<string> Fname; [Input("Read", DefaultValue = 0)] public ISpread<bool> FRead; [Input("Index", DefaultValue = 1.0)] public ISpread<int> FIndex; [Input("Apply", DefaultValue = 0)] public ISpread<bool> FApply; [Input("Reset", DefaultValue = 0)] public ISpread<bool> FReset; [Output("Vertex")] public ISpread<double> FVertex; [Output("Normal")] public ISpread<double> FNormal; [Output("Indices")] public ISpread<double> FIndices; [Output("bin size")] public ISpread<int> FBin; [Output("Done")] public ISpread<bool> FDone; [Import()] public ILogger FLogger; #endregion fields & pins Model[] models; // バイナリファイルの判定 public bool IsBinaryFile(string filePath) { FileStream fs = File.OpenRead(filePath); int len = (int)fs.Length; int count = 0; byte[] content = new byte[len]; int size = fs.Read(content, 0, len); for (int i = 0; i < size; i++){ if (content[i] == 0){ count++; if (count == 4){ return true; } } else{ count = 0; } } return false; } // STLファイル読み込み private void readSTL(int num, string name){ // ファイル名からオブジェクト生成 string path = name; string file = Path.GetFileName(path); if(file == ""){ return; } //FLogger.Log(LogType.Debug, file + ": Start Loading"); if(IsBinaryFile(path)){ // バイナリフォーマットの場合 models[num] = new Model(file); using(BinaryReader w = new BinaryReader(File.OpenRead(name))){ // 任意の文字列 byte[] ch = w.ReadBytes(80); // 三角形の枚数 int triNum = (int)w.ReadUInt32(); int count = 0; for (int i = 0; i < triNum; i++) { models[num].normal.Add(w.ReadSingle()); models[num].normal.Add(w.ReadSingle()); models[num].normal.Add(w.ReadSingle()); for (int j = 0; j < 3; j++) { models[num].vertex.Add(w.ReadSingle()); float tf = w.ReadSingle(); models[num].vertex.Add(w.ReadSingle()); models[num].vertex.Add(tf); models[num].indices.Add(count++); } ch = w.ReadBytes(2); } } } else{ // アスキーフォーマットの場合 models[num] = new Model(file); using (StreamReader sr = new StreamReader(name, Encoding.Default)) { string line = ""; int count = 0; while((line = sr.ReadLine()) != null){ if(line.Contains("normal")){ string[] sp = line.Split(' '); models[num].normal.Add(double.Parse(sp[sp.Length-3])); models[num].normal.Add(double.Parse(sp[sp.Length-2])); models[num].normal.Add(double.Parse(sp[sp.Length-1])); } if(line.Contains("vertex")){ string[] sp = line.Split(' '); models[num].vertex.Add(double.Parse(sp[sp.Length-3])); models[num].vertex.Add(double.Parse(sp[sp.Length-1])); models[num].vertex.Add(double.Parse(sp[sp.Length-2])); models[num].indices.Add(count++); } } } //FLogger.Log(LogType.Debug, file + ": Done!"); } } public void outputSTL(int i){ int vc = FVertex.SliceCount; int nc = FNormal.SliceCount; int ic = FIndices.SliceCount; FVertex.SliceCount += models[i].vertex.Count; FNormal.SliceCount += models[i].normal.Count; FIndices.SliceCount += models[i].indices.Count; for(int j = vc; j < FVertex.SliceCount;j++){ FVertex[j] = models[i].vertex[j-vc]; } for(int j = nc; j < FNormal.SliceCount;j++){ FNormal[j] = models[i].normal[j-nc]; } for(int j = ic; j < FIndices.SliceCount;j++){ FIndices[j] = models[i].indices[j-ic]; } //FLogger.Log(LogType.Debug, models[i].name + ": Output!"); } //called when data for any output pin is requested public void Evaluate(int SpreadMax) { FDone[0] = false; if(FReset[0]){ FVertex.SliceCount = 0; FNormal.SliceCount = 0; FIndices.SliceCount = 0; FDone.SliceCount = 1; FBin.SliceCount = 0; models = new Model[0]; } if(FRead[0] && Fname != null){ //FLogger.Log(LogType.Debug, "========================"); models = new Model[Fname.SliceCount]; for (int i = 0; i < Fname.SliceCount; i++){ readSTL(i,Fname[i]); } } if(FApply[0] && models != null){ //FLogger.Log(LogType.Debug, "========================"); FVertex.SliceCount = 0; FNormal.SliceCount = 0; FIndices.SliceCount = 0; FBin.SliceCount = Fname.SliceCount; for (int i = 0; i < FIndex.SliceCount; i++){ outputSTL(FIndex[i]%Fname.SliceCount); FBin[i] = models[FIndex[i]%Fname.SliceCount].vertex.Count; } FDone[0] = true; } //FLogger.Log(LogType.Debug, "hi tty!"); } } public class Model{ public List<double> vertex; public List<double> normal; public List<double> indices; public string name; public Model(string name){ this.vertex = new List<double>(); this.normal = new List<double>(); this.indices = new List<double>(); this.name = name; } } }
24.54386
111
0.597212
[ "MIT" ]
HarukiTakahashi/vvvv_Advent2017
ZigzagSlicer/plugins/ValueSTLReader/ValueSTLReaderNode.cs
5,740
C#
// ================================================== // Copyright 2019(C) , DotLogix // File: ConcatenatedSettings.cs // Author: Alexander Schill <alexander@schillnet.de>. // Created: .. // LastEdited: 12.12.2019 // ================================================== // ================================================== // Copyright 2019(C) , DotLogix // File: ConcatenatedSettings.cs // Author: Alexander Schill <alexander@schillnet.de>. // Created: .. // LastEdited: 12.12.2019 // ================================================== using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; using DotLogix.Core.Extensions; namespace DotLogix.Core.Utils { public class ConcatenatedSettings : IReadOnlySettings { public IEqualityComparer<string> EqualityComparer { get; protected set; } /// <summary> /// The source settings collection /// </summary> public ICollection<IReadOnlySettings> Settings { get; } /// <inheritdoc /> public ConcatenatedSettings(ICollection<IReadOnlySettings> settings, IEqualityComparer<string> comparer = null) { Settings = settings; EqualityComparer = comparer ?? StringComparer.Ordinal; } /// <inheritdoc /> public ConcatenatedSettings(IEqualityComparer<string> comparer = null) : this(new List<IReadOnlySettings>(), comparer) { } /// <inheritdoc /> public IReadOnlySettings Inherits => null; /// <inheritdoc /> public IReadOnlySettings OwnSettings => new Settings(); /// <inheritdoc /> public IEnumerable<string> OwnKeys => Enumerable.Empty<string>(); /// <inheritdoc /> public int OwnCount => 0; /// <inheritdoc /> public IEnumerable<string> Keys { get { return Settings.SkipNull() .SelectMany(s => s.Keys) .Distinct(); } } /// <inheritdoc /> public int Count => Keys.Count(); /// <inheritdoc /> public Optional<object> this[string key] => Get(key); /// <inheritdoc /> public virtual Optional<object> Get(string key) { return TryGet(key, out var value) ? new Optional<object>(value) : default; } /// <inheritdoc /> public virtual object Get(string key, object defaultValue) { return TryGet(key, out var value) ? value : defaultValue; } /// <inheritdoc /> public virtual Optional<T> Get<T>(string key) { return TryGet(key, out T value) ? new Optional<T>(value) : default; } /// <inheritdoc /> public virtual T Get<T>(string key, T defaultValue) { return TryGet(key, out T value) ? value : defaultValue; } /// <inheritdoc /> public virtual bool TryGet(string key, out object value) { foreach(var settings in Settings) { if (settings != null && settings.TryGet(key, out value)) return true; } value = default; return false; } /// <inheritdoc /> public virtual bool TryGet<T>(string key, out T value) { foreach (var settings in Settings) { if (settings != null && settings.TryGet(key, out value)) return true; } value = default; return false; } /// <inheritdoc /> public virtual ISettings Reduce() { var values = new Dictionary<string, object>(EqualityComparer); foreach(var settings in Settings.Reverse()) { if(settings != null) values.Union(settings); } return new Settings(values, EqualityComparer); } /// <inheritdoc /> public virtual ISettings Inherit() { return new Settings { Inherits = this }; } /// <inheritdoc /> public IReadOnlySettings Clone() { return new ConcatenatedSettings(new List<IReadOnlySettings>(Settings), EqualityComparer); } /// <inheritdoc /> object ICloneable.Clone() { return Clone(); } /// <summary>Returns an enumerator that iterates through the collection.</summary> /// <returns>An enumerator that can be used to iterate through the collection.</returns> public IEnumerator<KeyValuePair<string, object>> GetEnumerator() { var settingKeys = new HashSet<string>(EqualityComparer); IReadOnlySettings current = this; do { if (current.OwnCount > 0) { foreach (var kv in current) { if (settingKeys.Add(kv.Key)) yield return kv; } } current = current.Inherits; } while (current != null); } /// <summary>Returns an enumerator that iterates through a collection.</summary> /// <returns>An <see cref="T:System.Collections.IEnumerator" /> object that can be used to iterate through the collection.</returns> IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } /// <summary> /// If called by a class member the member name can be omitted /// </summary> protected virtual T GetWithMemberName<T>([CallerMemberName] string memberName = null, T defaultValue = default) { return Get(memberName, defaultValue); } } }
32.450549
140
0.526583
[ "MIT" ]
dotlogix/DotlogixCore
Core/Utils/ConcatenatedSettings.cs
5,906
C#
using System; using System.Collections.Generic; namespace exemplo { class Program { static void Main(string[] args) { Dictionary<string, string> cookies = new Dictionary<string, string>(); cookies["user"] = "maria"; cookies["email"] = "maria@gmail.com"; cookies["phone"] = "99712234"; Console.WriteLine(cookies["phone"]); Console.WriteLine(cookies["email"]); cookies.Remove("email"); if(cookies.ContainsKey("email")) { Console.WriteLine(cookies["email"]); } else { Console.WriteLine("Email não encontrado!"); } Console.WriteLine("Tamanho: " + cookies.Count); foreach(KeyValuePair<string, string> obj in cookies) { Console.WriteLine(obj.Key + ": " + obj.Value); } } } }
24.74359
82
0.497409
[ "MIT" ]
Maxel-Uds/Curso-C-Sharp
Generics_Set_Dictionary/Dictionary/exemplo/Program.cs
968
C#