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 |
|---|---|---|---|---|---|---|---|---|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Linq;
using NuGet.Common;
using NuGet.Configuration;
using NuGet.Packaging;
using NuGet.Packaging.Core;
using NuGet.Protocol.Core.Types;
using NuGet.Versioning;
namespace NuGet.Protocol
{
/// <summary>
/// A resource capable of fetching packages, package versions and package dependency information.
/// </summary>
public class RemoteV2FindPackageByIdResource : FindPackageByIdResource
{
private static readonly XName _xnameEntry = XName.Get("entry", "http://www.w3.org/2005/Atom");
private static readonly XName _xnameContent = XName.Get("content", "http://www.w3.org/2005/Atom");
private static readonly XName _xnameLink = XName.Get("link", "http://www.w3.org/2005/Atom");
private static readonly XName _xnameProperties = XName.Get("properties", "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata");
private static readonly XName _xnameId = XName.Get("Id", "http://schemas.microsoft.com/ado/2007/08/dataservices");
private static readonly XName _xnameVersion = XName.Get("Version", "http://schemas.microsoft.com/ado/2007/08/dataservices");
private static readonly XName _xnamePublish = XName.Get("Published", "http://schemas.microsoft.com/ado/2007/08/dataservices");
// An unlisted package's publish time must be 1900-01-01T00:00:00.
private static readonly DateTime _unlistedPublishedTime = new DateTime(1900, 1, 1, 0, 0, 0);
private readonly string _baseUri;
private readonly HttpSource _httpSource;
private readonly Dictionary<string, Task<IEnumerable<PackageInfo>>> _packageVersionsCache = new Dictionary<string, Task<IEnumerable<PackageInfo>>>(StringComparer.OrdinalIgnoreCase);
private readonly FindPackagesByIdNupkgDownloader _nupkgDownloader;
/// <summary>
/// Initializes a new <see cref="RemoteV2FindPackageByIdResource" /> class.
/// </summary>
/// <param name="packageSource">A package source.</param>
/// <param name="httpSource">An HTTP source.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="packageSource" />
/// is <c>null</c>.</exception>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="httpSource" />
/// is <c>null</c>.</exception>
public RemoteV2FindPackageByIdResource(PackageSource packageSource, HttpSource httpSource)
{
if (packageSource == null)
{
throw new ArgumentNullException(nameof(packageSource));
}
if (httpSource == null)
{
throw new ArgumentNullException(nameof(httpSource));
}
_baseUri = packageSource.Source.EndsWith("/") ? packageSource.Source : (packageSource.Source + "/");
_httpSource = httpSource;
_nupkgDownloader = new FindPackagesByIdNupkgDownloader(_httpSource);
PackageSource = packageSource;
}
/// <summary>
/// Gets the package source.
/// </summary>
public PackageSource PackageSource { get; }
/// <summary>
/// Asynchronously gets all package versions for a package ID.
/// </summary>
/// <param name="id">A package ID.</param>
/// <param name="cacheContext">A source cache context.</param>
/// <param name="logger">A logger.</param>
/// <param name="cancellationToken">A cancellation token.</param>
/// <returns>A task that represents the asynchronous operation.
/// The task result (<see cref="Task{TResult}.Result" />) returns an
/// <see cref="IEnumerable{NuGetVersion}" />.</returns>
/// <exception cref="ArgumentException">Thrown if <paramref name="id" />
/// is either <c>null</c> or an empty string.</exception>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="cacheContext" /> <c>null</c>.</exception>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="logger" /> <c>null</c>.</exception>
/// <exception cref="OperationCanceledException">Thrown if <paramref name="cancellationToken" />
/// is cancelled.</exception>
public override async Task<IEnumerable<NuGetVersion>> GetAllVersionsAsync(
string id,
SourceCacheContext cacheContext,
ILogger logger,
CancellationToken cancellationToken)
{
if (string.IsNullOrEmpty(id))
{
throw new ArgumentException(Strings.ArgumentCannotBeNullOrEmpty, nameof(id));
}
if (cacheContext == null)
{
throw new ArgumentNullException(nameof(cacheContext));
}
if (logger == null)
{
throw new ArgumentNullException(nameof(logger));
}
cancellationToken.ThrowIfCancellationRequested();
var result = await EnsurePackagesAsync(id, cacheContext, logger, cancellationToken);
return result.Select(item => item.Identity.Version);
}
/// <summary>
/// Asynchronously gets dependency information for a specific package.
/// </summary>
/// <param name="id">A package id.</param>
/// <param name="version">A package version.</param>
/// <param name="cacheContext">A source cache context.</param>
/// <param name="logger">A logger.</param>
/// <param name="cancellationToken">A cancellation token.</param>
/// <returns>A task that represents the asynchronous operation.
/// The task result (<see cref="Task{TResult}.Result" />) returns an
/// <see cref="IEnumerable{NuGetVersion}" />.</returns>
/// <exception cref="ArgumentException">Thrown if <paramref name="id" />
/// is either <c>null</c> or an empty string.</exception>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="version" /> <c>null</c>.</exception>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="cacheContext" /> <c>null</c>.</exception>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="logger" /> <c>null</c>.</exception>
/// <exception cref="OperationCanceledException">Thrown if <paramref name="cancellationToken" />
/// is cancelled.</exception>
public override async Task<FindPackageByIdDependencyInfo> GetDependencyInfoAsync(
string id,
NuGetVersion version,
SourceCacheContext cacheContext,
ILogger logger,
CancellationToken cancellationToken)
{
if (string.IsNullOrEmpty(id))
{
throw new ArgumentException(Strings.ArgumentCannotBeNullOrEmpty, nameof(id));
}
if (version == null)
{
throw new ArgumentNullException(nameof(version));
}
if (cacheContext == null)
{
throw new ArgumentNullException(nameof(cacheContext));
}
if (logger == null)
{
throw new ArgumentNullException(nameof(logger));
}
cancellationToken.ThrowIfCancellationRequested();
var packageInfo = await GetPackageInfoAsync(id, version, cacheContext, logger, cancellationToken);
if (packageInfo == null)
{
logger.LogWarning($"Unable to find package {id}{version}");
return null;
}
var reader = await _nupkgDownloader.GetNuspecReaderFromNupkgAsync(
packageInfo.Identity,
packageInfo.ContentUri,
cacheContext,
logger,
cancellationToken);
return GetDependencyInfo(reader);
}
/// <summary>
/// Asynchronously copies a .nupkg to a stream.
/// </summary>
/// <param name="id">A package ID.</param>
/// <param name="version">A package version.</param>
/// <param name="destination">A destination stream.</param>
/// <param name="cacheContext">A source cache context.</param>
/// <param name="logger">A logger.</param>
/// <param name="cancellationToken">A cancellation token.</param>
/// <returns>A task that represents the asynchronous operation.
/// The task result (<see cref="Task{TResult}.Result" />) returns an
/// <see cref="bool" /> indicating whether or not the .nupkg file was copied.</returns>
/// <exception cref="ArgumentException">Thrown if <paramref name="id" />
/// is either <c>null</c> or an empty string.</exception>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="version" /> <c>null</c>.</exception>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="destination" /> <c>null</c>.</exception>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="cacheContext" /> <c>null</c>.</exception>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="logger" /> <c>null</c>.</exception>
/// <exception cref="OperationCanceledException">Thrown if <paramref name="cancellationToken" />
/// is cancelled.</exception>
public override async Task<bool> CopyNupkgToStreamAsync(
string id,
NuGetVersion version,
Stream destination,
SourceCacheContext cacheContext,
ILogger logger,
CancellationToken cancellationToken)
{
if (string.IsNullOrEmpty(id))
{
throw new ArgumentException(Strings.ArgumentCannotBeNullOrEmpty, nameof(id));
}
if (version == null)
{
throw new ArgumentNullException(nameof(version));
}
if (destination == null)
{
throw new ArgumentNullException(nameof(destination));
}
if (cacheContext == null)
{
throw new ArgumentNullException(nameof(cacheContext));
}
if (logger == null)
{
throw new ArgumentNullException(nameof(logger));
}
cancellationToken.ThrowIfCancellationRequested();
var packageInfo = await GetPackageInfoAsync(id, version, cacheContext, logger, cancellationToken);
if (packageInfo == null)
{
return false;
}
return await _nupkgDownloader.CopyNupkgToStreamAsync(
packageInfo.Identity,
packageInfo.ContentUri,
destination,
cacheContext,
logger,
cancellationToken);
}
/// <summary>
/// Asynchronously gets a package downloader for a package identity.
/// </summary>
/// <param name="packageIdentity">A package identity.</param>
/// <param name="cacheContext">A source cache context.</param>
/// <param name="logger">A logger.</param>
/// <param name="cancellationToken">A cancellation token.</param>
/// <returns>A task that represents the asynchronous operation.
/// The task result (<see cref="Task{TResult}.Result" />) returns an <see cref="IPackageDownloader" />.</returns>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="packageIdentity" /> <c>null</c>.</exception>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="cacheContext" /> <c>null</c>.</exception>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="logger" /> <c>null</c>.</exception>
/// <exception cref="OperationCanceledException">Thrown if <paramref name="cancellationToken" />
/// is cancelled.</exception>
public override async Task<IPackageDownloader> GetPackageDownloaderAsync(
PackageIdentity packageIdentity,
SourceCacheContext cacheContext,
ILogger logger,
CancellationToken cancellationToken)
{
if (packageIdentity == null)
{
throw new ArgumentNullException(nameof(packageIdentity));
}
if (cacheContext == null)
{
throw new ArgumentNullException(nameof(cacheContext));
}
if (logger == null)
{
throw new ArgumentNullException(nameof(logger));
}
cancellationToken.ThrowIfCancellationRequested();
var packageInfo = await GetPackageInfoAsync(
packageIdentity.Id,
packageIdentity.Version,
cacheContext,
logger,
cancellationToken);
if (packageInfo == null)
{
return null;
}
return new RemotePackageArchiveDownloader(this, packageInfo.Identity, cacheContext, logger);
}
private async Task<PackageInfo> GetPackageInfoAsync(
string id,
NuGetVersion version,
SourceCacheContext cacheContext,
ILogger logger,
CancellationToken cancellationToken)
{
var packageInfos = await EnsurePackagesAsync(id, cacheContext, logger, cancellationToken);
return packageInfos.FirstOrDefault(p => p.Identity.Version == version);
}
private Task<IEnumerable<PackageInfo>> EnsurePackagesAsync(
string id,
SourceCacheContext cacheContext,
ILogger logger,
CancellationToken cancellationToken)
{
Task<IEnumerable<PackageInfo>> task;
lock (_packageVersionsCache)
{
if (cacheContext.RefreshMemoryCache || !_packageVersionsCache.TryGetValue(id, out task))
{
task = FindPackagesByIdAsyncCore(id, cacheContext, logger, cancellationToken);
_packageVersionsCache[id] = task;
}
}
return task;
}
private async Task<IEnumerable<PackageInfo>> FindPackagesByIdAsyncCore(
string id,
SourceCacheContext cacheContext,
ILogger logger,
CancellationToken cancellationToken)
{
for (var retry = 0; retry < 3; ++retry)
{
var uri = _baseUri + "FindPackagesById()?id='" + id + "'";
var httpSourceCacheContext = HttpSourceCacheContext.Create(cacheContext, retry);
try
{
var results = new List<PackageInfo>();
var uris = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
uris.Add(uri);
var page = 1;
var paging = true;
while (paging)
{
// TODO: Pages for a package ID are cached separately.
// So we will get inaccurate data when a page shrinks.
// However, (1) In most cases the pages grow rather than shrink;
// (2) cache for pages is valid for only 30 min.
// So we decide to leave current logic and observe.
paging = await _httpSource.GetAsync(
new HttpSourceCachedRequest(
uri,
$"list_{id.ToLowerInvariant()}_page{page}",
httpSourceCacheContext)
{
AcceptHeaderValues =
{
new MediaTypeWithQualityHeaderValue("application/atom+xml"),
new MediaTypeWithQualityHeaderValue("application/xml")
},
EnsureValidContents = stream => HttpStreamValidation.ValidateXml(uri, stream),
MaxTries = 1
},
async httpSourceResult =>
{
if (httpSourceResult.Status == HttpSourceResultStatus.NoContent)
{
// Team city returns 204 when no versions of the package exist
// This should result in an empty list and we should not try to
// read the stream as xml.
return false;
}
var doc = await V2FeedParser.LoadXmlAsync(httpSourceResult.Stream);
var result = doc.Root
.Elements(_xnameEntry)
.Select(x => BuildModel(id, x))
.Where(x => x != null);
results.AddRange(result);
// Find the next url for continuation
var nextUri = V2FeedParser.GetNextUrl(doc);
// Stop if there's nothing else to GET
if (string.IsNullOrEmpty(nextUri))
{
return false;
}
// check for any duplicate url and error out
if (!uris.Add(nextUri))
{
throw new FatalProtocolException(string.Format(
CultureInfo.CurrentCulture,
Strings.Protocol_duplicateUri,
nextUri));
}
uri = nextUri;
page++;
return true;
},
logger,
cancellationToken);
}
return results;
}
catch (Exception ex) when (retry < 2)
{
var message = string.Format(CultureInfo.CurrentCulture, Strings.Log_RetryingFindPackagesById, nameof(FindPackagesByIdAsyncCore), uri)
+ Environment.NewLine
+ ExceptionUtilities.DisplayMessage(ex);
logger.LogMinimal(message);
}
catch (Exception ex) when (retry == 2)
{
var message = string.Format(
CultureInfo.CurrentCulture,
Strings.Log_FailedToRetrievePackage,
id,
uri);
throw new FatalProtocolException(message, ex);
}
}
return null;
}
private static PackageInfo BuildModel(string id, XElement element)
{
var properties = element.Element(_xnameProperties);
var idElement = properties.Element(_xnameId);
return new PackageInfo
{
Identity = new PackageIdentity(
idElement?.Value ?? id, // Use the given Id as final fallback if all elements above don't exist
NuGetVersion.Parse(properties.Element(_xnameVersion).Value)),
ContentUri = element.Element(_xnameContent).Attribute("src").Value,
};
}
private class PackageInfo
{
public PackageIdentity Identity { get; set; }
public string Path { get; set; }
public string ContentUri { get; set; }
}
}
} | 43.657447 | 189 | 0.552902 | [
"Apache-2.0"
] | clairernovotny/NuGet.Client | src/NuGet.Core/NuGet.Protocol/RemoteRepositories/RemoteV2FindPackageByIdResource.cs | 20,519 | C# |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
namespace Apache.Geode.Client.Tests
{
using Apache.Geode.Client;
public class DeltaTestImpl
: IGeodeSerializable, IGeodeDelta
{
private static sbyte INT_MASK = 0x1;
private static sbyte STR_MASK = 0X2;
private static sbyte DOUBLE_MASK = 0x4;
private static sbyte BYTE_ARR_MASK = 0x8;
private static sbyte TEST_OBJ_MASK = 0x10;
private static Int64 toDataCount = 0;
private static Int64 fromDataCount = 0;
private static object LOCK_THIS_CLASS = new object();
private int intVar = 0;
private string str;
private double doubleVar;
private byte[] byteArr;
private TestObject1 testobj;
private sbyte deltaBits = 0x0;
private bool hasDelta = false;
private Int64 toDeltaCounter;
private Int64 fromDeltaCounter;
public DeltaTestImpl()
{
intVar = 1;
str = "test";
doubleVar = 1.1;
byte [] arr2 = new byte[1];
byteArr = arr2;
testobj = null;
hasDelta = false;
deltaBits = 0;
toDeltaCounter = 0;
fromDeltaCounter = 0;
}
public DeltaTestImpl(DeltaTestImpl rhs)
{
this.intVar = rhs.intVar;
this.str = rhs.str;
this.doubleVar=rhs.doubleVar;
this.byteArr = rhs.byteArr;
this.testobj = rhs.testobj;
this.toDeltaCounter = rhs.GetToDeltaCounter();
this.fromDeltaCounter = rhs.GetFromDeltaCounter();
}
public DeltaTestImpl(Int32 intValue, string strValue)
{
this.intVar = intValue;
this.str = strValue;
}
public DeltaTestImpl(Int32 intValue, string strValue, double doubleVal, byte[] bytes, TestObject1 testObject)
{
this.intVar = intValue;
this.str = strValue;
this.doubleVar = doubleVal;
this.byteArr = bytes;
this.testobj = testObject;
}
public UInt64 ObjectSize
{
get
{
return 0;
}
}
public UInt32 ClassId
{
get
{
return 0x1E;
}
}
public static IGeodeSerializable CreateDeserializable()
{
return new DeltaTestImpl();
}
public Int64 GetToDeltaCounter()
{
return toDeltaCounter;
}
public Int64 GetFromDeltaCounter()
{
return fromDeltaCounter;
}
public static Int64 GetToDataCount()
{
return toDataCount;
}
public static Int64 GetFromDataCount()
{
return fromDataCount;
}
public static void ResetDataCount()
{
lock (LOCK_THIS_CLASS)
{
toDataCount = 0;
fromDataCount = 0;
}
}
public void SetIntVar(Int32 value)
{
intVar = value;
deltaBits |= INT_MASK;
hasDelta = true;
}
public Int32 GetIntVar()
{
return intVar;
}
public void SetStr(string str1)
{
str = str1;
}
public string GetStr()
{
return str;
}
public void SetDoubleVar(double value)
{
doubleVar = value;
deltaBits |= DOUBLE_MASK;
hasDelta = true;
}
public double GetSetDoubleVar()
{
return doubleVar;
}
public void SetByteArr(byte[] value)
{
byteArr = value;
deltaBits |= BYTE_ARR_MASK;
hasDelta = true;
}
public byte[] GetByteArr()
{
return (byte[])byteArr;
}
public TestObject1 GetTestObj()
{
return testobj;
}
public void SetTestObj(TestObject1 testObj)
{
this.testobj = testObj;
deltaBits |= TEST_OBJ_MASK;
hasDelta = true;
}
public void SetDelta(bool value)
{
hasDelta = value;
}
public bool HasDelta()
{
return hasDelta;
}
public void FromData(DataInput input)
{
intVar = input.ReadInt32();
str = (string)input.ReadObject();
doubleVar = input.ReadDouble();
byteArr = (byte[])input.ReadObject();
testobj = (TestObject1)input.ReadObject();
lock (LOCK_THIS_CLASS)
{
fromDataCount++;
}
}
public void ToData(DataOutput output)
{
output.WriteInt32(intVar);
output.WriteObject(str);
output.WriteDouble(doubleVar);
output.WriteObject(byteArr);
output.WriteObject(testobj);
lock (LOCK_THIS_CLASS)
{
toDataCount++;
}
}
public void ToDelta(DataOutput output)
{
lock (LOCK_THIS_CLASS)
{
toDeltaCounter++;
}
output.WriteSByte(deltaBits);
if (deltaBits != 0)
{
if ((deltaBits & INT_MASK) == INT_MASK)
{
output.WriteInt32(intVar);
}
if ((deltaBits & STR_MASK) == STR_MASK)
{
output.WriteObject(str);
}
if ((deltaBits & DOUBLE_MASK) == DOUBLE_MASK)
{
output.WriteDouble(doubleVar);
}
if ((deltaBits & BYTE_ARR_MASK) == BYTE_ARR_MASK)
{
output.WriteObject(byteArr);
}
if ((deltaBits & TEST_OBJ_MASK) == TEST_OBJ_MASK)
{
output.WriteObject(testobj);
}
}
}
public void FromDelta(DataInput input)
{
lock (LOCK_THIS_CLASS)
{
fromDeltaCounter++;
}
deltaBits = input.ReadSByte();
if ((deltaBits & INT_MASK) == INT_MASK)
{
intVar = input.ReadInt32();
}
if ((deltaBits & STR_MASK) == STR_MASK)
{
str = (string)input.ReadObject();
}
if ((deltaBits & DOUBLE_MASK) == DOUBLE_MASK)
{
doubleVar = input.ReadDouble();
}
if ((deltaBits & BYTE_ARR_MASK) == BYTE_ARR_MASK)
{
byteArr = (byte[])input.ReadObject();
}
if ((deltaBits & TEST_OBJ_MASK) == TEST_OBJ_MASK)
{
testobj = (TestObject1)input.ReadObject();
}
}
public override string ToString()
{
string portStr = string.Format("DeltaTestImpl [hasDelta={0} int={1} " +
"double={2} str={3}]", hasDelta, intVar, doubleVar, str);
return portStr;
}
}
}
| 24.038869 | 113 | 0.601793 | [
"Apache-2.0"
] | mcmellawatt/geode-native | tests/cli/NewTestObject/DeltaTestImpl.cs | 6,803 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\Arm\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void LoadAndReplicateToVector128_Double()
{
var test = new LoadUnaryOpTest__LoadAndReplicateToVector128_Double();
if (test.IsSupported)
{
// Validates basic functionality works
test.RunBasicScenario_Load();
// Validates calling via reflection works
test.RunReflectionScenario_Load();
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class LoadUnaryOpTest__LoadAndReplicateToVector128_Double
{
private struct DataTable
{
private byte[] inArray1;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Double[] inArray1, Double[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Double>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Double>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Double, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private static readonly int LargestVectorSize = 16;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double);
private static Double[] _data = new Double[Op1ElementCount];
private DataTable _dataTable;
public LoadUnaryOpTest__LoadAndReplicateToVector128_Double()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetDouble(); }
_dataTable = new DataTable(_data, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.Arm64.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.Arm64.LoadAndReplicateToVector128(
(Double*)(_dataTable.inArray1Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.LoadAndReplicateToVector128), new Type[] { typeof(Double*) })
.Invoke(null, new object[] {
Pointer.Box(_dataTable.inArray1Ptr, typeof(Double*))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
Succeeded = false;
try
{
RunBasicScenario_Load();
}
catch (PlatformNotSupportedException)
{
Succeeded = true;
}
}
private void ValidateResult(Vector128<Double> firstOp, void* result, [CallerMemberName] string method = "")
{
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), firstOp);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
{
Double[] inArray = new Double[Op1ElementCount];
Double[] outArray = new Double[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<Double>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>());
ValidateResult(inArray, outArray, method);
}
private void ValidateResult(Double[] firstOp, Double[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
for (var i = 0; i < RetElementCount; i++)
{
if (BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[i]))
{
succeeded = false;
break;
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.LoadAndReplicateToVector128)}<Double>(Vector128<Double>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| 39.676471 | 182 | 0.58599 | [
"MIT"
] | 06needhamt/runtime | src/coreclr/tests/src/JIT/HardwareIntrinsics/Arm/AdvSimd.Arm64/LoadAndReplicateToVector128.Double.cs | 8,094 | C# |
using System;
using System.IO;
using System.Net.Mime;
using GreenhousePlusPlus.WebAPI.Models;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using NLog.Web;
namespace GreenhousePlusPlus.WebAPI
{
public class Startup
{
public const string StaticFolder = "Static";
public static string StaticPath => Path.Combine(StartupFolder, StaticFolder);
public static string StartupFolder => Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
private NLog.Logger _logger = NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger();
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddCors();
services.AddControllers();
services.AddControllers(options =>
options.Filters.Add(new HttpResponseExceptionFilter()))
.ConfigureApiBehaviorOptions(options =>
{
options.InvalidModelStateResponseFactory = context =>
{
var result = new BadRequestObjectResult(context.ModelState);
// TODO: add `using using System.Net.Mime;` to resolve MediaTypeNames
result.ContentTypes.Add(MediaTypeNames.Application.Json);
result.ContentTypes.Add(MediaTypeNames.Application.Xml);
return result;
};
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
app.UseExceptionHandler(env.IsDevelopment() ? "/error-local-development" : "/error");
app.UseExceptionHandler(a => a.Run(async context =>
{
var exceptionHandlerPathFeature = context.Features.Get<IExceptionHandlerPathFeature>();
var exception = exceptionHandlerPathFeature.Error;
_logger.Error(exception.Message);
}));
if (env.IsDevelopment())
{
var srcFolder = Path.Combine(Directory.GetCurrentDirectory(), StaticFolder);
Directory.CreateDirectory(StaticPath);
foreach (var srcPath in Directory.GetFiles(srcFolder))
{
File.Copy(srcPath, srcPath.Replace(srcPath, srcPath.Replace(srcFolder, StaticPath)), true);
}
}
app.UseCors(x => x
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader());
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(StaticPath),
RequestPath = "/static",
OnPrepareResponse = context =>
{
context.Context.Response.Headers.Add("Cache-Control", "no-cache, no-store");
context.Context.Response.Headers.Add("Expires", "-1");
}
});
app.UseRouting();
//app.UseAuthorization();
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
}
}
} | 34.474747 | 124 | 0.692939 | [
"MIT"
] | srad/Greenhouse- | GreenhousePlusPlus.WebAPI/Startup.cs | 3,413 | C# |
// <auto-generated>
// 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.
// </auto-generated>
namespace Microsoft.Azure.Management.WebSites.Models
{
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Container App container Custom scaling rule.
/// </summary>
public partial class HttpScaleRule
{
/// <summary>
/// Initializes a new instance of the HttpScaleRule class.
/// </summary>
public HttpScaleRule()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the HttpScaleRule class.
/// </summary>
/// <param name="metadata">Metadata properties to describe http scale
/// rule.</param>
/// <param name="auth">Authentication secrets for the custom scale
/// rule.</param>
public HttpScaleRule(IDictionary<string, string> metadata = default(IDictionary<string, string>), IList<ScaleRuleAuth> auth = default(IList<ScaleRuleAuth>))
{
Metadata = metadata;
Auth = auth;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets or sets metadata properties to describe http scale rule.
/// </summary>
[JsonProperty(PropertyName = "metadata")]
public IDictionary<string, string> Metadata { get; set; }
/// <summary>
/// Gets or sets authentication secrets for the custom scale rule.
/// </summary>
[JsonProperty(PropertyName = "auth")]
public IList<ScaleRuleAuth> Auth { get; set; }
}
}
| 32.453125 | 164 | 0.617236 | [
"MIT"
] | ChenTanyi/azure-sdk-for-net | sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/HttpScaleRule.cs | 2,077 | C# |
using System;
using _03BarracksFactory.Contracts;
namespace P03_BarraksWars.Core.Commands
{
public class FightCommand : Command
{
public FightCommand(string[] data)
: base(data)
{
}
public override string Execute()
{
Environment.Exit(0);
return null;
}
}
} | 18.736842 | 43 | 0.55618 | [
"MIT"
] | GeorgiGarnenkov/CSharp-Fundamentals | C#OOPAdvanced/ReflectionAndAttributes/P03_BarraksWars/Core/Commands/FightCommand.cs | 358 | C# |
// <copyright file="WebDriverObjectProxy.cs" company="WebDriver Committers">
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Proxies;
using System.Text;
namespace OpenQA.Selenium.Support.PageObjects
{
/// <summary>
/// Represents a base proxy class for objects used with the PageFactory.
/// </summary>
internal abstract class WebDriverObjectProxy : RealProxy
{
private readonly IElementLocator locator;
private readonly IEnumerable<By> bys;
private readonly bool cache;
/// <summary>
/// Initializes a new instance of the <see cref="WebDriverObjectProxy"/> class.
/// </summary>
/// <param name="classToProxy">The <see cref="Type"/> of object for which to create a proxy.</param>
/// <param name="locator">The <see cref="IElementLocator"/> implementation that
/// determines how elements are located.</param>
/// <param name="bys">The list of methods by which to search for the elements.</param>
/// <param name="cache"><see langword="true"/> to cache the lookup to the element; otherwise, <see langword="false"/>.</param>
protected WebDriverObjectProxy(Type classToProxy, IElementLocator locator, IEnumerable<By> bys, bool cache)
: base(classToProxy)
{
this.locator = locator;
this.bys = bys;
this.cache = cache;
}
/// <summary>
/// Gets the <see cref="IElementLocator"/> implementation that determines how elements are located.
/// </summary>
protected IElementLocator Locator
{
get { return this.locator; }
}
/// <summary>
/// Gets the list of methods by which to search for the elements.
/// </summary>
protected IEnumerable<By> Bys
{
get { return this.bys; }
}
/// <summary>
/// Gets a value indicating whether element search results should be cached.
/// </summary>
protected bool Cache
{
get { return this.cache; }
}
/// <summary>
/// Invokes a method on the object this proxy represents.
/// </summary>
/// <param name="msg">Message containing the parameters of the method being invoked.</param>
/// <param name="representedValue">The object this proxy represents.</param>
/// <returns>The <see cref="ReturnMessage"/> instance as a result of method invocation on the
/// object which this proxy represents.</returns>
protected static ReturnMessage InvokeMethod(IMethodCallMessage msg, object representedValue)
{
if (msg == null)
{
throw new ArgumentNullException("msg", "The message containing invocation information cannot be null");
}
MethodInfo proxiedMethod = msg.MethodBase as MethodInfo;
return new ReturnMessage(proxiedMethod.Invoke(representedValue, msg.Args), null, 0, msg.LogicalCallContext, msg);
}
}
}
| 41.041237 | 134 | 0.652851 | [
"Apache-2.0"
] | cjayswal/selenium | dotnet/src/support/PageObjects/WebDriverObjectProxy.cs | 3,983 | C# |
namespace SqlStreamStore
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Shouldly;
using SqlStreamStore.Imports.AsyncEx.Nito.AsyncEx.Coordination;
using SqlStreamStore.Streams;
using SqlStreamStore.Subscriptions;
using Xunit;
public partial class AcceptanceTests
{
[Fact, Trait("Category", "Subscriptions")]
public async Task Can_subscribe_to_a_stream_from_start()
{
var streamId1 = "stream-1";
await AppendMessages(store, streamId1, 10);
var streamId2 = "stream-2";
await AppendMessages(store, streamId2, 10);
var done = new TaskCompletionSource<StreamMessage>();
var receivedMessages = new List<StreamMessage>();
using (var subscription = store.SubscribeToStream(
streamId1,
StreamVersion.None,
(_, message, ct) =>
{
receivedMessages.Add(message);
if (message.StreamVersion == 11)
{
done.SetResult(message);
}
return Task.CompletedTask;
}))
{
await AppendMessages(store, streamId1, 2);
var receivedMessage = await done.Task.WithTimeout();
receivedMessages.Count.ShouldBe(12);
subscription.StreamId.ShouldBe(streamId1);
receivedMessage.StreamId.ShouldBe(streamId1);
receivedMessage.StreamVersion.ShouldBe(11);
subscription.LastVersion.Value.ShouldBeGreaterThan(0);
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_subscribe_to_a_stream_and_receive_message_then_should_get_subscription_instance()
{
var streamId = "stream-1";
await AppendMessages(store, streamId, 10);
var done = new TaskCompletionSource<IStreamSubscription>();
using (var subscription = store.SubscribeToStream(
streamId,
StreamVersion.None,
(sub, _, ct) =>
{
done.SetResult(sub);
return Task.CompletedTask;
}))
{
var receivedSubscription = await done.Task.WithTimeout();
receivedSubscription.ShouldBe(subscription);
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task Can_subscribe_to_a_stream_from_start_before_messages_are_written()
{
var streamId = "stream-1";
var done = new TaskCompletionSource<StreamMessage>();
var receivedMessages = new List<StreamMessage>();
using (var subscription = store.SubscribeToStream(
streamId,
StreamVersion.None,
(_, message, ct) =>
{
receivedMessages.Add(message);
if (message.StreamVersion == 1)
{
done.SetResult(message);
}
return Task.CompletedTask;
}))
{
await AppendMessages(store, streamId, 2);
var receivedMessage = await done.Task.WithTimeout();
receivedMessages.Count.ShouldBe(2);
subscription.StreamId.ShouldBe(streamId);
receivedMessage.StreamId.ShouldBe(streamId);
receivedMessage.StreamVersion.ShouldBe(1);
subscription.LastVersion.Value.ShouldBeGreaterThan(0);
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task Can_subscribe_to_all_stream_from_start()
{
string streamId1 = "stream-1";
await AppendMessages(store, streamId1, 3);
string streamId2 = "stream-2";
await AppendMessages(store, streamId2, 3);
var receiveMessages = new TaskCompletionSource<StreamMessage>();
List<StreamMessage> receivedMessages = new List<StreamMessage>();
using(store.SubscribeToAll(
Position.None,
(_, message, __) =>
{
TestOutputHelper.WriteLine($"Received message {message.StreamId} " +
$"{message.StreamVersion} {message.Position}");
receivedMessages.Add(message);
if (message.StreamId == streamId1 && message.StreamVersion == 3)
{
receiveMessages.SetResult(message);
}
return Task.CompletedTask;
}))
{
await AppendMessages(store, streamId1, 1);
await receiveMessages.Task.WithTimeout();
receivedMessages.Count.ShouldBe(7);
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_subscribe_to_all_and_receive_message_then_should_get_subscription_instance()
{
const string streamId = "stream-1";
await AppendMessages(store, streamId, 10);
var done = new TaskCompletionSource<IAllStreamSubscription>();
using (var subscription = store.SubscribeToAll(
Position.None,
(sub, _, __) =>
{
done.SetResult(sub);
return Task.CompletedTask;
}))
{
var receivedSubscription = await done.Task.WithTimeout();
receivedSubscription.ShouldBe(subscription);
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task Can_subscribe_to_all_stream_from_start_before_messages_are_written()
{
string streamId1 = "stream-1";
string streamId2 = "stream-2";
var receiveMessages = new TaskCompletionSource<StreamMessage>();
List<StreamMessage> receivedMessages = new List<StreamMessage>();
using (store.SubscribeToAll(
Position.None,
(_, message, __) =>
{
TestOutputHelper.WriteLine($"Received message {message.StreamId} {message.StreamVersion} {message.Position}");
receivedMessages.Add(message);
if (message.StreamId == streamId1 && message.StreamVersion == 3)
{
receiveMessages.SetResult(message);
}
return Task.CompletedTask;
}))
{
await AppendMessages(store, streamId1, 3);
await AppendMessages(store, streamId2, 3);
await AppendMessages(store, streamId1, 1);
await receiveMessages.Task.WithTimeout(5000);
receivedMessages.Count.ShouldBe(7);
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task Can_subscribe_to_a_stream_from_end()
{
string streamId1 = "stream-1";
await AppendMessages(store, streamId1, 10);
string streamId2 = "stream-2";
await AppendMessages(store, streamId2, 10);
var receiveMessage = new TaskCompletionSource<StreamMessage>();
int receivedCount = 0;
using (var subscription = store.SubscribeToStream(
streamId1,
StreamVersion.End,
(_, message, ct) =>
{
TestOutputHelper.WriteLine($"Received message {message.StreamId} {message.StreamVersion} "
+ $"{message.Position}");
receivedCount++;
if (message.StreamVersion >= 11)
{
receiveMessage.SetResult(message);
}
return Task.CompletedTask;
}))
{
await subscription.Started;
await AppendMessages(store, streamId1, 2);
var allMessagesPage = await store.ReadAllForwards(0, 30);
foreach(var streamMessage in allMessagesPage.Messages)
{
TestOutputHelper.WriteLine(streamMessage.ToString());
}
var receivedMessage = await receiveMessage.Task.WithTimeout();
receivedCount.ShouldBe(2);
subscription.StreamId.ShouldBe(streamId1);
receivedMessage.StreamId.ShouldBe(streamId1);
receivedMessage.StreamVersion.ShouldBe(11);
subscription.LastVersion.Value.ShouldBeGreaterThan(0);
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task Given_non_empty_streamstore_can_subscribe_to_all_stream_from_end()
{
string streamId1 = "stream-1";
await AppendMessages(store, streamId1, 10);
string streamId2 = "stream-2";
await AppendMessages(store, streamId2, 10);
var receiveMessages = new TaskCompletionSource<StreamMessage>();
List<StreamMessage> receivedMessages = new List<StreamMessage>();
using(var subscription = store.SubscribeToAll(
Position.End,
(_, message, __) =>
{
TestOutputHelper.WriteLine($"StreamId={message.StreamId} Version={message.StreamVersion} "
+ $"Position={message.Position}");
receivedMessages.Add(message);
if (message.StreamId == streamId1 && message.StreamVersion == 11)
{
receiveMessages.SetResult(message);
}
return Task.CompletedTask;
}))
{
await subscription.Started;
await AppendMessages(store, streamId1, 2);
await receiveMessages.Task.WithTimeout();
receivedMessages.Count.ShouldBe(2);
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task Given_empty_streamstore_can_subscribe_to_all_stream_from_end()
{
string streamId1 = "stream-1";
var receiveMessages = new TaskCompletionSource<int>();
List<StreamMessage> receivedMessages = new List<StreamMessage>();
using (var subscription = store.SubscribeToAll(
Position.End,
(_, message, __) =>
{
receivedMessages.Add(message);
if (message.StreamId == streamId1 && message.StreamVersion == 9)
{
receiveMessages.SetResult(0);
}
return Task.CompletedTask;
}))
{
await subscription.Started;
await AppendMessages(store, streamId1, 10);
await receiveMessages.Task.WithTimeout();
receivedMessages.Count.ShouldBe(10);
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task Can_subscribe_to_a_stream_from_a_specific_version()
{
string streamId1 = "stream-1";
await AppendMessages(store, streamId1, 10);
string streamId2 = "stream-2";
await AppendMessages(store, streamId2, 10);
var receiveMessages = new TaskCompletionSource<StreamMessage>();
int receivedCount = 0;
using (var subscription = store.SubscribeToStream(
streamId1,
7,
(_, message, ct) =>
{
receivedCount++;
if (message.StreamVersion == 11)
{
receiveMessages.SetResult(message);
}
return Task.CompletedTask;
}))
{
await AppendMessages(store, streamId1, 2);
var receivedMessage = await receiveMessages.Task.WithTimeout();
receivedCount.ShouldBe(4);
subscription.StreamId.ShouldBe(streamId1);
receivedMessage.StreamId.ShouldBe(streamId1);
receivedMessage.StreamVersion.ShouldBe(11);
subscription.LastVersion.Value.ShouldBeGreaterThan(0);
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task Can_have_multiple_subscriptions_to_all()
{
string streamId1 = "stream-1";
await AppendMessages(store, streamId1, 2);
var completionSources =
Enumerable.Range(0, fixture.MaxSubscriptionCount).Select(_ => new TaskCompletionSource<int>())
.ToArray();
var subscriptions = Enumerable.Range(0, fixture.MaxSubscriptionCount)
.Select(index => store.SubscribeToAll(
Position.None,
(_, message, __) =>
{
if(message.StreamVersion == 1)
{
completionSources[index].SetResult(0);
}
return Task.CompletedTask;
}))
.ToArray();
try
{
await Task.WhenAll(completionSources.Select(source => source.Task)).WithTimeout(10000);
}
finally
{
foreach (var subscription in subscriptions) subscription.Dispose();
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task Can_have_multiple_subscriptions_to_stream()
{
string streamId1 = "stream-1";
await AppendMessages(store, streamId1, 2);
var subscriptionCount = 50;
var completionSources =
Enumerable.Range(0, subscriptionCount)
.Select(_ => new TaskCompletionSource<int>())
.ToArray();
var subscriptions = Enumerable.Range(0, subscriptionCount)
.Select(index => store.SubscribeToStream(
streamId1,
0,
(_, message, ct) =>
{
if(message.StreamVersion == 1)
{
completionSources[index].SetResult(0);
}
return Task.CompletedTask;
}))
.ToArray();
try
{
await Task.WhenAll(completionSources.Select(source => source.Task)).WithTimeout();
}
finally
{
foreach(var subscription in subscriptions)
{
subscription.Dispose();
}
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_delete_then_deleted_message_should_have_correct_position()
{
// Arrange
var streamId = "stream-1";
var receiveMessage = new TaskCompletionSource<bool>();
var receiveDeletedMessage = new TaskCompletionSource<StreamMessage>();
List<StreamMessage> receivedMessages = new List<StreamMessage>();
using (var subscription = store.SubscribeToAll(
Position.None,
(_, message, __) =>
{
TestOutputHelper.WriteLine($"Received message {message.StreamId} " +
$"{message.StreamVersion} {message.Position}");
receivedMessages.Add(message);
if (message.StreamId == streamId)
{
receiveMessage.SetResult(true);
}
if (message.StreamId == Deleted.DeletedStreamId
&& message.Type == Deleted.StreamDeletedMessageType)
{
receiveDeletedMessage.SetResult(message);
}
return Task.CompletedTask;
}))
{
await AppendMessages(store, streamId, 1);
await receiveMessage.Task.WithTimeout();
// Act
await store.DeleteStream(streamId);
await receiveDeletedMessage.Task.WithTimeout();
// Assert
receivedMessages[1].Position.ShouldBeGreaterThan(receivedMessages[0].Position);
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_exception_throw_by_stream_subscriber_then_should_drop_subscription_with_reason_SubscriberError()
{
var eventReceivedException = new TaskCompletionSource<SubscriptionDroppedReason>();
Task MessageReceived(IStreamSubscription _, StreamMessage __, CancellationToken ___) => throw new Exception();
void SubscriptionDropped(IStreamSubscription _, SubscriptionDroppedReason reason, Exception __) => eventReceivedException.SetResult(reason);
var streamId = "stream-1";
using(store.SubscribeToStream(
streamId,
StreamVersion.None,
MessageReceived,
SubscriptionDropped))
{
await store.AppendToStream(streamId,
ExpectedVersion.NoStream,
new NewStreamMessage(Guid.NewGuid(), "type", "{}"));
var droppedReason = await eventReceivedException.Task.WithTimeout();
droppedReason.ShouldBe(SubscriptionDroppedReason.SubscriberError);
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_stream_subscription_disposed_then_should_drop_subscription_with_reason_Disposed()
{
var tcs = new TaskCompletionSource<SubscriptionDroppedReason>();
var subscription = store.SubscribeToStream(
"stream-1",
StreamVersion.End,
(_, __, ___) => Task.CompletedTask,
(_, reason, __) =>
{
tcs.SetResult(reason);
});
subscription.Dispose();
var droppedReason = await tcs.Task.WithTimeout();
droppedReason.ShouldBe(SubscriptionDroppedReason.Disposed);
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_stream_subscription_dropped_then_should_supply_subscription_instance()
{
var tcs = new TaskCompletionSource<IStreamSubscription>();
var subscription = store.SubscribeToStream(
"stream-1",
StreamVersion.None,
(_, __, ___) => Task.CompletedTask,
(sub, _, __) =>
{
tcs.SetResult(sub);
});
subscription.Dispose();
var receivedSubscription = await tcs.Task.WithTimeout();
receivedSubscription.ShouldBe(subscription);
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_stream_subscription_disposed_while_handling_messages_then_should_drop_subscription_with_reason_Disposed()
{
string streamId = "stream-1";
var droppedTcs = new TaskCompletionSource<SubscriptionDroppedReason>();
var handler = new AsyncAutoResetEvent();
var subscription = store.SubscribeToStream(streamId,
StreamVersion.Start,
async (_, __, ct) =>
{
handler.Set();
await Task.Delay(TimeSpan.FromSeconds(3)); // block "handling" while a dispose occurs
},
(_, reason, __) =>
{
droppedTcs.SetResult(reason);
});
// First message is blocked in handling, the second is co-operatively cancelled
await AppendMessages(store, streamId, 2);
await handler.WaitAsync().WithTimeout(10000);
subscription.Dispose();
var droppedReason = await droppedTcs.Task.WithTimeout(10000);
droppedReason.ShouldBe(SubscriptionDroppedReason.Disposed);
}
[Fact, Trait("Category", "Subscriptions")]
public async Task Can_dispose_stream_subscription_multiple_times()
{
var streamId = "stream-1";
var subscription = store.SubscribeToStream(streamId,
StreamVersion.Start,
(_, __, ___) => Task.CompletedTask);
await AppendMessages(store, streamId, 2);
subscription.Dispose();
subscription.Dispose();
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_exception_throw_by_all_stream_subscriber_then_should_drop_subscription_with_reason_SubscriberError()
{
var eventReceivedException = new TaskCompletionSource<SubscriptionDroppedReason>();
Task MessageReceived(IAllStreamSubscription _, StreamMessage __, CancellationToken ___) => throw new Exception();
void SubscriptionDropped(IAllStreamSubscription _, SubscriptionDroppedReason reason, Exception __) => eventReceivedException.SetResult(reason);
var streamId = "stream-1";
using (store.SubscribeToAll(
Position.None,
MessageReceived,
SubscriptionDropped))
{
await store.AppendToStream(
streamId,
ExpectedVersion.NoStream,
new NewStreamMessage(Guid.NewGuid(), "type", "{}"));
var droppedReason = await eventReceivedException.Task.WithTimeout();
droppedReason.ShouldBe(SubscriptionDroppedReason.SubscriberError);
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_all_stream_subscription_disposed_then_should_drop_subscription_with_reason_Disposed()
{
var tcs = new TaskCompletionSource<SubscriptionDroppedReason>();
var subscription = store.SubscribeToAll(
Position.End,
(_, __, ___) => Task.CompletedTask,
(_, reason, __) =>
{
tcs.SetResult(reason);
});
subscription.Dispose();
var droppedReason = await tcs.Task.WithTimeout();
droppedReason.ShouldBe(SubscriptionDroppedReason.Disposed);
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_all_stream_subscription_dropped_then_should_supply_subscription_instance()
{
var tcs = new TaskCompletionSource<IAllStreamSubscription>();
var subscription = store.SubscribeToAll(
Position.End,
(_, __, ___) => Task.CompletedTask,
(sub, _, __) =>
{
tcs.SetResult(sub);
});
subscription.Dispose();
var receivedSubscription = await tcs.Task.WithTimeout();
receivedSubscription.ShouldBe(subscription);
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_all_stream_subscription_disposed_while_handling_messages_then_should_drop_subscription_with_reason_Disposed()
{
string streamId = "stream-1";
var droppedTcs = new TaskCompletionSource<SubscriptionDroppedReason>();
var handler = new AsyncAutoResetEvent();
var subscription = store.SubscribeToAll(
Position.End,
async (_, __, ___) =>
{
handler.Set();
await Task.Delay(TimeSpan.FromSeconds(3)); // block "handling" while a dispose occurs
},
(_, reason, __) =>
{
droppedTcs.SetResult(reason);
});
// First message is blocked in handling, the second is cooperatively cancelled
await subscription.Started;
await AppendMessages(store, streamId, 2);
await handler.WaitAsync().WithTimeout();
subscription.Dispose();
var droppedReason = await droppedTcs.Task.WithTimeout();
droppedReason.ShouldBe(SubscriptionDroppedReason.Disposed);
}
[Fact, Trait("Category", "Subscriptions")]
public async Task Can_dispose_all_stream_subscription_multiple_times()
{
var streamId = "stream-1";
var subscription = store.SubscribeToAll(
Position.Start,
(_, __, ___) => Task.CompletedTask);
await AppendMessages(store, streamId, 2);
subscription.Dispose();
subscription.Dispose();
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_caught_up_to_all_then_then_should_notify()
{
var streamId = "stream-1";
await AppendMessages(store, streamId, 30);
var caughtUp = new TaskCompletionSource<bool>();
var subscription = store.SubscribeToAll(
Position.None,
(_, __, ___) => Task.CompletedTask,
hasCaughtUp: b =>
{
if(b)
{
caughtUp.SetResult(b);
}
});
subscription.MaxCountPerRead = 10;
await caughtUp.Task.WithTimeout(5000);
subscription.Dispose();
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_caught_up_to_all_then_then_should_notify_only_twice()
{
var streamId = "stream-1";
await AppendMessages(store, streamId, 30);
var caughtUp = new TaskCompletionSource<bool>();
var numberOfCaughtUps = 0;
var subscription = store.SubscribeToAll(
Position.None,
(_, __, ___) => Task.CompletedTask,
hasCaughtUp: b =>
{
if(b)
{
if(++numberOfCaughtUps > 2)
{
caughtUp.SetException(
new Exception("Should not raise hasCaughtUp more than twice."));
}
}
});
subscription.MaxCountPerRead = 10;
Func<Task> act = async () => await caughtUp.Task.WithTimeout(1000);
await act.ShouldThrowAsync<TimeoutException>();
subscription.Dispose();
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_caughtup_to_stream_then_then_should_notify()
{
var streamId = "stream-1";
await AppendMessages(store, streamId, 30);
var caughtUp = new TaskCompletionSource<bool>();
var subscription = store.SubscribeToStream(
streamId,
StreamVersion.None,
(_, __, ___) => Task.CompletedTask,
hasCaughtUp: b =>
{
if (b)
{
caughtUp.SetResult(b);
}
});
subscription.MaxCountPerRead = 10;
await caughtUp.Task.WithTimeout(5000);
subscription.Dispose();
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_falls_behind_on_all_then_then_should_notify()
{
var streamId = "stream-1";
await AppendMessages(store, streamId, 30);
var fallenBehind = new TaskCompletionSource<bool>();
bool caughtUp = false;
var subscription = store.SubscribeToAll(
Position.None,
(_, __, ___) => Task.CompletedTask,
hasCaughtUp: b =>
{
if (b)
{
caughtUp = true;
}
if (b && caughtUp)
{
fallenBehind.SetResult(b);
}
});
subscription.MaxCountPerRead = 10;
await fallenBehind.Task.WithTimeout(5000);
subscription.Dispose();
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_falls_behind_on_stream_then_then_should_notify()
{
var streamId = "stream-1";
await AppendMessages(store, streamId, 30);
var fallenBehind = new TaskCompletionSource<bool>();
bool caughtUp = false;
var subscription = store.SubscribeToStream(
streamId,
StreamVersion.None,
(_, __, ___) => Task.CompletedTask,
hasCaughtUp: b =>
{
if (b)
{
caughtUp = true;
}
if(b && caughtUp)
{
fallenBehind.SetResult(b);
}
});
subscription.MaxCountPerRead = 10;
await fallenBehind.Task.WithTimeout(5000);
subscription.Dispose();
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_dispose_store_then_should_dispose_stream_subscriptions()
{
var subscriptionDropped = new TaskCompletionSource<SubscriptionDroppedReason>();
var subscription = store.SubscribeToStream(
"stream-1",
StreamVersion.None,
(_, __, ___) => Task.CompletedTask,
subscriptionDropped: (streamSubscription, reason, exception) =>
{
subscriptionDropped.SetResult(reason);
});
store.Dispose();
var droppedReason = await subscriptionDropped.Task.WithTimeout(5000);
droppedReason.ShouldBe(SubscriptionDroppedReason.Disposed);
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_dispose_store_then_should_dispose_all_stream_subscriptions()
{
var subscriptionDropped = new TaskCompletionSource<SubscriptionDroppedReason>();
var subscription = store.SubscribeToAll(
Position.None,
(_, __, ___) => Task.CompletedTask,
subscriptionDropped: (streamSubscription, reason, exception) =>
{
subscriptionDropped.SetResult(reason);
});
store.Dispose();
var droppedReason = await subscriptionDropped.Task.WithTimeout(5000);
droppedReason.ShouldBe(SubscriptionDroppedReason.Disposed);
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_subscribe_to_stream_and_append_messages_then_should_receive_message()
{
var streamId1 = "stream-1";
var streamId2 = "stream-2";
var received = new AsyncAutoResetEvent();
string streamIdReceived = null;
using (store.SubscribeToStream(
streamId1,
StreamVersion.None,
(_, message, ct) =>
{
streamIdReceived = message.StreamId;
received.Set();
return Task.CompletedTask;
}))
{
await AppendMessages(store, streamId1, 1);
await AppendMessages(store, streamId2, 1);
await received.WaitAsync().WithTimeout();
streamIdReceived.ShouldBe(streamId1);
await AppendMessages(store, streamId1, 1);
await AppendMessages(store, streamId2, 1);
await received.WaitAsync().WithTimeout();
streamIdReceived.ShouldBe(streamId1);
await AppendMessages(store, streamId1, 1);
await AppendMessages(store, streamId2, 1);
await received.WaitAsync().WithTimeout();
streamIdReceived.ShouldBe(streamId1);
}
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_subscribe_to_all_with_empty_store_should_raise_has_caught_up()
{
bool hasCaughtUp;
var tcs = new TaskCompletionSource<bool>();
using (store.SubscribeToAll(
null,
(_, message, ct) => Task.CompletedTask,
hasCaughtUp: b => tcs.SetResult(b)))
{
hasCaughtUp = await tcs.Task.WithTimeout(5000);
}
hasCaughtUp.ShouldBeTrue();
}
[Fact, Trait("Category", "Subscriptions")]
public async Task When_subscribe_to_stream_with_empty_store_should_raise_has_caught_up()
{
bool hasCaughtUp;
var tcs = new TaskCompletionSource<bool>();
using (store.SubscribeToStream(
"stream-1",
null,
(_, message, ct) => Task.CompletedTask,
hasCaughtUp: b => tcs.SetResult(b)))
{
hasCaughtUp = await tcs.Task.WithTimeout(5000);
}
hasCaughtUp.ShouldBeTrue();
}
private static async Task AppendMessages(
IStreamStore streamStore,
string streamId,
int numberOfEvents)
{
for(int i = 0; i < numberOfEvents; i++)
{
var newmessage = new NewStreamMessage(Guid.NewGuid(), "MyEvent", "{}");
await streamStore.AppendToStream(streamId, ExpectedVersion.Any, newmessage);
}
}
}
}
| 38.507795 | 155 | 0.531955 | [
"MIT"
] | dcomartin/SQLStreamStore | tests/SqlStreamStore.AcceptanceTests/AcceptanceTests.Subscriptions.cs | 34,582 | C# |
namespace BeerApp.Web.ViewModels.Manage
{
using System.Collections.Generic;
using System.Web.Mvc;
public class ConfigureTwoFactorViewModel
{
public string SelectedProvider { get; set; }
public ICollection<SelectListItem> Providers { get; set; }
}
}
| 22.153846 | 66 | 0.690972 | [
"MIT"
] | ahansb/BeerApp | Source/Web/BeerApp.Web/ViewModels/Manage/ConfigureTwoFactorViewModel.cs | 290 | C# |
using System.Threading.Tasks;
using MongoDB.Driver;
using Uniswap.Data.Entities;
using Uniswap.Data.Mongo.Entities;
using Uniswap.Data.Repositories;
namespace Uniswap.Data.Mongo.Repositories
{
public class MongoLastBlockFetchedByExchangeRepository : ILastBlockFetchedByExchangeRepository
{
private readonly IMongoCollection<MongoLastBlockHandledByExchangeEntity> _collection;
public MongoLastBlockFetchedByExchangeRepository(IMongoCollection<MongoLastBlockHandledByExchangeEntity> collection)
{
_collection = collection;
}
public async Task<ILastBlockFetchedByExchangeEntity> FindByIdAsync(string id)
{
var entity =
await (await _collection.FindAsync(e => e.Id.Equals(id),
new FindOptions<MongoLastBlockHandledByExchangeEntity>())).FirstOrDefaultAsync();
return entity;
}
public async Task AddOrUpdateAsync(ILastBlockFetchedByExchangeEntity entity)
{
await _collection.FindOneAndReplaceAsync<MongoLastBlockHandledByExchangeEntity>(
e => e.Id.Equals(entity.Id),
(MongoLastBlockHandledByExchangeEntity) entity,
new FindOneAndReplaceOptions<MongoLastBlockHandledByExchangeEntity> {IsUpsert = true});
}
}
} | 38.028571 | 124 | 0.709241 | [
"MIT"
] | loanscan/uniswap-statistics-api | src/Uniswap.Data.Mongo/Repositories/MongoLastBlockFetchedByExchangeRepository.cs | 1,331 | C# |
namespace Dyalect.Compiler
{
public enum OpCode
{
Nop = 0, //0
Str, //0
This, //+1
Pop, //-1
PushNil, //+1
PushI1_0, //+1
PushI1_1, //+1
PushI8, //+1
PushI8_0, //+1
PushI8_1, //+1
PushR8, //+1
PushR8_0, //+1
PushR8_1, //+1
PushStr, //+1
PushCh, //+1
Br, //0
Brtrue, //-1
Brfalse, //-1
Shl, //-1
Shr, //-1
And, //-1
Or, //-1
Xor, //-1
Add, //-1
Sub, //-1
Mul, //-1
Div, //-1
Rem, //-1
Neg, //0
Plus, //0
Not, //0
BitNot, //0
Len, //0
Gt, //-1
Lt, //-1
Eq, //-1
NotEq, //-1
GtEq, //-1
LtEq, //-1
Pushloc, //1
Pushvar, //1
Pushext, //1
Poploc, //-1
Popvar, //-1
Ret, //0
Dup, //1
SyncPoint, //0
Fail, //-1
FailSys, //0
NewFun, //0
NewFunV, //0
NewIter, //0
SetMember, //-2
SetMemberT, //-2
GetMember, //-1
HasMember, //-1
SetMemberS, //-2
SetMemberST,//-2
Get, //-1
Set, //-3
RunMod, //+1
Type, //0
Tag, //0
Term, //0
Yield, //-1
PushNilT, //1
Brterm, //0
Briter, //0
Aux, //0
FunPrep, //0
FunArgIx, //-1
FunArgNm, //-1
FunCall, //0
NewTuple, //Dynamic
HasField, //0
TypeCheck, //0
TypeCheckT, //0
TypeCheckF, //0
TypeCheckFT,//0
Start, //0
End, //0
NewType, //0
TypeS, //1
TypeST, //1
CtorCheck, //0
IsNull, //0
GetIter, //0
Mut, //0
Priv, //0
TypeAnno, //0
TypeAnnoT, //0
SetType, //0
SetTypeT, //0
UnsetType, //0
NewAmg, //Dynamic
Tag0, //1
FunAttr, //0
}
}
| 23.169811 | 29 | 0.289902 | [
"MIT"
] | vorov2/dyalect | Dyalect/Compiler/OpCode.cs | 2,458 | C# |
using DaybreakGames.Census;
using DaybreakGames.Census.Exceptions;
using DaybreakGames.Census.Operators;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using watchtower.Models;
namespace watchtower.Census {
public class ItemCollection : IItemCollection {
private readonly ILogger<ItemCollection> _Logger;
private readonly ICensusQueryFactory _Census;
private readonly ConcurrentDictionary<string, PsItem?> _Cache = new ConcurrentDictionary<string, PsItem?>();
public ItemCollection(ILogger<ItemCollection> logger,
ICensusQueryFactory query) {
_Logger = logger;
_Census = query;
}
public async Task<PsItem?> GetByIDAsync(string ID) {
PsItem? item = null;
lock (_Cache) {
if (_Cache.TryGetValue(ID, out item)) {
return item;
}
}
item = await _GetFromCensus(ID, true);
lock (_Cache) {
_Cache.TryAdd(ID, item);
}
return item;
}
private async Task<PsItem?> _GetFromCensus(string ID, bool retry) {
CensusQuery query = _Census.Create("item");
query.Where("item_id").Equals(ID);
try {
JToken result = await query.GetAsync();
PsItem? player = _ParseItem(result);
return player;
} catch (CensusConnectionException ex) {
if (retry == true) {
_Logger.LogWarning("Retrying Item {Item} from API", ID);
return await _GetFromCensus(ID, false);
} else {
_Logger.LogError(ex, "Failed to get Item {0} from API", ID);
throw ex;
}
}
}
private PsItem? _ParseItem(JToken result) {
if (result == null) {
return null;
}
//_Logger.LogInformation($"{result}");
PsItem item = new PsItem() {
ItemID = result.Value<long?>("item_id") ?? 0,
TypeID = result.Value<string?>("item_type_id") ?? "0",
CategoryID = result.Value<string?>("item_category_id") ?? "0",
FactionID = result.Value<string?>("faction_id") ?? "0"
};
JToken? name = result.SelectToken("name");
if (name == null) {
_Logger.LogWarning($"Missing name token in {result}");
} else {
item.Name = name.Value<string?>("en") ?? "<MISSING NAME>";
}
return item;
}
}
}
| 29.375 | 116 | 0.537589 | [
"MIT"
] | Varunda/pwe-armor | Census/ItemCollection.cs | 2,822 | C# |
using System;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using PanoramicDataWin8.model.data.attribute;
using PanoramicDataWin8.model.data.idea;
using IDEA_common.catalog;
using System.Collections.Generic;
using System.Linq;
namespace PanoramicDataWin8.model.data.operation
{
public class PredictorOperationModel : ComputationalOperationModel, IFilterConsumerOperationModel
{
private readonly FilterConsumerOperationModelImpl _filterConsumerOperationModelImpl;
public PredictorOperationModel(OriginModel schemaModel, string rawName, string displayName = null) : base(schemaModel, DataType.Double, "numeric", rawName, displayName)
{
_filterConsumerOperationModelImpl = new FilterConsumerOperationModelImpl(this);
AttributeTransformationModelParameters.CollectionChanged += _attributeUsageModels_CollectionChanged;
IgnoredAttributeTransformationModels.CollectionChanged += _ignoredAttributeUsageModels_CollectionChanged;
}
public AttributeModel TargetAttributeUsageModel { get; set; }
public ObservableCollection<AttributeTransformationModel> IgnoredAttributeTransformationModels { get; } = new ObservableCollection<AttributeTransformationModel>();
public void UpdateBackendOperatorId(string backendOperatorId)
{
IDEAAttributeModel attributeModel = GetAttributeModel();
var funcModel = attributeModel.FuncModel as AttributeModel.AttributeFuncModel.AttributeBackendFuncModel;
funcModel.Id = backendOperatorId;
attributeModel.DataType = TargetAttributeUsageModel.DataType;
attributeModel.InputVisualizationType = TargetAttributeUsageModel.InputVisualizationType;
}
public FilteringOperation FilteringOperation
{
get { return _filterConsumerOperationModelImpl.FilteringOperation; }
set { _filterConsumerOperationModelImpl.FilteringOperation = value; }
}
public ObservableCollection<FilterLinkModel> ConsumerLinkModels
{
get { return _filterConsumerOperationModelImpl.ConsumerLinkModels; }
set { _filterConsumerOperationModelImpl.ConsumerLinkModels = value; }
}
private void _attributeUsageModels_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
FireOperationModelUpdated(new OperationModelUpdatedEventArgs());
}
private void _ignoredAttributeUsageModels_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
FireOperationModelUpdated(new OperationModelUpdatedEventArgs());
}
}
} | 46.016949 | 176 | 0.754696 | [
"Apache-2.0"
] | ezg/PanoramicDataWin8 | PanoramicDataWin8/model/data/operation/computational/PredictorOperationModel.cs | 2,717 | C# |
namespace Sitecore.Foundation.Alerts.Extensions
{
using System.Web.Mvc;
using System.Web.Mvc.Html;
using Sitecore.Diagnostics;
using Sitecore.Foundation.Alerts.Models;
using Sitecore.Data;
public static class AlertHtmlHelpers
{
public static MvcHtmlString PageEditorError(this HtmlHelper helper, string errorMessage)
{
Log.Error($@"Presentation error: {errorMessage}", typeof(AlertHtmlHelpers));
if (Context.PageMode.IsNormal)
{
return new MvcHtmlString(string.Empty);
}
return helper.Partial(ViewPath.InfoMessage, InfoMessage.Error(errorMessage));
}
public static MvcHtmlString PageEditorError(this HtmlHelper helper, string errorMessage, string friendlyMessage, ID contextItemId, ID renderingId)
{
Log.Error($@"Presentation error: {errorMessage}, Context item ID: {contextItemId}, Rendering ID: {renderingId}", typeof(AlertHtmlHelpers));
if (Context.PageMode.IsNormal)
{
return new MvcHtmlString(string.Empty);
}
return helper.Partial(ViewPath.InfoMessage, InfoMessage.Error(friendlyMessage));
}
}
} | 32.114286 | 150 | 0.72242 | [
"Apache-2.0"
] | SiriusBits/HS8Base | src/Foundation/Alerts/code/Extensions/AlertHtmlHelpers.cs | 1,126 | C# |
using System;
using System.Collections.Generic;
public static partial class Extension
{
/// <summary>
/// An ICollection<T> extension method that adds a collection of objects to the end of this collection only
/// for value who satisfies the predicate.
/// </summary>
/// <typeparam name="T">Generic type parameter.</typeparam>
/// <param name="this">The @this to act on.</param>
/// <param name="predicate">The predicate.</param>
/// <param name="values">A variable-length parameters list containing values.</param>
public static void AddRangeIf<T>(this ICollection<T> @this, Func<T, bool> predicate, params T[] values)
{
foreach (var value in values)
{
if (predicate(value)) @this.Add(value);
}
}
} | 37.904762 | 121 | 0.643216 | [
"MIT"
] | Cactus-Blade/Cactus.Blade.Collection | Collection/System.Collections.Generic.ICollection/ICollection.AddRangeIf.cs | 798 | C# |
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace EasyCrypto
{
/// <summary>
/// AES encryption helper class
/// </summary>
public static class AesEncryption
{
private static readonly byte[] _emptyKey = new byte[32];
// TODO: consider moving regions in separate classes or partial classes
#region methods with password
/// <summary>
/// Encrypts string and returns string. Salt and IV will be embedded to encrypted string.
/// Can later be decrypted with <see cref="DecryptWithPassword(string, string, ReportAndCancellationToken)"/>
/// IV and salt are generated by <see cref="CryptoRandom"/> which is using System.Security.Cryptography.Rfc2898DeriveBytes.
/// IV size is 16 bytes (128 bits) and key size will be 32 bytes (256 bits).
/// </summary>
/// <param name="dataToEncrypt">String to encrypt</param>
/// <param name="password">Password that is used for generating key for encryption/decryption</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
/// <returns>Encrypted string</returns>
public static string EncryptWithPassword(string dataToEncrypt, string password, ReportAndCancellationToken token = null)
{
byte[] data = Encoding.UTF8.GetBytes(dataToEncrypt);
byte[] result = EncryptWithPassword(data, password, token);
return Convert.ToBase64String(result);
}
/// <summary>
/// Decrypts string with embedded salt and IV that are encrypted with <see cref="EncryptWithPassword(byte[], string, ReportAndCancellationToken)"/>
/// </summary>
/// <param name="dataToDecrypt">string to decrypt</param>
/// <param name="password">Password that is used for generating key for encryption/decryption</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
/// <returns>Decrypted string</returns>
public static string DecryptWithPassword(string dataToDecrypt, string password, ReportAndCancellationToken token = null)
{
byte[] data = Convert.FromBase64String(dataToDecrypt);
byte[] result = DecryptWithPassword(data, password, token);
return Encoding.UTF8.GetString(result);
}
/// <summary>
/// Encrypts byte array and returns byte array. Salt and IV will be embedded in result.
/// Can be later decrypted using <see cref="DecryptWithPassword(byte[], string, ReportAndCancellationToken)"/>
/// IV and salt are generated by <see cref="CryptoRandom"/> which is using System.Security.Cryptography.Rfc2898DeriveBytes.
/// IV size is 16 bytes (128 bits) and key size will be 32 bytes (256 bits).
/// </summary>
/// <param name="dataToEncrypt">Bytes to encrypt</param>
/// <param name="password">Password that is used for generating key for encryption/decryption</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
/// <returns>Encrypted bytes</returns>
public static byte[] EncryptWithPassword(byte[] dataToEncrypt, string password, ReportAndCancellationToken token = null)
=> HandleByteToStream(dataToEncrypt, (inStream, outStream) => EncryptWithPassword(inStream, password, outStream, token));
/// <summary>
/// Decrypts byte array with embedded salt and IV that is encrypted with <see cref="EncryptWithPassword(byte[], string, ReportAndCancellationToken)"/>
/// </summary>
/// <param name="dataToDecrypt"></param>
/// <param name="password">Password that is used for generating key for encryption/decryption</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
/// <returns>Decrypted bytes</returns>
public static byte[] DecryptWithPassword(byte[] dataToDecrypt, string password, ReportAndCancellationToken token = null)
=> HandleByteToStream(dataToDecrypt, (inStream, outStream) => DecryptWithPassword(inStream, password, outStream, token));
/// <summary>
/// Reads data from stream (parameter dataToEncrypt) and writes encrypted data to stream (parameter destination).
/// Can be later decrypted using <see cref="DecryptWithPassword(Stream, string, Stream, ReportAndCancellationToken)"/>.
/// Salt and IV will be embedded to resulting stream.
/// IV and salt are generated by <see cref="CryptoRandom"/> which is using System.Security.Cryptography.Rfc2898DeriveBytes.
/// IV size is 16 bytes (128 bits) and key size will be 32 bytes (256 bits).
/// </summary>
/// <param name="dataToEncrypt">Stream containing data to encrypt</param>
/// <param name="password">Password that is used for generating key for encryption/decryption</param>
/// <param name="destination">Stream to which to write encrypted data</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
public static void EncryptWithPassword(Stream dataToEncrypt, string password, Stream destination, ReportAndCancellationToken token = null)
{
byte[] salt;
var ph = new PasswordHasher(32);
byte[] key = ph.HashPasswordAndGenerateSalt(password, out salt);
EncryptAndEmbedIv(dataToEncrypt, key, destination, salt, token);
}
/// <summary>
/// Reads data from stream (parameter dataToEncrypt) and writes encrypted data to stream (parameter destination) asynchronously.
/// Can be later decrypted using <see cref="DecryptWithPasswordAsync(Stream, string, Stream, ReportAndCancellationToken)"/>.
/// Salt and IV will be embedded to resulting stream.
/// IV and salt are generated by <see cref="CryptoRandom"/> which is using System.Security.Cryptography.Rfc2898DeriveBytes.
/// IV size is 16 bytes (128 bits) and key size will be 32 bytes (256 bits).
/// </summary>
/// <param name="dataToEncrypt">Stream containing data to encrypt</param>
/// <param name="password">Password that is used for generating key for encryption/decryption</param>
/// <param name="destination">Stream to which to write encrypted data</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
/// <returns>Task to await</returns>
public static Task EncryptWithPasswordAsync(Stream dataToEncrypt, string password, Stream destination, ReportAndCancellationToken token = null)
{
byte[] salt;
var ph = new PasswordHasher(32);
byte[] key = ph.HashPasswordAndGenerateSalt(password, out salt);
return EncryptAndEmbedIvAsync(dataToEncrypt, key, destination, salt, token);
}
/// <summary>
/// Decrypts the with password data that was encrypted with <see cref="EncryptWithPassword(Stream, string, Stream, ReportAndCancellationToken)"/>
/// </summary>
/// <param name="dataToDecrypt">The data to decrypt.</param>
/// <param name="password">The password.</param>
/// <param name="destination">The destination stream.</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
public static void DecryptWithPassword(Stream dataToDecrypt, string password, Stream destination, ReportAndCancellationToken token = null)
=> DecryptWithEmbeddedIv(dataToDecrypt, null, destination, password, token);
/// <summary>
/// Decrypts the with password asynchronously data that was encrypted with <see cref="EncryptWithPasswordAsync(Stream, string, Stream, ReportAndCancellationToken)"/>
/// </summary>
/// <param name="dataToDecrypt">The data to decrypt.</param>
/// <param name="password">The password.</param>
/// <param name="destination">The destination stream.</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
public static Task DecryptWithPasswordAsync(Stream dataToDecrypt, string password, Stream destination, ReportAndCancellationToken token = null)
=> DecryptWithEmbeddedIvAsync(dataToDecrypt, null, destination, password, token);
#endregion
#region methods with embedded iv
/// <summary>
/// Encrypts bytes and embeds IV. Can be decrypted with <see cref="DecryptWithEmbeddedIv(byte[], byte[], ReportAndCancellationToken)"/>
/// IV is generated by <see cref="CryptoRandom"/> which is using System.Security.Cryptography.Rfc2898DeriveBytes.
/// IV size is 16 bytes (128 bits) and key size will be 32 bytes (256 bits).
/// </summary>
/// <param name="dataToEncrypt">Bytes to encrypt</param>
/// <param name="key">Key that will be used for encryption/decryption</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
/// <returns>Byte array, encrypted data with embedded IV</returns>
public static byte[] EncryptAndEmbedIv(byte[] dataToEncrypt, byte[] key, ReportAndCancellationToken token = null)
=> HandleByteToStream(dataToEncrypt, (inStream, outStream) => EncryptAndEmbedIv(inStream, key, outStream, token));
/// <summary>
/// Decrypts bytes with embedded IV encrypted with <see cref="EncryptAndEmbedIv(byte[], byte[], ReportAndCancellationToken)"/>
/// </summary>
/// <param name="dataToDecrypt">Bytes, data with embedded IV, to decrypt</param>
/// <param name="key">Key that will be used for encryption/decryption, must be 16, 24 or 32 bytes long.</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
/// <returns>Byte array, encrypted data</returns>
public static byte[] DecryptWithEmbeddedIv(byte[] dataToDecrypt, byte[] key, ReportAndCancellationToken token = null)
=> HandleByteToStream(dataToDecrypt, (inStream, outStream) => DecryptWithEmbeddedIv(inStream, key, outStream, token));
/// <summary>
/// Encrypts and embeds IV into result. Data is read from stream and encrypted data is wrote to stream.
/// Can be decrypted with <see cref="DecryptWithEmbeddedIv(Stream, byte[], Stream, ReportAndCancellationToken)"/>
/// IV is generated by <see cref="CryptoRandom"/> which is using System.Security.Cryptography.Rfc2898DeriveBytes.
/// IV size is 16 bytes (128 bits).
/// </summary>
/// <param name="dataToEncrypt">Stream containing data to encrypt</param>
/// <param name="key">Key that will be used for encryption/decryption, must be 16, 24 or 32 bytes long.</param>
/// <param name="destination"></param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
public static void EncryptAndEmbedIv(Stream dataToEncrypt, byte[] key, Stream destination, ReportAndCancellationToken token = null)
=> EncryptAndEmbedIv(dataToEncrypt, key, destination, null, token);
private static void EncryptAndEmbedIv(Stream dataToEncrypt, byte[] key, Stream destination, byte[] salt, ReportAndCancellationToken token = null)
{
byte[] iv = CryptoRandom.NextBytesStatic(16);
Encrypt(new CryptoRequest
{
EmbedIV = true,
InData = dataToEncrypt,
OutData = destination,
IV = iv,
Key = key,
EmbedSalt = salt != null,
Salt = salt,
Token = token
});
}
private static Task EncryptAndEmbedIvAsync(Stream dataToEncrypt, byte[] key, Stream destination, byte[] salt, ReportAndCancellationToken token = null)
{
byte[] iv = CryptoRandom.NextBytesStatic(16);
return EncryptAsync(new CryptoRequest
{
EmbedIV = true,
InData = dataToEncrypt,
OutData = destination,
IV = iv,
Key = key,
EmbedSalt = salt != null,
Salt = salt,
Token = token
});
}
/// <summary>
/// Decrypts data with embedded IV, that is encrypted with <see cref="EncryptAndEmbedIv(Stream, byte[], Stream, ReportAndCancellationToken)"/>, into result.
/// Data is read from stream and decrypted data is wrote to stream.
/// </summary>
/// <param name="dataToDecrypt">Stream containing data to decrypt.</param>
/// <param name="key">Key that will be used for encryption/decryption, must be 16, 24 or 32 bytes long.</param>
/// <param name="destination">Stream to which decrypted data will be wrote.</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
public static void DecryptWithEmbeddedIv(Stream dataToDecrypt, byte[] key, Stream destination, ReportAndCancellationToken token = null)
=> DecryptWithEmbeddedIv(dataToDecrypt, key, destination, null, token);
private static void DecryptWithEmbeddedIv(Stream dataToDecrypt, byte[] key, Stream destination, string password, ReportAndCancellationToken token = null)
{
Decrypt(new CryptoRequest
{
EmbedIV = true,
InData = dataToDecrypt,
OutData = destination,
Key = key,
Password = password,
EmbedSalt = password != null,
Token = token
});
}
private static Task DecryptWithEmbeddedIvAsync(Stream dataToDecrypt, byte[] key, Stream destination, string password, ReportAndCancellationToken token = null)
{
return DecryptAsync(new CryptoRequest
{
EmbedIV = true,
InData = dataToDecrypt,
OutData = destination,
Key = key,
Password = password,
EmbedSalt = password != null,
Token = token
});
}
#endregion
#region base methods
/// <summary>
/// Encrypts data from byte array to byte array.
/// </summary>
/// <param name="dataToEncrypt"></param>
/// <param name="key">Key that will be used for encryption/decryption, must be 16, 24 or 32 bytes long.</param>
/// <param name="iv">Initialization vector, must be 16 bytes</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
/// <returns>Encrypted data in for of bytes</returns>
public static byte[] Encrypt(byte[] dataToEncrypt, byte[] key, byte[] iv, ReportAndCancellationToken token = null)
=> HandleByteToStream(dataToEncrypt, (inStream, outStream) =>
Encrypt(new CryptoRequest
{
EmbedIV = true,
InData = inStream,
OutData = outStream,
IV = iv,
Key = key,
Token = token
}));
/// <summary>
/// Decrypts data from byte array to byte array.
/// </summary>
/// <param name="dataToDecrypt"></param>
/// <param name="key">Key that will be used for encryption/decryption, must be 16, 24 or 32 bytes long.</param>
/// <param name="iv">Initialization vector, must be 16 bytes</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
/// <returns>Decrypted data in for of bytes</returns>
public static byte[] Decrypt(byte[] dataToDecrypt, byte[] key, byte[] iv, ReportAndCancellationToken token = null)
=> HandleByteToStream(dataToDecrypt, (inStream, outStream) => Decrypt(inStream, key, iv, outStream, token));
/// <summary>
/// Encrypts data from stream to stream.
/// </summary>
/// <param name="dataToEncrypt">Stream with data to decrypt.</param>
/// <param name="key">Key that will be used for encryption/decryption, must be 16, 24 or 32 bytes long.</param>
/// <param name="iv">Initialization vector, must be 16 bytes</param>
/// <param name="destination">Stream to which encrypted data will be wrote.</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
public static void Encrypt(Stream dataToEncrypt, byte[] key, byte[] iv, Stream destination, ReportAndCancellationToken token = null)
=> Encrypt(new CryptoRequest
{
SkipValidations = false,
InData = dataToEncrypt,
OutData = destination,
Key = key,
IV = iv,
Token = token
});
/// <summary>
/// Encrypts data from stream to stream asynchronously.
/// </summary>
/// <param name="dataToEncrypt">Stream with data to decrypt.</param>
/// <param name="key">Key that will be used for encryption/decryption, must be 16, 24 or 32 bytes long.</param>
/// <param name="iv">Initialization vector, must be 16 bytes</param>
/// <param name="destination">Stream to which encrypted data will be wrote.</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
/// <returns>Task to await</returns>
public static Task EncryptAsync(Stream dataToEncrypt, byte[] key, byte[] iv, Stream destination, ReportAndCancellationToken token = null)
=> EncryptAsync(new CryptoRequest
{
SkipValidations = false,
InData = dataToEncrypt,
OutData = destination,
Key = key,
IV = iv,
Token = token
});
/// <summary>
/// Decrypts data from stream to stream.
/// </summary>
/// <param name="dataToDecrypt">Stream with data to encrypt.</param>
/// <param name="key">Key that will be used for encryption/decryption, must be 16, 24 or 32 bytes long.</param>
/// <param name="iv">Initialization vector, must be 16 bytes</param>
/// <param name="destination">Stream to which decrypted data will be wrote.</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
public static void Decrypt(Stream dataToDecrypt, byte[] key, byte[] iv, Stream destination, ReportAndCancellationToken token = null)
=> Decrypt(new CryptoRequest
{
IV = iv,
Key = key,
InData = dataToDecrypt,
OutData = destination,
SkipValidations = false,
Token = token
});
/// <summary>
/// Decrypts data from stream to stream asynchronously.
/// </summary>
/// <param name="dataToDecrypt">Stream with data to encrypt.</param>
/// <param name="key">Key that will be used for encryption/decryption, must be 16, 24 or 32 bytes long.</param>
/// <param name="iv">Initialization vector, must be 16 bytes</param>
/// <param name="destination">Stream to which decrypted data will be wrote.</param>
/// <param name="token">Optional token for progress reporting and canceling operation.</param>
/// <returns>Task to await</returns>
public static Task DecryptAsync(Stream dataToDecrypt, byte[] key, byte[] iv, Stream destination, ReportAndCancellationToken token = null)
=> DecryptAsync(new CryptoRequest
{
IV = iv,
Key = key,
InData = dataToDecrypt,
OutData = destination,
SkipValidations = false,
Token = token
});
internal static void Encrypt(CryptoRequest request)
{
CryptoContainer container = request.ValidateEncryption();
ReportAndCancellationToken token = request.Token ?? new ReportAndCancellationToken();
token.CanReportProgress = request.InData.CanSeek;
using (var aes = GetAes())
using (var encryptor = GetEncryptorAndSetAes(aes, request))
{
int bufferSize = aes.BlockSize;
if (token.CanReportProgress ?? false)
{
token.NumberOfIterations = (int)Math.Ceiling(request.InData.Length / (double)bufferSize);
}
CryptoStream cs = new CryptoStream(request.OutData, encryptor, CryptoStreamMode.Write);
byte[] buffer = new byte[bufferSize];
int read = 0;
int iterationCount = 0;
while ((read = request.InData.Read(buffer, 0, bufferSize)) > 0)
{
cs.Write(buffer, 0, read);
cs.Flush();
if (token.IsCanceled)
{
break;
}
iterationCount++;
token.ReportProgressInternal(iterationCount);
}
if (token.IsCanceled)
{
return;
}
cs.FlushFinalBlock();
}
if (!request.SkipValidations)
{
container.WriteChecksAndEmbeddedData();
}
}
internal static async Task EncryptAsync(CryptoRequest request)
{
CryptoContainer container = request.ValidateEncryption();
ReportAndCancellationToken token = request.Token ?? new ReportAndCancellationToken();
token.CanReportProgress = request.InData.CanSeek;
using (var aes = GetAes())
using (var encryptor = GetEncryptorAndSetAes(aes, request))
{
int bufferSize = aes.BlockSize;
if (token.CanReportProgress ?? false)
{
token.NumberOfIterations = (int)Math.Ceiling(request.InData.Length / (double)bufferSize);
}
CryptoStream cs = new CryptoStream(request.OutData, encryptor, CryptoStreamMode.Write);
byte[] buffer = new byte[bufferSize];
int read = 0;
int iterationCount = 0;
while ((read = await request.InData.ReadAsync(buffer, 0, bufferSize)) > 0)
{
await cs.WriteAsync(buffer, 0, read);
await cs.FlushAsync();
if (token.IsCanceled)
{
break;
}
iterationCount++;
token.ReportProgressInternal(iterationCount);
}
if (token.IsCanceled)
{
return;
}
cs.FlushFinalBlock();
}
if (!request.SkipValidations)
{
await container.WriteChecksAndEmbeddedDataAsync();
}
}
internal static void Decrypt(CryptoRequest request)
{
CryptoContainer container = request.ValidateDecrypt(request);
ReportAndCancellationToken token = request.Token ?? new ReportAndCancellationToken();
token.CanReportProgress = request.InData.CanSeek;
using (var aes = GetAes())
using (ICryptoTransform decryptor = GetDecryptorAndSetAes(aes, request))
{
int bufferSize = aes.BlockSize;
if (token.CanReportProgress ?? false)
{
token.NumberOfIterations = (int)Math.Ceiling(request.InData.Length / (double)bufferSize);
}
CryptoStream cs = new CryptoStream(request.OutData, decryptor, CryptoStreamMode.Write);
byte[] buffer = new byte[bufferSize];
int read = 0;
int iterationCount = 0;
while ((read = request.InData.Read(buffer, 0, bufferSize)) > 0)
{
cs.Write(buffer, 0, read);
cs.Flush();
if (token.IsCanceled)
{
break;
}
iterationCount++;
token.ReportProgressInternal(iterationCount);
}
if (token.IsCanceled)
{
return;
}
cs.FlushFinalBlock();
}
}
internal static async Task DecryptAsync(CryptoRequest request)
{
CryptoContainer container = request.ValidateDecrypt(request);
ReportAndCancellationToken token = request.Token ?? new ReportAndCancellationToken();
token.CanReportProgress = request.InData.CanSeek;
using (var aes = GetAes())
using (ICryptoTransform decryptor = GetDecryptorAndSetAes(aes, request))
{
int bufferSize = aes.BlockSize;
if (token.CanReportProgress ?? false)
{
token.NumberOfIterations = (int)Math.Ceiling(request.InData.Length / (double)bufferSize);
}
CryptoStream cs = new CryptoStream(request.OutData, decryptor, CryptoStreamMode.Write);
byte[] buffer = new byte[bufferSize];
int read = 0;
int iterationCount = 0;
while ((read = await request.InData.ReadAsync(buffer, 0, bufferSize)) > 0)
{
await cs.WriteAsync(buffer, 0, read);
await cs.FlushAsync();
if (token.IsCanceled)
{
break;
}
iterationCount++;
token.ReportProgressInternal(iterationCount);
}
if (token.IsCanceled)
{
return;
}
cs.FlushFinalBlock();
}
}
#endregion
#region validations
/// <summary>
/// Validates the encrypted data.
/// </summary>
/// <param name="encryptedData">The encrypted data</param>
/// <param name="key">The key</param>
/// <param name="iv">The IV</param>
/// <returns>ValidationResult</returns>
public static ValidationResult ValidateEncryptedData(byte[] encryptedData, byte[] key, byte[] iv)
=> HandleByteToStream(encryptedData, (stream) => ValidateEncryptedData(stream, key, iv));
/// <summary>
/// Validates the encrypted data.
/// </summary>
/// <param name="encryptedData">The encrypted data</param>
/// <param name="key">The key</param>
/// <param name="iv">The IV</param>
/// <returns>ValidationResult</returns>
public static ValidationResult ValidateEncryptedData(Stream encryptedData, byte[] key, byte[] iv)
=> ValidateEncryptedData(new CryptoRequest
{
InData = encryptedData,
IV = iv,
Key = key
});
/// <summary>
/// Validates the encrypted data.
/// </summary>
/// <param name="encryptedData">The encrypted data</param>
/// <param name="key">Key used for encryption</param>
/// <returns>ValidationResult</returns>
public static ValidationResult ValidateEncryptedDataWithEmbededIv(byte[] encryptedData, byte[] key)
=> HandleByteToStream(encryptedData, (stream) => ValidateEncryptedDataWithEmbededIv(stream, key));
/// <summary>
/// Validates the encrypted data.
/// </summary>
/// <param name="encryptedData">The encrypted data</param>
/// <param name="key">Key used for encryption</param>
/// <returns>ValidationResult</returns>
public static ValidationResult ValidateEncryptedDataWithEmbededIv(Stream encryptedData, byte[] key)
=> ValidateEncryptedData(new CryptoRequest
{
InData = encryptedData,
Key = key,
EmbedIV = true
});
/// <summary>
/// Validates the encrypted data.
/// </summary>
/// <param name="encryptedData">The encrypted data</param>
/// <param name="password">Password used for encryption</param>
/// <returns>ValidationResult</returns>
public static ValidationResult ValidateEncryptedDataWithPassword(string encryptedData, string password)
=> ValidateEncryptedDataWithPassword(Convert.FromBase64String(encryptedData), password);
/// <summary>
/// Validates the encrypted data.
/// </summary>
/// <param name="encryptedData">The encrypted data</param>
/// <param name="password">Password used for encryption</param>
/// <returns>ValidationResult</returns>
public static ValidationResult ValidateEncryptedDataWithPassword(byte[] encryptedData, string password)
=> HandleByteToStream(encryptedData, (stream) => ValidateEncryptedDataWithPassword(stream, password));
/// <summary>
/// Validates the encrypted data.
/// </summary>
/// <param name="encryptedData">The encrypted data</param>
/// <param name="password">Password used for encryption</param>
/// <returns>ValidationResult</returns>
public static ValidationResult ValidateEncryptedDataWithPassword(Stream encryptedData, string password)
=> ValidateEncryptedData(new CryptoRequest
{
InData = encryptedData,
EmbedIV = true,
EmbedSalt = true,
Password = password
});
internal static ValidationResult ValidateEncryptedData(CryptoRequest request)
=> CryptoContainer.CreateForDecryption(request).ReadAndValidateDataForDecryption();
#endregion
internal static byte[] HandleByteToStream(byte[] data, Action<Stream, Stream> action)
{
byte[] result;
using (Stream inStream = new MemoryStream())
using (Stream outStream = new MemoryStream())
{
inStream.Write(data, 0, data.Length);
inStream.Flush();
inStream.Position = 0;
action(inStream, outStream);
outStream.Position = 0;
result = new byte[outStream.Length];
outStream.Read(result, 0, result.Length);
}
return result;
}
internal static ValidationResult HandleByteToStream(byte[] data, Func<Stream, ValidationResult> func)
{
ValidationResult result;
using (Stream stream = new MemoryStream())
{
stream.Write(data, 0, data.Length);
stream.Flush();
stream.Position = 0;
result = func(stream);
}
return result;
}
private static Aes GetAes() => Aes.Create();
private static ICryptoTransform GetEncryptorAndSetAes(Aes aes, CryptoRequest request)
{
aes.IV = request.IV;
aes.Key = request.Key;
// aes.Padding = PaddingMode.PKCS7;
// aes.BlockSize = 128;
return aes.CreateEncryptor();
}
private static ICryptoTransform GetDecryptorAndSetAes(Aes aes, CryptoRequest request)
{
aes.IV = request.IV;
aes.Key = request.Key;
// aes.Padding = PaddingMode.PKCS7;
// aes.BlockSize = 128;
return aes.CreateDecryptor();
}
}
}
| 49.159332 | 173 | 0.597049 | [
"MIT"
] | stanac/EasyCrypto | src/EasyCrypto/AesEncryption.cs | 32,398 | C# |
namespace MyMvcProjectTemplate.Web.ViewModels.Account
{
public class ExternalLoginListViewModel
{
public string ReturnUrl { get; set; }
}
}
| 20.125 | 54 | 0.701863 | [
"MIT"
] | Borayvor/Templates | MyMvcProjectTemplate/Web/MyMvcProjectTemplate.Web/ViewModels/Account/ExternalLoginListViewModel.cs | 163 | C# |
/*
* THIS FILE WAS GENERATED BY PLOTLY.BLAZOR.GENERATOR
*/
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text.Json.Serialization;
namespace Plotly.Blazor.Traces.ContourCarpetLib.ColorBarLib.TitleLib
{
/// <summary>
/// The Font class.
/// </summary>
[System.CodeDom.Compiler.GeneratedCode("Plotly.Blazor.Generator", "1.0.0.0")]
[Serializable]
public class Font : IEquatable<Font>
{
/// <summary>
/// HTML font family - the typeface that will be applied by the web browser.
/// The web browser will only be able to apply a font if it is available on
/// the system which it operates. Provide multiple font families, separated
/// by commas, to indicate the preference in which to apply fonts if they aren't
/// available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com
/// or on-premise) generates images on a server, where only a select number
/// of fonts are installed and supported. These include <c>Arial</c>, <c>Balto</c>,
/// 'Courier New', 'Droid Sans',, 'Droid Serif', 'Droid
/// Sans Mono', 'Gravitas One', 'Old Standard TT', 'Open
/// Sans', <c>Overpass</c>, 'PT Sans Narrow', <c>Raleway</c>, 'Times
/// New Roman'.
/// </summary>
[JsonPropertyName(@"family")]
public string Family { get; set;}
/// <summary>
/// Gets or sets the Size.
/// </summary>
[JsonPropertyName(@"size")]
public decimal? Size { get; set;}
/// <summary>
/// Gets or sets the Color.
/// </summary>
[JsonPropertyName(@"color")]
public object Color { get; set;}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (!(obj is Font other)) return false;
return ReferenceEquals(this, obj) || Equals(other);
}
/// <inheritdoc />
public bool Equals([AllowNull] Font other)
{
if (other == null) return false;
if (ReferenceEquals(this, other)) return true;
return
(
Family == other.Family ||
Family != null &&
Family.Equals(other.Family)
) &&
(
Size == other.Size ||
Size != null &&
Size.Equals(other.Size)
) &&
(
Color == other.Color ||
Color != null &&
Color.Equals(other.Color)
);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
var hashCode = 41;
if (Family != null) hashCode = hashCode * 59 + Family.GetHashCode();
if (Size != null) hashCode = hashCode * 59 + Size.GetHashCode();
if (Color != null) hashCode = hashCode * 59 + Color.GetHashCode();
return hashCode;
}
}
/// <summary>
/// Checks for equality of the left Font and the right Font.
/// </summary>
/// <param name="left">Left Font.</param>
/// <param name="right">Right Font.</param>
/// <returns>Boolean</returns>
public static bool operator == (Font left, Font right)
{
return Equals(left, right);
}
/// <summary>
/// Checks for inequality of the left Font and the right Font.
/// </summary>
/// <param name="left">Left Font.</param>
/// <param name="right">Right Font.</param>
/// <returns>Boolean</returns>
public static bool operator != (Font left, Font right)
{
return !Equals(left, right);
}
/// <summary>
/// Gets a deep copy of this instance.
/// </summary>
/// <returns>Font</returns>
public Font DeepClone()
{
return this.Copy();
}
}
} | 35.024194 | 99 | 0.510477 | [
"MIT"
] | valu8/Plotly.Blazor | Plotly.Blazor/Traces/ContourCarpetLib/ColorBarLib/TitleLib/Font.cs | 4,343 | C# |
using Nop.Core.Domain.Customers;
namespace Nop.Services.Customers
{
/// <summary>
/// Customer registration request
/// </summary>
public class CustomerRegistrationRequest
{
/// <summary>
/// Customer
/// </summary>
public Customer Customer { get; set; }
/// <summary>
/// Email
/// </summary>
public string Email { get; set; }
/// <summary>
/// Username
/// </summary>
public string Username { get; set; }
/// <summary>
/// Password
/// </summary>
public string Password { get; set; }
/// <summary>
/// Password format
/// </summary>
public PasswordFormat PasswordFormat { get; set; }
/// <summary>
/// Is approved
/// </summary>
public bool IsApproved { get; set; }
/// <summary>
/// Ctor
/// </summary>
/// <param name="customer">Customer</param>
/// <param name="email">Email</param>
/// <param name="username">Username</param>
/// <param name="password">Password</param>
/// <param name="passwordFormat">Password fprmat</param>
/// <param name="isApproved">Is approved</param>
public CustomerRegistrationRequest(Customer customer, string email, string username,
string password,
PasswordFormat passwordFormat,
bool isApproved = true)
{
this.Customer = customer;
this.Email = email;
this.Username = username;
this.Password = password;
this.PasswordFormat = passwordFormat;
this.IsApproved = isApproved;
}
}
}
| 29.948276 | 92 | 0.525619 | [
"MIT"
] | tebyaniyan/internet-Shop | Libraries/Nop.Services/Customers/CustomerRegistrationRequest.cs | 1,739 | C# |
/*
MIT License
Copyright (c) 2020 Jeff Campbell
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;
namespace JCMG.EntitasRedux
{
/// <summary>
/// Base exception used by EntitasRedux.
/// </summary>
public class EntitasReduxException : Exception
{
public EntitasReduxException(string message, string hint)
: base(hint != null ? message + "\n" + hint : message)
{
}
}
}
| 33.634146 | 77 | 0.772299 | [
"MIT"
] | HitCache/Entitas-Redux | Plugins/EntitasRedux.Core/EntitasReduxException.cs | 1,381 | C# |
using ManagedCuda.BasicTypes;
using ManagedCuda.CudaBlas;
using System;
using TensorSharp.Core;
using TensorSharp.Cpu;
namespace TensorSharp.CUDA.MatrixMul
{
public static class CudaMatrixMulMM
{
// Computes c := alpha * a * b + beta * c
public static void Gemm(TSCudaContext context, float alpha, Tensor a, Tensor b, float beta, Tensor c)
{
if (a.Sizes[0] != c.Sizes[0] || b.Sizes[1] != c.Sizes[1] || a.Sizes[1] != b.Sizes[0])
{
throw new InvalidOperationException("Size mismatch");
}
BlasOp aOp = default(BlasOp);
BlasOp bOp = default(BlasOp);
bool copyC = false;
Tensor aClone = null;
Tensor bClone = null;
Tensor cClone = null;
if (c.Strides[0] == 1 &&
c.Strides[1] != 0 && c.Strides[1] != 1)
{
// If c is contiguous in dimension 0 (column-major)
aClone = a.CopyRef();
bClone = b.CopyRef();
cClone = c.CopyRef();
}
else if (c.Strides[1] == 1 &&
c.Strides[0] != 0 && c.Strides[0] != 1)
{
// If c is contiguous in dimension 1 (row-major)
// using (a * b)' == b' * a'
// we can pass row-major matrices to BLAS functions that expect column-major by swapping A and B,
// and transposing all 3 matrices
cClone = c.Transpose();
aClone = b.Transpose(); // Note swap of a and b
bClone = a.Transpose();
}
else
{
Tensor cNew = new Tensor(c.Allocator, c.ElementType, c.Sizes[1], c.Sizes[0]);
cClone = cNew.Transpose();
Ops.Copy(cClone, c);
cNew.Dispose();
copyC = true;
aClone = a.CopyRef();
bClone = b.CopyRef();
}
try
{
if (aClone.Strides[0] == 1 &&
aClone.Strides[1] != 0 && aClone.Strides[1] != 1)
{
// If a is contiguous in dimension 0 (column-major)
aOp = BlasOp.NonTranspose;
}
else if (aClone.Strides[1] == 1 &&
aClone.Strides[0] != 0 && aClone.Strides[0] != 1)
{
aOp = BlasOp.Transpose;
Tensor aNew = aClone.Transpose();
aClone.Dispose();
aClone = aNew;
}
else
{
Tensor aNew = new Tensor(aClone.Allocator, aClone.ElementType, aClone.Sizes[1], aClone.Sizes[0]);
Tensor aClone2 = aNew.Transpose();
Ops.Copy(aClone2, aClone);
aClone.Dispose();
aClone = aClone2;
aNew.Dispose();
aOp = BlasOp.NonTranspose;
}
if (bClone.Strides[0] == 1 &&
bClone.Strides[1] != 0 && bClone.Strides[1] != 1)
{
// If a is contiguous in dimension 0 (column-major)
bOp = BlasOp.NonTranspose;
}
else if (bClone.Strides[1] == 1 &&
bClone.Strides[0] != 0 && bClone.Strides[0] != 1)
{
bOp = BlasOp.Transpose;
Tensor bNew = bClone.Transpose();
bClone.Dispose();
bClone = bNew;
}
else
{
Tensor bNew = new Tensor(bClone.Allocator, bClone.ElementType, bClone.Sizes[1], bClone.Sizes[0]);
Tensor bClone2 = bNew.Transpose();
Ops.Copy(bClone2, bClone);
bClone.Dispose();
bClone = bClone2;
bNew.Dispose();
bOp = BlasOp.NonTranspose;
}
GemmOp(context, aOp, bOp, alpha, aClone, bClone, beta, cClone);
if (copyC)
{
Ops.Copy(c, cClone);
}
}
finally
{
aClone.Dispose();
bClone.Dispose();
cClone.Dispose();
}
}
// Computes c := alpha * a * b + beta * c
public static void GemmBatch(TSCudaContext context, float alpha, Tensor a, Tensor b, float beta, Tensor c)
{
if (a.Sizes[1] != c.Sizes[1] || b.Sizes[2] != c.Sizes[2] || a.Sizes[2] != b.Sizes[1])
{
throw new InvalidOperationException("Size mismatch");
}
BlasOp aOp = default(BlasOp);
BlasOp bOp = default(BlasOp);
bool copyC = false;
Tensor aClone = null;
Tensor bClone = null;
Tensor cClone = null;
if (c.Strides[1] == 1 &&
c.Strides[2] != 0 && c.Strides[2] != 1)
{
// If c is contiguous in dimension 0 (column-major)
aClone = a.CopyRef();
bClone = b.CopyRef();
cClone = c.CopyRef();
}
else if (c.Strides[2] == 1 &&
c.Strides[1] != 0 && c.Strides[1] != 1)
{
// If c is contiguous in dimension 1 (row-major)
// using (a * b)' == b' * a'
// we can pass row-major matrices to BLAS functions that expect column-major by swapping A and B,
// and transposing all 3 matrices
cClone = c.Transpose(1, 2);
aClone = b.Transpose(1, 2); // Note swap of a and b
bClone = a.Transpose(1, 2);
}
else
{
Tensor cNew = new Tensor(c.Allocator, c.ElementType, c.Sizes[0], c.Sizes[2], c.Sizes[1]);
cClone = cNew.Transpose(1, 2);
Ops.Copy(cClone, c);
cNew.Dispose();
copyC = true;
aClone = a.CopyRef();
bClone = b.CopyRef();
}
try
{
if (aClone.Strides[1] == 1 &&
aClone.Strides[2] != 0 && aClone.Strides[2] != 1)
{
// If a is contiguous in dimension 0 (column-major)
aOp = BlasOp.NonTranspose;
}
else if (aClone.Strides[2] == 1 &&
aClone.Strides[1] != 0 && aClone.Strides[1] != 1)
{
aOp = BlasOp.Transpose;
Tensor aNew = aClone.Transpose(1, 2);
aClone.Dispose();
aClone = aNew;
}
else
{
Tensor aNew = new Tensor(aClone.Allocator, aClone.ElementType, aClone.Sizes[0], aClone.Sizes[2], aClone.Sizes[1]);
Tensor aClone2 = aNew.Transpose(1, 2);
Ops.Copy(aClone2, aClone);
aClone.Dispose();
aClone = aClone2;
aNew.Dispose();
aOp = BlasOp.NonTranspose;
}
if (bClone.Strides[1] == 1 &&
bClone.Strides[2] != 0 && bClone.Strides[2] != 1)
{
// If a is contiguous in dimension 0 (column-major)
bOp = BlasOp.NonTranspose;
}
else if (bClone.Strides[2] == 1 &&
bClone.Strides[1] != 0 && bClone.Strides[1] != 1)
{
bOp = BlasOp.Transpose;
Tensor bNew = bClone.Transpose(1, 2);
bClone.Dispose();
bClone = bNew;
}
else
{
Tensor bNew = new Tensor(bClone.Allocator, bClone.ElementType, bClone.Sizes[0], bClone.Sizes[2], bClone.Sizes[1]);
Tensor bClone2 = bNew.Transpose(1, 2);
Ops.Copy(bClone2, bClone);
bClone.Dispose();
bClone = bClone2;
bNew.Dispose();
bOp = BlasOp.NonTranspose;
}
GemmOpBatch(context, aOp, bOp, alpha, aClone, bClone, beta, cClone);
if (copyC)
{
Ops.Copy(c, cClone);
}
}
finally
{
aClone.Dispose();
bClone.Dispose();
cClone.Dispose();
}
}
private static Operation GetCudaBlasOp(BlasOp op)
{
switch (op)
{
case BlasOp.NonTranspose: return Operation.NonTranspose;
case BlasOp.Transpose: return Operation.Transpose;
case BlasOp.ConjugateTranspose: return Operation.ConjugateTranspose;
default:
throw new InvalidOperationException("BlasOp not supported: " + op);
}
}
private static void GemmOp(TSCudaContext context, BlasOp transA, BlasOp transB, float alpha, Tensor a, Tensor b, float beta, Tensor c)
{
if (a.Strides[0] != 1)
{
throw new ArgumentException($"a must be contiguous in the first dimension (column major / fortran order). ({a.Strides[0]},{a.Strides[1]}) ({b.Strides[0]},{b.Strides[1]}) ({c.Strides[0]},{c.Strides[1]})");
}
if (b.Strides[0] != 1)
{
throw new ArgumentException("b must be contiguous in the first dimension (column major / fortran order)");
}
if (c.Strides[0] != 1)
{
throw new ArgumentException("c must be contiguous in the first dimension (column major / fortran order)");
}
using (Util.PooledObject<CudaBlas> blas = context.BlasForTensor(c))
{
bool nta = transA == BlasOp.NonTranspose;
bool ntb = transB == BlasOp.NonTranspose;
Operation transa = GetCudaBlasOp(transA);
Operation transb = GetCudaBlasOp(transB);
int m = (int)a.Sizes[nta ? 0 : 1];
int k = (int)b.Sizes[ntb ? 0 : 1];
int n = (int)b.Sizes[ntb ? 1 : 0];
int lda = (int)a.Strides[1];
int ldb = (int)b.Strides[1];
int ldc = (int)c.Strides[1];
if (c.ElementType == DType.Float32)
{
CUdeviceptr aPtrSingle = CudaHelpers.GetBufferStart(a);
CUdeviceptr bPtrSingle = CudaHelpers.GetBufferStart(b);
CUdeviceptr cPtrSingle = CudaHelpers.GetBufferStart(c);
CublasStatus _statusF32 = CudaBlasNativeMethods.cublasSgemm_v2(blas.Value.CublasHandle,
transa, transb, m, n, k, ref alpha, aPtrSingle, lda, bPtrSingle, ldb, ref beta, cPtrSingle, ldc);
if (_statusF32 != CublasStatus.Success)
{
throw new CudaBlasException(_statusF32);
}
}
else if (c.ElementType == DType.Float64)
{
CUdeviceptr aPtrDouble = CudaHelpers.GetBufferStart(a);
CUdeviceptr bPtrDouble = CudaHelpers.GetBufferStart(b);
CUdeviceptr cPtrDouble = CudaHelpers.GetBufferStart(c);
double alphaDouble = alpha;
double betaDouble = beta;
CublasStatus _statusF64 = CudaBlasNativeMethods.cublasDgemm_v2(blas.Value.CublasHandle,
transa, transb, m, n, k, ref alphaDouble, aPtrDouble, lda, bPtrDouble, ldb, ref betaDouble, cPtrDouble, ldc);
if (_statusF64 != CublasStatus.Success)
{
throw new CudaBlasException(_statusF64);
}
}
else
{
throw new NotSupportedException("CUDA GEMM with element type " + c.ElementType + " not supported");
}
}
}
private static void GemmOpBatch(TSCudaContext context, BlasOp transA, BlasOp transB, float alpha, Tensor a, Tensor b, float beta, Tensor c)
{
if (a.Strides[1] != 1)
{
throw new ArgumentException($"a must be contiguous in the first dimension (column major / fortran order). ({a.Strides[0]},{a.Strides[1]}) ({b.Strides[0]},{b.Strides[1]}) ({c.Strides[0]},{c.Strides[1]})");
}
if (b.Strides[1] != 1)
{
throw new ArgumentException("b must be contiguous in the first dimension (column major / fortran order)");
}
if (c.Strides[1] != 1)
{
throw new ArgumentException($"c must be contiguous in the first dimension (column major / fortran order) ({a.Strides[0]}, {a.Strides[1]}, {a.Strides[2]}) ({b.Strides[0]}, {b.Strides[1]}, {b.Strides[2]}) ({c.Strides[0]}, {c.Strides[1]}, {c.Strides[2]})");
}
using (Util.PooledObject<CudaBlas> blas = context.BlasForTensor(c))
{
bool nta = transA == BlasOp.NonTranspose;
bool ntb = transB == BlasOp.NonTranspose;
Operation transa = GetCudaBlasOp(transA);
Operation transb = GetCudaBlasOp(transB);
int m = (int)a.Sizes[nta ? 1 : 2];
int k = (int)b.Sizes[ntb ? 1 : 2];
int n = (int)b.Sizes[ntb ? 2 : 1];
int lda = (int)a.Strides[2];
int ldb = (int)b.Strides[2];
int ldc = (int)c.Strides[2];
int stra = (int)a.Strides[0];
int strb = (int)b.Strides[0];
int strc = (int)c.Strides[0];
int batchSize = (int)c.Sizes[0];
if (c.ElementType == DType.Float32)
{
CUdeviceptr aPtrSingle = CudaHelpers.GetBufferStart(a);
CUdeviceptr bPtrSingle = CudaHelpers.GetBufferStart(b);
CUdeviceptr cPtrSingle = CudaHelpers.GetBufferStart(c);
CublasStatus _statusF32 = CudaBlasNativeMethods.cublasSgemmStridedBatched(blas.Value.CublasHandle,
transa, transb, m, n, k, ref alpha, aPtrSingle, lda, stra, bPtrSingle, ldb, strb, ref beta, cPtrSingle, ldc, strc, batchSize);
if (_statusF32 != CublasStatus.Success)
{
throw new CudaBlasException(_statusF32);
}
}
else if (c.ElementType == DType.Float64)
{
CUdeviceptr aPtrDouble = CudaHelpers.GetBufferStart(a);
CUdeviceptr bPtrDouble = CudaHelpers.GetBufferStart(b);
CUdeviceptr cPtrDouble = CudaHelpers.GetBufferStart(c);
double alphaDouble = alpha;
double betaDouble = beta;
CublasStatus _statusF64 = CudaBlasNativeMethods.cublasDgemmStridedBatched(blas.Value.CublasHandle,
transa, transb, m, n, k, ref alphaDouble, aPtrDouble, lda, stra, bPtrDouble, ldb, strb, ref betaDouble, cPtrDouble, ldc, strc, batchSize);
if (_statusF64 != CublasStatus.Success)
{
throw new CudaBlasException(_statusF64);
}
}
else
{
throw new NotSupportedException("CUDA GEMM with element type " + c.ElementType + " not supported");
}
}
}
public static Tensor Mul_M_M(TSCudaContext context, Tensor result, Tensor lhs, Tensor rhs)
{
if (lhs.ElementType != rhs.ElementType || (result != null && result.ElementType != lhs.ElementType))
{
throw new InvalidOperationException("All tensors must have the same element type");
}
CudaHelpers.ThrowIfDifferentDevices(result, lhs, rhs);
if (result != null && !(result.Storage is CudaStorage))
{
throw new ArgumentException("result must be a CUDA tensor", "result");
}
if (!(lhs.Storage is CudaStorage))
{
throw new ArgumentException("lhs must be a CUDA tensor", "lhs");
}
if (!(rhs.Storage is CudaStorage))
{
throw new ArgumentException("rhs must be a CUDA tensor", "rhs");
}
Tensor writeTarget = TensorResultBuilder.GetWriteTarget(result, lhs, false, lhs.Sizes[0], rhs.Sizes[1]);
Gemm(context, 1, lhs, rhs, 0, writeTarget);
return writeTarget;
}
}
}
| 39.663594 | 270 | 0.468398 | [
"BSD-3-Clause"
] | zamgi/Seq2SeqSharp | TensorSharp.CUDA/MatrixMul/CudaMatrixMulMM.cs | 17,216 | C# |
namespace Demo.Engine.Platform.NetStandard.Win32.WindowMessage
{
/// <summary>
/// Sent when a menu is active and the user presses a key that does not correspond to any
/// mnemonic or accelerator key. This message is sent to the window that owns the menu.
/// </summary>
internal enum MenuCharValues
{
/// <summary>
/// Informs the system that it should discard the character the user pressed and create a
/// short beep on the system speaker.
/// </summary>
Ignore = 0,
/// <summary>
/// Informs the system that it should close the active menu.
/// </summary>
Close = 1,
/// <summary>
/// Informs the system that it should choose the item specified in the low-order word of the
/// return value. The owner window receives a WM_COMMAND message.
/// </summary>
Execute = 2,
/// <summary>
/// Informs the system that it should select the item specified in the low-order word of the
/// return value.
/// </summary>
Select = 3
}
} | 34.71875 | 100 | 0.59856 | [
"MIT"
] | DemoBytom/DemoEngine | src/Demo.Engine.Platform.Windows/WindowMessage/MenuCharValues.cs | 1,111 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace Room133
{
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
}
| 24.12 | 76 | 0.691542 | [
"MIT"
] | figueiredorui/Room133 | src/Program.cs | 605 | C# |
using System.Reflection;
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("Owned")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Owned")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[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("b34ccccc-30ef-40e7-8492-25ff878b8a77")]
// 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.333333 | 84 | 0.738839 | [
"MIT"
] | Pellared/Examples | DiProblems/Owned/Properties/AssemblyInfo.cs | 1,347 | C# |
using System;
using Cosmos.Serialization.Json;
using Newtonsoft.Json;
using Xunit;
namespace Cosmos.Test.Serialization.NewtonsoftTest {
public class JsonTest {
[Fact]
public void BasicJsonTest() {
var model = CreateNiceModel();
var json1 = model.ToJson();
var back1 = json1.FromJson<NiceModel>();
var back2 = (NiceModel) json1.FromJson(typeof(NiceModel));
Assert.Equal(
Tuple.Create(model.Id, model.Name, model.NiceType, model.Count, model.CreatedTime, model.IsValid),
Tuple.Create(back1.Id, back1.Name, back1.NiceType, back1.Count, back1.CreatedTime, back1.IsValid));
Assert.Equal(
Tuple.Create(model.Id, model.Name, model.NiceType, model.Count, model.CreatedTime, model.IsValid),
Tuple.Create(back2.Id, back2.Name, back2.NiceType, back2.Count, back2.CreatedTime, back2.IsValid));
}
[Fact]
public void OptionalJsonTest() {
var model = CreateNiceModel();
var options = new JsonSerializerSettings {DateTimeZoneHandling = DateTimeZoneHandling.Utc};
var json1 = model.ToJson(options);
var back1 = json1.FromJson<NiceModel>(options);
var back2 = (NiceModel) json1.FromJson(typeof(NiceModel), options);
Assert.Equal(
Tuple.Create(model.Id, model.Name, model.NiceType, model.Count, model.CreatedTime, model.IsValid),
Tuple.Create(back1.Id, back1.Name, back1.NiceType, back1.Count, back1.CreatedTime, back1.IsValid));
Assert.Equal(
Tuple.Create(model.Id, model.Name, model.NiceType, model.Count, model.CreatedTime, model.IsValid),
Tuple.Create(back2.Id, back2.Name, back2.NiceType, back2.Count, back2.CreatedTime, back2.IsValid));
}
private static NiceModel CreateNiceModel() {
return new NiceModel {
Id = Guid.NewGuid(),
Name = "nice",
NiceType = NiceType.Yes,
Count = new Random().Next(0, 100),
CreatedTime = new DateTime(2019, 10, 1).ToUniversalTime(),
IsValid = true
};
}
}
} | 41.796296 | 115 | 0.603899 | [
"Apache-2.0"
] | alexinea/dotnet-static-pages | tests/Cosmos.Test.Serialization.NewtonsoftTest/JsonTest.cs | 2,257 | C# |
/* Yet Another Forum.NET
* Copyright (C) 2003-2005 Bjørnar Henden
* Copyright (C) 2006-2013 Jaben Cargman
* Copyright (C) 2014-2022 Ingo Herbote
* https://www.yetanotherforum.net/
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* https://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.
*/
namespace YAF.Pages.Admin
{
#region Using
using System;
using System.Web.UI.WebControls;
using YAF.Core.BasePages;
using YAF.Core.Extensions;
using YAF.Core.Model;
using YAF.Core.Utilities;
using YAF.Types;
using YAF.Types.Constants;
using YAF.Types.Extensions;
using YAF.Types.Interfaces;
using YAF.Types.Models;
using YAF.Web.Extensions;
#endregion
/// <summary>
/// Admin Page to Edit NNTP Forums
/// </summary>
public partial class NntpForums : AdminPage
{
#region Constructors and Destructors
/// <summary>
/// Initializes a new instance of the <see cref="NntpForums"/> class.
/// </summary>
public NntpForums()
: base("ADMIN_NNTPFORUMS", ForumPages.Admin_NntpForums)
{
}
#endregion
#region Methods
/// <summary>
/// News the forum click.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected void NewForumClick([NotNull] object sender, [NotNull] EventArgs e)
{
this.EditDialog.BindData(null);
this.PageContext.PageElements.RegisterJsBlockStartup(
"openModalJs",
JavaScriptBlocks.OpenModalJs("NntpForumEditDialog"));
}
/// <summary>
/// Handles the Load event of the Page control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
{
if (!this.IsPostBack)
{
this.BindData();
}
}
/// <summary>
/// Creates page links for this page.
/// </summary>
protected override void CreatePageLinks()
{
this.PageLinks.AddRoot();
this.PageLinks.AddAdminIndex();
this.PageLinks.AddLink(this.GetText("ADMIN_NNTPFORUMS", "TITLE"), string.Empty);
}
/// <summary>
/// Ranks the list item command.
/// </summary>
/// <param name="source">The source.</param>
/// <param name="e">The <see cref="RepeaterCommandEventArgs"/> instance containing the event data.</param>
protected void RankListItemCommand([NotNull] object source, [NotNull] RepeaterCommandEventArgs e)
{
switch (e.CommandName)
{
case "edit":
this.EditDialog.BindData(e.CommandArgument.ToType<int>());
this.PageContext.PageElements.RegisterJsBlockStartup(
"openModalJs",
JavaScriptBlocks.OpenModalJs("NntpForumEditDialog"));
break;
case "delete":
var forumId = e.CommandArgument.ToType<int>();
this.GetRepository<NntpTopic>().Delete(n => n.NntpForumID == forumId);
this.GetRepository<NntpForum>().Delete(n => n.ID == forumId);
this.BindData();
break;
}
}
/// <summary>
/// The bind data.
/// </summary>
private void BindData()
{
this.RankList.DataSource = this.GetRepository<NntpForum>()
.NntpForumList(this.PageContext.PageBoardID, null);
this.DataBind();
}
#endregion
}
} | 33.907801 | 115 | 0.574566 | [
"Apache-2.0"
] | correaAlex/YAFNET | yafsrc/YetAnotherForum.NET/Pages/Admin/NntpForums.ascx.cs | 4,642 | C# |
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 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("File Checksum")]
[assembly: AssemblyDescription("Quickly verify MD5 and SHA1 checksum values of files")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("JFM Concepts, LLC")]
[assembly: AssemblyProduct("File Checksum")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("CompliaShield is a registered trademark of JFM Concepts, LLC")]
[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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// 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.2")]
[assembly: AssemblyFileVersion("1.0.0.2")]
| 44.839286 | 98 | 0.71366 | [
"Apache-2.0"
] | compliashield/file-checksum | src/FileChecksum/Properties/AssemblyInfo.cs | 2,514 | C# |
using NHM.MinerPluginToolkitV1;
using NHM.MinerPluginToolkitV1.Configs;
using NHM.Common.Algorithm;
using NHM.Common.Device;
using NHM.Common.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
namespace CCMinerTpruvot
{
public partial class CCMinerTpruvotPlugin : PluginBase
{
public CCMinerTpruvotPlugin()
{
// mandatory init
InitInsideConstuctorPluginSupportedAlgorithmsSettings();
// set default internal settings
MinerOptionsPackage = PluginInternalSettings.MinerOptionsPackage;
// https://github.com/tpruvot/ccminer/releases current 2.3.1
MinersBinsUrlsSettings = new MinersBinsUrlsSettings
{
BinVersion = "2.3.1",
ExePath = new List<string> { "ccminer-x64.exe" },
Urls = new List<string>
{
"https://github.com/tpruvot/ccminer/releases/download/2.3.1-tpruvot/ccminer-2.3.1-cuda10.7z", // original
}
};
PluginMetaInfo = new PluginMetaInfo
{
PluginDescription = "NVIDIA miner for Lyra2REv3.",
SupportedDevicesAlgorithms = SupportedDevicesAlgorithmsDict()
};
}
public override string PluginUUID => "95b390a0-94eb-11ea-a64d-17be303ea466";
public override Version Version => new Version(14, 0);
public override string Name => "CCMinerTpruvot";
public override string Author => "info@nicehash.com";
public override Dictionary<BaseDevice, IReadOnlyList<Algorithm>> GetSupportedAlgorithms(IEnumerable<BaseDevice> devices)
{
var supported = new Dictionary<BaseDevice, IReadOnlyList<Algorithm>>();
#warning TEMP disable NVIDIA driver check
//var reqCudaVer = Checkers.CudaVersion.CUDA_10_0_130;
//var isCompatible = Checkers.IsCudaCompatibleDriver(reqCudaVer, CUDADevice.INSTALLED_NVIDIA_DRIVERS);
//if (!isCompatible) return supported; // return emtpy
var cudaGpus = devices
.Where(dev => dev is CUDADevice gpu && gpu.SM_major >= 3)
.Cast<CUDADevice>();
foreach (var gpu in cudaGpus)
{
var algorithms = GetSupportedAlgorithmsForDevice(gpu);
if (algorithms.Count > 0) supported.Add(gpu, algorithms);
}
return supported;
}
protected override MinerBase CreateMinerBase()
{
return new CCMinerTpruvot(PluginUUID);
}
public override IEnumerable<string> CheckBinaryPackageMissingFiles()
{
var pluginRootBinsPath = GetBinAndCwdPaths().Item2;
return BinaryPackageMissingFilesCheckerHelpers.ReturnMissingFiles(pluginRootBinsPath, new List<string> { "ccminer-x64.exe" });
}
public override bool ShouldReBenchmarkAlgorithmOnDevice(BaseDevice device, Version benchmarkedPluginVersion, params AlgorithmType[] ids)
{
return false;
}
}
}
| 37.817073 | 144 | 0.632377 | [
"MIT"
] | Adsryen/NiceHashMiner | src/Miners/CCMinerTpruvot/CCMinerTpruvotPlugin.cs | 3,103 | C# |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using Org.Apache.REEF.Client.API;
using Org.Apache.REEF.Client.Avro;
using Org.Apache.REEF.Client.Avro.YARN;
using Org.Apache.REEF.Client.YARN.Parameters;
using Org.Apache.REEF.Common.Avro;
using Org.Apache.REEF.Common.Files;
using Org.Apache.REEF.Driver.Bridge;
using Org.Apache.REEF.Tang.Annotations;
using Org.Apache.REEF.Tang.Interface;
using Org.Apache.REEF.Utilities.Logging;
using Org.Apache.REEF.Wake.Remote.Parameters;
namespace Org.Apache.REEF.Client.YARN
{
/// <summary>
/// Job/application parameter file serializer for <see cref="YarnREEFClient"/>.
/// </summary>
internal sealed class YarnREEFParamSerializer
{
private static readonly Logger Logger = Logger.GetLogger(typeof(YarnREEFParamSerializer));
private readonly REEFFileNames _fileNames;
/// <summary>
/// Security token kind name. Used for single token case.
/// </summary>
[System.Obsolete("TODO[JIRA REEF-1887] Deprecated. Remove in REEF 0.18.")]
private readonly string _securityTokenKind;
/// <summary>
/// Security token service name. Used for single token case.
/// </summary>
[System.Obsolete("TODO[JIRA REEF-1887] Deprecated. Remove in REEF 0.18.")]
private readonly string _securityTokenService;
/// <summary>
/// File system URL
/// </summary>
private readonly string _fileSystemUrl;
/// <summary>
/// Job submission folder relative path
/// </summary>
private readonly string _jobSubmissionPrefix;
/// <summary>
/// Security token writer that parses and writes token information.
/// It can process multiple tokens.
/// </summary>
private readonly SecurityTokenWriter _securityTokenWriter;
/// <summary>
/// Serialize parameters and tokens for Java client.
/// </summary>
/// <param name="fileNames">REEF file name class which contains file names.</param>
/// <param name="securityTokenWriter">SecurityTokenWriter which writes security token info.</param>
/// <param name="securityTokenKind">Security token kind name.</param>
/// <param name="securityTokenService">Security token service name.</param>
/// <param name="fileSystemUrl">File system URL.</param>
/// <param name="jobSubmissionPrefix">Job submission folder. e.g: fileSystemUrl/jobSubmissionPrefix/</param>
[Inject]
private YarnREEFParamSerializer(
REEFFileNames fileNames,
SecurityTokenWriter securityTokenWriter,
[Parameter(typeof(SecurityTokenKindParameter))] string securityTokenKind,
[Parameter(typeof(SecurityTokenServiceParameter))] string securityTokenService,
[Parameter(typeof(FileSystemUrl))] string fileSystemUrl,
[Parameter(typeof(JobSubmissionDirectoryPrefixParameter))] string jobSubmissionPrefix)
{
_fileNames = fileNames;
_securityTokenWriter = securityTokenWriter;
_jobSubmissionPrefix = jobSubmissionPrefix;
_fileSystemUrl = fileSystemUrl;
_securityTokenKind = securityTokenKind;
_securityTokenService = securityTokenService;
}
/// <summary>
/// Serializes the application parameters to reef/local/app-submission-params.json.
/// </summary>
internal string SerializeAppFile(AppParameters appParameters, IInjector paramInjector, string driverFolderPath)
{
var serializedArgs = SerializeAppArgsToBytes(appParameters, paramInjector);
var submissionArgsFilePath = Path.Combine(driverFolderPath, _fileNames.GetAppSubmissionParametersFile());
using (var argsFileStream = new FileStream(submissionArgsFilePath, FileMode.CreateNew))
{
argsFileStream.Write(serializedArgs, 0, serializedArgs.Length);
}
return submissionArgsFilePath;
}
internal byte[] SerializeAppArgsToBytes(AppParameters appParameters, IInjector paramInjector)
{
var avroAppSubmissionParameters = new AvroAppSubmissionParameters
{
tcpBeginPort = paramInjector.GetNamedInstance<TcpPortRangeStart, int>(),
tcpRangeCount = paramInjector.GetNamedInstance<TcpPortRangeCount, int>(),
tcpTryCount = paramInjector.GetNamedInstance<TcpPortRangeTryCount, int>()
};
var avroYarnAppSubmissionParameters = new AvroYarnAppSubmissionParameters
{
sharedAppSubmissionParameters = avroAppSubmissionParameters,
driverRecoveryTimeout = paramInjector.GetNamedInstance<DriverBridgeConfigurationOptions.DriverRestartEvaluatorRecoverySeconds, int>()
};
return AvroJsonSerializer<AvroYarnAppSubmissionParameters>.ToBytes(avroYarnAppSubmissionParameters);
}
/// <summary>
/// Serializes the job parameters to job-submission-params.json.
/// </summary>
internal string SerializeJobFile(JobParameters jobParameters, IInjector paramInjector, string driverFolderPath)
{
var serializedArgs = SerializeJobArgsToBytes(jobParameters, driverFolderPath);
var submissionArgsFilePath = Path.Combine(driverFolderPath, _fileNames.GetJobSubmissionParametersFile());
using (var argsFileStream = new FileStream(submissionArgsFilePath, FileMode.CreateNew))
{
argsFileStream.Write(serializedArgs, 0, serializedArgs.Length);
}
return submissionArgsFilePath;
}
internal byte[] SerializeJobArgsToBytes(JobParameters jobParameters, string driverFolderPath)
{
var avroJobSubmissionParameters = new AvroJobSubmissionParameters
{
jobId = jobParameters.JobIdentifier,
jobSubmissionFolder = driverFolderPath
};
var avroYarnJobSubmissionParameters = new AvroYarnJobSubmissionParameters
{
sharedJobSubmissionParameters = avroJobSubmissionParameters,
fileSystemUrl = _fileSystemUrl,
jobSubmissionDirectoryPrefix = _jobSubmissionPrefix
};
var avroYarnClusterJobSubmissionParameters = new AvroYarnClusterJobSubmissionParameters
{
// TODO[JIRA REEF-1887] Deprecated. Remove in REEF 0.18.
securityTokenKind = _securityTokenKind,
securityTokenService = _securityTokenService,
yarnJobSubmissionParameters = avroYarnJobSubmissionParameters,
driverMemory = jobParameters.DriverMemoryInMB,
environmentVariablesMap = jobParameters.JobSubmissionEnvMap,
maxApplicationSubmissions = jobParameters.MaxApplicationSubmissions,
driverStdoutFilePath = string.IsNullOrWhiteSpace(jobParameters.StdoutFilePath.Value) ?
_fileNames.GetDefaultYarnDriverStdoutFilePath() : jobParameters.StdoutFilePath.Value,
driverStderrFilePath = string.IsNullOrWhiteSpace(jobParameters.StderrFilePath.Value) ?
_fileNames.GetDefaultYarnDriverStderrFilePath() : jobParameters.StderrFilePath.Value
};
return AvroJsonSerializer<AvroYarnClusterJobSubmissionParameters>.ToBytes(avroYarnClusterJobSubmissionParameters);
}
/// <summary>
/// Write Token info.
/// </summary>
internal void WriteSecurityTokens()
{
_securityTokenWriter.WriteTokensToFile();
}
}
}
| 45.937173 | 150 | 0.667085 | [
"Apache-2.0"
] | AI-ML-Projects/reef | lang/cs/Org.Apache.REEF.Client/YARN/YarnREEFParamSerializer.cs | 8,586 | C# |
//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: This file contains C#/managed code bindings for the OpenVR interfaces
// This file is auto-generated, do not edit it.
//
//=============================================================================
#if !OPENVR_XR_API
using System;
using System.Runtime.InteropServices;
#if UNITY_5_3_OR_NEWER
using UnityEngine;
#endif
namespace Valve.VR
{
[StructLayout(LayoutKind.Sequential)]
public struct IVRSystem
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _GetRecommendedRenderTargetSize(ref uint pnWidth, ref uint pnHeight);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetRecommendedRenderTargetSize GetRecommendedRenderTargetSize;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate HmdMatrix44_t _GetProjectionMatrix(EVREye eEye, float fNearZ, float fFarZ);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetProjectionMatrix GetProjectionMatrix;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _GetProjectionRaw(EVREye eEye, ref float pfLeft, ref float pfRight, ref float pfTop, ref float pfBottom);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetProjectionRaw GetProjectionRaw;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _ComputeDistortion(EVREye eEye, float fU, float fV, ref DistortionCoordinates_t pDistortionCoordinates);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ComputeDistortion ComputeDistortion;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate HmdMatrix34_t _GetEyeToHeadTransform(EVREye eEye);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetEyeToHeadTransform GetEyeToHeadTransform;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetTimeSinceLastVsync(ref float pfSecondsSinceLastVsync, ref ulong pulFrameCounter);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetTimeSinceLastVsync GetTimeSinceLastVsync;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate int _GetD3D9AdapterIndex();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetD3D9AdapterIndex GetD3D9AdapterIndex;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _GetDXGIOutputInfo(ref int pnAdapterIndex);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetDXGIOutputInfo GetDXGIOutputInfo;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _GetOutputDevice(ref ulong pnDevice, ETextureType textureType, IntPtr pInstance);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOutputDevice GetOutputDevice;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsDisplayOnDesktop();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsDisplayOnDesktop IsDisplayOnDesktop;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _SetDisplayVisibility(bool bIsVisibleOnDesktop);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetDisplayVisibility SetDisplayVisibility;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _GetDeviceToAbsoluteTrackingPose(ETrackingUniverseOrigin eOrigin, float fPredictedSecondsToPhotonsFromNow, [In, Out] TrackedDevicePose_t[] pTrackedDevicePoseArray, uint unTrackedDevicePoseArrayCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetDeviceToAbsoluteTrackingPose GetDeviceToAbsoluteTrackingPose;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _ResetSeatedZeroPose();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ResetSeatedZeroPose ResetSeatedZeroPose;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate HmdMatrix34_t _GetSeatedZeroPoseToStandingAbsoluteTrackingPose();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetSeatedZeroPoseToStandingAbsoluteTrackingPose GetSeatedZeroPoseToStandingAbsoluteTrackingPose;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate HmdMatrix34_t _GetRawZeroPoseToStandingAbsoluteTrackingPose();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetRawZeroPoseToStandingAbsoluteTrackingPose GetRawZeroPoseToStandingAbsoluteTrackingPose;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetSortedTrackedDeviceIndicesOfClass(ETrackedDeviceClass eTrackedDeviceClass, [In, Out] uint[] punTrackedDeviceIndexArray, uint unTrackedDeviceIndexArrayCount, uint unRelativeToTrackedDeviceIndex);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetSortedTrackedDeviceIndicesOfClass GetSortedTrackedDeviceIndicesOfClass;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EDeviceActivityLevel _GetTrackedDeviceActivityLevel(uint unDeviceId);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetTrackedDeviceActivityLevel GetTrackedDeviceActivityLevel;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _ApplyTransform(ref TrackedDevicePose_t pOutputPose, ref TrackedDevicePose_t pTrackedDevicePose, ref HmdMatrix34_t pTransform);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ApplyTransform ApplyTransform;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetTrackedDeviceIndexForControllerRole(ETrackedControllerRole unDeviceType);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetTrackedDeviceIndexForControllerRole GetTrackedDeviceIndexForControllerRole;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ETrackedControllerRole _GetControllerRoleForTrackedDeviceIndex(uint unDeviceIndex);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetControllerRoleForTrackedDeviceIndex GetControllerRoleForTrackedDeviceIndex;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ETrackedDeviceClass _GetTrackedDeviceClass(uint unDeviceIndex);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetTrackedDeviceClass GetTrackedDeviceClass;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsTrackedDeviceConnected(uint unDeviceIndex);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsTrackedDeviceConnected IsTrackedDeviceConnected;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetBoolTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetBoolTrackedDeviceProperty GetBoolTrackedDeviceProperty;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate float _GetFloatTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetFloatTrackedDeviceProperty GetFloatTrackedDeviceProperty;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate int _GetInt32TrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetInt32TrackedDeviceProperty GetInt32TrackedDeviceProperty;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ulong _GetUint64TrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetUint64TrackedDeviceProperty GetUint64TrackedDeviceProperty;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate HmdMatrix34_t _GetMatrix34TrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetMatrix34TrackedDeviceProperty GetMatrix34TrackedDeviceProperty;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetArrayTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, uint propType, IntPtr pBuffer, uint unBufferSize, ref ETrackedPropertyError pError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetArrayTrackedDeviceProperty GetArrayTrackedDeviceProperty;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetStringTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, System.Text.StringBuilder pchValue, uint unBufferSize, ref ETrackedPropertyError pError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetStringTrackedDeviceProperty GetStringTrackedDeviceProperty;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate IntPtr _GetPropErrorNameFromEnum(ETrackedPropertyError error);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetPropErrorNameFromEnum GetPropErrorNameFromEnum;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _PollNextEvent(ref VREvent_t pEvent, uint uncbVREvent);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _PollNextEvent PollNextEvent;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _PollNextEventWithPose(ETrackingUniverseOrigin eOrigin, ref VREvent_t pEvent, uint uncbVREvent, ref TrackedDevicePose_t pTrackedDevicePose);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _PollNextEventWithPose PollNextEventWithPose;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate IntPtr _GetEventTypeNameFromEnum(EVREventType eType);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetEventTypeNameFromEnum GetEventTypeNameFromEnum;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate HiddenAreaMesh_t _GetHiddenAreaMesh(EVREye eEye, EHiddenAreaMeshType type);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetHiddenAreaMesh GetHiddenAreaMesh;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetControllerState(uint unControllerDeviceIndex, ref VRControllerState_t pControllerState, uint unControllerStateSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetControllerState GetControllerState;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetControllerStateWithPose(ETrackingUniverseOrigin eOrigin, uint unControllerDeviceIndex, ref VRControllerState_t pControllerState, uint unControllerStateSize, ref TrackedDevicePose_t pTrackedDevicePose);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetControllerStateWithPose GetControllerStateWithPose;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _TriggerHapticPulse(uint unControllerDeviceIndex, uint unAxisId, ushort usDurationMicroSec);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _TriggerHapticPulse TriggerHapticPulse;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate IntPtr _GetButtonIdNameFromEnum(EVRButtonId eButtonId);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetButtonIdNameFromEnum GetButtonIdNameFromEnum;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate IntPtr _GetControllerAxisTypeNameFromEnum(EVRControllerAxisType eAxisType);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetControllerAxisTypeNameFromEnum GetControllerAxisTypeNameFromEnum;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsInputAvailable();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsInputAvailable IsInputAvailable;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsSteamVRDrawingControllers();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsSteamVRDrawingControllers IsSteamVRDrawingControllers;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _ShouldApplicationPause();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ShouldApplicationPause ShouldApplicationPause;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _ShouldApplicationReduceRenderingWork();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ShouldApplicationReduceRenderingWork ShouldApplicationReduceRenderingWork;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRFirmwareError _PerformFirmwareUpdate(uint unDeviceIndex);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _PerformFirmwareUpdate PerformFirmwareUpdate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _AcknowledgeQuit_Exiting();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _AcknowledgeQuit_Exiting AcknowledgeQuit_Exiting;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetAppContainerFilePaths(System.Text.StringBuilder pchBuffer, uint unBufferSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetAppContainerFilePaths GetAppContainerFilePaths;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate IntPtr _GetRuntimeVersion();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetRuntimeVersion GetRuntimeVersion;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRExtendedDisplay
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _GetWindowBounds(ref int pnX, ref int pnY, ref uint pnWidth, ref uint pnHeight);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetWindowBounds GetWindowBounds;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _GetEyeOutputViewport(EVREye eEye, ref uint pnX, ref uint pnY, ref uint pnWidth, ref uint pnHeight);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetEyeOutputViewport GetEyeOutputViewport;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _GetDXGIOutputInfo(ref int pnAdapterIndex, ref int pnAdapterOutputIndex);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetDXGIOutputInfo GetDXGIOutputInfo;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRTrackedCamera
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate IntPtr _GetCameraErrorNameFromEnum(EVRTrackedCameraError eCameraError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetCameraErrorNameFromEnum GetCameraErrorNameFromEnum;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRTrackedCameraError _HasCamera(uint nDeviceIndex, ref bool pHasCamera);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _HasCamera HasCamera;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRTrackedCameraError _GetCameraFrameSize(uint nDeviceIndex, EVRTrackedCameraFrameType eFrameType, ref uint pnWidth, ref uint pnHeight, ref uint pnFrameBufferSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetCameraFrameSize GetCameraFrameSize;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRTrackedCameraError _GetCameraIntrinsics(uint nDeviceIndex, uint nCameraIndex, EVRTrackedCameraFrameType eFrameType, ref HmdVector2_t pFocalLength, ref HmdVector2_t pCenter);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetCameraIntrinsics GetCameraIntrinsics;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRTrackedCameraError _GetCameraProjection(uint nDeviceIndex, uint nCameraIndex, EVRTrackedCameraFrameType eFrameType, float flZNear, float flZFar, ref HmdMatrix44_t pProjection);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetCameraProjection GetCameraProjection;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRTrackedCameraError _AcquireVideoStreamingService(uint nDeviceIndex, ref ulong pHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _AcquireVideoStreamingService AcquireVideoStreamingService;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRTrackedCameraError _ReleaseVideoStreamingService(ulong hTrackedCamera);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ReleaseVideoStreamingService ReleaseVideoStreamingService;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRTrackedCameraError _GetVideoStreamFrameBuffer(ulong hTrackedCamera, EVRTrackedCameraFrameType eFrameType, IntPtr pFrameBuffer, uint nFrameBufferSize, ref CameraVideoStreamFrameHeader_t pFrameHeader, uint nFrameHeaderSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetVideoStreamFrameBuffer GetVideoStreamFrameBuffer;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRTrackedCameraError _GetVideoStreamTextureSize(uint nDeviceIndex, EVRTrackedCameraFrameType eFrameType, ref VRTextureBounds_t pTextureBounds, ref uint pnWidth, ref uint pnHeight);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetVideoStreamTextureSize GetVideoStreamTextureSize;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRTrackedCameraError _GetVideoStreamTextureD3D11(ulong hTrackedCamera, EVRTrackedCameraFrameType eFrameType, IntPtr pD3D11DeviceOrResource, ref IntPtr ppD3D11ShaderResourceView, ref CameraVideoStreamFrameHeader_t pFrameHeader, uint nFrameHeaderSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetVideoStreamTextureD3D11 GetVideoStreamTextureD3D11;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRTrackedCameraError _GetVideoStreamTextureGL(ulong hTrackedCamera, EVRTrackedCameraFrameType eFrameType, ref uint pglTextureId, ref CameraVideoStreamFrameHeader_t pFrameHeader, uint nFrameHeaderSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetVideoStreamTextureGL GetVideoStreamTextureGL;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRTrackedCameraError _ReleaseVideoStreamTextureGL(ulong hTrackedCamera, uint glTextureId);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ReleaseVideoStreamTextureGL ReleaseVideoStreamTextureGL;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetCameraTrackingSpace(ETrackingUniverseOrigin eUniverse);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetCameraTrackingSpace SetCameraTrackingSpace;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ETrackingUniverseOrigin _GetCameraTrackingSpace();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetCameraTrackingSpace GetCameraTrackingSpace;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRApplications
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRApplicationError _AddApplicationManifest(IntPtr pchApplicationManifestFullPath, bool bTemporary);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _AddApplicationManifest AddApplicationManifest;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRApplicationError _RemoveApplicationManifest(IntPtr pchApplicationManifestFullPath);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _RemoveApplicationManifest RemoveApplicationManifest;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsApplicationInstalled(IntPtr pchAppKey);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsApplicationInstalled IsApplicationInstalled;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetApplicationCount();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetApplicationCount GetApplicationCount;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRApplicationError _GetApplicationKeyByIndex(uint unApplicationIndex, System.Text.StringBuilder pchAppKeyBuffer, uint unAppKeyBufferLen);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetApplicationKeyByIndex GetApplicationKeyByIndex;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRApplicationError _GetApplicationKeyByProcessId(uint unProcessId, System.Text.StringBuilder pchAppKeyBuffer, uint unAppKeyBufferLen);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetApplicationKeyByProcessId GetApplicationKeyByProcessId;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRApplicationError _LaunchApplication(IntPtr pchAppKey);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _LaunchApplication LaunchApplication;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRApplicationError _LaunchTemplateApplication(IntPtr pchTemplateAppKey, IntPtr pchNewAppKey, [In, Out] AppOverrideKeys_t[] pKeys, uint unKeys);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _LaunchTemplateApplication LaunchTemplateApplication;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRApplicationError _LaunchApplicationFromMimeType(IntPtr pchMimeType, IntPtr pchArgs);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _LaunchApplicationFromMimeType LaunchApplicationFromMimeType;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRApplicationError _LaunchDashboardOverlay(IntPtr pchAppKey);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _LaunchDashboardOverlay LaunchDashboardOverlay;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _CancelApplicationLaunch(IntPtr pchAppKey);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _CancelApplicationLaunch CancelApplicationLaunch;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRApplicationError _IdentifyApplication(uint unProcessId, IntPtr pchAppKey);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IdentifyApplication IdentifyApplication;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetApplicationProcessId(IntPtr pchAppKey);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetApplicationProcessId GetApplicationProcessId;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate IntPtr _GetApplicationsErrorNameFromEnum(EVRApplicationError error);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetApplicationsErrorNameFromEnum GetApplicationsErrorNameFromEnum;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetApplicationPropertyString(IntPtr pchAppKey, EVRApplicationProperty eProperty, System.Text.StringBuilder pchPropertyValueBuffer, uint unPropertyValueBufferLen, ref EVRApplicationError peError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetApplicationPropertyString GetApplicationPropertyString;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetApplicationPropertyBool(IntPtr pchAppKey, EVRApplicationProperty eProperty, ref EVRApplicationError peError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetApplicationPropertyBool GetApplicationPropertyBool;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ulong _GetApplicationPropertyUint64(IntPtr pchAppKey, EVRApplicationProperty eProperty, ref EVRApplicationError peError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetApplicationPropertyUint64 GetApplicationPropertyUint64;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRApplicationError _SetApplicationAutoLaunch(IntPtr pchAppKey, bool bAutoLaunch);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetApplicationAutoLaunch SetApplicationAutoLaunch;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetApplicationAutoLaunch(IntPtr pchAppKey);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetApplicationAutoLaunch GetApplicationAutoLaunch;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRApplicationError _SetDefaultApplicationForMimeType(IntPtr pchAppKey, IntPtr pchMimeType);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetDefaultApplicationForMimeType SetDefaultApplicationForMimeType;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetDefaultApplicationForMimeType(IntPtr pchMimeType, System.Text.StringBuilder pchAppKeyBuffer, uint unAppKeyBufferLen);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetDefaultApplicationForMimeType GetDefaultApplicationForMimeType;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetApplicationSupportedMimeTypes(IntPtr pchAppKey, System.Text.StringBuilder pchMimeTypesBuffer, uint unMimeTypesBuffer);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetApplicationSupportedMimeTypes GetApplicationSupportedMimeTypes;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetApplicationsThatSupportMimeType(IntPtr pchMimeType, System.Text.StringBuilder pchAppKeysThatSupportBuffer, uint unAppKeysThatSupportBuffer);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetApplicationsThatSupportMimeType GetApplicationsThatSupportMimeType;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetApplicationLaunchArguments(uint unHandle, System.Text.StringBuilder pchArgs, uint unArgs);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetApplicationLaunchArguments GetApplicationLaunchArguments;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRApplicationError _GetStartingApplication(System.Text.StringBuilder pchAppKeyBuffer, uint unAppKeyBufferLen);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetStartingApplication GetStartingApplication;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRSceneApplicationState _GetSceneApplicationState();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetSceneApplicationState GetSceneApplicationState;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRApplicationError _PerformApplicationPrelaunchCheck(IntPtr pchAppKey);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _PerformApplicationPrelaunchCheck PerformApplicationPrelaunchCheck;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate IntPtr _GetSceneApplicationStateNameFromEnum(EVRSceneApplicationState state);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetSceneApplicationStateNameFromEnum GetSceneApplicationStateNameFromEnum;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRApplicationError _LaunchInternalProcess(IntPtr pchBinaryPath, IntPtr pchArguments, IntPtr pchWorkingDirectory);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _LaunchInternalProcess LaunchInternalProcess;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetCurrentSceneProcessId();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetCurrentSceneProcessId GetCurrentSceneProcessId;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRChaperone
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ChaperoneCalibrationState _GetCalibrationState();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetCalibrationState GetCalibrationState;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetPlayAreaSize(ref float pSizeX, ref float pSizeZ);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetPlayAreaSize GetPlayAreaSize;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetPlayAreaRect(ref HmdQuad_t rect);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetPlayAreaRect GetPlayAreaRect;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _ReloadInfo();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ReloadInfo ReloadInfo;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetSceneColor(HmdColor_t color);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetSceneColor SetSceneColor;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _GetBoundsColor(ref HmdColor_t pOutputColorArray, int nNumOutputColors, float flCollisionBoundsFadeDistance, ref HmdColor_t pOutputCameraColor);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetBoundsColor GetBoundsColor;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _AreBoundsVisible();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _AreBoundsVisible AreBoundsVisible;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _ForceBoundsVisible(bool bForce);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ForceBoundsVisible ForceBoundsVisible;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRChaperoneSetup
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _CommitWorkingCopy(EChaperoneConfigFile configFile);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _CommitWorkingCopy CommitWorkingCopy;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _RevertWorkingCopy();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _RevertWorkingCopy RevertWorkingCopy;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetWorkingPlayAreaSize(ref float pSizeX, ref float pSizeZ);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetWorkingPlayAreaSize GetWorkingPlayAreaSize;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetWorkingPlayAreaRect(ref HmdQuad_t rect);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetWorkingPlayAreaRect GetWorkingPlayAreaRect;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetWorkingCollisionBoundsInfo([In, Out] HmdQuad_t[] pQuadsBuffer, ref uint punQuadsCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetWorkingCollisionBoundsInfo GetWorkingCollisionBoundsInfo;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetLiveCollisionBoundsInfo([In, Out] HmdQuad_t[] pQuadsBuffer, ref uint punQuadsCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetLiveCollisionBoundsInfo GetLiveCollisionBoundsInfo;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetWorkingSeatedZeroPoseToRawTrackingPose(ref HmdMatrix34_t pmatSeatedZeroPoseToRawTrackingPose);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetWorkingSeatedZeroPoseToRawTrackingPose GetWorkingSeatedZeroPoseToRawTrackingPose;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetWorkingStandingZeroPoseToRawTrackingPose(ref HmdMatrix34_t pmatStandingZeroPoseToRawTrackingPose);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetWorkingStandingZeroPoseToRawTrackingPose GetWorkingStandingZeroPoseToRawTrackingPose;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetWorkingPlayAreaSize(float sizeX, float sizeZ);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetWorkingPlayAreaSize SetWorkingPlayAreaSize;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetWorkingCollisionBoundsInfo([In, Out] HmdQuad_t[] pQuadsBuffer, uint unQuadsCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetWorkingCollisionBoundsInfo SetWorkingCollisionBoundsInfo;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetWorkingPerimeter([In, Out] HmdVector2_t[] pPointBuffer, uint unPointCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetWorkingPerimeter SetWorkingPerimeter;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetWorkingSeatedZeroPoseToRawTrackingPose(ref HmdMatrix34_t pMatSeatedZeroPoseToRawTrackingPose);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetWorkingSeatedZeroPoseToRawTrackingPose SetWorkingSeatedZeroPoseToRawTrackingPose;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetWorkingStandingZeroPoseToRawTrackingPose(ref HmdMatrix34_t pMatStandingZeroPoseToRawTrackingPose);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetWorkingStandingZeroPoseToRawTrackingPose SetWorkingStandingZeroPoseToRawTrackingPose;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _ReloadFromDisk(EChaperoneConfigFile configFile);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ReloadFromDisk ReloadFromDisk;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetLiveSeatedZeroPoseToRawTrackingPose(ref HmdMatrix34_t pmatSeatedZeroPoseToRawTrackingPose);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetLiveSeatedZeroPoseToRawTrackingPose GetLiveSeatedZeroPoseToRawTrackingPose;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _ExportLiveToBuffer(System.Text.StringBuilder pBuffer, ref uint pnBufferLength);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ExportLiveToBuffer ExportLiveToBuffer;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _ImportFromBufferToWorking(IntPtr pBuffer, uint nImportFlags);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ImportFromBufferToWorking ImportFromBufferToWorking;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _ShowWorkingSetPreview();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ShowWorkingSetPreview ShowWorkingSetPreview;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _HideWorkingSetPreview();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _HideWorkingSetPreview HideWorkingSetPreview;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _RoomSetupStarting();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _RoomSetupStarting RoomSetupStarting;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRCompositor
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetTrackingSpace(ETrackingUniverseOrigin eOrigin);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetTrackingSpace SetTrackingSpace;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ETrackingUniverseOrigin _GetTrackingSpace();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetTrackingSpace GetTrackingSpace;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRCompositorError _WaitGetPoses([In, Out] TrackedDevicePose_t[] pRenderPoseArray, uint unRenderPoseArrayCount, [In, Out] TrackedDevicePose_t[] pGamePoseArray, uint unGamePoseArrayCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _WaitGetPoses WaitGetPoses;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRCompositorError _GetLastPoses([In, Out] TrackedDevicePose_t[] pRenderPoseArray, uint unRenderPoseArrayCount, [In, Out] TrackedDevicePose_t[] pGamePoseArray, uint unGamePoseArrayCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetLastPoses GetLastPoses;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRCompositorError _GetLastPoseForTrackedDeviceIndex(uint unDeviceIndex, ref TrackedDevicePose_t pOutputPose, ref TrackedDevicePose_t pOutputGamePose);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetLastPoseForTrackedDeviceIndex GetLastPoseForTrackedDeviceIndex;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRCompositorError _Submit(EVREye eEye, ref Texture_t pTexture, ref VRTextureBounds_t pBounds, EVRSubmitFlags nSubmitFlags);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _Submit Submit;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _ClearLastSubmittedFrame();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ClearLastSubmittedFrame ClearLastSubmittedFrame;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _PostPresentHandoff();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _PostPresentHandoff PostPresentHandoff;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetFrameTiming(ref Compositor_FrameTiming pTiming, uint unFramesAgo);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetFrameTiming GetFrameTiming;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetFrameTimings([In, Out] Compositor_FrameTiming[] pTiming, uint nFrames);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetFrameTimings GetFrameTimings;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate float _GetFrameTimeRemaining();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetFrameTimeRemaining GetFrameTimeRemaining;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _GetCumulativeStats(ref Compositor_CumulativeStats pStats, uint nStatsSizeInBytes);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetCumulativeStats GetCumulativeStats;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _FadeToColor(float fSeconds, float fRed, float fGreen, float fBlue, float fAlpha, bool bBackground);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _FadeToColor FadeToColor;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate HmdColor_t _GetCurrentFadeColor(bool bBackground);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetCurrentFadeColor GetCurrentFadeColor;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _FadeGrid(float fSeconds, bool bFadeIn);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _FadeGrid FadeGrid;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate float _GetCurrentGridAlpha();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetCurrentGridAlpha GetCurrentGridAlpha;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRCompositorError _SetSkyboxOverride([In, Out] Texture_t[] pTextures, uint unTextureCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetSkyboxOverride SetSkyboxOverride;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _ClearSkyboxOverride();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ClearSkyboxOverride ClearSkyboxOverride;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _CompositorBringToFront();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _CompositorBringToFront CompositorBringToFront;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _CompositorGoToBack();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _CompositorGoToBack CompositorGoToBack;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _CompositorQuit();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _CompositorQuit CompositorQuit;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsFullscreen();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsFullscreen IsFullscreen;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetCurrentSceneFocusProcess();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetCurrentSceneFocusProcess GetCurrentSceneFocusProcess;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetLastFrameRenderer();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetLastFrameRenderer GetLastFrameRenderer;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _CanRenderScene();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _CanRenderScene CanRenderScene;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _ShowMirrorWindow();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ShowMirrorWindow ShowMirrorWindow;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _HideMirrorWindow();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _HideMirrorWindow HideMirrorWindow;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsMirrorWindowVisible();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsMirrorWindowVisible IsMirrorWindowVisible;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _CompositorDumpImages();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _CompositorDumpImages CompositorDumpImages;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _ShouldAppRenderWithLowResources();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ShouldAppRenderWithLowResources ShouldAppRenderWithLowResources;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _ForceInterleavedReprojectionOn(bool bOverride);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ForceInterleavedReprojectionOn ForceInterleavedReprojectionOn;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _ForceReconnectProcess();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ForceReconnectProcess ForceReconnectProcess;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SuspendRendering(bool bSuspend);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SuspendRendering SuspendRendering;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRCompositorError _GetMirrorTextureD3D11(EVREye eEye, IntPtr pD3D11DeviceOrResource, ref IntPtr ppD3D11ShaderResourceView);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetMirrorTextureD3D11 GetMirrorTextureD3D11;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _ReleaseMirrorTextureD3D11(IntPtr pD3D11ShaderResourceView);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ReleaseMirrorTextureD3D11 ReleaseMirrorTextureD3D11;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRCompositorError _GetMirrorTextureGL(EVREye eEye, ref uint pglTextureId, IntPtr pglSharedTextureHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetMirrorTextureGL GetMirrorTextureGL;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _ReleaseSharedGLTexture(uint glTextureId, IntPtr glSharedTextureHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ReleaseSharedGLTexture ReleaseSharedGLTexture;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _LockGLSharedTextureForAccess(IntPtr glSharedTextureHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _LockGLSharedTextureForAccess LockGLSharedTextureForAccess;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _UnlockGLSharedTextureForAccess(IntPtr glSharedTextureHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _UnlockGLSharedTextureForAccess UnlockGLSharedTextureForAccess;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetVulkanInstanceExtensionsRequired(System.Text.StringBuilder pchValue, uint unBufferSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetVulkanInstanceExtensionsRequired GetVulkanInstanceExtensionsRequired;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetVulkanDeviceExtensionsRequired(IntPtr pPhysicalDevice, System.Text.StringBuilder pchValue, uint unBufferSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetVulkanDeviceExtensionsRequired GetVulkanDeviceExtensionsRequired;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetExplicitTimingMode(EVRCompositorTimingMode eTimingMode);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetExplicitTimingMode SetExplicitTimingMode;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRCompositorError _SubmitExplicitTimingData();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SubmitExplicitTimingData SubmitExplicitTimingData;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsMotionSmoothingEnabled();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsMotionSmoothingEnabled IsMotionSmoothingEnabled;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsMotionSmoothingSupported();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsMotionSmoothingSupported IsMotionSmoothingSupported;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsCurrentSceneFocusAppLoading();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsCurrentSceneFocusAppLoading IsCurrentSceneFocusAppLoading;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRCompositorError _SetStageOverride_Async(IntPtr pchRenderModelPath, ref HmdMatrix34_t pTransform, ref Compositor_StageRenderSettings pRenderSettings, uint nSizeOfRenderSettings);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetStageOverride_Async SetStageOverride_Async;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _ClearStageOverride();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ClearStageOverride ClearStageOverride;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetCompositorBenchmarkResults(ref Compositor_BenchmarkResults pBenchmarkResults, uint nSizeOfBenchmarkResults);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetCompositorBenchmarkResults GetCompositorBenchmarkResults;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRCompositorError _GetLastPosePredictionIDs(ref uint pRenderPosePredictionID, ref uint pGamePosePredictionID);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetLastPosePredictionIDs GetLastPosePredictionIDs;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRCompositorError _GetPosesForFrame(uint unPosePredictionID, [In, Out] TrackedDevicePose_t[] pPoseArray, uint unPoseArrayCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetPosesForFrame GetPosesForFrame;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVROverlay
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _FindOverlay(IntPtr pchOverlayKey, ref ulong pOverlayHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _FindOverlay FindOverlay;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _CreateOverlay(IntPtr pchOverlayKey, IntPtr pchOverlayName, ref ulong pOverlayHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _CreateOverlay CreateOverlay;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _DestroyOverlay(ulong ulOverlayHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _DestroyOverlay DestroyOverlay;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetOverlayKey(ulong ulOverlayHandle, System.Text.StringBuilder pchValue, uint unBufferSize, ref EVROverlayError pError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayKey GetOverlayKey;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetOverlayName(ulong ulOverlayHandle, System.Text.StringBuilder pchValue, uint unBufferSize, ref EVROverlayError pError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayName GetOverlayName;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayName(ulong ulOverlayHandle, IntPtr pchName);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayName SetOverlayName;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayImageData(ulong ulOverlayHandle, IntPtr pvBuffer, uint unBufferSize, ref uint punWidth, ref uint punHeight);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayImageData GetOverlayImageData;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate IntPtr _GetOverlayErrorNameFromEnum(EVROverlayError error);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayErrorNameFromEnum GetOverlayErrorNameFromEnum;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayRenderingPid(ulong ulOverlayHandle, uint unPID);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayRenderingPid SetOverlayRenderingPid;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetOverlayRenderingPid(ulong ulOverlayHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayRenderingPid GetOverlayRenderingPid;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayFlag(ulong ulOverlayHandle, VROverlayFlags eOverlayFlag, bool bEnabled);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayFlag SetOverlayFlag;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayFlag(ulong ulOverlayHandle, VROverlayFlags eOverlayFlag, ref bool pbEnabled);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayFlag GetOverlayFlag;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayFlags(ulong ulOverlayHandle, ref uint pFlags);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayFlags GetOverlayFlags;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayColor(ulong ulOverlayHandle, float fRed, float fGreen, float fBlue);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayColor SetOverlayColor;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayColor(ulong ulOverlayHandle, ref float pfRed, ref float pfGreen, ref float pfBlue);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayColor GetOverlayColor;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayAlpha(ulong ulOverlayHandle, float fAlpha);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayAlpha SetOverlayAlpha;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayAlpha(ulong ulOverlayHandle, ref float pfAlpha);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayAlpha GetOverlayAlpha;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayTexelAspect(ulong ulOverlayHandle, float fTexelAspect);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayTexelAspect SetOverlayTexelAspect;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayTexelAspect(ulong ulOverlayHandle, ref float pfTexelAspect);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayTexelAspect GetOverlayTexelAspect;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlaySortOrder(ulong ulOverlayHandle, uint unSortOrder);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlaySortOrder SetOverlaySortOrder;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlaySortOrder(ulong ulOverlayHandle, ref uint punSortOrder);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlaySortOrder GetOverlaySortOrder;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayWidthInMeters(ulong ulOverlayHandle, float fWidthInMeters);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayWidthInMeters SetOverlayWidthInMeters;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayWidthInMeters(ulong ulOverlayHandle, ref float pfWidthInMeters);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayWidthInMeters GetOverlayWidthInMeters;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayCurvature(ulong ulOverlayHandle, float fCurvature);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayCurvature SetOverlayCurvature;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayCurvature(ulong ulOverlayHandle, ref float pfCurvature);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayCurvature GetOverlayCurvature;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayTextureColorSpace(ulong ulOverlayHandle, EColorSpace eTextureColorSpace);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayTextureColorSpace SetOverlayTextureColorSpace;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayTextureColorSpace(ulong ulOverlayHandle, ref EColorSpace peTextureColorSpace);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayTextureColorSpace GetOverlayTextureColorSpace;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayTextureBounds(ulong ulOverlayHandle, ref VRTextureBounds_t pOverlayTextureBounds);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayTextureBounds SetOverlayTextureBounds;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayTextureBounds(ulong ulOverlayHandle, ref VRTextureBounds_t pOverlayTextureBounds);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayTextureBounds GetOverlayTextureBounds;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayTransformType(ulong ulOverlayHandle, ref VROverlayTransformType peTransformType);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayTransformType GetOverlayTransformType;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayTransformAbsolute(ulong ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, ref HmdMatrix34_t pmatTrackingOriginToOverlayTransform);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayTransformAbsolute SetOverlayTransformAbsolute;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayTransformAbsolute(ulong ulOverlayHandle, ref ETrackingUniverseOrigin peTrackingOrigin, ref HmdMatrix34_t pmatTrackingOriginToOverlayTransform);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayTransformAbsolute GetOverlayTransformAbsolute;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayTransformTrackedDeviceRelative(ulong ulOverlayHandle, uint unTrackedDevice, ref HmdMatrix34_t pmatTrackedDeviceToOverlayTransform);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayTransformTrackedDeviceRelative SetOverlayTransformTrackedDeviceRelative;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayTransformTrackedDeviceRelative(ulong ulOverlayHandle, ref uint punTrackedDevice, ref HmdMatrix34_t pmatTrackedDeviceToOverlayTransform);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayTransformTrackedDeviceRelative GetOverlayTransformTrackedDeviceRelative;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayTransformTrackedDeviceComponent(ulong ulOverlayHandle, uint unDeviceIndex, IntPtr pchComponentName);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayTransformTrackedDeviceComponent SetOverlayTransformTrackedDeviceComponent;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayTransformTrackedDeviceComponent(ulong ulOverlayHandle, ref uint punDeviceIndex, System.Text.StringBuilder pchComponentName, uint unComponentNameSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayTransformTrackedDeviceComponent GetOverlayTransformTrackedDeviceComponent;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayTransformOverlayRelative(ulong ulOverlayHandle, ref ulong ulOverlayHandleParent, ref HmdMatrix34_t pmatParentOverlayToOverlayTransform);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayTransformOverlayRelative GetOverlayTransformOverlayRelative;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayTransformOverlayRelative(ulong ulOverlayHandle, ulong ulOverlayHandleParent, ref HmdMatrix34_t pmatParentOverlayToOverlayTransform);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayTransformOverlayRelative SetOverlayTransformOverlayRelative;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayTransformCursor(ulong ulCursorOverlayHandle, ref HmdVector2_t pvHotspot);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayTransformCursor SetOverlayTransformCursor;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayTransformCursor(ulong ulOverlayHandle, ref HmdVector2_t pvHotspot);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayTransformCursor GetOverlayTransformCursor;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _ShowOverlay(ulong ulOverlayHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ShowOverlay ShowOverlay;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _HideOverlay(ulong ulOverlayHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _HideOverlay HideOverlay;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsOverlayVisible(ulong ulOverlayHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsOverlayVisible IsOverlayVisible;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetTransformForOverlayCoordinates(ulong ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, HmdVector2_t coordinatesInOverlay, ref HmdMatrix34_t pmatTransform);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetTransformForOverlayCoordinates GetTransformForOverlayCoordinates;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _PollNextOverlayEvent(ulong ulOverlayHandle, ref VREvent_t pEvent, uint uncbVREvent);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _PollNextOverlayEvent PollNextOverlayEvent;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayInputMethod(ulong ulOverlayHandle, ref VROverlayInputMethod peInputMethod);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayInputMethod GetOverlayInputMethod;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayInputMethod(ulong ulOverlayHandle, VROverlayInputMethod eInputMethod);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayInputMethod SetOverlayInputMethod;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayMouseScale(ulong ulOverlayHandle, ref HmdVector2_t pvecMouseScale);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayMouseScale GetOverlayMouseScale;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayMouseScale(ulong ulOverlayHandle, ref HmdVector2_t pvecMouseScale);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayMouseScale SetOverlayMouseScale;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _ComputeOverlayIntersection(ulong ulOverlayHandle, ref VROverlayIntersectionParams_t pParams, ref VROverlayIntersectionResults_t pResults);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ComputeOverlayIntersection ComputeOverlayIntersection;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsHoverTargetOverlay(ulong ulOverlayHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsHoverTargetOverlay IsHoverTargetOverlay;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayIntersectionMask(ulong ulOverlayHandle, ref VROverlayIntersectionMaskPrimitive_t pMaskPrimitives, uint unNumMaskPrimitives, uint unPrimitiveSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayIntersectionMask SetOverlayIntersectionMask;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _TriggerLaserMouseHapticVibration(ulong ulOverlayHandle, float fDurationSeconds, float fFrequency, float fAmplitude);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _TriggerLaserMouseHapticVibration TriggerLaserMouseHapticVibration;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayCursor(ulong ulOverlayHandle, ulong ulCursorHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayCursor SetOverlayCursor;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayCursorPositionOverride(ulong ulOverlayHandle, ref HmdVector2_t pvCursor);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayCursorPositionOverride SetOverlayCursorPositionOverride;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _ClearOverlayCursorPositionOverride(ulong ulOverlayHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ClearOverlayCursorPositionOverride ClearOverlayCursorPositionOverride;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayTexture(ulong ulOverlayHandle, ref Texture_t pTexture);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayTexture SetOverlayTexture;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _ClearOverlayTexture(ulong ulOverlayHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ClearOverlayTexture ClearOverlayTexture;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayRaw(ulong ulOverlayHandle, IntPtr pvBuffer, uint unWidth, uint unHeight, uint unBytesPerPixel);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayRaw SetOverlayRaw;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayFromFile(ulong ulOverlayHandle, IntPtr pchFilePath);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayFromFile SetOverlayFromFile;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayTexture(ulong ulOverlayHandle, ref IntPtr pNativeTextureHandle, IntPtr pNativeTextureRef, ref uint pWidth, ref uint pHeight, ref uint pNativeFormat, ref ETextureType pAPIType, ref EColorSpace pColorSpace, ref VRTextureBounds_t pTextureBounds);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayTexture GetOverlayTexture;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _ReleaseNativeOverlayHandle(ulong ulOverlayHandle, IntPtr pNativeTextureHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ReleaseNativeOverlayHandle ReleaseNativeOverlayHandle;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayTextureSize(ulong ulOverlayHandle, ref uint pWidth, ref uint pHeight);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayTextureSize GetOverlayTextureSize;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _CreateDashboardOverlay(IntPtr pchOverlayKey, IntPtr pchOverlayFriendlyName, ref ulong pMainHandle, ref ulong pThumbnailHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _CreateDashboardOverlay CreateDashboardOverlay;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsDashboardVisible();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsDashboardVisible IsDashboardVisible;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsActiveDashboardOverlay(ulong ulOverlayHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsActiveDashboardOverlay IsActiveDashboardOverlay;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetDashboardOverlaySceneProcess(ulong ulOverlayHandle, uint unProcessId);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetDashboardOverlaySceneProcess SetDashboardOverlaySceneProcess;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetDashboardOverlaySceneProcess(ulong ulOverlayHandle, ref uint punProcessId);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetDashboardOverlaySceneProcess GetDashboardOverlaySceneProcess;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _ShowDashboard(IntPtr pchOverlayToShow);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ShowDashboard ShowDashboard;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetPrimaryDashboardDevice();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetPrimaryDashboardDevice GetPrimaryDashboardDevice;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _ShowKeyboard(int eInputMode, int eLineInputMode, uint unFlags, IntPtr pchDescription, uint unCharMax, IntPtr pchExistingText, ulong uUserValue);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ShowKeyboard ShowKeyboard;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _ShowKeyboardForOverlay(ulong ulOverlayHandle, int eInputMode, int eLineInputMode, uint unFlags, IntPtr pchDescription, uint unCharMax, IntPtr pchExistingText, ulong uUserValue);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ShowKeyboardForOverlay ShowKeyboardForOverlay;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetKeyboardText(System.Text.StringBuilder pchText, uint cchText);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetKeyboardText GetKeyboardText;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _HideKeyboard();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _HideKeyboard HideKeyboard;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetKeyboardTransformAbsolute(ETrackingUniverseOrigin eTrackingOrigin, ref HmdMatrix34_t pmatTrackingOriginToKeyboardTransform);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetKeyboardTransformAbsolute SetKeyboardTransformAbsolute;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetKeyboardPositionForOverlay(ulong ulOverlayHandle, HmdRect2_t avoidRect);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetKeyboardPositionForOverlay SetKeyboardPositionForOverlay;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate VRMessageOverlayResponse _ShowMessageOverlay(IntPtr pchText, IntPtr pchCaption, IntPtr pchButton0Text, IntPtr pchButton1Text, IntPtr pchButton2Text, IntPtr pchButton3Text);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ShowMessageOverlay ShowMessageOverlay;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _CloseMessageOverlay();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _CloseMessageOverlay CloseMessageOverlay;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVROverlayView
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _AcquireOverlayView(ulong ulOverlayHandle, ref VRNativeDevice_t pNativeDevice, ref VROverlayView_t pOverlayView, uint unOverlayViewSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _AcquireOverlayView AcquireOverlayView;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _ReleaseOverlayView(ref VROverlayView_t pOverlayView);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ReleaseOverlayView ReleaseOverlayView;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _PostOverlayEvent(ulong ulOverlayHandle, ref VREvent_t pvrEvent);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _PostOverlayEvent PostOverlayEvent;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsViewingPermitted(ulong ulOverlayHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsViewingPermitted IsViewingPermitted;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRHeadsetView
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetHeadsetViewSize(uint nWidth, uint nHeight);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetHeadsetViewSize SetHeadsetViewSize;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _GetHeadsetViewSize(ref uint pnWidth, ref uint pnHeight);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetHeadsetViewSize GetHeadsetViewSize;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetHeadsetViewMode(uint eHeadsetViewMode);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetHeadsetViewMode SetHeadsetViewMode;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetHeadsetViewMode();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetHeadsetViewMode GetHeadsetViewMode;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetHeadsetViewCropped(bool bCropped);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetHeadsetViewCropped SetHeadsetViewCropped;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetHeadsetViewCropped();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetHeadsetViewCropped GetHeadsetViewCropped;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate float _GetHeadsetViewAspectRatio();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetHeadsetViewAspectRatio GetHeadsetViewAspectRatio;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetHeadsetViewBlendRange(float flStartPct, float flEndPct);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetHeadsetViewBlendRange SetHeadsetViewBlendRange;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _GetHeadsetViewBlendRange(ref float pStartPct, ref float pEndPct);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetHeadsetViewBlendRange GetHeadsetViewBlendRange;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRRenderModels
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRRenderModelError _LoadRenderModel_Async(IntPtr pchRenderModelName, ref IntPtr ppRenderModel);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _LoadRenderModel_Async LoadRenderModel_Async;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _FreeRenderModel(IntPtr pRenderModel);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _FreeRenderModel FreeRenderModel;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRRenderModelError _LoadTexture_Async(int textureId, ref IntPtr ppTexture);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _LoadTexture_Async LoadTexture_Async;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _FreeTexture(IntPtr pTexture);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _FreeTexture FreeTexture;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRRenderModelError _LoadTextureD3D11_Async(int textureId, IntPtr pD3D11Device, ref IntPtr ppD3D11Texture2D);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _LoadTextureD3D11_Async LoadTextureD3D11_Async;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRRenderModelError _LoadIntoTextureD3D11_Async(int textureId, IntPtr pDstTexture);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _LoadIntoTextureD3D11_Async LoadIntoTextureD3D11_Async;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _FreeTextureD3D11(IntPtr pD3D11Texture2D);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _FreeTextureD3D11 FreeTextureD3D11;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetRenderModelName(uint unRenderModelIndex, System.Text.StringBuilder pchRenderModelName, uint unRenderModelNameLen);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetRenderModelName GetRenderModelName;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetRenderModelCount();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetRenderModelCount GetRenderModelCount;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetComponentCount(IntPtr pchRenderModelName);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetComponentCount GetComponentCount;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetComponentName(IntPtr pchRenderModelName, uint unComponentIndex, System.Text.StringBuilder pchComponentName, uint unComponentNameLen);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetComponentName GetComponentName;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ulong _GetComponentButtonMask(IntPtr pchRenderModelName, IntPtr pchComponentName);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetComponentButtonMask GetComponentButtonMask;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetComponentRenderModelName(IntPtr pchRenderModelName, IntPtr pchComponentName, System.Text.StringBuilder pchComponentRenderModelName, uint unComponentRenderModelNameLen);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetComponentRenderModelName GetComponentRenderModelName;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetComponentStateForDevicePath(IntPtr pchRenderModelName, IntPtr pchComponentName, ulong devicePath, ref RenderModel_ControllerMode_State_t pState, ref RenderModel_ComponentState_t pComponentState);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetComponentStateForDevicePath GetComponentStateForDevicePath;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetComponentState(IntPtr pchRenderModelName, IntPtr pchComponentName, ref VRControllerState_t pControllerState, ref RenderModel_ControllerMode_State_t pState, ref RenderModel_ComponentState_t pComponentState);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetComponentState GetComponentState;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _RenderModelHasComponent(IntPtr pchRenderModelName, IntPtr pchComponentName);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _RenderModelHasComponent RenderModelHasComponent;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetRenderModelThumbnailURL(IntPtr pchRenderModelName, System.Text.StringBuilder pchThumbnailURL, uint unThumbnailURLLen, ref EVRRenderModelError peError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetRenderModelThumbnailURL GetRenderModelThumbnailURL;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetRenderModelOriginalPath(IntPtr pchRenderModelName, System.Text.StringBuilder pchOriginalPath, uint unOriginalPathLen, ref EVRRenderModelError peError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetRenderModelOriginalPath GetRenderModelOriginalPath;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate IntPtr _GetRenderModelErrorNameFromEnum(EVRRenderModelError error);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetRenderModelErrorNameFromEnum GetRenderModelErrorNameFromEnum;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRNotifications
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRNotificationError _CreateNotification(ulong ulOverlayHandle, ulong ulUserValue, EVRNotificationType type, IntPtr pchText, EVRNotificationStyle style, ref NotificationBitmap_t pImage, ref uint pNotificationId);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _CreateNotification CreateNotification;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRNotificationError _RemoveNotification(uint notificationId);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _RemoveNotification RemoveNotification;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRSettings
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate IntPtr _GetSettingsErrorNameFromEnum(EVRSettingsError eError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetSettingsErrorNameFromEnum GetSettingsErrorNameFromEnum;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetBool(IntPtr pchSection, IntPtr pchSettingsKey, bool bValue, ref EVRSettingsError peError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetBool SetBool;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetInt32(IntPtr pchSection, IntPtr pchSettingsKey, int nValue, ref EVRSettingsError peError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetInt32 SetInt32;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetFloat(IntPtr pchSection, IntPtr pchSettingsKey, float flValue, ref EVRSettingsError peError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetFloat SetFloat;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _SetString(IntPtr pchSection, IntPtr pchSettingsKey, IntPtr pchValue, ref EVRSettingsError peError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetString SetString;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetBool(IntPtr pchSection, IntPtr pchSettingsKey, ref EVRSettingsError peError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetBool GetBool;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate int _GetInt32(IntPtr pchSection, IntPtr pchSettingsKey, ref EVRSettingsError peError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetInt32 GetInt32;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate float _GetFloat(IntPtr pchSection, IntPtr pchSettingsKey, ref EVRSettingsError peError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetFloat GetFloat;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _GetString(IntPtr pchSection, IntPtr pchSettingsKey, System.Text.StringBuilder pchValue, uint unValueLen, ref EVRSettingsError peError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetString GetString;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _RemoveSection(IntPtr pchSection, ref EVRSettingsError peError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _RemoveSection RemoveSection;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate void _RemoveKeyInSection(IntPtr pchSection, IntPtr pchSettingsKey, ref EVRSettingsError peError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _RemoveKeyInSection RemoveKeyInSection;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRScreenshots
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRScreenshotError _RequestScreenshot(ref uint pOutScreenshotHandle, EVRScreenshotType type, IntPtr pchPreviewFilename, IntPtr pchVRFilename);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _RequestScreenshot RequestScreenshot;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRScreenshotError _HookScreenshot([In, Out] EVRScreenshotType[] pSupportedTypes, int numTypes);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _HookScreenshot HookScreenshot;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRScreenshotType _GetScreenshotPropertyType(uint screenshotHandle, ref EVRScreenshotError pError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetScreenshotPropertyType GetScreenshotPropertyType;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetScreenshotPropertyFilename(uint screenshotHandle, EVRScreenshotPropertyFilenames filenameType, System.Text.StringBuilder pchFilename, uint cchFilename, ref EVRScreenshotError pError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetScreenshotPropertyFilename GetScreenshotPropertyFilename;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRScreenshotError _UpdateScreenshotProgress(uint screenshotHandle, float flProgress);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _UpdateScreenshotProgress UpdateScreenshotProgress;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRScreenshotError _TakeStereoScreenshot(ref uint pOutScreenshotHandle, IntPtr pchPreviewFilename, IntPtr pchVRFilename);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _TakeStereoScreenshot TakeStereoScreenshot;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRScreenshotError _SubmitScreenshot(uint screenshotHandle, EVRScreenshotType type, IntPtr pchSourcePreviewFilename, IntPtr pchSourceVRFilename);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SubmitScreenshot SubmitScreenshot;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRResources
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _LoadSharedResource(IntPtr pchResourceName, string pchBuffer, uint unBufferLen);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _LoadSharedResource LoadSharedResource;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetResourceFullPath(IntPtr pchResourceName, IntPtr pchResourceTypeDirectory, System.Text.StringBuilder pchPathBuffer, uint unBufferLen);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetResourceFullPath GetResourceFullPath;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRDriverManager
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetDriverCount();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetDriverCount GetDriverCount;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetDriverName(uint nDriver, System.Text.StringBuilder pchValue, uint unBufferSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetDriverName GetDriverName;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ulong _GetDriverHandle(IntPtr pchDriverName);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetDriverHandle GetDriverHandle;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsEnabled(uint nDriver);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsEnabled IsEnabled;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRInput
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _SetActionManifestPath(IntPtr pchActionManifestPath);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetActionManifestPath SetActionManifestPath;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetActionSetHandle(IntPtr pchActionSetName, ref ulong pHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetActionSetHandle GetActionSetHandle;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetActionHandle(IntPtr pchActionName, ref ulong pHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetActionHandle GetActionHandle;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetInputSourceHandle(IntPtr pchInputSourcePath, ref ulong pHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetInputSourceHandle GetInputSourceHandle;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _UpdateActionState([In, Out] VRActiveActionSet_t[] pSets, uint unSizeOfVRSelectedActionSet_t, uint unSetCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _UpdateActionState UpdateActionState;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetDigitalActionData(ulong action, ref InputDigitalActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetDigitalActionData GetDigitalActionData;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetAnalogActionData(ulong action, ref InputAnalogActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetAnalogActionData GetAnalogActionData;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetPoseActionDataRelativeToNow(ulong action, ETrackingUniverseOrigin eOrigin, float fPredictedSecondsFromNow, ref InputPoseActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetPoseActionDataRelativeToNow GetPoseActionDataRelativeToNow;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetPoseActionDataForNextFrame(ulong action, ETrackingUniverseOrigin eOrigin, ref InputPoseActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetPoseActionDataForNextFrame GetPoseActionDataForNextFrame;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetSkeletalActionData(ulong action, ref InputSkeletalActionData_t pActionData, uint unActionDataSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetSkeletalActionData GetSkeletalActionData;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetDominantHand(ref ETrackedControllerRole peDominantHand);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetDominantHand GetDominantHand;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _SetDominantHand(ETrackedControllerRole eDominantHand);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetDominantHand SetDominantHand;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetBoneCount(ulong action, ref uint pBoneCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetBoneCount GetBoneCount;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetBoneHierarchy(ulong action, [In, Out] int[] pParentIndices, uint unIndexArayCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetBoneHierarchy GetBoneHierarchy;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetBoneName(ulong action, int nBoneIndex, System.Text.StringBuilder pchBoneName, uint unNameBufferSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetBoneName GetBoneName;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetSkeletalReferenceTransforms(ulong action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalReferencePose eReferencePose, [In, Out] VRBoneTransform_t[] pTransformArray, uint unTransformArrayCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetSkeletalReferenceTransforms GetSkeletalReferenceTransforms;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetSkeletalTrackingLevel(ulong action, ref EVRSkeletalTrackingLevel pSkeletalTrackingLevel);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetSkeletalTrackingLevel GetSkeletalTrackingLevel;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetSkeletalBoneData(ulong action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalMotionRange eMotionRange, [In, Out] VRBoneTransform_t[] pTransformArray, uint unTransformArrayCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetSkeletalBoneData GetSkeletalBoneData;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetSkeletalSummaryData(ulong action, EVRSummaryType eSummaryType, ref VRSkeletalSummaryData_t pSkeletalSummaryData);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetSkeletalSummaryData GetSkeletalSummaryData;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetSkeletalBoneDataCompressed(ulong action, EVRSkeletalMotionRange eMotionRange, IntPtr pvCompressedData, uint unCompressedSize, ref uint punRequiredCompressedSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetSkeletalBoneDataCompressed GetSkeletalBoneDataCompressed;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _DecompressSkeletalBoneData(IntPtr pvCompressedBuffer, uint unCompressedBufferSize, EVRSkeletalTransformSpace eTransformSpace, [In, Out] VRBoneTransform_t[] pTransformArray, uint unTransformArrayCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _DecompressSkeletalBoneData DecompressSkeletalBoneData;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _TriggerHapticVibrationAction(ulong action, float fStartSecondsFromNow, float fDurationSeconds, float fFrequency, float fAmplitude, ulong ulRestrictToDevice);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _TriggerHapticVibrationAction TriggerHapticVibrationAction;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetActionOrigins(ulong actionSetHandle, ulong digitalActionHandle, [In, Out] ulong[] originsOut, uint originOutCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetActionOrigins GetActionOrigins;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetOriginLocalizedName(ulong origin, System.Text.StringBuilder pchNameArray, uint unNameArraySize, int unStringSectionsToInclude);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOriginLocalizedName GetOriginLocalizedName;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetOriginTrackedDeviceInfo(ulong origin, ref InputOriginInfo_t pOriginInfo, uint unOriginInfoSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOriginTrackedDeviceInfo GetOriginTrackedDeviceInfo;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetActionBindingInfo(ulong action, ref InputBindingInfo_t pOriginInfo, uint unBindingInfoSize, uint unBindingInfoCount, ref uint punReturnedBindingInfoCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetActionBindingInfo GetActionBindingInfo;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _ShowActionOrigins(ulong actionSetHandle, ulong ulActionHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ShowActionOrigins ShowActionOrigins;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _ShowBindingsForActionSet([In, Out] VRActiveActionSet_t[] pSets, uint unSizeOfVRSelectedActionSet_t, uint unSetCount, ulong originToHighlight);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ShowBindingsForActionSet ShowBindingsForActionSet;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetComponentStateForBinding(IntPtr pchRenderModelName, IntPtr pchComponentName, ref InputBindingInfo_t pOriginInfo, uint unBindingInfoSize, uint unBindingInfoCount, ref RenderModel_ComponentState_t pComponentState);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetComponentStateForBinding GetComponentStateForBinding;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _IsUsingLegacyInput();
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _IsUsingLegacyInput IsUsingLegacyInput;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _OpenBindingUI(IntPtr pchAppKey, ulong ulActionSetHandle, ulong ulDeviceHandle, bool bShowOnDesktop);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _OpenBindingUI OpenBindingUI;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRInputError _GetBindingVariant(ulong ulDevicePath, System.Text.StringBuilder pchVariantArray, uint unVariantArraySize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetBindingVariant GetBindingVariant;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRIOBuffer
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EIOBufferError _Open(IntPtr pchPath, EIOBufferMode mode, uint unElementSize, uint unElements, ref ulong pulBuffer);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _Open Open;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EIOBufferError _Close(ulong ulBuffer);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _Close Close;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EIOBufferError _Read(ulong ulBuffer, IntPtr pDst, uint unBytes, ref uint punRead);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _Read Read;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EIOBufferError _Write(ulong ulBuffer, IntPtr pSrc, uint unBytes);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _Write Write;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ulong _PropertyContainer(ulong ulBuffer);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _PropertyContainer PropertyContainer;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _HasReaders(ulong ulBuffer);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _HasReaders HasReaders;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRSpatialAnchors
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRSpatialAnchorError _CreateSpatialAnchorFromDescriptor(IntPtr pchDescriptor, ref uint pHandleOut);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _CreateSpatialAnchorFromDescriptor CreateSpatialAnchorFromDescriptor;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRSpatialAnchorError _CreateSpatialAnchorFromPose(uint unDeviceIndex, ETrackingUniverseOrigin eOrigin, ref SpatialAnchorPose_t pPose, ref uint pHandleOut);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _CreateSpatialAnchorFromPose CreateSpatialAnchorFromPose;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRSpatialAnchorError _GetSpatialAnchorPose(uint unHandle, ETrackingUniverseOrigin eOrigin, ref SpatialAnchorPose_t pPoseOut);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetSpatialAnchorPose GetSpatialAnchorPose;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRSpatialAnchorError _GetSpatialAnchorDescriptor(uint unHandle, System.Text.StringBuilder pchDescriptorOut, ref uint punDescriptorBufferLenInOut);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetSpatialAnchorDescriptor GetSpatialAnchorDescriptor;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRDebug
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRDebugError _EmitVrProfilerEvent(IntPtr pchMessage);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _EmitVrProfilerEvent EmitVrProfilerEvent;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRDebugError _BeginVrProfilerEvent(ref ulong pHandleOut);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _BeginVrProfilerEvent BeginVrProfilerEvent;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRDebugError _FinishVrProfilerEvent(ulong hHandle, IntPtr pchMessage);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _FinishVrProfilerEvent FinishVrProfilerEvent;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _DriverDebugRequest(uint unDeviceIndex, IntPtr pchRequest, System.Text.StringBuilder pchResponseBuffer, uint unResponseBufferSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _DriverDebugRequest DriverDebugRequest;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRProperties
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ETrackedPropertyError _ReadPropertyBatch(ulong ulContainerHandle, ref PropertyRead_t pBatch, uint unBatchEntryCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ReadPropertyBatch ReadPropertyBatch;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ETrackedPropertyError _WritePropertyBatch(ulong ulContainerHandle, ref PropertyWrite_t pBatch, uint unBatchEntryCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _WritePropertyBatch WritePropertyBatch;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate IntPtr _GetPropErrorNameFromEnum(ETrackedPropertyError error);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetPropErrorNameFromEnum GetPropErrorNameFromEnum;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ulong _TrackedDeviceToPropertyContainer(uint nDevice);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _TrackedDeviceToPropertyContainer TrackedDeviceToPropertyContainer;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRPaths
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ETrackedPropertyError _ReadPathBatch(ulong ulRootHandle, ref PathRead_t pBatch, uint unBatchEntryCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ReadPathBatch ReadPathBatch;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ETrackedPropertyError _WritePathBatch(ulong ulRootHandle, ref PathWrite_t pBatch, uint unBatchEntryCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _WritePathBatch WritePathBatch;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ETrackedPropertyError _StringToHandle(ref ulong pHandle, IntPtr pchPath);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _StringToHandle StringToHandle;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate ETrackedPropertyError _HandleToString(ulong pHandle, string pchBuffer, uint unBufferSize, ref uint punBufferSizeUsed);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _HandleToString HandleToString;
}
[StructLayout(LayoutKind.Sequential)]
public struct IVRBlockQueue
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EBlockQueueError _Create(ref ulong pulQueueHandle, IntPtr pchPath, uint unBlockDataSize, uint unBlockHeaderSize, uint unBlockCount);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _Create Create;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EBlockQueueError _Connect(ref ulong pulQueueHandle, IntPtr pchPath);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _Connect Connect;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EBlockQueueError _Destroy(ulong ulQueueHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _Destroy Destroy;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EBlockQueueError _AcquireWriteOnlyBlock(ulong ulQueueHandle, ref ulong pulBlockHandle, ref IntPtr ppvBuffer);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _AcquireWriteOnlyBlock AcquireWriteOnlyBlock;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EBlockQueueError _ReleaseWriteOnlyBlock(ulong ulQueueHandle, ulong ulBlockHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ReleaseWriteOnlyBlock ReleaseWriteOnlyBlock;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EBlockQueueError _WaitAndAcquireReadOnlyBlock(ulong ulQueueHandle, ref ulong pulBlockHandle, ref IntPtr ppvBuffer, EBlockQueueReadType eReadType, uint unTimeoutMs);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _WaitAndAcquireReadOnlyBlock WaitAndAcquireReadOnlyBlock;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EBlockQueueError _AcquireReadOnlyBlock(ulong ulQueueHandle, ref ulong pulBlockHandle, ref IntPtr ppvBuffer, EBlockQueueReadType eReadType);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _AcquireReadOnlyBlock AcquireReadOnlyBlock;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EBlockQueueError _ReleaseReadOnlyBlock(ulong ulQueueHandle, ulong ulBlockHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ReleaseReadOnlyBlock ReleaseReadOnlyBlock;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EBlockQueueError _QueueHasReader(ulong ulQueueHandle, ref bool pbHasReaders);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _QueueHasReader QueueHasReader;
}
public class Utils
{
public static IntPtr ToUtf8(string managedString)
{
if (string.IsNullOrEmpty(managedString))
return IntPtr.Zero;
int size = System.Text.Encoding.UTF8.GetByteCount(managedString) + 1;
if (buffer.Length < size) buffer = new byte[size];
int written = System.Text.Encoding.UTF8.GetBytes(managedString, 0, managedString.Length, buffer, 0);
buffer[written] = 0x00; // null terminate
IntPtr nativeUtf8 = Marshal.AllocHGlobal(written+1);
Marshal.Copy(buffer, 0, nativeUtf8, written+1);
return nativeUtf8;
}
private static byte[] buffer = new byte[1024];
}
public class CVRSystem
{
IVRSystem FnTable;
internal CVRSystem(IntPtr pInterface)
{
FnTable = (IVRSystem)Marshal.PtrToStructure(pInterface, typeof(IVRSystem));
}
public void GetRecommendedRenderTargetSize(ref uint pnWidth,ref uint pnHeight)
{
pnWidth = 0;
pnHeight = 0;
FnTable.GetRecommendedRenderTargetSize(ref pnWidth,ref pnHeight);
}
public HmdMatrix44_t GetProjectionMatrix(EVREye eEye,float fNearZ,float fFarZ)
{
HmdMatrix44_t result = FnTable.GetProjectionMatrix(eEye,fNearZ,fFarZ);
return result;
}
public void GetProjectionRaw(EVREye eEye,ref float pfLeft,ref float pfRight,ref float pfTop,ref float pfBottom)
{
pfLeft = 0;
pfRight = 0;
pfTop = 0;
pfBottom = 0;
FnTable.GetProjectionRaw(eEye,ref pfLeft,ref pfRight,ref pfTop,ref pfBottom);
}
public bool ComputeDistortion(EVREye eEye,float fU,float fV,ref DistortionCoordinates_t pDistortionCoordinates)
{
bool result = FnTable.ComputeDistortion(eEye,fU,fV,ref pDistortionCoordinates);
return result;
}
public HmdMatrix34_t GetEyeToHeadTransform(EVREye eEye)
{
HmdMatrix34_t result = FnTable.GetEyeToHeadTransform(eEye);
return result;
}
public bool GetTimeSinceLastVsync(ref float pfSecondsSinceLastVsync,ref ulong pulFrameCounter)
{
pfSecondsSinceLastVsync = 0;
pulFrameCounter = 0;
bool result = FnTable.GetTimeSinceLastVsync(ref pfSecondsSinceLastVsync,ref pulFrameCounter);
return result;
}
public int GetD3D9AdapterIndex()
{
int result = FnTable.GetD3D9AdapterIndex();
return result;
}
public void GetDXGIOutputInfo(ref int pnAdapterIndex)
{
pnAdapterIndex = 0;
FnTable.GetDXGIOutputInfo(ref pnAdapterIndex);
}
public void GetOutputDevice(ref ulong pnDevice,ETextureType textureType,IntPtr pInstance)
{
pnDevice = 0;
FnTable.GetOutputDevice(ref pnDevice,textureType,pInstance);
}
public bool IsDisplayOnDesktop()
{
bool result = FnTable.IsDisplayOnDesktop();
return result;
}
public bool SetDisplayVisibility(bool bIsVisibleOnDesktop)
{
bool result = FnTable.SetDisplayVisibility(bIsVisibleOnDesktop);
return result;
}
public void GetDeviceToAbsoluteTrackingPose(ETrackingUniverseOrigin eOrigin,float fPredictedSecondsToPhotonsFromNow,TrackedDevicePose_t [] pTrackedDevicePoseArray)
{
FnTable.GetDeviceToAbsoluteTrackingPose(eOrigin,fPredictedSecondsToPhotonsFromNow,pTrackedDevicePoseArray,(uint) pTrackedDevicePoseArray.Length);
}
public void ResetSeatedZeroPose()
{
FnTable.ResetSeatedZeroPose();
}
public HmdMatrix34_t GetSeatedZeroPoseToStandingAbsoluteTrackingPose()
{
HmdMatrix34_t result = FnTable.GetSeatedZeroPoseToStandingAbsoluteTrackingPose();
return result;
}
public HmdMatrix34_t GetRawZeroPoseToStandingAbsoluteTrackingPose()
{
HmdMatrix34_t result = FnTable.GetRawZeroPoseToStandingAbsoluteTrackingPose();
return result;
}
public uint GetSortedTrackedDeviceIndicesOfClass(ETrackedDeviceClass eTrackedDeviceClass,uint [] punTrackedDeviceIndexArray,uint unRelativeToTrackedDeviceIndex)
{
uint result = FnTable.GetSortedTrackedDeviceIndicesOfClass(eTrackedDeviceClass,punTrackedDeviceIndexArray,(uint) punTrackedDeviceIndexArray.Length,unRelativeToTrackedDeviceIndex);
return result;
}
public EDeviceActivityLevel GetTrackedDeviceActivityLevel(uint unDeviceId)
{
EDeviceActivityLevel result = FnTable.GetTrackedDeviceActivityLevel(unDeviceId);
return result;
}
public void ApplyTransform(ref TrackedDevicePose_t pOutputPose,ref TrackedDevicePose_t pTrackedDevicePose,ref HmdMatrix34_t pTransform)
{
FnTable.ApplyTransform(ref pOutputPose,ref pTrackedDevicePose,ref pTransform);
}
public uint GetTrackedDeviceIndexForControllerRole(ETrackedControllerRole unDeviceType)
{
uint result = FnTable.GetTrackedDeviceIndexForControllerRole(unDeviceType);
return result;
}
public ETrackedControllerRole GetControllerRoleForTrackedDeviceIndex(uint unDeviceIndex)
{
ETrackedControllerRole result = FnTable.GetControllerRoleForTrackedDeviceIndex(unDeviceIndex);
return result;
}
public ETrackedDeviceClass GetTrackedDeviceClass(uint unDeviceIndex)
{
ETrackedDeviceClass result = FnTable.GetTrackedDeviceClass(unDeviceIndex);
return result;
}
public bool IsTrackedDeviceConnected(uint unDeviceIndex)
{
bool result = FnTable.IsTrackedDeviceConnected(unDeviceIndex);
return result;
}
public bool GetBoolTrackedDeviceProperty(uint unDeviceIndex,ETrackedDeviceProperty prop,ref ETrackedPropertyError pError)
{
bool result = FnTable.GetBoolTrackedDeviceProperty(unDeviceIndex,prop,ref pError);
return result;
}
public float GetFloatTrackedDeviceProperty(uint unDeviceIndex,ETrackedDeviceProperty prop,ref ETrackedPropertyError pError)
{
float result = FnTable.GetFloatTrackedDeviceProperty(unDeviceIndex,prop,ref pError);
return result;
}
public int GetInt32TrackedDeviceProperty(uint unDeviceIndex,ETrackedDeviceProperty prop,ref ETrackedPropertyError pError)
{
int result = FnTable.GetInt32TrackedDeviceProperty(unDeviceIndex,prop,ref pError);
return result;
}
public ulong GetUint64TrackedDeviceProperty(uint unDeviceIndex,ETrackedDeviceProperty prop,ref ETrackedPropertyError pError)
{
ulong result = FnTable.GetUint64TrackedDeviceProperty(unDeviceIndex,prop,ref pError);
return result;
}
public HmdMatrix34_t GetMatrix34TrackedDeviceProperty(uint unDeviceIndex,ETrackedDeviceProperty prop,ref ETrackedPropertyError pError)
{
HmdMatrix34_t result = FnTable.GetMatrix34TrackedDeviceProperty(unDeviceIndex,prop,ref pError);
return result;
}
public uint GetArrayTrackedDeviceProperty(uint unDeviceIndex,ETrackedDeviceProperty prop,uint propType,IntPtr pBuffer,uint unBufferSize,ref ETrackedPropertyError pError)
{
uint result = FnTable.GetArrayTrackedDeviceProperty(unDeviceIndex,prop,propType,pBuffer,unBufferSize,ref pError);
return result;
}
public uint GetStringTrackedDeviceProperty(uint unDeviceIndex,ETrackedDeviceProperty prop,System.Text.StringBuilder pchValue,uint unBufferSize,ref ETrackedPropertyError pError)
{
uint result = FnTable.GetStringTrackedDeviceProperty(unDeviceIndex,prop,pchValue,unBufferSize,ref pError);
return result;
}
public string GetPropErrorNameFromEnum(ETrackedPropertyError error)
{
IntPtr result = FnTable.GetPropErrorNameFromEnum(error);
return Marshal.PtrToStringAnsi(result);
}
// This is a terrible hack to workaround the fact that VRControllerState_t and VREvent_t were
// originally mis-compiled with the wrong packing for Linux and OSX.
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _PollNextEventPacked(ref VREvent_t_Packed pEvent,uint uncbVREvent);
[StructLayout(LayoutKind.Explicit)]
struct PollNextEventUnion
{
[FieldOffset(0)]
public IVRSystem._PollNextEvent pPollNextEvent;
[FieldOffset(0)]
public _PollNextEventPacked pPollNextEventPacked;
}
public bool PollNextEvent(ref VREvent_t pEvent,uint uncbVREvent)
{
#if !UNITY_METRO
if ((System.Environment.OSVersion.Platform == System.PlatformID.MacOSX) ||
(System.Environment.OSVersion.Platform == System.PlatformID.Unix))
{
PollNextEventUnion u;
VREvent_t_Packed event_packed = new VREvent_t_Packed();
u.pPollNextEventPacked = null;
u.pPollNextEvent = FnTable.PollNextEvent;
bool packed_result = u.pPollNextEventPacked(ref event_packed,(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VREvent_t_Packed)));
event_packed.Unpack(ref pEvent);
return packed_result;
}
#endif
bool result = FnTable.PollNextEvent(ref pEvent,uncbVREvent);
return result;
}
public bool PollNextEventWithPose(ETrackingUniverseOrigin eOrigin,ref VREvent_t pEvent,uint uncbVREvent,ref TrackedDevicePose_t pTrackedDevicePose)
{
bool result = FnTable.PollNextEventWithPose(eOrigin,ref pEvent,uncbVREvent,ref pTrackedDevicePose);
return result;
}
public string GetEventTypeNameFromEnum(EVREventType eType)
{
IntPtr result = FnTable.GetEventTypeNameFromEnum(eType);
return Marshal.PtrToStringAnsi(result);
}
public HiddenAreaMesh_t GetHiddenAreaMesh(EVREye eEye,EHiddenAreaMeshType type)
{
HiddenAreaMesh_t result = FnTable.GetHiddenAreaMesh(eEye,type);
return result;
}
// This is a terrible hack to workaround the fact that VRControllerState_t and VREvent_t were
// originally mis-compiled with the wrong packing for Linux and OSX.
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetControllerStatePacked(uint unControllerDeviceIndex,ref VRControllerState_t_Packed pControllerState,uint unControllerStateSize);
[StructLayout(LayoutKind.Explicit)]
struct GetControllerStateUnion
{
[FieldOffset(0)]
public IVRSystem._GetControllerState pGetControllerState;
[FieldOffset(0)]
public _GetControllerStatePacked pGetControllerStatePacked;
}
public bool GetControllerState(uint unControllerDeviceIndex,ref VRControllerState_t pControllerState,uint unControllerStateSize)
{
#if !UNITY_METRO
if ((System.Environment.OSVersion.Platform == System.PlatformID.MacOSX) ||
(System.Environment.OSVersion.Platform == System.PlatformID.Unix))
{
GetControllerStateUnion u;
VRControllerState_t_Packed state_packed = new VRControllerState_t_Packed(pControllerState);
u.pGetControllerStatePacked = null;
u.pGetControllerState = FnTable.GetControllerState;
bool packed_result = u.pGetControllerStatePacked(unControllerDeviceIndex,ref state_packed,(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VRControllerState_t_Packed)));
state_packed.Unpack(ref pControllerState);
return packed_result;
}
#endif
bool result = FnTable.GetControllerState(unControllerDeviceIndex,ref pControllerState,unControllerStateSize);
return result;
}
// This is a terrible hack to workaround the fact that VRControllerState_t and VREvent_t were
// originally mis-compiled with the wrong packing for Linux and OSX.
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetControllerStateWithPosePacked(ETrackingUniverseOrigin eOrigin,uint unControllerDeviceIndex,ref VRControllerState_t_Packed pControllerState,uint unControllerStateSize,ref TrackedDevicePose_t pTrackedDevicePose);
[StructLayout(LayoutKind.Explicit)]
struct GetControllerStateWithPoseUnion
{
[FieldOffset(0)]
public IVRSystem._GetControllerStateWithPose pGetControllerStateWithPose;
[FieldOffset(0)]
public _GetControllerStateWithPosePacked pGetControllerStateWithPosePacked;
}
public bool GetControllerStateWithPose(ETrackingUniverseOrigin eOrigin,uint unControllerDeviceIndex,ref VRControllerState_t pControllerState,uint unControllerStateSize,ref TrackedDevicePose_t pTrackedDevicePose)
{
#if !UNITY_METRO
if ((System.Environment.OSVersion.Platform == System.PlatformID.MacOSX) ||
(System.Environment.OSVersion.Platform == System.PlatformID.Unix))
{
GetControllerStateWithPoseUnion u;
VRControllerState_t_Packed state_packed = new VRControllerState_t_Packed(pControllerState);
u.pGetControllerStateWithPosePacked = null;
u.pGetControllerStateWithPose = FnTable.GetControllerStateWithPose;
bool packed_result = u.pGetControllerStateWithPosePacked(eOrigin,unControllerDeviceIndex,ref state_packed,(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VRControllerState_t_Packed)),ref pTrackedDevicePose);
state_packed.Unpack(ref pControllerState);
return packed_result;
}
#endif
bool result = FnTable.GetControllerStateWithPose(eOrigin,unControllerDeviceIndex,ref pControllerState,unControllerStateSize,ref pTrackedDevicePose);
return result;
}
public void TriggerHapticPulse(uint unControllerDeviceIndex,uint unAxisId,ushort usDurationMicroSec)
{
FnTable.TriggerHapticPulse(unControllerDeviceIndex,unAxisId,usDurationMicroSec);
}
public string GetButtonIdNameFromEnum(EVRButtonId eButtonId)
{
IntPtr result = FnTable.GetButtonIdNameFromEnum(eButtonId);
return Marshal.PtrToStringAnsi(result);
}
public string GetControllerAxisTypeNameFromEnum(EVRControllerAxisType eAxisType)
{
IntPtr result = FnTable.GetControllerAxisTypeNameFromEnum(eAxisType);
return Marshal.PtrToStringAnsi(result);
}
public bool IsInputAvailable()
{
bool result = FnTable.IsInputAvailable();
return result;
}
public bool IsSteamVRDrawingControllers()
{
bool result = FnTable.IsSteamVRDrawingControllers();
return result;
}
public bool ShouldApplicationPause()
{
bool result = FnTable.ShouldApplicationPause();
return result;
}
public bool ShouldApplicationReduceRenderingWork()
{
bool result = FnTable.ShouldApplicationReduceRenderingWork();
return result;
}
public EVRFirmwareError PerformFirmwareUpdate(uint unDeviceIndex)
{
EVRFirmwareError result = FnTable.PerformFirmwareUpdate(unDeviceIndex);
return result;
}
public void AcknowledgeQuit_Exiting()
{
FnTable.AcknowledgeQuit_Exiting();
}
public uint GetAppContainerFilePaths(System.Text.StringBuilder pchBuffer,uint unBufferSize)
{
uint result = FnTable.GetAppContainerFilePaths(pchBuffer,unBufferSize);
return result;
}
public string GetRuntimeVersion()
{
IntPtr result = FnTable.GetRuntimeVersion();
return Marshal.PtrToStringAnsi(result);
}
}
public class CVRExtendedDisplay
{
IVRExtendedDisplay FnTable;
internal CVRExtendedDisplay(IntPtr pInterface)
{
FnTable = (IVRExtendedDisplay)Marshal.PtrToStructure(pInterface, typeof(IVRExtendedDisplay));
}
public void GetWindowBounds(ref int pnX,ref int pnY,ref uint pnWidth,ref uint pnHeight)
{
pnX = 0;
pnY = 0;
pnWidth = 0;
pnHeight = 0;
FnTable.GetWindowBounds(ref pnX,ref pnY,ref pnWidth,ref pnHeight);
}
public void GetEyeOutputViewport(EVREye eEye,ref uint pnX,ref uint pnY,ref uint pnWidth,ref uint pnHeight)
{
pnX = 0;
pnY = 0;
pnWidth = 0;
pnHeight = 0;
FnTable.GetEyeOutputViewport(eEye,ref pnX,ref pnY,ref pnWidth,ref pnHeight);
}
public void GetDXGIOutputInfo(ref int pnAdapterIndex,ref int pnAdapterOutputIndex)
{
pnAdapterIndex = 0;
pnAdapterOutputIndex = 0;
FnTable.GetDXGIOutputInfo(ref pnAdapterIndex,ref pnAdapterOutputIndex);
}
}
public class CVRTrackedCamera
{
IVRTrackedCamera FnTable;
internal CVRTrackedCamera(IntPtr pInterface)
{
FnTable = (IVRTrackedCamera)Marshal.PtrToStructure(pInterface, typeof(IVRTrackedCamera));
}
public string GetCameraErrorNameFromEnum(EVRTrackedCameraError eCameraError)
{
IntPtr result = FnTable.GetCameraErrorNameFromEnum(eCameraError);
return Marshal.PtrToStringAnsi(result);
}
public EVRTrackedCameraError HasCamera(uint nDeviceIndex,ref bool pHasCamera)
{
pHasCamera = false;
EVRTrackedCameraError result = FnTable.HasCamera(nDeviceIndex,ref pHasCamera);
return result;
}
public EVRTrackedCameraError GetCameraFrameSize(uint nDeviceIndex,EVRTrackedCameraFrameType eFrameType,ref uint pnWidth,ref uint pnHeight,ref uint pnFrameBufferSize)
{
pnWidth = 0;
pnHeight = 0;
pnFrameBufferSize = 0;
EVRTrackedCameraError result = FnTable.GetCameraFrameSize(nDeviceIndex,eFrameType,ref pnWidth,ref pnHeight,ref pnFrameBufferSize);
return result;
}
public EVRTrackedCameraError GetCameraIntrinsics(uint nDeviceIndex,uint nCameraIndex,EVRTrackedCameraFrameType eFrameType,ref HmdVector2_t pFocalLength,ref HmdVector2_t pCenter)
{
EVRTrackedCameraError result = FnTable.GetCameraIntrinsics(nDeviceIndex,nCameraIndex,eFrameType,ref pFocalLength,ref pCenter);
return result;
}
public EVRTrackedCameraError GetCameraProjection(uint nDeviceIndex,uint nCameraIndex,EVRTrackedCameraFrameType eFrameType,float flZNear,float flZFar,ref HmdMatrix44_t pProjection)
{
EVRTrackedCameraError result = FnTable.GetCameraProjection(nDeviceIndex,nCameraIndex,eFrameType,flZNear,flZFar,ref pProjection);
return result;
}
public EVRTrackedCameraError AcquireVideoStreamingService(uint nDeviceIndex,ref ulong pHandle)
{
pHandle = 0;
EVRTrackedCameraError result = FnTable.AcquireVideoStreamingService(nDeviceIndex,ref pHandle);
return result;
}
public EVRTrackedCameraError ReleaseVideoStreamingService(ulong hTrackedCamera)
{
EVRTrackedCameraError result = FnTable.ReleaseVideoStreamingService(hTrackedCamera);
return result;
}
public EVRTrackedCameraError GetVideoStreamFrameBuffer(ulong hTrackedCamera,EVRTrackedCameraFrameType eFrameType,IntPtr pFrameBuffer,uint nFrameBufferSize,ref CameraVideoStreamFrameHeader_t pFrameHeader,uint nFrameHeaderSize)
{
EVRTrackedCameraError result = FnTable.GetVideoStreamFrameBuffer(hTrackedCamera,eFrameType,pFrameBuffer,nFrameBufferSize,ref pFrameHeader,nFrameHeaderSize);
return result;
}
public EVRTrackedCameraError GetVideoStreamTextureSize(uint nDeviceIndex,EVRTrackedCameraFrameType eFrameType,ref VRTextureBounds_t pTextureBounds,ref uint pnWidth,ref uint pnHeight)
{
pnWidth = 0;
pnHeight = 0;
EVRTrackedCameraError result = FnTable.GetVideoStreamTextureSize(nDeviceIndex,eFrameType,ref pTextureBounds,ref pnWidth,ref pnHeight);
return result;
}
public EVRTrackedCameraError GetVideoStreamTextureD3D11(ulong hTrackedCamera,EVRTrackedCameraFrameType eFrameType,IntPtr pD3D11DeviceOrResource,ref IntPtr ppD3D11ShaderResourceView,ref CameraVideoStreamFrameHeader_t pFrameHeader,uint nFrameHeaderSize)
{
EVRTrackedCameraError result = FnTable.GetVideoStreamTextureD3D11(hTrackedCamera,eFrameType,pD3D11DeviceOrResource,ref ppD3D11ShaderResourceView,ref pFrameHeader,nFrameHeaderSize);
return result;
}
public EVRTrackedCameraError GetVideoStreamTextureGL(ulong hTrackedCamera,EVRTrackedCameraFrameType eFrameType,ref uint pglTextureId,ref CameraVideoStreamFrameHeader_t pFrameHeader,uint nFrameHeaderSize)
{
pglTextureId = 0;
EVRTrackedCameraError result = FnTable.GetVideoStreamTextureGL(hTrackedCamera,eFrameType,ref pglTextureId,ref pFrameHeader,nFrameHeaderSize);
return result;
}
public EVRTrackedCameraError ReleaseVideoStreamTextureGL(ulong hTrackedCamera,uint glTextureId)
{
EVRTrackedCameraError result = FnTable.ReleaseVideoStreamTextureGL(hTrackedCamera,glTextureId);
return result;
}
public void SetCameraTrackingSpace(ETrackingUniverseOrigin eUniverse)
{
FnTable.SetCameraTrackingSpace(eUniverse);
}
public ETrackingUniverseOrigin GetCameraTrackingSpace()
{
ETrackingUniverseOrigin result = FnTable.GetCameraTrackingSpace();
return result;
}
}
public class CVRApplications
{
IVRApplications FnTable;
internal CVRApplications(IntPtr pInterface)
{
FnTable = (IVRApplications)Marshal.PtrToStructure(pInterface, typeof(IVRApplications));
}
public EVRApplicationError AddApplicationManifest(string pchApplicationManifestFullPath,bool bTemporary)
{
IntPtr pchApplicationManifestFullPathUtf8 = Utils.ToUtf8(pchApplicationManifestFullPath);
EVRApplicationError result = FnTable.AddApplicationManifest(pchApplicationManifestFullPathUtf8,bTemporary);
Marshal.FreeHGlobal(pchApplicationManifestFullPathUtf8);
return result;
}
public EVRApplicationError RemoveApplicationManifest(string pchApplicationManifestFullPath)
{
IntPtr pchApplicationManifestFullPathUtf8 = Utils.ToUtf8(pchApplicationManifestFullPath);
EVRApplicationError result = FnTable.RemoveApplicationManifest(pchApplicationManifestFullPathUtf8);
Marshal.FreeHGlobal(pchApplicationManifestFullPathUtf8);
return result;
}
public bool IsApplicationInstalled(string pchAppKey)
{
IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey);
bool result = FnTable.IsApplicationInstalled(pchAppKeyUtf8);
Marshal.FreeHGlobal(pchAppKeyUtf8);
return result;
}
public uint GetApplicationCount()
{
uint result = FnTable.GetApplicationCount();
return result;
}
public EVRApplicationError GetApplicationKeyByIndex(uint unApplicationIndex,System.Text.StringBuilder pchAppKeyBuffer,uint unAppKeyBufferLen)
{
EVRApplicationError result = FnTable.GetApplicationKeyByIndex(unApplicationIndex,pchAppKeyBuffer,unAppKeyBufferLen);
return result;
}
public EVRApplicationError GetApplicationKeyByProcessId(uint unProcessId,System.Text.StringBuilder pchAppKeyBuffer,uint unAppKeyBufferLen)
{
EVRApplicationError result = FnTable.GetApplicationKeyByProcessId(unProcessId,pchAppKeyBuffer,unAppKeyBufferLen);
return result;
}
public EVRApplicationError LaunchApplication(string pchAppKey)
{
IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey);
EVRApplicationError result = FnTable.LaunchApplication(pchAppKeyUtf8);
Marshal.FreeHGlobal(pchAppKeyUtf8);
return result;
}
public EVRApplicationError LaunchTemplateApplication(string pchTemplateAppKey,string pchNewAppKey,AppOverrideKeys_t [] pKeys)
{
IntPtr pchTemplateAppKeyUtf8 = Utils.ToUtf8(pchTemplateAppKey);
IntPtr pchNewAppKeyUtf8 = Utils.ToUtf8(pchNewAppKey);
EVRApplicationError result = FnTable.LaunchTemplateApplication(pchTemplateAppKeyUtf8,pchNewAppKeyUtf8,pKeys,(uint) pKeys.Length);
Marshal.FreeHGlobal(pchTemplateAppKeyUtf8);
Marshal.FreeHGlobal(pchNewAppKeyUtf8);
return result;
}
public EVRApplicationError LaunchApplicationFromMimeType(string pchMimeType,string pchArgs)
{
IntPtr pchMimeTypeUtf8 = Utils.ToUtf8(pchMimeType);
IntPtr pchArgsUtf8 = Utils.ToUtf8(pchArgs);
EVRApplicationError result = FnTable.LaunchApplicationFromMimeType(pchMimeTypeUtf8,pchArgsUtf8);
Marshal.FreeHGlobal(pchMimeTypeUtf8);
Marshal.FreeHGlobal(pchArgsUtf8);
return result;
}
public EVRApplicationError LaunchDashboardOverlay(string pchAppKey)
{
IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey);
EVRApplicationError result = FnTable.LaunchDashboardOverlay(pchAppKeyUtf8);
Marshal.FreeHGlobal(pchAppKeyUtf8);
return result;
}
public bool CancelApplicationLaunch(string pchAppKey)
{
IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey);
bool result = FnTable.CancelApplicationLaunch(pchAppKeyUtf8);
Marshal.FreeHGlobal(pchAppKeyUtf8);
return result;
}
public EVRApplicationError IdentifyApplication(uint unProcessId,string pchAppKey)
{
IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey);
EVRApplicationError result = FnTable.IdentifyApplication(unProcessId,pchAppKeyUtf8);
Marshal.FreeHGlobal(pchAppKeyUtf8);
return result;
}
public uint GetApplicationProcessId(string pchAppKey)
{
IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey);
uint result = FnTable.GetApplicationProcessId(pchAppKeyUtf8);
Marshal.FreeHGlobal(pchAppKeyUtf8);
return result;
}
public string GetApplicationsErrorNameFromEnum(EVRApplicationError error)
{
IntPtr result = FnTable.GetApplicationsErrorNameFromEnum(error);
return Marshal.PtrToStringAnsi(result);
}
public uint GetApplicationPropertyString(string pchAppKey,EVRApplicationProperty eProperty,System.Text.StringBuilder pchPropertyValueBuffer,uint unPropertyValueBufferLen,ref EVRApplicationError peError)
{
IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey);
uint result = FnTable.GetApplicationPropertyString(pchAppKeyUtf8,eProperty,pchPropertyValueBuffer,unPropertyValueBufferLen,ref peError);
Marshal.FreeHGlobal(pchAppKeyUtf8);
return result;
}
public bool GetApplicationPropertyBool(string pchAppKey,EVRApplicationProperty eProperty,ref EVRApplicationError peError)
{
IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey);
bool result = FnTable.GetApplicationPropertyBool(pchAppKeyUtf8,eProperty,ref peError);
Marshal.FreeHGlobal(pchAppKeyUtf8);
return result;
}
public ulong GetApplicationPropertyUint64(string pchAppKey,EVRApplicationProperty eProperty,ref EVRApplicationError peError)
{
IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey);
ulong result = FnTable.GetApplicationPropertyUint64(pchAppKeyUtf8,eProperty,ref peError);
Marshal.FreeHGlobal(pchAppKeyUtf8);
return result;
}
public EVRApplicationError SetApplicationAutoLaunch(string pchAppKey,bool bAutoLaunch)
{
IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey);
EVRApplicationError result = FnTable.SetApplicationAutoLaunch(pchAppKeyUtf8,bAutoLaunch);
Marshal.FreeHGlobal(pchAppKeyUtf8);
return result;
}
public bool GetApplicationAutoLaunch(string pchAppKey)
{
IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey);
bool result = FnTable.GetApplicationAutoLaunch(pchAppKeyUtf8);
Marshal.FreeHGlobal(pchAppKeyUtf8);
return result;
}
public EVRApplicationError SetDefaultApplicationForMimeType(string pchAppKey,string pchMimeType)
{
IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey);
IntPtr pchMimeTypeUtf8 = Utils.ToUtf8(pchMimeType);
EVRApplicationError result = FnTable.SetDefaultApplicationForMimeType(pchAppKeyUtf8,pchMimeTypeUtf8);
Marshal.FreeHGlobal(pchAppKeyUtf8);
Marshal.FreeHGlobal(pchMimeTypeUtf8);
return result;
}
public bool GetDefaultApplicationForMimeType(string pchMimeType,System.Text.StringBuilder pchAppKeyBuffer,uint unAppKeyBufferLen)
{
IntPtr pchMimeTypeUtf8 = Utils.ToUtf8(pchMimeType);
bool result = FnTable.GetDefaultApplicationForMimeType(pchMimeTypeUtf8,pchAppKeyBuffer,unAppKeyBufferLen);
Marshal.FreeHGlobal(pchMimeTypeUtf8);
return result;
}
public bool GetApplicationSupportedMimeTypes(string pchAppKey,System.Text.StringBuilder pchMimeTypesBuffer,uint unMimeTypesBuffer)
{
IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey);
bool result = FnTable.GetApplicationSupportedMimeTypes(pchAppKeyUtf8,pchMimeTypesBuffer,unMimeTypesBuffer);
Marshal.FreeHGlobal(pchAppKeyUtf8);
return result;
}
public uint GetApplicationsThatSupportMimeType(string pchMimeType,System.Text.StringBuilder pchAppKeysThatSupportBuffer,uint unAppKeysThatSupportBuffer)
{
IntPtr pchMimeTypeUtf8 = Utils.ToUtf8(pchMimeType);
uint result = FnTable.GetApplicationsThatSupportMimeType(pchMimeTypeUtf8,pchAppKeysThatSupportBuffer,unAppKeysThatSupportBuffer);
Marshal.FreeHGlobal(pchMimeTypeUtf8);
return result;
}
public uint GetApplicationLaunchArguments(uint unHandle,System.Text.StringBuilder pchArgs,uint unArgs)
{
uint result = FnTable.GetApplicationLaunchArguments(unHandle,pchArgs,unArgs);
return result;
}
public EVRApplicationError GetStartingApplication(System.Text.StringBuilder pchAppKeyBuffer,uint unAppKeyBufferLen)
{
EVRApplicationError result = FnTable.GetStartingApplication(pchAppKeyBuffer,unAppKeyBufferLen);
return result;
}
public EVRSceneApplicationState GetSceneApplicationState()
{
EVRSceneApplicationState result = FnTable.GetSceneApplicationState();
return result;
}
public EVRApplicationError PerformApplicationPrelaunchCheck(string pchAppKey)
{
IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey);
EVRApplicationError result = FnTable.PerformApplicationPrelaunchCheck(pchAppKeyUtf8);
Marshal.FreeHGlobal(pchAppKeyUtf8);
return result;
}
public string GetSceneApplicationStateNameFromEnum(EVRSceneApplicationState state)
{
IntPtr result = FnTable.GetSceneApplicationStateNameFromEnum(state);
return Marshal.PtrToStringAnsi(result);
}
public EVRApplicationError LaunchInternalProcess(string pchBinaryPath,string pchArguments,string pchWorkingDirectory)
{
IntPtr pchBinaryPathUtf8 = Utils.ToUtf8(pchBinaryPath);
IntPtr pchArgumentsUtf8 = Utils.ToUtf8(pchArguments);
IntPtr pchWorkingDirectoryUtf8 = Utils.ToUtf8(pchWorkingDirectory);
EVRApplicationError result = FnTable.LaunchInternalProcess(pchBinaryPathUtf8,pchArgumentsUtf8,pchWorkingDirectoryUtf8);
Marshal.FreeHGlobal(pchBinaryPathUtf8);
Marshal.FreeHGlobal(pchArgumentsUtf8);
Marshal.FreeHGlobal(pchWorkingDirectoryUtf8);
return result;
}
public uint GetCurrentSceneProcessId()
{
uint result = FnTable.GetCurrentSceneProcessId();
return result;
}
}
public class CVRChaperone
{
IVRChaperone FnTable;
internal CVRChaperone(IntPtr pInterface)
{
FnTable = (IVRChaperone)Marshal.PtrToStructure(pInterface, typeof(IVRChaperone));
}
public ChaperoneCalibrationState GetCalibrationState()
{
ChaperoneCalibrationState result = FnTable.GetCalibrationState();
return result;
}
public bool GetPlayAreaSize(ref float pSizeX,ref float pSizeZ)
{
pSizeX = 0;
pSizeZ = 0;
bool result = FnTable.GetPlayAreaSize(ref pSizeX,ref pSizeZ);
return result;
}
public bool GetPlayAreaRect(ref HmdQuad_t rect)
{
bool result = FnTable.GetPlayAreaRect(ref rect);
return result;
}
public void ReloadInfo()
{
FnTable.ReloadInfo();
}
public void SetSceneColor(HmdColor_t color)
{
FnTable.SetSceneColor(color);
}
public void GetBoundsColor(ref HmdColor_t pOutputColorArray,int nNumOutputColors,float flCollisionBoundsFadeDistance,ref HmdColor_t pOutputCameraColor)
{
FnTable.GetBoundsColor(ref pOutputColorArray,nNumOutputColors,flCollisionBoundsFadeDistance,ref pOutputCameraColor);
}
public bool AreBoundsVisible()
{
bool result = FnTable.AreBoundsVisible();
return result;
}
public void ForceBoundsVisible(bool bForce)
{
FnTable.ForceBoundsVisible(bForce);
}
}
public class CVRChaperoneSetup
{
IVRChaperoneSetup FnTable;
internal CVRChaperoneSetup(IntPtr pInterface)
{
FnTable = (IVRChaperoneSetup)Marshal.PtrToStructure(pInterface, typeof(IVRChaperoneSetup));
}
public bool CommitWorkingCopy(EChaperoneConfigFile configFile)
{
bool result = FnTable.CommitWorkingCopy(configFile);
return result;
}
public void RevertWorkingCopy()
{
FnTable.RevertWorkingCopy();
}
public bool GetWorkingPlayAreaSize(ref float pSizeX,ref float pSizeZ)
{
pSizeX = 0;
pSizeZ = 0;
bool result = FnTable.GetWorkingPlayAreaSize(ref pSizeX,ref pSizeZ);
return result;
}
public bool GetWorkingPlayAreaRect(ref HmdQuad_t rect)
{
bool result = FnTable.GetWorkingPlayAreaRect(ref rect);
return result;
}
public bool GetWorkingCollisionBoundsInfo(out HmdQuad_t [] pQuadsBuffer)
{
uint punQuadsCount = 0;
bool result = FnTable.GetWorkingCollisionBoundsInfo(null,ref punQuadsCount);
pQuadsBuffer= new HmdQuad_t[punQuadsCount];
result = FnTable.GetWorkingCollisionBoundsInfo(pQuadsBuffer,ref punQuadsCount);
return result;
}
public bool GetLiveCollisionBoundsInfo(out HmdQuad_t [] pQuadsBuffer)
{
uint punQuadsCount = 0;
bool result = FnTable.GetLiveCollisionBoundsInfo(null,ref punQuadsCount);
pQuadsBuffer= new HmdQuad_t[punQuadsCount];
result = FnTable.GetLiveCollisionBoundsInfo(pQuadsBuffer,ref punQuadsCount);
return result;
}
public bool GetWorkingSeatedZeroPoseToRawTrackingPose(ref HmdMatrix34_t pmatSeatedZeroPoseToRawTrackingPose)
{
bool result = FnTable.GetWorkingSeatedZeroPoseToRawTrackingPose(ref pmatSeatedZeroPoseToRawTrackingPose);
return result;
}
public bool GetWorkingStandingZeroPoseToRawTrackingPose(ref HmdMatrix34_t pmatStandingZeroPoseToRawTrackingPose)
{
bool result = FnTable.GetWorkingStandingZeroPoseToRawTrackingPose(ref pmatStandingZeroPoseToRawTrackingPose);
return result;
}
public void SetWorkingPlayAreaSize(float sizeX,float sizeZ)
{
FnTable.SetWorkingPlayAreaSize(sizeX,sizeZ);
}
public void SetWorkingCollisionBoundsInfo(HmdQuad_t [] pQuadsBuffer)
{
FnTable.SetWorkingCollisionBoundsInfo(pQuadsBuffer,(uint) pQuadsBuffer.Length);
}
public void SetWorkingPerimeter(HmdVector2_t [] pPointBuffer)
{
FnTable.SetWorkingPerimeter(pPointBuffer,(uint) pPointBuffer.Length);
}
public void SetWorkingSeatedZeroPoseToRawTrackingPose(ref HmdMatrix34_t pMatSeatedZeroPoseToRawTrackingPose)
{
FnTable.SetWorkingSeatedZeroPoseToRawTrackingPose(ref pMatSeatedZeroPoseToRawTrackingPose);
}
public void SetWorkingStandingZeroPoseToRawTrackingPose(ref HmdMatrix34_t pMatStandingZeroPoseToRawTrackingPose)
{
FnTable.SetWorkingStandingZeroPoseToRawTrackingPose(ref pMatStandingZeroPoseToRawTrackingPose);
}
public void ReloadFromDisk(EChaperoneConfigFile configFile)
{
FnTable.ReloadFromDisk(configFile);
}
public bool GetLiveSeatedZeroPoseToRawTrackingPose(ref HmdMatrix34_t pmatSeatedZeroPoseToRawTrackingPose)
{
bool result = FnTable.GetLiveSeatedZeroPoseToRawTrackingPose(ref pmatSeatedZeroPoseToRawTrackingPose);
return result;
}
public bool ExportLiveToBuffer(System.Text.StringBuilder pBuffer,ref uint pnBufferLength)
{
pnBufferLength = 0;
bool result = FnTable.ExportLiveToBuffer(pBuffer,ref pnBufferLength);
return result;
}
public bool ImportFromBufferToWorking(string pBuffer,uint nImportFlags)
{
IntPtr pBufferUtf8 = Utils.ToUtf8(pBuffer);
bool result = FnTable.ImportFromBufferToWorking(pBufferUtf8,nImportFlags);
Marshal.FreeHGlobal(pBufferUtf8);
return result;
}
public void ShowWorkingSetPreview()
{
FnTable.ShowWorkingSetPreview();
}
public void HideWorkingSetPreview()
{
FnTable.HideWorkingSetPreview();
}
public void RoomSetupStarting()
{
FnTable.RoomSetupStarting();
}
}
public class CVRCompositor
{
IVRCompositor FnTable;
internal CVRCompositor(IntPtr pInterface)
{
FnTable = (IVRCompositor)Marshal.PtrToStructure(pInterface, typeof(IVRCompositor));
}
public void SetTrackingSpace(ETrackingUniverseOrigin eOrigin)
{
FnTable.SetTrackingSpace(eOrigin);
}
public ETrackingUniverseOrigin GetTrackingSpace()
{
ETrackingUniverseOrigin result = FnTable.GetTrackingSpace();
return result;
}
public EVRCompositorError WaitGetPoses(TrackedDevicePose_t [] pRenderPoseArray,TrackedDevicePose_t [] pGamePoseArray)
{
EVRCompositorError result = FnTable.WaitGetPoses(pRenderPoseArray,(uint) pRenderPoseArray.Length,pGamePoseArray,(uint) pGamePoseArray.Length);
return result;
}
public EVRCompositorError GetLastPoses(TrackedDevicePose_t [] pRenderPoseArray,TrackedDevicePose_t [] pGamePoseArray)
{
EVRCompositorError result = FnTable.GetLastPoses(pRenderPoseArray,(uint) pRenderPoseArray.Length,pGamePoseArray,(uint) pGamePoseArray.Length);
return result;
}
public EVRCompositorError GetLastPoseForTrackedDeviceIndex(uint unDeviceIndex,ref TrackedDevicePose_t pOutputPose,ref TrackedDevicePose_t pOutputGamePose)
{
EVRCompositorError result = FnTable.GetLastPoseForTrackedDeviceIndex(unDeviceIndex,ref pOutputPose,ref pOutputGamePose);
return result;
}
public EVRCompositorError Submit(EVREye eEye,ref Texture_t pTexture,ref VRTextureBounds_t pBounds,EVRSubmitFlags nSubmitFlags)
{
EVRCompositorError result = FnTable.Submit(eEye,ref pTexture,ref pBounds,nSubmitFlags);
return result;
}
public void ClearLastSubmittedFrame()
{
FnTable.ClearLastSubmittedFrame();
}
public void PostPresentHandoff()
{
FnTable.PostPresentHandoff();
}
public bool GetFrameTiming(ref Compositor_FrameTiming pTiming,uint unFramesAgo)
{
bool result = FnTable.GetFrameTiming(ref pTiming,unFramesAgo);
return result;
}
public uint GetFrameTimings(Compositor_FrameTiming [] pTiming)
{
uint result = FnTable.GetFrameTimings(pTiming,(uint) pTiming.Length);
return result;
}
public float GetFrameTimeRemaining()
{
float result = FnTable.GetFrameTimeRemaining();
return result;
}
public void GetCumulativeStats(ref Compositor_CumulativeStats pStats,uint nStatsSizeInBytes)
{
FnTable.GetCumulativeStats(ref pStats,nStatsSizeInBytes);
}
public void FadeToColor(float fSeconds,float fRed,float fGreen,float fBlue,float fAlpha,bool bBackground)
{
FnTable.FadeToColor(fSeconds,fRed,fGreen,fBlue,fAlpha,bBackground);
}
public HmdColor_t GetCurrentFadeColor(bool bBackground)
{
HmdColor_t result = FnTable.GetCurrentFadeColor(bBackground);
return result;
}
public void FadeGrid(float fSeconds,bool bFadeIn)
{
FnTable.FadeGrid(fSeconds,bFadeIn);
}
public float GetCurrentGridAlpha()
{
float result = FnTable.GetCurrentGridAlpha();
return result;
}
public EVRCompositorError SetSkyboxOverride(Texture_t [] pTextures)
{
EVRCompositorError result = FnTable.SetSkyboxOverride(pTextures,(uint) pTextures.Length);
return result;
}
public void ClearSkyboxOverride()
{
FnTable.ClearSkyboxOverride();
}
public void CompositorBringToFront()
{
FnTable.CompositorBringToFront();
}
public void CompositorGoToBack()
{
FnTable.CompositorGoToBack();
}
public void CompositorQuit()
{
FnTable.CompositorQuit();
}
public bool IsFullscreen()
{
bool result = FnTable.IsFullscreen();
return result;
}
public uint GetCurrentSceneFocusProcess()
{
uint result = FnTable.GetCurrentSceneFocusProcess();
return result;
}
public uint GetLastFrameRenderer()
{
uint result = FnTable.GetLastFrameRenderer();
return result;
}
public bool CanRenderScene()
{
bool result = FnTable.CanRenderScene();
return result;
}
public void ShowMirrorWindow()
{
FnTable.ShowMirrorWindow();
}
public void HideMirrorWindow()
{
FnTable.HideMirrorWindow();
}
public bool IsMirrorWindowVisible()
{
bool result = FnTable.IsMirrorWindowVisible();
return result;
}
public void CompositorDumpImages()
{
FnTable.CompositorDumpImages();
}
public bool ShouldAppRenderWithLowResources()
{
bool result = FnTable.ShouldAppRenderWithLowResources();
return result;
}
public void ForceInterleavedReprojectionOn(bool bOverride)
{
FnTable.ForceInterleavedReprojectionOn(bOverride);
}
public void ForceReconnectProcess()
{
FnTable.ForceReconnectProcess();
}
public void SuspendRendering(bool bSuspend)
{
FnTable.SuspendRendering(bSuspend);
}
public EVRCompositorError GetMirrorTextureD3D11(EVREye eEye,IntPtr pD3D11DeviceOrResource,ref IntPtr ppD3D11ShaderResourceView)
{
EVRCompositorError result = FnTable.GetMirrorTextureD3D11(eEye,pD3D11DeviceOrResource,ref ppD3D11ShaderResourceView);
return result;
}
public void ReleaseMirrorTextureD3D11(IntPtr pD3D11ShaderResourceView)
{
FnTable.ReleaseMirrorTextureD3D11(pD3D11ShaderResourceView);
}
public EVRCompositorError GetMirrorTextureGL(EVREye eEye,ref uint pglTextureId,IntPtr pglSharedTextureHandle)
{
pglTextureId = 0;
EVRCompositorError result = FnTable.GetMirrorTextureGL(eEye,ref pglTextureId,pglSharedTextureHandle);
return result;
}
public bool ReleaseSharedGLTexture(uint glTextureId,IntPtr glSharedTextureHandle)
{
bool result = FnTable.ReleaseSharedGLTexture(glTextureId,glSharedTextureHandle);
return result;
}
public void LockGLSharedTextureForAccess(IntPtr glSharedTextureHandle)
{
FnTable.LockGLSharedTextureForAccess(glSharedTextureHandle);
}
public void UnlockGLSharedTextureForAccess(IntPtr glSharedTextureHandle)
{
FnTable.UnlockGLSharedTextureForAccess(glSharedTextureHandle);
}
public uint GetVulkanInstanceExtensionsRequired(System.Text.StringBuilder pchValue,uint unBufferSize)
{
uint result = FnTable.GetVulkanInstanceExtensionsRequired(pchValue,unBufferSize);
return result;
}
public uint GetVulkanDeviceExtensionsRequired(IntPtr pPhysicalDevice,System.Text.StringBuilder pchValue,uint unBufferSize)
{
uint result = FnTable.GetVulkanDeviceExtensionsRequired(pPhysicalDevice,pchValue,unBufferSize);
return result;
}
public void SetExplicitTimingMode(EVRCompositorTimingMode eTimingMode)
{
FnTable.SetExplicitTimingMode(eTimingMode);
}
public EVRCompositorError SubmitExplicitTimingData()
{
EVRCompositorError result = FnTable.SubmitExplicitTimingData();
return result;
}
public bool IsMotionSmoothingEnabled()
{
bool result = FnTable.IsMotionSmoothingEnabled();
return result;
}
public bool IsMotionSmoothingSupported()
{
bool result = FnTable.IsMotionSmoothingSupported();
return result;
}
public bool IsCurrentSceneFocusAppLoading()
{
bool result = FnTable.IsCurrentSceneFocusAppLoading();
return result;
}
public EVRCompositorError SetStageOverride_Async(string pchRenderModelPath,ref HmdMatrix34_t pTransform,ref Compositor_StageRenderSettings pRenderSettings,uint nSizeOfRenderSettings)
{
IntPtr pchRenderModelPathUtf8 = Utils.ToUtf8(pchRenderModelPath);
EVRCompositorError result = FnTable.SetStageOverride_Async(pchRenderModelPathUtf8,ref pTransform,ref pRenderSettings,nSizeOfRenderSettings);
Marshal.FreeHGlobal(pchRenderModelPathUtf8);
return result;
}
public void ClearStageOverride()
{
FnTable.ClearStageOverride();
}
public bool GetCompositorBenchmarkResults(ref Compositor_BenchmarkResults pBenchmarkResults,uint nSizeOfBenchmarkResults)
{
bool result = FnTable.GetCompositorBenchmarkResults(ref pBenchmarkResults,nSizeOfBenchmarkResults);
return result;
}
public EVRCompositorError GetLastPosePredictionIDs(ref uint pRenderPosePredictionID,ref uint pGamePosePredictionID)
{
pRenderPosePredictionID = 0;
pGamePosePredictionID = 0;
EVRCompositorError result = FnTable.GetLastPosePredictionIDs(ref pRenderPosePredictionID,ref pGamePosePredictionID);
return result;
}
public EVRCompositorError GetPosesForFrame(uint unPosePredictionID,TrackedDevicePose_t [] pPoseArray)
{
EVRCompositorError result = FnTable.GetPosesForFrame(unPosePredictionID,pPoseArray,(uint) pPoseArray.Length);
return result;
}
}
public class CVROverlay
{
IVROverlay FnTable;
internal CVROverlay(IntPtr pInterface)
{
FnTable = (IVROverlay)Marshal.PtrToStructure(pInterface, typeof(IVROverlay));
}
public EVROverlayError FindOverlay(string pchOverlayKey,ref ulong pOverlayHandle)
{
IntPtr pchOverlayKeyUtf8 = Utils.ToUtf8(pchOverlayKey);
pOverlayHandle = 0;
EVROverlayError result = FnTable.FindOverlay(pchOverlayKeyUtf8,ref pOverlayHandle);
Marshal.FreeHGlobal(pchOverlayKeyUtf8);
return result;
}
public EVROverlayError CreateOverlay(string pchOverlayKey,string pchOverlayName,ref ulong pOverlayHandle)
{
IntPtr pchOverlayKeyUtf8 = Utils.ToUtf8(pchOverlayKey);
IntPtr pchOverlayNameUtf8 = Utils.ToUtf8(pchOverlayName);
pOverlayHandle = 0;
EVROverlayError result = FnTable.CreateOverlay(pchOverlayKeyUtf8,pchOverlayNameUtf8,ref pOverlayHandle);
Marshal.FreeHGlobal(pchOverlayKeyUtf8);
Marshal.FreeHGlobal(pchOverlayNameUtf8);
return result;
}
public EVROverlayError DestroyOverlay(ulong ulOverlayHandle)
{
EVROverlayError result = FnTable.DestroyOverlay(ulOverlayHandle);
return result;
}
public uint GetOverlayKey(ulong ulOverlayHandle,System.Text.StringBuilder pchValue,uint unBufferSize,ref EVROverlayError pError)
{
uint result = FnTable.GetOverlayKey(ulOverlayHandle,pchValue,unBufferSize,ref pError);
return result;
}
public uint GetOverlayName(ulong ulOverlayHandle,System.Text.StringBuilder pchValue,uint unBufferSize,ref EVROverlayError pError)
{
uint result = FnTable.GetOverlayName(ulOverlayHandle,pchValue,unBufferSize,ref pError);
return result;
}
public EVROverlayError SetOverlayName(ulong ulOverlayHandle,string pchName)
{
IntPtr pchNameUtf8 = Utils.ToUtf8(pchName);
EVROverlayError result = FnTable.SetOverlayName(ulOverlayHandle,pchNameUtf8);
Marshal.FreeHGlobal(pchNameUtf8);
return result;
}
public EVROverlayError GetOverlayImageData(ulong ulOverlayHandle,IntPtr pvBuffer,uint unBufferSize,ref uint punWidth,ref uint punHeight)
{
punWidth = 0;
punHeight = 0;
EVROverlayError result = FnTable.GetOverlayImageData(ulOverlayHandle,pvBuffer,unBufferSize,ref punWidth,ref punHeight);
return result;
}
public string GetOverlayErrorNameFromEnum(EVROverlayError error)
{
IntPtr result = FnTable.GetOverlayErrorNameFromEnum(error);
return Marshal.PtrToStringAnsi(result);
}
public EVROverlayError SetOverlayRenderingPid(ulong ulOverlayHandle,uint unPID)
{
EVROverlayError result = FnTable.SetOverlayRenderingPid(ulOverlayHandle,unPID);
return result;
}
public uint GetOverlayRenderingPid(ulong ulOverlayHandle)
{
uint result = FnTable.GetOverlayRenderingPid(ulOverlayHandle);
return result;
}
public EVROverlayError SetOverlayFlag(ulong ulOverlayHandle,VROverlayFlags eOverlayFlag,bool bEnabled)
{
EVROverlayError result = FnTable.SetOverlayFlag(ulOverlayHandle,eOverlayFlag,bEnabled);
return result;
}
public EVROverlayError GetOverlayFlag(ulong ulOverlayHandle,VROverlayFlags eOverlayFlag,ref bool pbEnabled)
{
pbEnabled = false;
EVROverlayError result = FnTable.GetOverlayFlag(ulOverlayHandle,eOverlayFlag,ref pbEnabled);
return result;
}
public EVROverlayError GetOverlayFlags(ulong ulOverlayHandle,ref uint pFlags)
{
pFlags = 0;
EVROverlayError result = FnTable.GetOverlayFlags(ulOverlayHandle,ref pFlags);
return result;
}
public EVROverlayError SetOverlayColor(ulong ulOverlayHandle,float fRed,float fGreen,float fBlue)
{
EVROverlayError result = FnTable.SetOverlayColor(ulOverlayHandle,fRed,fGreen,fBlue);
return result;
}
public EVROverlayError GetOverlayColor(ulong ulOverlayHandle,ref float pfRed,ref float pfGreen,ref float pfBlue)
{
pfRed = 0;
pfGreen = 0;
pfBlue = 0;
EVROverlayError result = FnTable.GetOverlayColor(ulOverlayHandle,ref pfRed,ref pfGreen,ref pfBlue);
return result;
}
public EVROverlayError SetOverlayAlpha(ulong ulOverlayHandle,float fAlpha)
{
EVROverlayError result = FnTable.SetOverlayAlpha(ulOverlayHandle,fAlpha);
return result;
}
public EVROverlayError GetOverlayAlpha(ulong ulOverlayHandle,ref float pfAlpha)
{
pfAlpha = 0;
EVROverlayError result = FnTable.GetOverlayAlpha(ulOverlayHandle,ref pfAlpha);
return result;
}
public EVROverlayError SetOverlayTexelAspect(ulong ulOverlayHandle,float fTexelAspect)
{
EVROverlayError result = FnTable.SetOverlayTexelAspect(ulOverlayHandle,fTexelAspect);
return result;
}
public EVROverlayError GetOverlayTexelAspect(ulong ulOverlayHandle,ref float pfTexelAspect)
{
pfTexelAspect = 0;
EVROverlayError result = FnTable.GetOverlayTexelAspect(ulOverlayHandle,ref pfTexelAspect);
return result;
}
public EVROverlayError SetOverlaySortOrder(ulong ulOverlayHandle,uint unSortOrder)
{
EVROverlayError result = FnTable.SetOverlaySortOrder(ulOverlayHandle,unSortOrder);
return result;
}
public EVROverlayError GetOverlaySortOrder(ulong ulOverlayHandle,ref uint punSortOrder)
{
punSortOrder = 0;
EVROverlayError result = FnTable.GetOverlaySortOrder(ulOverlayHandle,ref punSortOrder);
return result;
}
public EVROverlayError SetOverlayWidthInMeters(ulong ulOverlayHandle,float fWidthInMeters)
{
EVROverlayError result = FnTable.SetOverlayWidthInMeters(ulOverlayHandle,fWidthInMeters);
return result;
}
public EVROverlayError GetOverlayWidthInMeters(ulong ulOverlayHandle,ref float pfWidthInMeters)
{
pfWidthInMeters = 0;
EVROverlayError result = FnTable.GetOverlayWidthInMeters(ulOverlayHandle,ref pfWidthInMeters);
return result;
}
public EVROverlayError SetOverlayCurvature(ulong ulOverlayHandle,float fCurvature)
{
EVROverlayError result = FnTable.SetOverlayCurvature(ulOverlayHandle,fCurvature);
return result;
}
public EVROverlayError GetOverlayCurvature(ulong ulOverlayHandle,ref float pfCurvature)
{
pfCurvature = 0;
EVROverlayError result = FnTable.GetOverlayCurvature(ulOverlayHandle,ref pfCurvature);
return result;
}
public EVROverlayError SetOverlayTextureColorSpace(ulong ulOverlayHandle,EColorSpace eTextureColorSpace)
{
EVROverlayError result = FnTable.SetOverlayTextureColorSpace(ulOverlayHandle,eTextureColorSpace);
return result;
}
public EVROverlayError GetOverlayTextureColorSpace(ulong ulOverlayHandle,ref EColorSpace peTextureColorSpace)
{
EVROverlayError result = FnTable.GetOverlayTextureColorSpace(ulOverlayHandle,ref peTextureColorSpace);
return result;
}
public EVROverlayError SetOverlayTextureBounds(ulong ulOverlayHandle,ref VRTextureBounds_t pOverlayTextureBounds)
{
EVROverlayError result = FnTable.SetOverlayTextureBounds(ulOverlayHandle,ref pOverlayTextureBounds);
return result;
}
public EVROverlayError GetOverlayTextureBounds(ulong ulOverlayHandle,ref VRTextureBounds_t pOverlayTextureBounds)
{
EVROverlayError result = FnTable.GetOverlayTextureBounds(ulOverlayHandle,ref pOverlayTextureBounds);
return result;
}
public EVROverlayError GetOverlayTransformType(ulong ulOverlayHandle,ref VROverlayTransformType peTransformType)
{
EVROverlayError result = FnTable.GetOverlayTransformType(ulOverlayHandle,ref peTransformType);
return result;
}
public EVROverlayError SetOverlayTransformAbsolute(ulong ulOverlayHandle,ETrackingUniverseOrigin eTrackingOrigin,ref HmdMatrix34_t pmatTrackingOriginToOverlayTransform)
{
EVROverlayError result = FnTable.SetOverlayTransformAbsolute(ulOverlayHandle,eTrackingOrigin,ref pmatTrackingOriginToOverlayTransform);
return result;
}
public EVROverlayError GetOverlayTransformAbsolute(ulong ulOverlayHandle,ref ETrackingUniverseOrigin peTrackingOrigin,ref HmdMatrix34_t pmatTrackingOriginToOverlayTransform)
{
EVROverlayError result = FnTable.GetOverlayTransformAbsolute(ulOverlayHandle,ref peTrackingOrigin,ref pmatTrackingOriginToOverlayTransform);
return result;
}
public EVROverlayError SetOverlayTransformTrackedDeviceRelative(ulong ulOverlayHandle,uint unTrackedDevice,ref HmdMatrix34_t pmatTrackedDeviceToOverlayTransform)
{
EVROverlayError result = FnTable.SetOverlayTransformTrackedDeviceRelative(ulOverlayHandle,unTrackedDevice,ref pmatTrackedDeviceToOverlayTransform);
return result;
}
public EVROverlayError GetOverlayTransformTrackedDeviceRelative(ulong ulOverlayHandle,ref uint punTrackedDevice,ref HmdMatrix34_t pmatTrackedDeviceToOverlayTransform)
{
punTrackedDevice = 0;
EVROverlayError result = FnTable.GetOverlayTransformTrackedDeviceRelative(ulOverlayHandle,ref punTrackedDevice,ref pmatTrackedDeviceToOverlayTransform);
return result;
}
public EVROverlayError SetOverlayTransformTrackedDeviceComponent(ulong ulOverlayHandle,uint unDeviceIndex,string pchComponentName)
{
IntPtr pchComponentNameUtf8 = Utils.ToUtf8(pchComponentName);
EVROverlayError result = FnTable.SetOverlayTransformTrackedDeviceComponent(ulOverlayHandle,unDeviceIndex,pchComponentNameUtf8);
Marshal.FreeHGlobal(pchComponentNameUtf8);
return result;
}
public EVROverlayError GetOverlayTransformTrackedDeviceComponent(ulong ulOverlayHandle,ref uint punDeviceIndex,System.Text.StringBuilder pchComponentName,uint unComponentNameSize)
{
punDeviceIndex = 0;
EVROverlayError result = FnTable.GetOverlayTransformTrackedDeviceComponent(ulOverlayHandle,ref punDeviceIndex,pchComponentName,unComponentNameSize);
return result;
}
public EVROverlayError GetOverlayTransformOverlayRelative(ulong ulOverlayHandle,ref ulong ulOverlayHandleParent,ref HmdMatrix34_t pmatParentOverlayToOverlayTransform)
{
ulOverlayHandleParent = 0;
EVROverlayError result = FnTable.GetOverlayTransformOverlayRelative(ulOverlayHandle,ref ulOverlayHandleParent,ref pmatParentOverlayToOverlayTransform);
return result;
}
public EVROverlayError SetOverlayTransformOverlayRelative(ulong ulOverlayHandle,ulong ulOverlayHandleParent,ref HmdMatrix34_t pmatParentOverlayToOverlayTransform)
{
EVROverlayError result = FnTable.SetOverlayTransformOverlayRelative(ulOverlayHandle,ulOverlayHandleParent,ref pmatParentOverlayToOverlayTransform);
return result;
}
public EVROverlayError SetOverlayTransformCursor(ulong ulCursorOverlayHandle,ref HmdVector2_t pvHotspot)
{
EVROverlayError result = FnTable.SetOverlayTransformCursor(ulCursorOverlayHandle,ref pvHotspot);
return result;
}
public EVROverlayError GetOverlayTransformCursor(ulong ulOverlayHandle,ref HmdVector2_t pvHotspot)
{
EVROverlayError result = FnTable.GetOverlayTransformCursor(ulOverlayHandle,ref pvHotspot);
return result;
}
public EVROverlayError ShowOverlay(ulong ulOverlayHandle)
{
EVROverlayError result = FnTable.ShowOverlay(ulOverlayHandle);
return result;
}
public EVROverlayError HideOverlay(ulong ulOverlayHandle)
{
EVROverlayError result = FnTable.HideOverlay(ulOverlayHandle);
return result;
}
public bool IsOverlayVisible(ulong ulOverlayHandle)
{
bool result = FnTable.IsOverlayVisible(ulOverlayHandle);
return result;
}
public EVROverlayError GetTransformForOverlayCoordinates(ulong ulOverlayHandle,ETrackingUniverseOrigin eTrackingOrigin,HmdVector2_t coordinatesInOverlay,ref HmdMatrix34_t pmatTransform)
{
EVROverlayError result = FnTable.GetTransformForOverlayCoordinates(ulOverlayHandle,eTrackingOrigin,coordinatesInOverlay,ref pmatTransform);
return result;
}
// This is a terrible hack to workaround the fact that VRControllerState_t and VREvent_t were
// originally mis-compiled with the wrong packing for Linux and OSX.
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _PollNextOverlayEventPacked(ulong ulOverlayHandle,ref VREvent_t_Packed pEvent,uint uncbVREvent);
[StructLayout(LayoutKind.Explicit)]
struct PollNextOverlayEventUnion
{
[FieldOffset(0)]
public IVROverlay._PollNextOverlayEvent pPollNextOverlayEvent;
[FieldOffset(0)]
public _PollNextOverlayEventPacked pPollNextOverlayEventPacked;
}
public bool PollNextOverlayEvent(ulong ulOverlayHandle,ref VREvent_t pEvent,uint uncbVREvent)
{
#if !UNITY_METRO
if ((System.Environment.OSVersion.Platform == System.PlatformID.MacOSX) ||
(System.Environment.OSVersion.Platform == System.PlatformID.Unix))
{
PollNextOverlayEventUnion u;
VREvent_t_Packed event_packed = new VREvent_t_Packed();
u.pPollNextOverlayEventPacked = null;
u.pPollNextOverlayEvent = FnTable.PollNextOverlayEvent;
bool packed_result = u.pPollNextOverlayEventPacked(ulOverlayHandle,ref event_packed,(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VREvent_t_Packed)));
event_packed.Unpack(ref pEvent);
return packed_result;
}
#endif
bool result = FnTable.PollNextOverlayEvent(ulOverlayHandle,ref pEvent,uncbVREvent);
return result;
}
public EVROverlayError GetOverlayInputMethod(ulong ulOverlayHandle,ref VROverlayInputMethod peInputMethod)
{
EVROverlayError result = FnTable.GetOverlayInputMethod(ulOverlayHandle,ref peInputMethod);
return result;
}
public EVROverlayError SetOverlayInputMethod(ulong ulOverlayHandle,VROverlayInputMethod eInputMethod)
{
EVROverlayError result = FnTable.SetOverlayInputMethod(ulOverlayHandle,eInputMethod);
return result;
}
public EVROverlayError GetOverlayMouseScale(ulong ulOverlayHandle,ref HmdVector2_t pvecMouseScale)
{
EVROverlayError result = FnTable.GetOverlayMouseScale(ulOverlayHandle,ref pvecMouseScale);
return result;
}
public EVROverlayError SetOverlayMouseScale(ulong ulOverlayHandle,ref HmdVector2_t pvecMouseScale)
{
EVROverlayError result = FnTable.SetOverlayMouseScale(ulOverlayHandle,ref pvecMouseScale);
return result;
}
public bool ComputeOverlayIntersection(ulong ulOverlayHandle,ref VROverlayIntersectionParams_t pParams,ref VROverlayIntersectionResults_t pResults)
{
bool result = FnTable.ComputeOverlayIntersection(ulOverlayHandle,ref pParams,ref pResults);
return result;
}
public bool IsHoverTargetOverlay(ulong ulOverlayHandle)
{
bool result = FnTable.IsHoverTargetOverlay(ulOverlayHandle);
return result;
}
public EVROverlayError SetOverlayIntersectionMask(ulong ulOverlayHandle,ref VROverlayIntersectionMaskPrimitive_t pMaskPrimitives,uint unNumMaskPrimitives,uint unPrimitiveSize)
{
EVROverlayError result = FnTable.SetOverlayIntersectionMask(ulOverlayHandle,ref pMaskPrimitives,unNumMaskPrimitives,unPrimitiveSize);
return result;
}
public EVROverlayError TriggerLaserMouseHapticVibration(ulong ulOverlayHandle,float fDurationSeconds,float fFrequency,float fAmplitude)
{
EVROverlayError result = FnTable.TriggerLaserMouseHapticVibration(ulOverlayHandle,fDurationSeconds,fFrequency,fAmplitude);
return result;
}
public EVROverlayError SetOverlayCursor(ulong ulOverlayHandle,ulong ulCursorHandle)
{
EVROverlayError result = FnTable.SetOverlayCursor(ulOverlayHandle,ulCursorHandle);
return result;
}
public EVROverlayError SetOverlayCursorPositionOverride(ulong ulOverlayHandle,ref HmdVector2_t pvCursor)
{
EVROverlayError result = FnTable.SetOverlayCursorPositionOverride(ulOverlayHandle,ref pvCursor);
return result;
}
public EVROverlayError ClearOverlayCursorPositionOverride(ulong ulOverlayHandle)
{
EVROverlayError result = FnTable.ClearOverlayCursorPositionOverride(ulOverlayHandle);
return result;
}
public EVROverlayError SetOverlayTexture(ulong ulOverlayHandle,ref Texture_t pTexture)
{
EVROverlayError result = FnTable.SetOverlayTexture(ulOverlayHandle,ref pTexture);
return result;
}
public EVROverlayError ClearOverlayTexture(ulong ulOverlayHandle)
{
EVROverlayError result = FnTable.ClearOverlayTexture(ulOverlayHandle);
return result;
}
public EVROverlayError SetOverlayRaw(ulong ulOverlayHandle,IntPtr pvBuffer,uint unWidth,uint unHeight,uint unBytesPerPixel)
{
EVROverlayError result = FnTable.SetOverlayRaw(ulOverlayHandle,pvBuffer,unWidth,unHeight,unBytesPerPixel);
return result;
}
public EVROverlayError SetOverlayFromFile(ulong ulOverlayHandle,string pchFilePath)
{
IntPtr pchFilePathUtf8 = Utils.ToUtf8(pchFilePath);
EVROverlayError result = FnTable.SetOverlayFromFile(ulOverlayHandle,pchFilePathUtf8);
Marshal.FreeHGlobal(pchFilePathUtf8);
return result;
}
public EVROverlayError GetOverlayTexture(ulong ulOverlayHandle,ref IntPtr pNativeTextureHandle,IntPtr pNativeTextureRef,ref uint pWidth,ref uint pHeight,ref uint pNativeFormat,ref ETextureType pAPIType,ref EColorSpace pColorSpace,ref VRTextureBounds_t pTextureBounds)
{
pWidth = 0;
pHeight = 0;
pNativeFormat = 0;
EVROverlayError result = FnTable.GetOverlayTexture(ulOverlayHandle,ref pNativeTextureHandle,pNativeTextureRef,ref pWidth,ref pHeight,ref pNativeFormat,ref pAPIType,ref pColorSpace,ref pTextureBounds);
return result;
}
public EVROverlayError ReleaseNativeOverlayHandle(ulong ulOverlayHandle,IntPtr pNativeTextureHandle)
{
EVROverlayError result = FnTable.ReleaseNativeOverlayHandle(ulOverlayHandle,pNativeTextureHandle);
return result;
}
public EVROverlayError GetOverlayTextureSize(ulong ulOverlayHandle,ref uint pWidth,ref uint pHeight)
{
pWidth = 0;
pHeight = 0;
EVROverlayError result = FnTable.GetOverlayTextureSize(ulOverlayHandle,ref pWidth,ref pHeight);
return result;
}
public EVROverlayError CreateDashboardOverlay(string pchOverlayKey,string pchOverlayFriendlyName,ref ulong pMainHandle,ref ulong pThumbnailHandle)
{
IntPtr pchOverlayKeyUtf8 = Utils.ToUtf8(pchOverlayKey);
IntPtr pchOverlayFriendlyNameUtf8 = Utils.ToUtf8(pchOverlayFriendlyName);
pMainHandle = 0;
pThumbnailHandle = 0;
EVROverlayError result = FnTable.CreateDashboardOverlay(pchOverlayKeyUtf8,pchOverlayFriendlyNameUtf8,ref pMainHandle,ref pThumbnailHandle);
Marshal.FreeHGlobal(pchOverlayKeyUtf8);
Marshal.FreeHGlobal(pchOverlayFriendlyNameUtf8);
return result;
}
public bool IsDashboardVisible()
{
bool result = FnTable.IsDashboardVisible();
return result;
}
public bool IsActiveDashboardOverlay(ulong ulOverlayHandle)
{
bool result = FnTable.IsActiveDashboardOverlay(ulOverlayHandle);
return result;
}
public EVROverlayError SetDashboardOverlaySceneProcess(ulong ulOverlayHandle,uint unProcessId)
{
EVROverlayError result = FnTable.SetDashboardOverlaySceneProcess(ulOverlayHandle,unProcessId);
return result;
}
public EVROverlayError GetDashboardOverlaySceneProcess(ulong ulOverlayHandle,ref uint punProcessId)
{
punProcessId = 0;
EVROverlayError result = FnTable.GetDashboardOverlaySceneProcess(ulOverlayHandle,ref punProcessId);
return result;
}
public void ShowDashboard(string pchOverlayToShow)
{
IntPtr pchOverlayToShowUtf8 = Utils.ToUtf8(pchOverlayToShow);
FnTable.ShowDashboard(pchOverlayToShowUtf8);
Marshal.FreeHGlobal(pchOverlayToShowUtf8);
}
public uint GetPrimaryDashboardDevice()
{
uint result = FnTable.GetPrimaryDashboardDevice();
return result;
}
public EVROverlayError ShowKeyboard(int eInputMode,int eLineInputMode,uint unFlags,string pchDescription,uint unCharMax,string pchExistingText,ulong uUserValue)
{
IntPtr pchDescriptionUtf8 = Utils.ToUtf8(pchDescription);
IntPtr pchExistingTextUtf8 = Utils.ToUtf8(pchExistingText);
EVROverlayError result = FnTable.ShowKeyboard(eInputMode,eLineInputMode,unFlags,pchDescriptionUtf8,unCharMax,pchExistingTextUtf8,uUserValue);
Marshal.FreeHGlobal(pchDescriptionUtf8);
Marshal.FreeHGlobal(pchExistingTextUtf8);
return result;
}
public EVROverlayError ShowKeyboardForOverlay(ulong ulOverlayHandle,int eInputMode,int eLineInputMode,uint unFlags,string pchDescription,uint unCharMax,string pchExistingText,ulong uUserValue)
{
IntPtr pchDescriptionUtf8 = Utils.ToUtf8(pchDescription);
IntPtr pchExistingTextUtf8 = Utils.ToUtf8(pchExistingText);
EVROverlayError result = FnTable.ShowKeyboardForOverlay(ulOverlayHandle,eInputMode,eLineInputMode,unFlags,pchDescriptionUtf8,unCharMax,pchExistingTextUtf8,uUserValue);
Marshal.FreeHGlobal(pchDescriptionUtf8);
Marshal.FreeHGlobal(pchExistingTextUtf8);
return result;
}
public uint GetKeyboardText(System.Text.StringBuilder pchText,uint cchText)
{
uint result = FnTable.GetKeyboardText(pchText,cchText);
return result;
}
public void HideKeyboard()
{
FnTable.HideKeyboard();
}
public void SetKeyboardTransformAbsolute(ETrackingUniverseOrigin eTrackingOrigin,ref HmdMatrix34_t pmatTrackingOriginToKeyboardTransform)
{
FnTable.SetKeyboardTransformAbsolute(eTrackingOrigin,ref pmatTrackingOriginToKeyboardTransform);
}
public void SetKeyboardPositionForOverlay(ulong ulOverlayHandle,HmdRect2_t avoidRect)
{
FnTable.SetKeyboardPositionForOverlay(ulOverlayHandle,avoidRect);
}
public VRMessageOverlayResponse ShowMessageOverlay(string pchText,string pchCaption,string pchButton0Text,string pchButton1Text,string pchButton2Text,string pchButton3Text)
{
IntPtr pchTextUtf8 = Utils.ToUtf8(pchText);
IntPtr pchCaptionUtf8 = Utils.ToUtf8(pchCaption);
IntPtr pchButton0TextUtf8 = Utils.ToUtf8(pchButton0Text);
IntPtr pchButton1TextUtf8 = Utils.ToUtf8(pchButton1Text);
IntPtr pchButton2TextUtf8 = Utils.ToUtf8(pchButton2Text);
IntPtr pchButton3TextUtf8 = Utils.ToUtf8(pchButton3Text);
VRMessageOverlayResponse result = FnTable.ShowMessageOverlay(pchTextUtf8,pchCaptionUtf8,pchButton0TextUtf8,pchButton1TextUtf8,pchButton2TextUtf8,pchButton3TextUtf8);
Marshal.FreeHGlobal(pchTextUtf8);
Marshal.FreeHGlobal(pchCaptionUtf8);
Marshal.FreeHGlobal(pchButton0TextUtf8);
Marshal.FreeHGlobal(pchButton1TextUtf8);
Marshal.FreeHGlobal(pchButton2TextUtf8);
Marshal.FreeHGlobal(pchButton3TextUtf8);
return result;
}
public void CloseMessageOverlay()
{
FnTable.CloseMessageOverlay();
}
}
public class CVROverlayView
{
IVROverlayView FnTable;
internal CVROverlayView(IntPtr pInterface)
{
FnTable = (IVROverlayView)Marshal.PtrToStructure(pInterface, typeof(IVROverlayView));
}
public EVROverlayError AcquireOverlayView(ulong ulOverlayHandle,ref VRNativeDevice_t pNativeDevice,ref VROverlayView_t pOverlayView,uint unOverlayViewSize)
{
EVROverlayError result = FnTable.AcquireOverlayView(ulOverlayHandle,ref pNativeDevice,ref pOverlayView,unOverlayViewSize);
return result;
}
public EVROverlayError ReleaseOverlayView(ref VROverlayView_t pOverlayView)
{
EVROverlayError result = FnTable.ReleaseOverlayView(ref pOverlayView);
return result;
}
public void PostOverlayEvent(ulong ulOverlayHandle,ref VREvent_t pvrEvent)
{
FnTable.PostOverlayEvent(ulOverlayHandle,ref pvrEvent);
}
public bool IsViewingPermitted(ulong ulOverlayHandle)
{
bool result = FnTable.IsViewingPermitted(ulOverlayHandle);
return result;
}
}
public class CVRHeadsetView
{
IVRHeadsetView FnTable;
internal CVRHeadsetView(IntPtr pInterface)
{
FnTable = (IVRHeadsetView)Marshal.PtrToStructure(pInterface, typeof(IVRHeadsetView));
}
public void SetHeadsetViewSize(uint nWidth,uint nHeight)
{
FnTable.SetHeadsetViewSize(nWidth,nHeight);
}
public void GetHeadsetViewSize(ref uint pnWidth,ref uint pnHeight)
{
pnWidth = 0;
pnHeight = 0;
FnTable.GetHeadsetViewSize(ref pnWidth,ref pnHeight);
}
public void SetHeadsetViewMode(uint eHeadsetViewMode)
{
FnTable.SetHeadsetViewMode(eHeadsetViewMode);
}
public uint GetHeadsetViewMode()
{
uint result = FnTable.GetHeadsetViewMode();
return result;
}
public void SetHeadsetViewCropped(bool bCropped)
{
FnTable.SetHeadsetViewCropped(bCropped);
}
public bool GetHeadsetViewCropped()
{
bool result = FnTable.GetHeadsetViewCropped();
return result;
}
public float GetHeadsetViewAspectRatio()
{
float result = FnTable.GetHeadsetViewAspectRatio();
return result;
}
public void SetHeadsetViewBlendRange(float flStartPct,float flEndPct)
{
FnTable.SetHeadsetViewBlendRange(flStartPct,flEndPct);
}
public void GetHeadsetViewBlendRange(ref float pStartPct,ref float pEndPct)
{
pStartPct = 0;
pEndPct = 0;
FnTable.GetHeadsetViewBlendRange(ref pStartPct,ref pEndPct);
}
}
public class CVRRenderModels
{
IVRRenderModels FnTable;
internal CVRRenderModels(IntPtr pInterface)
{
FnTable = (IVRRenderModels)Marshal.PtrToStructure(pInterface, typeof(IVRRenderModels));
}
public EVRRenderModelError LoadRenderModel_Async(string pchRenderModelName,ref IntPtr ppRenderModel)
{
IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName);
EVRRenderModelError result = FnTable.LoadRenderModel_Async(pchRenderModelNameUtf8,ref ppRenderModel);
Marshal.FreeHGlobal(pchRenderModelNameUtf8);
return result;
}
public void FreeRenderModel(IntPtr pRenderModel)
{
FnTable.FreeRenderModel(pRenderModel);
}
public EVRRenderModelError LoadTexture_Async(int textureId,ref IntPtr ppTexture)
{
EVRRenderModelError result = FnTable.LoadTexture_Async(textureId,ref ppTexture);
return result;
}
public void FreeTexture(IntPtr pTexture)
{
FnTable.FreeTexture(pTexture);
}
public EVRRenderModelError LoadTextureD3D11_Async(int textureId,IntPtr pD3D11Device,ref IntPtr ppD3D11Texture2D)
{
EVRRenderModelError result = FnTable.LoadTextureD3D11_Async(textureId,pD3D11Device,ref ppD3D11Texture2D);
return result;
}
public EVRRenderModelError LoadIntoTextureD3D11_Async(int textureId,IntPtr pDstTexture)
{
EVRRenderModelError result = FnTable.LoadIntoTextureD3D11_Async(textureId,pDstTexture);
return result;
}
public void FreeTextureD3D11(IntPtr pD3D11Texture2D)
{
FnTable.FreeTextureD3D11(pD3D11Texture2D);
}
public uint GetRenderModelName(uint unRenderModelIndex,System.Text.StringBuilder pchRenderModelName,uint unRenderModelNameLen)
{
uint result = FnTable.GetRenderModelName(unRenderModelIndex,pchRenderModelName,unRenderModelNameLen);
return result;
}
public uint GetRenderModelCount()
{
uint result = FnTable.GetRenderModelCount();
return result;
}
public uint GetComponentCount(string pchRenderModelName)
{
IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName);
uint result = FnTable.GetComponentCount(pchRenderModelNameUtf8);
Marshal.FreeHGlobal(pchRenderModelNameUtf8);
return result;
}
public uint GetComponentName(string pchRenderModelName,uint unComponentIndex,System.Text.StringBuilder pchComponentName,uint unComponentNameLen)
{
IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName);
uint result = FnTable.GetComponentName(pchRenderModelNameUtf8,unComponentIndex,pchComponentName,unComponentNameLen);
Marshal.FreeHGlobal(pchRenderModelNameUtf8);
return result;
}
public ulong GetComponentButtonMask(string pchRenderModelName,string pchComponentName)
{
IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName);
IntPtr pchComponentNameUtf8 = Utils.ToUtf8(pchComponentName);
ulong result = FnTable.GetComponentButtonMask(pchRenderModelNameUtf8,pchComponentNameUtf8);
Marshal.FreeHGlobal(pchRenderModelNameUtf8);
Marshal.FreeHGlobal(pchComponentNameUtf8);
return result;
}
public uint GetComponentRenderModelName(string pchRenderModelName,string pchComponentName,System.Text.StringBuilder pchComponentRenderModelName,uint unComponentRenderModelNameLen)
{
IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName);
IntPtr pchComponentNameUtf8 = Utils.ToUtf8(pchComponentName);
uint result = FnTable.GetComponentRenderModelName(pchRenderModelNameUtf8,pchComponentNameUtf8,pchComponentRenderModelName,unComponentRenderModelNameLen);
Marshal.FreeHGlobal(pchRenderModelNameUtf8);
Marshal.FreeHGlobal(pchComponentNameUtf8);
return result;
}
public bool GetComponentStateForDevicePath(string pchRenderModelName,string pchComponentName,ulong devicePath,ref RenderModel_ControllerMode_State_t pState,ref RenderModel_ComponentState_t pComponentState)
{
IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName);
IntPtr pchComponentNameUtf8 = Utils.ToUtf8(pchComponentName);
bool result = FnTable.GetComponentStateForDevicePath(pchRenderModelNameUtf8,pchComponentNameUtf8,devicePath,ref pState,ref pComponentState);
Marshal.FreeHGlobal(pchRenderModelNameUtf8);
Marshal.FreeHGlobal(pchComponentNameUtf8);
return result;
}
// This is a terrible hack to workaround the fact that VRControllerState_t and VREvent_t were
// originally mis-compiled with the wrong packing for Linux and OSX.
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate bool _GetComponentStatePacked(IntPtr pchRenderModelName,IntPtr pchComponentName,ref VRControllerState_t_Packed pControllerState,ref RenderModel_ControllerMode_State_t pState,ref RenderModel_ComponentState_t pComponentState);
[StructLayout(LayoutKind.Explicit)]
struct GetComponentStateUnion
{
[FieldOffset(0)]
public IVRRenderModels._GetComponentState pGetComponentState;
[FieldOffset(0)]
public _GetComponentStatePacked pGetComponentStatePacked;
}
public bool GetComponentState(string pchRenderModelName,string pchComponentName,ref VRControllerState_t pControllerState,ref RenderModel_ControllerMode_State_t pState,ref RenderModel_ComponentState_t pComponentState)
{
IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName);
IntPtr pchComponentNameUtf8 = Utils.ToUtf8(pchComponentName);
#if !UNITY_METRO
if ((System.Environment.OSVersion.Platform == System.PlatformID.MacOSX) ||
(System.Environment.OSVersion.Platform == System.PlatformID.Unix))
{
GetComponentStateUnion u;
VRControllerState_t_Packed state_packed = new VRControllerState_t_Packed(pControllerState);
u.pGetComponentStatePacked = null;
u.pGetComponentState = FnTable.GetComponentState;
bool packed_result = u.pGetComponentStatePacked(pchRenderModelNameUtf8,pchComponentNameUtf8,ref state_packed,ref pState,ref pComponentState);
state_packed.Unpack(ref pControllerState);
return packed_result;
}
#endif
bool result = FnTable.GetComponentState(pchRenderModelNameUtf8,pchComponentNameUtf8,ref pControllerState,ref pState,ref pComponentState);
Marshal.FreeHGlobal(pchRenderModelNameUtf8);
Marshal.FreeHGlobal(pchComponentNameUtf8);
return result;
}
public bool RenderModelHasComponent(string pchRenderModelName,string pchComponentName)
{
IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName);
IntPtr pchComponentNameUtf8 = Utils.ToUtf8(pchComponentName);
bool result = FnTable.RenderModelHasComponent(pchRenderModelNameUtf8,pchComponentNameUtf8);
Marshal.FreeHGlobal(pchRenderModelNameUtf8);
Marshal.FreeHGlobal(pchComponentNameUtf8);
return result;
}
public uint GetRenderModelThumbnailURL(string pchRenderModelName,System.Text.StringBuilder pchThumbnailURL,uint unThumbnailURLLen,ref EVRRenderModelError peError)
{
IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName);
uint result = FnTable.GetRenderModelThumbnailURL(pchRenderModelNameUtf8,pchThumbnailURL,unThumbnailURLLen,ref peError);
Marshal.FreeHGlobal(pchRenderModelNameUtf8);
return result;
}
public uint GetRenderModelOriginalPath(string pchRenderModelName,System.Text.StringBuilder pchOriginalPath,uint unOriginalPathLen,ref EVRRenderModelError peError)
{
IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName);
uint result = FnTable.GetRenderModelOriginalPath(pchRenderModelNameUtf8,pchOriginalPath,unOriginalPathLen,ref peError);
Marshal.FreeHGlobal(pchRenderModelNameUtf8);
return result;
}
public string GetRenderModelErrorNameFromEnum(EVRRenderModelError error)
{
IntPtr result = FnTable.GetRenderModelErrorNameFromEnum(error);
return Marshal.PtrToStringAnsi(result);
}
}
public class CVRNotifications
{
IVRNotifications FnTable;
internal CVRNotifications(IntPtr pInterface)
{
FnTable = (IVRNotifications)Marshal.PtrToStructure(pInterface, typeof(IVRNotifications));
}
public EVRNotificationError CreateNotification(ulong ulOverlayHandle,ulong ulUserValue,EVRNotificationType type,string pchText,EVRNotificationStyle style,ref NotificationBitmap_t pImage,ref uint pNotificationId)
{
IntPtr pchTextUtf8 = Utils.ToUtf8(pchText);
pNotificationId = 0;
EVRNotificationError result = FnTable.CreateNotification(ulOverlayHandle,ulUserValue,type,pchTextUtf8,style,ref pImage,ref pNotificationId);
Marshal.FreeHGlobal(pchTextUtf8);
return result;
}
public EVRNotificationError RemoveNotification(uint notificationId)
{
EVRNotificationError result = FnTable.RemoveNotification(notificationId);
return result;
}
}
public class CVRSettings
{
IVRSettings FnTable;
internal CVRSettings(IntPtr pInterface)
{
FnTable = (IVRSettings)Marshal.PtrToStructure(pInterface, typeof(IVRSettings));
}
public string GetSettingsErrorNameFromEnum(EVRSettingsError eError)
{
IntPtr result = FnTable.GetSettingsErrorNameFromEnum(eError);
return Marshal.PtrToStringAnsi(result);
}
public void SetBool(string pchSection,string pchSettingsKey,bool bValue,ref EVRSettingsError peError)
{
IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection);
IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey);
FnTable.SetBool(pchSectionUtf8,pchSettingsKeyUtf8,bValue,ref peError);
Marshal.FreeHGlobal(pchSectionUtf8);
Marshal.FreeHGlobal(pchSettingsKeyUtf8);
}
public void SetInt32(string pchSection,string pchSettingsKey,int nValue,ref EVRSettingsError peError)
{
IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection);
IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey);
FnTable.SetInt32(pchSectionUtf8,pchSettingsKeyUtf8,nValue,ref peError);
Marshal.FreeHGlobal(pchSectionUtf8);
Marshal.FreeHGlobal(pchSettingsKeyUtf8);
}
public void SetFloat(string pchSection,string pchSettingsKey,float flValue,ref EVRSettingsError peError)
{
IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection);
IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey);
FnTable.SetFloat(pchSectionUtf8,pchSettingsKeyUtf8,flValue,ref peError);
Marshal.FreeHGlobal(pchSectionUtf8);
Marshal.FreeHGlobal(pchSettingsKeyUtf8);
}
public void SetString(string pchSection,string pchSettingsKey,string pchValue,ref EVRSettingsError peError)
{
IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection);
IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey);
IntPtr pchValueUtf8 = Utils.ToUtf8(pchValue);
FnTable.SetString(pchSectionUtf8,pchSettingsKeyUtf8,pchValueUtf8,ref peError);
Marshal.FreeHGlobal(pchSectionUtf8);
Marshal.FreeHGlobal(pchSettingsKeyUtf8);
Marshal.FreeHGlobal(pchValueUtf8);
}
public bool GetBool(string pchSection,string pchSettingsKey,ref EVRSettingsError peError)
{
IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection);
IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey);
bool result = FnTable.GetBool(pchSectionUtf8,pchSettingsKeyUtf8,ref peError);
Marshal.FreeHGlobal(pchSectionUtf8);
Marshal.FreeHGlobal(pchSettingsKeyUtf8);
return result;
}
public int GetInt32(string pchSection,string pchSettingsKey,ref EVRSettingsError peError)
{
IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection);
IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey);
int result = FnTable.GetInt32(pchSectionUtf8,pchSettingsKeyUtf8,ref peError);
Marshal.FreeHGlobal(pchSectionUtf8);
Marshal.FreeHGlobal(pchSettingsKeyUtf8);
return result;
}
public float GetFloat(string pchSection,string pchSettingsKey,ref EVRSettingsError peError)
{
IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection);
IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey);
float result = FnTable.GetFloat(pchSectionUtf8,pchSettingsKeyUtf8,ref peError);
Marshal.FreeHGlobal(pchSectionUtf8);
Marshal.FreeHGlobal(pchSettingsKeyUtf8);
return result;
}
public void GetString(string pchSection,string pchSettingsKey,System.Text.StringBuilder pchValue,uint unValueLen,ref EVRSettingsError peError)
{
IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection);
IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey);
FnTable.GetString(pchSectionUtf8,pchSettingsKeyUtf8,pchValue,unValueLen,ref peError);
Marshal.FreeHGlobal(pchSectionUtf8);
Marshal.FreeHGlobal(pchSettingsKeyUtf8);
}
public void RemoveSection(string pchSection,ref EVRSettingsError peError)
{
IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection);
FnTable.RemoveSection(pchSectionUtf8,ref peError);
Marshal.FreeHGlobal(pchSectionUtf8);
}
public void RemoveKeyInSection(string pchSection,string pchSettingsKey,ref EVRSettingsError peError)
{
IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection);
IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey);
FnTable.RemoveKeyInSection(pchSectionUtf8,pchSettingsKeyUtf8,ref peError);
Marshal.FreeHGlobal(pchSectionUtf8);
Marshal.FreeHGlobal(pchSettingsKeyUtf8);
}
}
public class CVRScreenshots
{
IVRScreenshots FnTable;
internal CVRScreenshots(IntPtr pInterface)
{
FnTable = (IVRScreenshots)Marshal.PtrToStructure(pInterface, typeof(IVRScreenshots));
}
public EVRScreenshotError RequestScreenshot(ref uint pOutScreenshotHandle,EVRScreenshotType type,string pchPreviewFilename,string pchVRFilename)
{
pOutScreenshotHandle = 0;
IntPtr pchPreviewFilenameUtf8 = Utils.ToUtf8(pchPreviewFilename);
IntPtr pchVRFilenameUtf8 = Utils.ToUtf8(pchVRFilename);
EVRScreenshotError result = FnTable.RequestScreenshot(ref pOutScreenshotHandle,type,pchPreviewFilenameUtf8,pchVRFilenameUtf8);
Marshal.FreeHGlobal(pchPreviewFilenameUtf8);
Marshal.FreeHGlobal(pchVRFilenameUtf8);
return result;
}
public EVRScreenshotError HookScreenshot(EVRScreenshotType [] pSupportedTypes)
{
EVRScreenshotError result = FnTable.HookScreenshot(pSupportedTypes,(int) pSupportedTypes.Length);
return result;
}
public EVRScreenshotType GetScreenshotPropertyType(uint screenshotHandle,ref EVRScreenshotError pError)
{
EVRScreenshotType result = FnTable.GetScreenshotPropertyType(screenshotHandle,ref pError);
return result;
}
public uint GetScreenshotPropertyFilename(uint screenshotHandle,EVRScreenshotPropertyFilenames filenameType,System.Text.StringBuilder pchFilename,uint cchFilename,ref EVRScreenshotError pError)
{
uint result = FnTable.GetScreenshotPropertyFilename(screenshotHandle,filenameType,pchFilename,cchFilename,ref pError);
return result;
}
public EVRScreenshotError UpdateScreenshotProgress(uint screenshotHandle,float flProgress)
{
EVRScreenshotError result = FnTable.UpdateScreenshotProgress(screenshotHandle,flProgress);
return result;
}
public EVRScreenshotError TakeStereoScreenshot(ref uint pOutScreenshotHandle,string pchPreviewFilename,string pchVRFilename)
{
pOutScreenshotHandle = 0;
IntPtr pchPreviewFilenameUtf8 = Utils.ToUtf8(pchPreviewFilename);
IntPtr pchVRFilenameUtf8 = Utils.ToUtf8(pchVRFilename);
EVRScreenshotError result = FnTable.TakeStereoScreenshot(ref pOutScreenshotHandle,pchPreviewFilenameUtf8,pchVRFilenameUtf8);
Marshal.FreeHGlobal(pchPreviewFilenameUtf8);
Marshal.FreeHGlobal(pchVRFilenameUtf8);
return result;
}
public EVRScreenshotError SubmitScreenshot(uint screenshotHandle,EVRScreenshotType type,string pchSourcePreviewFilename,string pchSourceVRFilename)
{
IntPtr pchSourcePreviewFilenameUtf8 = Utils.ToUtf8(pchSourcePreviewFilename);
IntPtr pchSourceVRFilenameUtf8 = Utils.ToUtf8(pchSourceVRFilename);
EVRScreenshotError result = FnTable.SubmitScreenshot(screenshotHandle,type,pchSourcePreviewFilenameUtf8,pchSourceVRFilenameUtf8);
Marshal.FreeHGlobal(pchSourcePreviewFilenameUtf8);
Marshal.FreeHGlobal(pchSourceVRFilenameUtf8);
return result;
}
}
public class CVRResources
{
IVRResources FnTable;
internal CVRResources(IntPtr pInterface)
{
FnTable = (IVRResources)Marshal.PtrToStructure(pInterface, typeof(IVRResources));
}
public uint LoadSharedResource(string pchResourceName,string pchBuffer,uint unBufferLen)
{
IntPtr pchResourceNameUtf8 = Utils.ToUtf8(pchResourceName);
uint result = FnTable.LoadSharedResource(pchResourceNameUtf8,pchBuffer,unBufferLen);
Marshal.FreeHGlobal(pchResourceNameUtf8);
return result;
}
public uint GetResourceFullPath(string pchResourceName,string pchResourceTypeDirectory,System.Text.StringBuilder pchPathBuffer,uint unBufferLen)
{
IntPtr pchResourceNameUtf8 = Utils.ToUtf8(pchResourceName);
IntPtr pchResourceTypeDirectoryUtf8 = Utils.ToUtf8(pchResourceTypeDirectory);
uint result = FnTable.GetResourceFullPath(pchResourceNameUtf8,pchResourceTypeDirectoryUtf8,pchPathBuffer,unBufferLen);
Marshal.FreeHGlobal(pchResourceNameUtf8);
Marshal.FreeHGlobal(pchResourceTypeDirectoryUtf8);
return result;
}
}
public class CVRDriverManager
{
IVRDriverManager FnTable;
internal CVRDriverManager(IntPtr pInterface)
{
FnTable = (IVRDriverManager)Marshal.PtrToStructure(pInterface, typeof(IVRDriverManager));
}
public uint GetDriverCount()
{
uint result = FnTable.GetDriverCount();
return result;
}
public uint GetDriverName(uint nDriver,System.Text.StringBuilder pchValue,uint unBufferSize)
{
uint result = FnTable.GetDriverName(nDriver,pchValue,unBufferSize);
return result;
}
public ulong GetDriverHandle(string pchDriverName)
{
IntPtr pchDriverNameUtf8 = Utils.ToUtf8(pchDriverName);
ulong result = FnTable.GetDriverHandle(pchDriverNameUtf8);
Marshal.FreeHGlobal(pchDriverNameUtf8);
return result;
}
public bool IsEnabled(uint nDriver)
{
bool result = FnTable.IsEnabled(nDriver);
return result;
}
}
public class CVRInput
{
IVRInput FnTable;
internal CVRInput(IntPtr pInterface)
{
FnTable = (IVRInput)Marshal.PtrToStructure(pInterface, typeof(IVRInput));
}
public EVRInputError SetActionManifestPath(string pchActionManifestPath)
{
IntPtr pchActionManifestPathUtf8 = Utils.ToUtf8(pchActionManifestPath);
EVRInputError result = FnTable.SetActionManifestPath(pchActionManifestPathUtf8);
Marshal.FreeHGlobal(pchActionManifestPathUtf8);
return result;
}
public EVRInputError GetActionSetHandle(string pchActionSetName,ref ulong pHandle)
{
IntPtr pchActionSetNameUtf8 = Utils.ToUtf8(pchActionSetName);
pHandle = 0;
EVRInputError result = FnTable.GetActionSetHandle(pchActionSetNameUtf8,ref pHandle);
Marshal.FreeHGlobal(pchActionSetNameUtf8);
return result;
}
public EVRInputError GetActionHandle(string pchActionName,ref ulong pHandle)
{
IntPtr pchActionNameUtf8 = Utils.ToUtf8(pchActionName);
pHandle = 0;
EVRInputError result = FnTable.GetActionHandle(pchActionNameUtf8,ref pHandle);
Marshal.FreeHGlobal(pchActionNameUtf8);
return result;
}
public EVRInputError GetInputSourceHandle(string pchInputSourcePath,ref ulong pHandle)
{
IntPtr pchInputSourcePathUtf8 = Utils.ToUtf8(pchInputSourcePath);
pHandle = 0;
EVRInputError result = FnTable.GetInputSourceHandle(pchInputSourcePathUtf8,ref pHandle);
Marshal.FreeHGlobal(pchInputSourcePathUtf8);
return result;
}
public EVRInputError UpdateActionState(VRActiveActionSet_t [] pSets,uint unSizeOfVRSelectedActionSet_t)
{
EVRInputError result = FnTable.UpdateActionState(pSets,unSizeOfVRSelectedActionSet_t,(uint) pSets.Length);
return result;
}
public EVRInputError GetDigitalActionData(ulong action,ref InputDigitalActionData_t pActionData,uint unActionDataSize,ulong ulRestrictToDevice)
{
EVRInputError result = FnTable.GetDigitalActionData(action,ref pActionData,unActionDataSize,ulRestrictToDevice);
return result;
}
public EVRInputError GetAnalogActionData(ulong action,ref InputAnalogActionData_t pActionData,uint unActionDataSize,ulong ulRestrictToDevice)
{
EVRInputError result = FnTable.GetAnalogActionData(action,ref pActionData,unActionDataSize,ulRestrictToDevice);
return result;
}
public EVRInputError GetPoseActionDataRelativeToNow(ulong action,ETrackingUniverseOrigin eOrigin,float fPredictedSecondsFromNow,ref InputPoseActionData_t pActionData,uint unActionDataSize,ulong ulRestrictToDevice)
{
EVRInputError result = FnTable.GetPoseActionDataRelativeToNow(action,eOrigin,fPredictedSecondsFromNow,ref pActionData,unActionDataSize,ulRestrictToDevice);
return result;
}
public EVRInputError GetPoseActionDataForNextFrame(ulong action,ETrackingUniverseOrigin eOrigin,ref InputPoseActionData_t pActionData,uint unActionDataSize,ulong ulRestrictToDevice)
{
EVRInputError result = FnTable.GetPoseActionDataForNextFrame(action,eOrigin,ref pActionData,unActionDataSize,ulRestrictToDevice);
return result;
}
public EVRInputError GetSkeletalActionData(ulong action,ref InputSkeletalActionData_t pActionData,uint unActionDataSize)
{
EVRInputError result = FnTable.GetSkeletalActionData(action,ref pActionData,unActionDataSize);
return result;
}
public EVRInputError GetDominantHand(ref ETrackedControllerRole peDominantHand)
{
EVRInputError result = FnTable.GetDominantHand(ref peDominantHand);
return result;
}
public EVRInputError SetDominantHand(ETrackedControllerRole eDominantHand)
{
EVRInputError result = FnTable.SetDominantHand(eDominantHand);
return result;
}
public EVRInputError GetBoneCount(ulong action,ref uint pBoneCount)
{
pBoneCount = 0;
EVRInputError result = FnTable.GetBoneCount(action,ref pBoneCount);
return result;
}
public EVRInputError GetBoneHierarchy(ulong action,int [] pParentIndices)
{
EVRInputError result = FnTable.GetBoneHierarchy(action,pParentIndices,(uint) pParentIndices.Length);
return result;
}
public EVRInputError GetBoneName(ulong action,int nBoneIndex,System.Text.StringBuilder pchBoneName,uint unNameBufferSize)
{
EVRInputError result = FnTable.GetBoneName(action,nBoneIndex,pchBoneName,unNameBufferSize);
return result;
}
public EVRInputError GetSkeletalReferenceTransforms(ulong action,EVRSkeletalTransformSpace eTransformSpace,EVRSkeletalReferencePose eReferencePose,VRBoneTransform_t [] pTransformArray)
{
EVRInputError result = FnTable.GetSkeletalReferenceTransforms(action,eTransformSpace,eReferencePose,pTransformArray,(uint) pTransformArray.Length);
return result;
}
public EVRInputError GetSkeletalTrackingLevel(ulong action,ref EVRSkeletalTrackingLevel pSkeletalTrackingLevel)
{
EVRInputError result = FnTable.GetSkeletalTrackingLevel(action,ref pSkeletalTrackingLevel);
return result;
}
public EVRInputError GetSkeletalBoneData(ulong action,EVRSkeletalTransformSpace eTransformSpace,EVRSkeletalMotionRange eMotionRange,VRBoneTransform_t [] pTransformArray)
{
EVRInputError result = FnTable.GetSkeletalBoneData(action,eTransformSpace,eMotionRange,pTransformArray,(uint) pTransformArray.Length);
return result;
}
public EVRInputError GetSkeletalSummaryData(ulong action,EVRSummaryType eSummaryType,ref VRSkeletalSummaryData_t pSkeletalSummaryData)
{
EVRInputError result = FnTable.GetSkeletalSummaryData(action,eSummaryType,ref pSkeletalSummaryData);
return result;
}
public EVRInputError GetSkeletalBoneDataCompressed(ulong action,EVRSkeletalMotionRange eMotionRange,IntPtr pvCompressedData,uint unCompressedSize,ref uint punRequiredCompressedSize)
{
punRequiredCompressedSize = 0;
EVRInputError result = FnTable.GetSkeletalBoneDataCompressed(action,eMotionRange,pvCompressedData,unCompressedSize,ref punRequiredCompressedSize);
return result;
}
public EVRInputError DecompressSkeletalBoneData(IntPtr pvCompressedBuffer,uint unCompressedBufferSize,EVRSkeletalTransformSpace eTransformSpace,VRBoneTransform_t [] pTransformArray)
{
EVRInputError result = FnTable.DecompressSkeletalBoneData(pvCompressedBuffer,unCompressedBufferSize,eTransformSpace,pTransformArray,(uint) pTransformArray.Length);
return result;
}
public EVRInputError TriggerHapticVibrationAction(ulong action,float fStartSecondsFromNow,float fDurationSeconds,float fFrequency,float fAmplitude,ulong ulRestrictToDevice)
{
EVRInputError result = FnTable.TriggerHapticVibrationAction(action,fStartSecondsFromNow,fDurationSeconds,fFrequency,fAmplitude,ulRestrictToDevice);
return result;
}
public EVRInputError GetActionOrigins(ulong actionSetHandle,ulong digitalActionHandle,ulong [] originsOut)
{
EVRInputError result = FnTable.GetActionOrigins(actionSetHandle,digitalActionHandle,originsOut,(uint) originsOut.Length);
return result;
}
public EVRInputError GetOriginLocalizedName(ulong origin,System.Text.StringBuilder pchNameArray,uint unNameArraySize,int unStringSectionsToInclude)
{
EVRInputError result = FnTable.GetOriginLocalizedName(origin,pchNameArray,unNameArraySize,unStringSectionsToInclude);
return result;
}
public EVRInputError GetOriginTrackedDeviceInfo(ulong origin,ref InputOriginInfo_t pOriginInfo,uint unOriginInfoSize)
{
EVRInputError result = FnTable.GetOriginTrackedDeviceInfo(origin,ref pOriginInfo,unOriginInfoSize);
return result;
}
public EVRInputError GetActionBindingInfo(ulong action,ref InputBindingInfo_t pOriginInfo,uint unBindingInfoSize,uint unBindingInfoCount,ref uint punReturnedBindingInfoCount)
{
punReturnedBindingInfoCount = 0;
EVRInputError result = FnTable.GetActionBindingInfo(action,ref pOriginInfo,unBindingInfoSize,unBindingInfoCount,ref punReturnedBindingInfoCount);
return result;
}
public EVRInputError ShowActionOrigins(ulong actionSetHandle,ulong ulActionHandle)
{
EVRInputError result = FnTable.ShowActionOrigins(actionSetHandle,ulActionHandle);
return result;
}
public EVRInputError ShowBindingsForActionSet(VRActiveActionSet_t [] pSets,uint unSizeOfVRSelectedActionSet_t,ulong originToHighlight)
{
EVRInputError result = FnTable.ShowBindingsForActionSet(pSets,unSizeOfVRSelectedActionSet_t,(uint) pSets.Length,originToHighlight);
return result;
}
public EVRInputError GetComponentStateForBinding(string pchRenderModelName,string pchComponentName,ref InputBindingInfo_t pOriginInfo,uint unBindingInfoSize,uint unBindingInfoCount,ref RenderModel_ComponentState_t pComponentState)
{
IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName);
IntPtr pchComponentNameUtf8 = Utils.ToUtf8(pchComponentName);
EVRInputError result = FnTable.GetComponentStateForBinding(pchRenderModelNameUtf8,pchComponentNameUtf8,ref pOriginInfo,unBindingInfoSize,unBindingInfoCount,ref pComponentState);
Marshal.FreeHGlobal(pchRenderModelNameUtf8);
Marshal.FreeHGlobal(pchComponentNameUtf8);
return result;
}
public bool IsUsingLegacyInput()
{
bool result = FnTable.IsUsingLegacyInput();
return result;
}
public EVRInputError OpenBindingUI(string pchAppKey,ulong ulActionSetHandle,ulong ulDeviceHandle,bool bShowOnDesktop)
{
IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey);
EVRInputError result = FnTable.OpenBindingUI(pchAppKeyUtf8,ulActionSetHandle,ulDeviceHandle,bShowOnDesktop);
Marshal.FreeHGlobal(pchAppKeyUtf8);
return result;
}
public EVRInputError GetBindingVariant(ulong ulDevicePath,System.Text.StringBuilder pchVariantArray,uint unVariantArraySize)
{
EVRInputError result = FnTable.GetBindingVariant(ulDevicePath,pchVariantArray,unVariantArraySize);
return result;
}
}
public class CVRIOBuffer
{
IVRIOBuffer FnTable;
internal CVRIOBuffer(IntPtr pInterface)
{
FnTable = (IVRIOBuffer)Marshal.PtrToStructure(pInterface, typeof(IVRIOBuffer));
}
public EIOBufferError Open(string pchPath,EIOBufferMode mode,uint unElementSize,uint unElements,ref ulong pulBuffer)
{
IntPtr pchPathUtf8 = Utils.ToUtf8(pchPath);
pulBuffer = 0;
EIOBufferError result = FnTable.Open(pchPathUtf8,mode,unElementSize,unElements,ref pulBuffer);
Marshal.FreeHGlobal(pchPathUtf8);
return result;
}
public EIOBufferError Close(ulong ulBuffer)
{
EIOBufferError result = FnTable.Close(ulBuffer);
return result;
}
public EIOBufferError Read(ulong ulBuffer,IntPtr pDst,uint unBytes,ref uint punRead)
{
punRead = 0;
EIOBufferError result = FnTable.Read(ulBuffer,pDst,unBytes,ref punRead);
return result;
}
public EIOBufferError Write(ulong ulBuffer,IntPtr pSrc,uint unBytes)
{
EIOBufferError result = FnTable.Write(ulBuffer,pSrc,unBytes);
return result;
}
public ulong PropertyContainer(ulong ulBuffer)
{
ulong result = FnTable.PropertyContainer(ulBuffer);
return result;
}
public bool HasReaders(ulong ulBuffer)
{
bool result = FnTable.HasReaders(ulBuffer);
return result;
}
}
public class CVRSpatialAnchors
{
IVRSpatialAnchors FnTable;
internal CVRSpatialAnchors(IntPtr pInterface)
{
FnTable = (IVRSpatialAnchors)Marshal.PtrToStructure(pInterface, typeof(IVRSpatialAnchors));
}
public EVRSpatialAnchorError CreateSpatialAnchorFromDescriptor(string pchDescriptor,ref uint pHandleOut)
{
IntPtr pchDescriptorUtf8 = Utils.ToUtf8(pchDescriptor);
pHandleOut = 0;
EVRSpatialAnchorError result = FnTable.CreateSpatialAnchorFromDescriptor(pchDescriptorUtf8,ref pHandleOut);
Marshal.FreeHGlobal(pchDescriptorUtf8);
return result;
}
public EVRSpatialAnchorError CreateSpatialAnchorFromPose(uint unDeviceIndex,ETrackingUniverseOrigin eOrigin,ref SpatialAnchorPose_t pPose,ref uint pHandleOut)
{
pHandleOut = 0;
EVRSpatialAnchorError result = FnTable.CreateSpatialAnchorFromPose(unDeviceIndex,eOrigin,ref pPose,ref pHandleOut);
return result;
}
public EVRSpatialAnchorError GetSpatialAnchorPose(uint unHandle,ETrackingUniverseOrigin eOrigin,ref SpatialAnchorPose_t pPoseOut)
{
EVRSpatialAnchorError result = FnTable.GetSpatialAnchorPose(unHandle,eOrigin,ref pPoseOut);
return result;
}
public EVRSpatialAnchorError GetSpatialAnchorDescriptor(uint unHandle,System.Text.StringBuilder pchDescriptorOut,ref uint punDescriptorBufferLenInOut)
{
punDescriptorBufferLenInOut = 0;
EVRSpatialAnchorError result = FnTable.GetSpatialAnchorDescriptor(unHandle,pchDescriptorOut,ref punDescriptorBufferLenInOut);
return result;
}
}
public class CVRDebug
{
IVRDebug FnTable;
internal CVRDebug(IntPtr pInterface)
{
FnTable = (IVRDebug)Marshal.PtrToStructure(pInterface, typeof(IVRDebug));
}
public EVRDebugError EmitVrProfilerEvent(string pchMessage)
{
IntPtr pchMessageUtf8 = Utils.ToUtf8(pchMessage);
EVRDebugError result = FnTable.EmitVrProfilerEvent(pchMessageUtf8);
Marshal.FreeHGlobal(pchMessageUtf8);
return result;
}
public EVRDebugError BeginVrProfilerEvent(ref ulong pHandleOut)
{
pHandleOut = 0;
EVRDebugError result = FnTable.BeginVrProfilerEvent(ref pHandleOut);
return result;
}
public EVRDebugError FinishVrProfilerEvent(ulong hHandle,string pchMessage)
{
IntPtr pchMessageUtf8 = Utils.ToUtf8(pchMessage);
EVRDebugError result = FnTable.FinishVrProfilerEvent(hHandle,pchMessageUtf8);
Marshal.FreeHGlobal(pchMessageUtf8);
return result;
}
public uint DriverDebugRequest(uint unDeviceIndex,string pchRequest,System.Text.StringBuilder pchResponseBuffer,uint unResponseBufferSize)
{
IntPtr pchRequestUtf8 = Utils.ToUtf8(pchRequest);
uint result = FnTable.DriverDebugRequest(unDeviceIndex,pchRequestUtf8,pchResponseBuffer,unResponseBufferSize);
Marshal.FreeHGlobal(pchRequestUtf8);
return result;
}
}
public class CVRProperties
{
IVRProperties FnTable;
internal CVRProperties(IntPtr pInterface)
{
FnTable = (IVRProperties)Marshal.PtrToStructure(pInterface, typeof(IVRProperties));
}
public ETrackedPropertyError ReadPropertyBatch(ulong ulContainerHandle,ref PropertyRead_t pBatch,uint unBatchEntryCount)
{
ETrackedPropertyError result = FnTable.ReadPropertyBatch(ulContainerHandle,ref pBatch,unBatchEntryCount);
return result;
}
public ETrackedPropertyError WritePropertyBatch(ulong ulContainerHandle,ref PropertyWrite_t pBatch,uint unBatchEntryCount)
{
ETrackedPropertyError result = FnTable.WritePropertyBatch(ulContainerHandle,ref pBatch,unBatchEntryCount);
return result;
}
public string GetPropErrorNameFromEnum(ETrackedPropertyError error)
{
IntPtr result = FnTable.GetPropErrorNameFromEnum(error);
return Marshal.PtrToStringAnsi(result);
}
public ulong TrackedDeviceToPropertyContainer(uint nDevice)
{
ulong result = FnTable.TrackedDeviceToPropertyContainer(nDevice);
return result;
}
}
public class CVRPaths
{
IVRPaths FnTable;
internal CVRPaths(IntPtr pInterface)
{
FnTable = (IVRPaths)Marshal.PtrToStructure(pInterface, typeof(IVRPaths));
}
public ETrackedPropertyError ReadPathBatch(ulong ulRootHandle,ref PathRead_t pBatch,uint unBatchEntryCount)
{
ETrackedPropertyError result = FnTable.ReadPathBatch(ulRootHandle,ref pBatch,unBatchEntryCount);
return result;
}
public ETrackedPropertyError WritePathBatch(ulong ulRootHandle,ref PathWrite_t pBatch,uint unBatchEntryCount)
{
ETrackedPropertyError result = FnTable.WritePathBatch(ulRootHandle,ref pBatch,unBatchEntryCount);
return result;
}
public ETrackedPropertyError StringToHandle(ref ulong pHandle,string pchPath)
{
pHandle = 0;
IntPtr pchPathUtf8 = Utils.ToUtf8(pchPath);
ETrackedPropertyError result = FnTable.StringToHandle(ref pHandle,pchPathUtf8);
Marshal.FreeHGlobal(pchPathUtf8);
return result;
}
public ETrackedPropertyError HandleToString(ulong pHandle,string pchBuffer,uint unBufferSize,ref uint punBufferSizeUsed)
{
punBufferSizeUsed = 0;
ETrackedPropertyError result = FnTable.HandleToString(pHandle,pchBuffer,unBufferSize,ref punBufferSizeUsed);
return result;
}
}
public class CVRBlockQueue
{
IVRBlockQueue FnTable;
internal CVRBlockQueue(IntPtr pInterface)
{
FnTable = (IVRBlockQueue)Marshal.PtrToStructure(pInterface, typeof(IVRBlockQueue));
}
public EBlockQueueError Create(ref ulong pulQueueHandle,string pchPath,uint unBlockDataSize,uint unBlockHeaderSize,uint unBlockCount)
{
pulQueueHandle = 0;
IntPtr pchPathUtf8 = Utils.ToUtf8(pchPath);
EBlockQueueError result = FnTable.Create(ref pulQueueHandle,pchPathUtf8,unBlockDataSize,unBlockHeaderSize,unBlockCount);
Marshal.FreeHGlobal(pchPathUtf8);
return result;
}
public EBlockQueueError Connect(ref ulong pulQueueHandle,string pchPath)
{
pulQueueHandle = 0;
IntPtr pchPathUtf8 = Utils.ToUtf8(pchPath);
EBlockQueueError result = FnTable.Connect(ref pulQueueHandle,pchPathUtf8);
Marshal.FreeHGlobal(pchPathUtf8);
return result;
}
public EBlockQueueError Destroy(ulong ulQueueHandle)
{
EBlockQueueError result = FnTable.Destroy(ulQueueHandle);
return result;
}
public EBlockQueueError AcquireWriteOnlyBlock(ulong ulQueueHandle,ref ulong pulBlockHandle,ref IntPtr ppvBuffer)
{
pulBlockHandle = 0;
EBlockQueueError result = FnTable.AcquireWriteOnlyBlock(ulQueueHandle,ref pulBlockHandle,ref ppvBuffer);
return result;
}
public EBlockQueueError ReleaseWriteOnlyBlock(ulong ulQueueHandle,ulong ulBlockHandle)
{
EBlockQueueError result = FnTable.ReleaseWriteOnlyBlock(ulQueueHandle,ulBlockHandle);
return result;
}
public EBlockQueueError WaitAndAcquireReadOnlyBlock(ulong ulQueueHandle,ref ulong pulBlockHandle,ref IntPtr ppvBuffer,EBlockQueueReadType eReadType,uint unTimeoutMs)
{
pulBlockHandle = 0;
EBlockQueueError result = FnTable.WaitAndAcquireReadOnlyBlock(ulQueueHandle,ref pulBlockHandle,ref ppvBuffer,eReadType,unTimeoutMs);
return result;
}
public EBlockQueueError AcquireReadOnlyBlock(ulong ulQueueHandle,ref ulong pulBlockHandle,ref IntPtr ppvBuffer,EBlockQueueReadType eReadType)
{
pulBlockHandle = 0;
EBlockQueueError result = FnTable.AcquireReadOnlyBlock(ulQueueHandle,ref pulBlockHandle,ref ppvBuffer,eReadType);
return result;
}
public EBlockQueueError ReleaseReadOnlyBlock(ulong ulQueueHandle,ulong ulBlockHandle)
{
EBlockQueueError result = FnTable.ReleaseReadOnlyBlock(ulQueueHandle,ulBlockHandle);
return result;
}
public EBlockQueueError QueueHasReader(ulong ulQueueHandle,ref bool pbHasReaders)
{
pbHasReaders = false;
EBlockQueueError result = FnTable.QueueHasReader(ulQueueHandle,ref pbHasReaders);
return result;
}
}
public class OpenVRInterop
{
[DllImportAttribute("openvr_api", EntryPoint = "VR_InitInternal", CallingConvention = CallingConvention.Cdecl)]
internal static extern uint InitInternal(ref EVRInitError peError, EVRApplicationType eApplicationType);
[DllImportAttribute("openvr_api", EntryPoint = "VR_InitInternal2", CallingConvention = CallingConvention.Cdecl)]
internal static extern uint InitInternal2(ref EVRInitError peError, EVRApplicationType eApplicationType,[In, MarshalAs(UnmanagedType.LPStr)] string pStartupInfo);
[DllImportAttribute("openvr_api", EntryPoint = "VR_ShutdownInternal", CallingConvention = CallingConvention.Cdecl)]
internal static extern void ShutdownInternal();
[DllImportAttribute("openvr_api", EntryPoint = "VR_IsHmdPresent", CallingConvention = CallingConvention.Cdecl)]
internal static extern bool IsHmdPresent();
[DllImportAttribute("openvr_api", EntryPoint = "VR_IsRuntimeInstalled", CallingConvention = CallingConvention.Cdecl)]
internal static extern bool IsRuntimeInstalled();
[DllImportAttribute("openvr_api", EntryPoint = "VR_RuntimePath", CallingConvention = CallingConvention.Cdecl)]
internal static extern string RuntimePath();
[DllImportAttribute("openvr_api", EntryPoint = "VR_GetRuntimePath", CallingConvention = CallingConvention.Cdecl)]
internal static extern bool GetRuntimePath(System.Text.StringBuilder pchPathBuffer, uint unBufferSize, ref uint punRequiredBufferSize);
[DllImportAttribute("openvr_api", EntryPoint = "VR_GetStringForHmdError", CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr GetStringForHmdError(EVRInitError error);
[DllImportAttribute("openvr_api", EntryPoint = "VR_GetGenericInterface", CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr GetGenericInterface([In, MarshalAs(UnmanagedType.LPStr)] string pchInterfaceVersion, ref EVRInitError peError);
[DllImportAttribute("openvr_api", EntryPoint = "VR_IsInterfaceVersionValid", CallingConvention = CallingConvention.Cdecl)]
internal static extern bool IsInterfaceVersionValid([In, MarshalAs(UnmanagedType.LPStr)] string pchInterfaceVersion);
[DllImportAttribute("openvr_api", EntryPoint = "VR_GetInitToken", CallingConvention = CallingConvention.Cdecl)]
internal static extern uint GetInitToken();
}
public enum EVREye
{
Eye_Left = 0,
Eye_Right = 1,
}
public enum ETextureType
{
Invalid = -1,
DirectX = 0,
OpenGL = 1,
Vulkan = 2,
IOSurface = 3,
DirectX12 = 4,
DXGISharedHandle = 5,
Metal = 6,
}
public enum EColorSpace
{
Auto = 0,
Gamma = 1,
Linear = 2,
}
public enum ETrackingResult
{
Uninitialized = 1,
Calibrating_InProgress = 100,
Calibrating_OutOfRange = 101,
Running_OK = 200,
Running_OutOfRange = 201,
Fallback_RotationOnly = 300,
}
public enum ETrackedDeviceClass
{
Invalid = 0,
HMD = 1,
Controller = 2,
GenericTracker = 3,
TrackingReference = 4,
DisplayRedirect = 5,
Max = 6,
}
public enum ETrackedControllerRole
{
Invalid = 0,
LeftHand = 1,
RightHand = 2,
OptOut = 3,
Treadmill = 4,
Stylus = 5,
Max = 5,
}
public enum ETrackingUniverseOrigin
{
TrackingUniverseSeated = 0,
TrackingUniverseStanding = 1,
TrackingUniverseRawAndUncalibrated = 2,
}
public enum EAdditionalRadioFeatures
{
None = 0,
HTCLinkBox = 1,
InternalDongle = 2,
ExternalDongle = 4,
}
public enum ETrackedDeviceProperty
{
Prop_Invalid = 0,
Prop_TrackingSystemName_String = 1000,
Prop_ModelNumber_String = 1001,
Prop_SerialNumber_String = 1002,
Prop_RenderModelName_String = 1003,
Prop_WillDriftInYaw_Bool = 1004,
Prop_ManufacturerName_String = 1005,
Prop_TrackingFirmwareVersion_String = 1006,
Prop_HardwareRevision_String = 1007,
Prop_AllWirelessDongleDescriptions_String = 1008,
Prop_ConnectedWirelessDongle_String = 1009,
Prop_DeviceIsWireless_Bool = 1010,
Prop_DeviceIsCharging_Bool = 1011,
Prop_DeviceBatteryPercentage_Float = 1012,
Prop_StatusDisplayTransform_Matrix34 = 1013,
Prop_Firmware_UpdateAvailable_Bool = 1014,
Prop_Firmware_ManualUpdate_Bool = 1015,
Prop_Firmware_ManualUpdateURL_String = 1016,
Prop_HardwareRevision_Uint64 = 1017,
Prop_FirmwareVersion_Uint64 = 1018,
Prop_FPGAVersion_Uint64 = 1019,
Prop_VRCVersion_Uint64 = 1020,
Prop_RadioVersion_Uint64 = 1021,
Prop_DongleVersion_Uint64 = 1022,
Prop_BlockServerShutdown_Bool = 1023,
Prop_CanUnifyCoordinateSystemWithHmd_Bool = 1024,
Prop_ContainsProximitySensor_Bool = 1025,
Prop_DeviceProvidesBatteryStatus_Bool = 1026,
Prop_DeviceCanPowerOff_Bool = 1027,
Prop_Firmware_ProgrammingTarget_String = 1028,
Prop_DeviceClass_Int32 = 1029,
Prop_HasCamera_Bool = 1030,
Prop_DriverVersion_String = 1031,
Prop_Firmware_ForceUpdateRequired_Bool = 1032,
Prop_ViveSystemButtonFixRequired_Bool = 1033,
Prop_ParentDriver_Uint64 = 1034,
Prop_ResourceRoot_String = 1035,
Prop_RegisteredDeviceType_String = 1036,
Prop_InputProfilePath_String = 1037,
Prop_NeverTracked_Bool = 1038,
Prop_NumCameras_Int32 = 1039,
Prop_CameraFrameLayout_Int32 = 1040,
Prop_CameraStreamFormat_Int32 = 1041,
Prop_AdditionalDeviceSettingsPath_String = 1042,
Prop_Identifiable_Bool = 1043,
Prop_BootloaderVersion_Uint64 = 1044,
Prop_AdditionalSystemReportData_String = 1045,
Prop_CompositeFirmwareVersion_String = 1046,
Prop_Firmware_RemindUpdate_Bool = 1047,
Prop_PeripheralApplicationVersion_Uint64 = 1048,
Prop_ManufacturerSerialNumber_String = 1049,
Prop_ComputedSerialNumber_String = 1050,
Prop_EstimatedDeviceFirstUseTime_Int32 = 1051,
Prop_ReportsTimeSinceVSync_Bool = 2000,
Prop_SecondsFromVsyncToPhotons_Float = 2001,
Prop_DisplayFrequency_Float = 2002,
Prop_UserIpdMeters_Float = 2003,
Prop_CurrentUniverseId_Uint64 = 2004,
Prop_PreviousUniverseId_Uint64 = 2005,
Prop_DisplayFirmwareVersion_Uint64 = 2006,
Prop_IsOnDesktop_Bool = 2007,
Prop_DisplayMCType_Int32 = 2008,
Prop_DisplayMCOffset_Float = 2009,
Prop_DisplayMCScale_Float = 2010,
Prop_EdidVendorID_Int32 = 2011,
Prop_DisplayMCImageLeft_String = 2012,
Prop_DisplayMCImageRight_String = 2013,
Prop_DisplayGCBlackClamp_Float = 2014,
Prop_EdidProductID_Int32 = 2015,
Prop_CameraToHeadTransform_Matrix34 = 2016,
Prop_DisplayGCType_Int32 = 2017,
Prop_DisplayGCOffset_Float = 2018,
Prop_DisplayGCScale_Float = 2019,
Prop_DisplayGCPrescale_Float = 2020,
Prop_DisplayGCImage_String = 2021,
Prop_LensCenterLeftU_Float = 2022,
Prop_LensCenterLeftV_Float = 2023,
Prop_LensCenterRightU_Float = 2024,
Prop_LensCenterRightV_Float = 2025,
Prop_UserHeadToEyeDepthMeters_Float = 2026,
Prop_CameraFirmwareVersion_Uint64 = 2027,
Prop_CameraFirmwareDescription_String = 2028,
Prop_DisplayFPGAVersion_Uint64 = 2029,
Prop_DisplayBootloaderVersion_Uint64 = 2030,
Prop_DisplayHardwareVersion_Uint64 = 2031,
Prop_AudioFirmwareVersion_Uint64 = 2032,
Prop_CameraCompatibilityMode_Int32 = 2033,
Prop_ScreenshotHorizontalFieldOfViewDegrees_Float = 2034,
Prop_ScreenshotVerticalFieldOfViewDegrees_Float = 2035,
Prop_DisplaySuppressed_Bool = 2036,
Prop_DisplayAllowNightMode_Bool = 2037,
Prop_DisplayMCImageWidth_Int32 = 2038,
Prop_DisplayMCImageHeight_Int32 = 2039,
Prop_DisplayMCImageNumChannels_Int32 = 2040,
Prop_DisplayMCImageData_Binary = 2041,
Prop_SecondsFromPhotonsToVblank_Float = 2042,
Prop_DriverDirectModeSendsVsyncEvents_Bool = 2043,
Prop_DisplayDebugMode_Bool = 2044,
Prop_GraphicsAdapterLuid_Uint64 = 2045,
Prop_DriverProvidedChaperonePath_String = 2048,
Prop_ExpectedTrackingReferenceCount_Int32 = 2049,
Prop_ExpectedControllerCount_Int32 = 2050,
Prop_NamedIconPathControllerLeftDeviceOff_String = 2051,
Prop_NamedIconPathControllerRightDeviceOff_String = 2052,
Prop_NamedIconPathTrackingReferenceDeviceOff_String = 2053,
Prop_DoNotApplyPrediction_Bool = 2054,
Prop_CameraToHeadTransforms_Matrix34_Array = 2055,
Prop_DistortionMeshResolution_Int32 = 2056,
Prop_DriverIsDrawingControllers_Bool = 2057,
Prop_DriverRequestsApplicationPause_Bool = 2058,
Prop_DriverRequestsReducedRendering_Bool = 2059,
Prop_MinimumIpdStepMeters_Float = 2060,
Prop_AudioBridgeFirmwareVersion_Uint64 = 2061,
Prop_ImageBridgeFirmwareVersion_Uint64 = 2062,
Prop_ImuToHeadTransform_Matrix34 = 2063,
Prop_ImuFactoryGyroBias_Vector3 = 2064,
Prop_ImuFactoryGyroScale_Vector3 = 2065,
Prop_ImuFactoryAccelerometerBias_Vector3 = 2066,
Prop_ImuFactoryAccelerometerScale_Vector3 = 2067,
Prop_ConfigurationIncludesLighthouse20Features_Bool = 2069,
Prop_AdditionalRadioFeatures_Uint64 = 2070,
Prop_CameraWhiteBalance_Vector4_Array = 2071,
Prop_CameraDistortionFunction_Int32_Array = 2072,
Prop_CameraDistortionCoefficients_Float_Array = 2073,
Prop_ExpectedControllerType_String = 2074,
Prop_HmdTrackingStyle_Int32 = 2075,
Prop_DriverProvidedChaperoneVisibility_Bool = 2076,
Prop_HmdColumnCorrectionSettingPrefix_String = 2077,
Prop_CameraSupportsCompatibilityModes_Bool = 2078,
Prop_DisplayAvailableFrameRates_Float_Array = 2080,
Prop_DisplaySupportsMultipleFramerates_Bool = 2081,
Prop_DisplayColorMultLeft_Vector3 = 2082,
Prop_DisplayColorMultRight_Vector3 = 2083,
Prop_DisplaySupportsRuntimeFramerateChange_Bool = 2084,
Prop_DisplaySupportsAnalogGain_Bool = 2085,
Prop_DisplayMinAnalogGain_Float = 2086,
Prop_DisplayMaxAnalogGain_Float = 2087,
Prop_DashboardScale_Float = 2091,
Prop_IpdUIRangeMinMeters_Float = 2100,
Prop_IpdUIRangeMaxMeters_Float = 2101,
Prop_DriverRequestedMuraCorrectionMode_Int32 = 2200,
Prop_DriverRequestedMuraFeather_InnerLeft_Int32 = 2201,
Prop_DriverRequestedMuraFeather_InnerRight_Int32 = 2202,
Prop_DriverRequestedMuraFeather_InnerTop_Int32 = 2203,
Prop_DriverRequestedMuraFeather_InnerBottom_Int32 = 2204,
Prop_DriverRequestedMuraFeather_OuterLeft_Int32 = 2205,
Prop_DriverRequestedMuraFeather_OuterRight_Int32 = 2206,
Prop_DriverRequestedMuraFeather_OuterTop_Int32 = 2207,
Prop_DriverRequestedMuraFeather_OuterBottom_Int32 = 2208,
Prop_Audio_DefaultPlaybackDeviceId_String = 2300,
Prop_Audio_DefaultRecordingDeviceId_String = 2301,
Prop_Audio_DefaultPlaybackDeviceVolume_Float = 2302,
Prop_AttachedDeviceId_String = 3000,
Prop_SupportedButtons_Uint64 = 3001,
Prop_Axis0Type_Int32 = 3002,
Prop_Axis1Type_Int32 = 3003,
Prop_Axis2Type_Int32 = 3004,
Prop_Axis3Type_Int32 = 3005,
Prop_Axis4Type_Int32 = 3006,
Prop_ControllerRoleHint_Int32 = 3007,
Prop_FieldOfViewLeftDegrees_Float = 4000,
Prop_FieldOfViewRightDegrees_Float = 4001,
Prop_FieldOfViewTopDegrees_Float = 4002,
Prop_FieldOfViewBottomDegrees_Float = 4003,
Prop_TrackingRangeMinimumMeters_Float = 4004,
Prop_TrackingRangeMaximumMeters_Float = 4005,
Prop_ModeLabel_String = 4006,
Prop_CanWirelessIdentify_Bool = 4007,
Prop_Nonce_Int32 = 4008,
Prop_IconPathName_String = 5000,
Prop_NamedIconPathDeviceOff_String = 5001,
Prop_NamedIconPathDeviceSearching_String = 5002,
Prop_NamedIconPathDeviceSearchingAlert_String = 5003,
Prop_NamedIconPathDeviceReady_String = 5004,
Prop_NamedIconPathDeviceReadyAlert_String = 5005,
Prop_NamedIconPathDeviceNotReady_String = 5006,
Prop_NamedIconPathDeviceStandby_String = 5007,
Prop_NamedIconPathDeviceAlertLow_String = 5008,
Prop_NamedIconPathDeviceStandbyAlert_String = 5009,
Prop_DisplayHiddenArea_Binary_Start = 5100,
Prop_DisplayHiddenArea_Binary_End = 5150,
Prop_ParentContainer = 5151,
Prop_OverrideContainer_Uint64 = 5152,
Prop_UserConfigPath_String = 6000,
Prop_InstallPath_String = 6001,
Prop_HasDisplayComponent_Bool = 6002,
Prop_HasControllerComponent_Bool = 6003,
Prop_HasCameraComponent_Bool = 6004,
Prop_HasDriverDirectModeComponent_Bool = 6005,
Prop_HasVirtualDisplayComponent_Bool = 6006,
Prop_HasSpatialAnchorsSupport_Bool = 6007,
Prop_ControllerType_String = 7000,
Prop_ControllerHandSelectionPriority_Int32 = 7002,
Prop_VendorSpecific_Reserved_Start = 10000,
Prop_VendorSpecific_Reserved_End = 10999,
Prop_TrackedDeviceProperty_Max = 1000000,
}
public enum ETrackedPropertyError
{
TrackedProp_Success = 0,
TrackedProp_WrongDataType = 1,
TrackedProp_WrongDeviceClass = 2,
TrackedProp_BufferTooSmall = 3,
TrackedProp_UnknownProperty = 4,
TrackedProp_InvalidDevice = 5,
TrackedProp_CouldNotContactServer = 6,
TrackedProp_ValueNotProvidedByDevice = 7,
TrackedProp_StringExceedsMaximumLength = 8,
TrackedProp_NotYetAvailable = 9,
TrackedProp_PermissionDenied = 10,
TrackedProp_InvalidOperation = 11,
TrackedProp_CannotWriteToWildcards = 12,
TrackedProp_IPCReadFailure = 13,
TrackedProp_OutOfMemory = 14,
TrackedProp_InvalidContainer = 15,
}
public enum EHmdTrackingStyle
{
Unknown = 0,
Lighthouse = 1,
OutsideInCameras = 2,
InsideOutCameras = 3,
}
public enum EVRSubmitFlags
{
Submit_Default = 0,
Submit_LensDistortionAlreadyApplied = 1,
Submit_GlRenderBuffer = 2,
Submit_Reserved = 4,
Submit_TextureWithPose = 8,
Submit_TextureWithDepth = 16,
Submit_FrameDiscontinuty = 32,
Submit_VulkanTextureWithArrayData = 64,
}
public enum EVRState
{
Undefined = -1,
Off = 0,
Searching = 1,
Searching_Alert = 2,
Ready = 3,
Ready_Alert = 4,
NotReady = 5,
Standby = 6,
Ready_Alert_Low = 7,
}
public enum EVREventType
{
VREvent_None = 0,
VREvent_TrackedDeviceActivated = 100,
VREvent_TrackedDeviceDeactivated = 101,
VREvent_TrackedDeviceUpdated = 102,
VREvent_TrackedDeviceUserInteractionStarted = 103,
VREvent_TrackedDeviceUserInteractionEnded = 104,
VREvent_IpdChanged = 105,
VREvent_EnterStandbyMode = 106,
VREvent_LeaveStandbyMode = 107,
VREvent_TrackedDeviceRoleChanged = 108,
VREvent_WatchdogWakeUpRequested = 109,
VREvent_LensDistortionChanged = 110,
VREvent_PropertyChanged = 111,
VREvent_WirelessDisconnect = 112,
VREvent_WirelessReconnect = 113,
VREvent_ButtonPress = 200,
VREvent_ButtonUnpress = 201,
VREvent_ButtonTouch = 202,
VREvent_ButtonUntouch = 203,
VREvent_Modal_Cancel = 257,
VREvent_MouseMove = 300,
VREvent_MouseButtonDown = 301,
VREvent_MouseButtonUp = 302,
VREvent_FocusEnter = 303,
VREvent_FocusLeave = 304,
VREvent_ScrollDiscrete = 305,
VREvent_TouchPadMove = 306,
VREvent_OverlayFocusChanged = 307,
VREvent_ReloadOverlays = 308,
VREvent_ScrollSmooth = 309,
VREvent_LockMousePosition = 310,
VREvent_UnlockMousePosition = 311,
VREvent_InputFocusCaptured = 400,
VREvent_InputFocusReleased = 401,
VREvent_SceneApplicationChanged = 404,
VREvent_SceneFocusChanged = 405,
VREvent_InputFocusChanged = 406,
VREvent_SceneApplicationUsingWrongGraphicsAdapter = 408,
VREvent_ActionBindingReloaded = 409,
VREvent_HideRenderModels = 410,
VREvent_ShowRenderModels = 411,
VREvent_SceneApplicationStateChanged = 412,
VREvent_ConsoleOpened = 420,
VREvent_ConsoleClosed = 421,
VREvent_OverlayShown = 500,
VREvent_OverlayHidden = 501,
VREvent_DashboardActivated = 502,
VREvent_DashboardDeactivated = 503,
VREvent_DashboardRequested = 505,
VREvent_ResetDashboard = 506,
VREvent_ImageLoaded = 508,
VREvent_ShowKeyboard = 509,
VREvent_HideKeyboard = 510,
VREvent_OverlayGamepadFocusGained = 511,
VREvent_OverlayGamepadFocusLost = 512,
VREvent_OverlaySharedTextureChanged = 513,
VREvent_ScreenshotTriggered = 516,
VREvent_ImageFailed = 517,
VREvent_DashboardOverlayCreated = 518,
VREvent_SwitchGamepadFocus = 519,
VREvent_RequestScreenshot = 520,
VREvent_ScreenshotTaken = 521,
VREvent_ScreenshotFailed = 522,
VREvent_SubmitScreenshotToDashboard = 523,
VREvent_ScreenshotProgressToDashboard = 524,
VREvent_PrimaryDashboardDeviceChanged = 525,
VREvent_RoomViewShown = 526,
VREvent_RoomViewHidden = 527,
VREvent_ShowUI = 528,
VREvent_ShowDevTools = 529,
VREvent_Notification_Shown = 600,
VREvent_Notification_Hidden = 601,
VREvent_Notification_BeginInteraction = 602,
VREvent_Notification_Destroyed = 603,
VREvent_Quit = 700,
VREvent_ProcessQuit = 701,
VREvent_QuitAcknowledged = 703,
VREvent_DriverRequestedQuit = 704,
VREvent_RestartRequested = 705,
VREvent_ChaperoneDataHasChanged = 800,
VREvent_ChaperoneUniverseHasChanged = 801,
VREvent_ChaperoneTempDataHasChanged = 802,
VREvent_ChaperoneSettingsHaveChanged = 803,
VREvent_SeatedZeroPoseReset = 804,
VREvent_ChaperoneFlushCache = 805,
VREvent_ChaperoneRoomSetupStarting = 806,
VREvent_ChaperoneRoomSetupFinished = 807,
VREvent_AudioSettingsHaveChanged = 820,
VREvent_BackgroundSettingHasChanged = 850,
VREvent_CameraSettingsHaveChanged = 851,
VREvent_ReprojectionSettingHasChanged = 852,
VREvent_ModelSkinSettingsHaveChanged = 853,
VREvent_EnvironmentSettingsHaveChanged = 854,
VREvent_PowerSettingsHaveChanged = 855,
VREvent_EnableHomeAppSettingsHaveChanged = 856,
VREvent_SteamVRSectionSettingChanged = 857,
VREvent_LighthouseSectionSettingChanged = 858,
VREvent_NullSectionSettingChanged = 859,
VREvent_UserInterfaceSectionSettingChanged = 860,
VREvent_NotificationsSectionSettingChanged = 861,
VREvent_KeyboardSectionSettingChanged = 862,
VREvent_PerfSectionSettingChanged = 863,
VREvent_DashboardSectionSettingChanged = 864,
VREvent_WebInterfaceSectionSettingChanged = 865,
VREvent_TrackersSectionSettingChanged = 866,
VREvent_LastKnownSectionSettingChanged = 867,
VREvent_DismissedWarningsSectionSettingChanged = 868,
VREvent_GpuSpeedSectionSettingChanged = 869,
VREvent_WindowsMRSectionSettingChanged = 870,
VREvent_OtherSectionSettingChanged = 871,
VREvent_StatusUpdate = 900,
VREvent_WebInterface_InstallDriverCompleted = 950,
VREvent_MCImageUpdated = 1000,
VREvent_FirmwareUpdateStarted = 1100,
VREvent_FirmwareUpdateFinished = 1101,
VREvent_KeyboardClosed = 1200,
VREvent_KeyboardCharInput = 1201,
VREvent_KeyboardDone = 1202,
VREvent_ApplicationListUpdated = 1303,
VREvent_ApplicationMimeTypeLoad = 1304,
VREvent_ProcessConnected = 1306,
VREvent_ProcessDisconnected = 1307,
VREvent_Compositor_ChaperoneBoundsShown = 1410,
VREvent_Compositor_ChaperoneBoundsHidden = 1411,
VREvent_Compositor_DisplayDisconnected = 1412,
VREvent_Compositor_DisplayReconnected = 1413,
VREvent_Compositor_HDCPError = 1414,
VREvent_Compositor_ApplicationNotResponding = 1415,
VREvent_Compositor_ApplicationResumed = 1416,
VREvent_Compositor_OutOfVideoMemory = 1417,
VREvent_Compositor_DisplayModeNotSupported = 1418,
VREvent_Compositor_StageOverrideReady = 1419,
VREvent_TrackedCamera_StartVideoStream = 1500,
VREvent_TrackedCamera_StopVideoStream = 1501,
VREvent_TrackedCamera_PauseVideoStream = 1502,
VREvent_TrackedCamera_ResumeVideoStream = 1503,
VREvent_TrackedCamera_EditingSurface = 1550,
VREvent_PerformanceTest_EnableCapture = 1600,
VREvent_PerformanceTest_DisableCapture = 1601,
VREvent_PerformanceTest_FidelityLevel = 1602,
VREvent_MessageOverlay_Closed = 1650,
VREvent_MessageOverlayCloseRequested = 1651,
VREvent_Input_HapticVibration = 1700,
VREvent_Input_BindingLoadFailed = 1701,
VREvent_Input_BindingLoadSuccessful = 1702,
VREvent_Input_ActionManifestReloaded = 1703,
VREvent_Input_ActionManifestLoadFailed = 1704,
VREvent_Input_ProgressUpdate = 1705,
VREvent_Input_TrackerActivated = 1706,
VREvent_Input_BindingsUpdated = 1707,
VREvent_Input_BindingSubscriptionChanged = 1708,
VREvent_SpatialAnchors_PoseUpdated = 1800,
VREvent_SpatialAnchors_DescriptorUpdated = 1801,
VREvent_SpatialAnchors_RequestPoseUpdate = 1802,
VREvent_SpatialAnchors_RequestDescriptorUpdate = 1803,
VREvent_SystemReport_Started = 1900,
VREvent_Monitor_ShowHeadsetView = 2000,
VREvent_Monitor_HideHeadsetView = 2001,
VREvent_VendorSpecific_Reserved_Start = 10000,
VREvent_VendorSpecific_Reserved_End = 19999,
}
public enum EDeviceActivityLevel
{
k_EDeviceActivityLevel_Unknown = -1,
k_EDeviceActivityLevel_Idle = 0,
k_EDeviceActivityLevel_UserInteraction = 1,
k_EDeviceActivityLevel_UserInteraction_Timeout = 2,
k_EDeviceActivityLevel_Standby = 3,
k_EDeviceActivityLevel_Idle_Timeout = 4,
}
public enum EVRButtonId
{
k_EButton_System = 0,
k_EButton_ApplicationMenu = 1,
k_EButton_Grip = 2,
k_EButton_DPad_Left = 3,
k_EButton_DPad_Up = 4,
k_EButton_DPad_Right = 5,
k_EButton_DPad_Down = 6,
k_EButton_A = 7,
k_EButton_ProximitySensor = 31,
k_EButton_Axis0 = 32,
k_EButton_Axis1 = 33,
k_EButton_Axis2 = 34,
k_EButton_Axis3 = 35,
k_EButton_Axis4 = 36,
k_EButton_SteamVR_Touchpad = 32,
k_EButton_SteamVR_Trigger = 33,
k_EButton_Dashboard_Back = 2,
k_EButton_IndexController_A = 2,
k_EButton_IndexController_B = 1,
k_EButton_IndexController_JoyStick = 35,
k_EButton_Max = 64,
}
public enum EVRMouseButton
{
Left = 1,
Right = 2,
Middle = 4,
}
public enum EShowUIType
{
ShowUI_ControllerBinding = 0,
ShowUI_ManageTrackers = 1,
ShowUI_Pairing = 3,
ShowUI_Settings = 4,
ShowUI_DebugCommands = 5,
ShowUI_FullControllerBinding = 6,
ShowUI_ManageDrivers = 7,
}
public enum EHDCPError
{
None = 0,
LinkLost = 1,
Tampered = 2,
DeviceRevoked = 3,
Unknown = 4,
}
public enum EVRComponentProperty
{
IsStatic = 1,
IsVisible = 2,
IsTouched = 4,
IsPressed = 8,
IsScrolled = 16,
IsHighlighted = 32,
}
public enum EVRInputError
{
None = 0,
NameNotFound = 1,
WrongType = 2,
InvalidHandle = 3,
InvalidParam = 4,
NoSteam = 5,
MaxCapacityReached = 6,
IPCError = 7,
NoActiveActionSet = 8,
InvalidDevice = 9,
InvalidSkeleton = 10,
InvalidBoneCount = 11,
InvalidCompressedData = 12,
NoData = 13,
BufferTooSmall = 14,
MismatchedActionManifest = 15,
MissingSkeletonData = 16,
InvalidBoneIndex = 17,
InvalidPriority = 18,
PermissionDenied = 19,
InvalidRenderModel = 20,
}
public enum EVRSpatialAnchorError
{
Success = 0,
Internal = 1,
UnknownHandle = 2,
ArrayTooSmall = 3,
InvalidDescriptorChar = 4,
NotYetAvailable = 5,
NotAvailableInThisUniverse = 6,
PermanentlyUnavailable = 7,
WrongDriver = 8,
DescriptorTooLong = 9,
Unknown = 10,
NoRoomCalibration = 11,
InvalidArgument = 12,
UnknownDriver = 13,
}
public enum EHiddenAreaMeshType
{
k_eHiddenAreaMesh_Standard = 0,
k_eHiddenAreaMesh_Inverse = 1,
k_eHiddenAreaMesh_LineLoop = 2,
k_eHiddenAreaMesh_Max = 3,
}
public enum EVRControllerAxisType
{
k_eControllerAxis_None = 0,
k_eControllerAxis_TrackPad = 1,
k_eControllerAxis_Joystick = 2,
k_eControllerAxis_Trigger = 3,
}
public enum EVRControllerEventOutputType
{
ControllerEventOutput_OSEvents = 0,
ControllerEventOutput_VREvents = 1,
}
public enum ECollisionBoundsStyle
{
COLLISION_BOUNDS_STYLE_BEGINNER = 0,
COLLISION_BOUNDS_STYLE_INTERMEDIATE = 1,
COLLISION_BOUNDS_STYLE_SQUARES = 2,
COLLISION_BOUNDS_STYLE_ADVANCED = 3,
COLLISION_BOUNDS_STYLE_NONE = 4,
COLLISION_BOUNDS_STYLE_COUNT = 5,
}
public enum EVROverlayError
{
None = 0,
UnknownOverlay = 10,
InvalidHandle = 11,
PermissionDenied = 12,
OverlayLimitExceeded = 13,
WrongVisibilityType = 14,
KeyTooLong = 15,
NameTooLong = 16,
KeyInUse = 17,
WrongTransformType = 18,
InvalidTrackedDevice = 19,
InvalidParameter = 20,
ThumbnailCantBeDestroyed = 21,
ArrayTooSmall = 22,
RequestFailed = 23,
InvalidTexture = 24,
UnableToLoadFile = 25,
KeyboardAlreadyInUse = 26,
NoNeighbor = 27,
TooManyMaskPrimitives = 29,
BadMaskPrimitive = 30,
TextureAlreadyLocked = 31,
TextureLockCapacityReached = 32,
TextureNotLocked = 33,
}
public enum EVRApplicationType
{
VRApplication_Other = 0,
VRApplication_Scene = 1,
VRApplication_Overlay = 2,
VRApplication_Background = 3,
VRApplication_Utility = 4,
VRApplication_VRMonitor = 5,
VRApplication_SteamWatchdog = 6,
VRApplication_Bootstrapper = 7,
VRApplication_WebHelper = 8,
VRApplication_Max = 9,
}
public enum EVRFirmwareError
{
None = 0,
Success = 1,
Fail = 2,
}
public enum EVRNotificationError
{
OK = 0,
InvalidNotificationId = 100,
NotificationQueueFull = 101,
InvalidOverlayHandle = 102,
SystemWithUserValueAlreadyExists = 103,
}
public enum EVRSkeletalMotionRange
{
WithController = 0,
WithoutController = 1,
}
public enum EVRSkeletalTrackingLevel
{
VRSkeletalTracking_Estimated = 0,
VRSkeletalTracking_Partial = 1,
VRSkeletalTracking_Full = 2,
Count = 3,
Max = 2,
}
public enum EVRInitError
{
None = 0,
Unknown = 1,
Init_InstallationNotFound = 100,
Init_InstallationCorrupt = 101,
Init_VRClientDLLNotFound = 102,
Init_FileNotFound = 103,
Init_FactoryNotFound = 104,
Init_InterfaceNotFound = 105,
Init_InvalidInterface = 106,
Init_UserConfigDirectoryInvalid = 107,
Init_HmdNotFound = 108,
Init_NotInitialized = 109,
Init_PathRegistryNotFound = 110,
Init_NoConfigPath = 111,
Init_NoLogPath = 112,
Init_PathRegistryNotWritable = 113,
Init_AppInfoInitFailed = 114,
Init_Retry = 115,
Init_InitCanceledByUser = 116,
Init_AnotherAppLaunching = 117,
Init_SettingsInitFailed = 118,
Init_ShuttingDown = 119,
Init_TooManyObjects = 120,
Init_NoServerForBackgroundApp = 121,
Init_NotSupportedWithCompositor = 122,
Init_NotAvailableToUtilityApps = 123,
Init_Internal = 124,
Init_HmdDriverIdIsNone = 125,
Init_HmdNotFoundPresenceFailed = 126,
Init_VRMonitorNotFound = 127,
Init_VRMonitorStartupFailed = 128,
Init_LowPowerWatchdogNotSupported = 129,
Init_InvalidApplicationType = 130,
Init_NotAvailableToWatchdogApps = 131,
Init_WatchdogDisabledInSettings = 132,
Init_VRDashboardNotFound = 133,
Init_VRDashboardStartupFailed = 134,
Init_VRHomeNotFound = 135,
Init_VRHomeStartupFailed = 136,
Init_RebootingBusy = 137,
Init_FirmwareUpdateBusy = 138,
Init_FirmwareRecoveryBusy = 139,
Init_USBServiceBusy = 140,
Init_VRWebHelperStartupFailed = 141,
Init_TrackerManagerInitFailed = 142,
Init_AlreadyRunning = 143,
Init_FailedForVrMonitor = 144,
Init_PropertyManagerInitFailed = 145,
Init_WebServerFailed = 146,
Driver_Failed = 200,
Driver_Unknown = 201,
Driver_HmdUnknown = 202,
Driver_NotLoaded = 203,
Driver_RuntimeOutOfDate = 204,
Driver_HmdInUse = 205,
Driver_NotCalibrated = 206,
Driver_CalibrationInvalid = 207,
Driver_HmdDisplayNotFound = 208,
Driver_TrackedDeviceInterfaceUnknown = 209,
Driver_HmdDriverIdOutOfBounds = 211,
Driver_HmdDisplayMirrored = 212,
Driver_HmdDisplayNotFoundLaptop = 213,
IPC_ServerInitFailed = 300,
IPC_ConnectFailed = 301,
IPC_SharedStateInitFailed = 302,
IPC_CompositorInitFailed = 303,
IPC_MutexInitFailed = 304,
IPC_Failed = 305,
IPC_CompositorConnectFailed = 306,
IPC_CompositorInvalidConnectResponse = 307,
IPC_ConnectFailedAfterMultipleAttempts = 308,
IPC_ConnectFailedAfterTargetExited = 309,
IPC_NamespaceUnavailable = 310,
Compositor_Failed = 400,
Compositor_D3D11HardwareRequired = 401,
Compositor_FirmwareRequiresUpdate = 402,
Compositor_OverlayInitFailed = 403,
Compositor_ScreenshotsInitFailed = 404,
Compositor_UnableToCreateDevice = 405,
Compositor_SharedStateIsNull = 406,
Compositor_NotificationManagerIsNull = 407,
Compositor_ResourceManagerClientIsNull = 408,
Compositor_MessageOverlaySharedStateInitFailure = 409,
Compositor_PropertiesInterfaceIsNull = 410,
Compositor_CreateFullscreenWindowFailed = 411,
Compositor_SettingsInterfaceIsNull = 412,
Compositor_FailedToShowWindow = 413,
Compositor_DistortInterfaceIsNull = 414,
Compositor_DisplayFrequencyFailure = 415,
Compositor_RendererInitializationFailed = 416,
Compositor_DXGIFactoryInterfaceIsNull = 417,
Compositor_DXGIFactoryCreateFailed = 418,
Compositor_DXGIFactoryQueryFailed = 419,
Compositor_InvalidAdapterDesktop = 420,
Compositor_InvalidHmdAttachment = 421,
Compositor_InvalidOutputDesktop = 422,
Compositor_InvalidDeviceProvided = 423,
Compositor_D3D11RendererInitializationFailed = 424,
Compositor_FailedToFindDisplayMode = 425,
Compositor_FailedToCreateSwapChain = 426,
Compositor_FailedToGetBackBuffer = 427,
Compositor_FailedToCreateRenderTarget = 428,
Compositor_FailedToCreateDXGI2SwapChain = 429,
Compositor_FailedtoGetDXGI2BackBuffer = 430,
Compositor_FailedToCreateDXGI2RenderTarget = 431,
Compositor_FailedToGetDXGIDeviceInterface = 432,
Compositor_SelectDisplayMode = 433,
Compositor_FailedToCreateNvAPIRenderTargets = 434,
Compositor_NvAPISetDisplayMode = 435,
Compositor_FailedToCreateDirectModeDisplay = 436,
Compositor_InvalidHmdPropertyContainer = 437,
Compositor_UpdateDisplayFrequency = 438,
Compositor_CreateRasterizerState = 439,
Compositor_CreateWireframeRasterizerState = 440,
Compositor_CreateSamplerState = 441,
Compositor_CreateClampToBorderSamplerState = 442,
Compositor_CreateAnisoSamplerState = 443,
Compositor_CreateOverlaySamplerState = 444,
Compositor_CreatePanoramaSamplerState = 445,
Compositor_CreateFontSamplerState = 446,
Compositor_CreateNoBlendState = 447,
Compositor_CreateBlendState = 448,
Compositor_CreateAlphaBlendState = 449,
Compositor_CreateBlendStateMaskR = 450,
Compositor_CreateBlendStateMaskG = 451,
Compositor_CreateBlendStateMaskB = 452,
Compositor_CreateDepthStencilState = 453,
Compositor_CreateDepthStencilStateNoWrite = 454,
Compositor_CreateDepthStencilStateNoDepth = 455,
Compositor_CreateFlushTexture = 456,
Compositor_CreateDistortionSurfaces = 457,
Compositor_CreateConstantBuffer = 458,
Compositor_CreateHmdPoseConstantBuffer = 459,
Compositor_CreateHmdPoseStagingConstantBuffer = 460,
Compositor_CreateSharedFrameInfoConstantBuffer = 461,
Compositor_CreateOverlayConstantBuffer = 462,
Compositor_CreateSceneTextureIndexConstantBuffer = 463,
Compositor_CreateReadableSceneTextureIndexConstantBuffer = 464,
Compositor_CreateLayerGraphicsTextureIndexConstantBuffer = 465,
Compositor_CreateLayerComputeTextureIndexConstantBuffer = 466,
Compositor_CreateLayerComputeSceneTextureIndexConstantBuffer = 467,
Compositor_CreateComputeHmdPoseConstantBuffer = 468,
Compositor_CreateGeomConstantBuffer = 469,
Compositor_CreatePanelMaskConstantBuffer = 470,
Compositor_CreatePixelSimUBO = 471,
Compositor_CreateMSAARenderTextures = 472,
Compositor_CreateResolveRenderTextures = 473,
Compositor_CreateComputeResolveRenderTextures = 474,
Compositor_CreateDriverDirectModeResolveTextures = 475,
Compositor_OpenDriverDirectModeResolveTextures = 476,
Compositor_CreateFallbackSyncTexture = 477,
Compositor_ShareFallbackSyncTexture = 478,
Compositor_CreateOverlayIndexBuffer = 479,
Compositor_CreateOverlayVertexBuffer = 480,
Compositor_CreateTextVertexBuffer = 481,
Compositor_CreateTextIndexBuffer = 482,
Compositor_CreateMirrorTextures = 483,
Compositor_CreateLastFrameRenderTexture = 484,
Compositor_CreateMirrorOverlay = 485,
Compositor_FailedToCreateVirtualDisplayBackbuffer = 486,
Compositor_DisplayModeNotSupported = 487,
Compositor_CreateOverlayInvalidCall = 488,
Compositor_CreateOverlayAlreadyInitialized = 489,
Compositor_FailedToCreateMailbox = 490,
VendorSpecific_UnableToConnectToOculusRuntime = 1000,
VendorSpecific_WindowsNotInDevMode = 1001,
VendorSpecific_HmdFound_CantOpenDevice = 1101,
VendorSpecific_HmdFound_UnableToRequestConfigStart = 1102,
VendorSpecific_HmdFound_NoStoredConfig = 1103,
VendorSpecific_HmdFound_ConfigTooBig = 1104,
VendorSpecific_HmdFound_ConfigTooSmall = 1105,
VendorSpecific_HmdFound_UnableToInitZLib = 1106,
VendorSpecific_HmdFound_CantReadFirmwareVersion = 1107,
VendorSpecific_HmdFound_UnableToSendUserDataStart = 1108,
VendorSpecific_HmdFound_UnableToGetUserDataStart = 1109,
VendorSpecific_HmdFound_UnableToGetUserDataNext = 1110,
VendorSpecific_HmdFound_UserDataAddressRange = 1111,
VendorSpecific_HmdFound_UserDataError = 1112,
VendorSpecific_HmdFound_ConfigFailedSanityCheck = 1113,
VendorSpecific_OculusRuntimeBadInstall = 1114,
Steam_SteamInstallationNotFound = 2000,
LastError = 2001,
}
public enum EVRScreenshotType
{
None = 0,
Mono = 1,
Stereo = 2,
Cubemap = 3,
MonoPanorama = 4,
StereoPanorama = 5,
}
public enum EVRScreenshotPropertyFilenames
{
Preview = 0,
VR = 1,
}
public enum EVRTrackedCameraError
{
None = 0,
OperationFailed = 100,
InvalidHandle = 101,
InvalidFrameHeaderVersion = 102,
OutOfHandles = 103,
IPCFailure = 104,
NotSupportedForThisDevice = 105,
SharedMemoryFailure = 106,
FrameBufferingFailure = 107,
StreamSetupFailure = 108,
InvalidGLTextureId = 109,
InvalidSharedTextureHandle = 110,
FailedToGetGLTextureId = 111,
SharedTextureFailure = 112,
NoFrameAvailable = 113,
InvalidArgument = 114,
InvalidFrameBufferSize = 115,
}
public enum EVRTrackedCameraFrameLayout
{
Mono = 1,
Stereo = 2,
VerticalLayout = 16,
HorizontalLayout = 32,
}
public enum EVRTrackedCameraFrameType
{
Distorted = 0,
Undistorted = 1,
MaximumUndistorted = 2,
MAX_CAMERA_FRAME_TYPES = 3,
}
public enum EVRDistortionFunctionType
{
None = 0,
FTheta = 1,
Extended_FTheta = 2,
MAX_DISTORTION_FUNCTION_TYPES = 3,
}
public enum EVSync
{
None = 0,
WaitRender = 1,
NoWaitRender = 2,
}
public enum EVRMuraCorrectionMode
{
Default = 0,
NoCorrection = 1,
}
public enum Imu_OffScaleFlags
{
OffScale_AccelX = 1,
OffScale_AccelY = 2,
OffScale_AccelZ = 4,
OffScale_GyroX = 8,
OffScale_GyroY = 16,
OffScale_GyroZ = 32,
}
public enum EVRApplicationError
{
None = 0,
AppKeyAlreadyExists = 100,
NoManifest = 101,
NoApplication = 102,
InvalidIndex = 103,
UnknownApplication = 104,
IPCFailed = 105,
ApplicationAlreadyRunning = 106,
InvalidManifest = 107,
InvalidApplication = 108,
LaunchFailed = 109,
ApplicationAlreadyStarting = 110,
LaunchInProgress = 111,
OldApplicationQuitting = 112,
TransitionAborted = 113,
IsTemplate = 114,
SteamVRIsExiting = 115,
BufferTooSmall = 200,
PropertyNotSet = 201,
UnknownProperty = 202,
InvalidParameter = 203,
}
public enum EVRApplicationProperty
{
Name_String = 0,
LaunchType_String = 11,
WorkingDirectory_String = 12,
BinaryPath_String = 13,
Arguments_String = 14,
URL_String = 15,
Description_String = 50,
NewsURL_String = 51,
ImagePath_String = 52,
Source_String = 53,
ActionManifestURL_String = 54,
IsDashboardOverlay_Bool = 60,
IsTemplate_Bool = 61,
IsInstanced_Bool = 62,
IsInternal_Bool = 63,
WantsCompositorPauseInStandby_Bool = 64,
IsHidden_Bool = 65,
LastLaunchTime_Uint64 = 70,
}
public enum EVRSceneApplicationState
{
None = 0,
Starting = 1,
Quitting = 2,
Running = 3,
Waiting = 4,
}
public enum ChaperoneCalibrationState
{
OK = 1,
Warning = 100,
Warning_BaseStationMayHaveMoved = 101,
Warning_BaseStationRemoved = 102,
Warning_SeatedBoundsInvalid = 103,
Error = 200,
Error_BaseStationUninitialized = 201,
Error_BaseStationConflict = 202,
Error_PlayAreaInvalid = 203,
Error_CollisionBoundsInvalid = 204,
}
public enum EChaperoneConfigFile
{
Live = 1,
Temp = 2,
}
public enum EChaperoneImportFlags
{
EChaperoneImport_BoundsOnly = 1,
}
public enum EVRCompositorError
{
None = 0,
RequestFailed = 1,
IncompatibleVersion = 100,
DoNotHaveFocus = 101,
InvalidTexture = 102,
IsNotSceneApplication = 103,
TextureIsOnWrongDevice = 104,
TextureUsesUnsupportedFormat = 105,
SharedTexturesNotSupported = 106,
IndexOutOfRange = 107,
AlreadySubmitted = 108,
InvalidBounds = 109,
AlreadySet = 110,
}
public enum EVRCompositorTimingMode
{
Implicit = 0,
Explicit_RuntimePerformsPostPresentHandoff = 1,
Explicit_ApplicationPerformsPostPresentHandoff = 2,
}
public enum VROverlayInputMethod
{
None = 0,
Mouse = 1,
}
public enum VROverlayTransformType
{
VROverlayTransform_Invalid = -1,
VROverlayTransform_Absolute = 0,
VROverlayTransform_TrackedDeviceRelative = 1,
VROverlayTransform_SystemOverlay = 2,
VROverlayTransform_TrackedComponent = 3,
VROverlayTransform_Cursor = 4,
VROverlayTransform_DashboardTab = 5,
VROverlayTransform_DashboardThumb = 6,
VROverlayTransform_Mountable = 7,
}
public enum VROverlayFlags
{
NoDashboardTab = 8,
SendVRDiscreteScrollEvents = 64,
SendVRTouchpadEvents = 128,
ShowTouchPadScrollWheel = 256,
TransferOwnershipToInternalProcess = 512,
SideBySide_Parallel = 1024,
SideBySide_Crossed = 2048,
Panorama = 4096,
StereoPanorama = 8192,
SortWithNonSceneOverlays = 16384,
VisibleInDashboard = 32768,
MakeOverlaysInteractiveIfVisible = 65536,
SendVRSmoothScrollEvents = 131072,
ProtectedContent = 262144,
HideLaserIntersection = 524288,
WantsModalBehavior = 1048576,
IsPremultiplied = 2097152,
}
public enum VRMessageOverlayResponse
{
ButtonPress_0 = 0,
ButtonPress_1 = 1,
ButtonPress_2 = 2,
ButtonPress_3 = 3,
CouldntFindSystemOverlay = 4,
CouldntFindOrCreateClientOverlay = 5,
ApplicationQuit = 6,
}
public enum EGamepadTextInputMode
{
k_EGamepadTextInputModeNormal = 0,
k_EGamepadTextInputModePassword = 1,
k_EGamepadTextInputModeSubmit = 2,
}
public enum EGamepadTextInputLineMode
{
k_EGamepadTextInputLineModeSingleLine = 0,
k_EGamepadTextInputLineModeMultipleLines = 1,
}
public enum EVROverlayIntersectionMaskPrimitiveType
{
OverlayIntersectionPrimitiveType_Rectangle = 0,
OverlayIntersectionPrimitiveType_Circle = 1,
}
public enum EKeyboardFlags
{
KeyboardFlag_Minimal = 1,
KeyboardFlag_Modal = 2,
}
public enum EDeviceType
{
Invalid = -1,
DirectX11 = 0,
Vulkan = 1,
}
public enum HeadsetViewMode_t
{
HeadsetViewMode_Left = 0,
HeadsetViewMode_Right = 1,
HeadsetViewMode_Both = 2,
}
public enum EVRRenderModelError
{
None = 0,
Loading = 100,
NotSupported = 200,
InvalidArg = 300,
InvalidModel = 301,
NoShapes = 302,
MultipleShapes = 303,
TooManyVertices = 304,
MultipleTextures = 305,
BufferTooSmall = 306,
NotEnoughNormals = 307,
NotEnoughTexCoords = 308,
InvalidTexture = 400,
}
public enum EVRRenderModelTextureFormat
{
RGBA8_SRGB = 0,
BC2 = 1,
BC4 = 2,
BC7 = 3,
BC7_SRGB = 4,
}
public enum EVRNotificationType
{
Transient = 0,
Persistent = 1,
Transient_SystemWithUserValue = 2,
}
public enum EVRNotificationStyle
{
None = 0,
Application = 100,
Contact_Disabled = 200,
Contact_Enabled = 201,
Contact_Active = 202,
}
public enum EVRSettingsError
{
None = 0,
IPCFailed = 1,
WriteFailed = 2,
ReadFailed = 3,
JsonParseFailed = 4,
UnsetSettingHasNoDefault = 5,
}
public enum EVRScreenshotError
{
None = 0,
RequestFailed = 1,
IncompatibleVersion = 100,
NotFound = 101,
BufferTooSmall = 102,
ScreenshotAlreadyInProgress = 108,
}
public enum EVRSkeletalTransformSpace
{
Model = 0,
Parent = 1,
}
public enum EVRSkeletalReferencePose
{
BindPose = 0,
OpenHand = 1,
Fist = 2,
GripLimit = 3,
}
public enum EVRFinger
{
Thumb = 0,
Index = 1,
Middle = 2,
Ring = 3,
Pinky = 4,
Count = 5,
}
public enum EVRFingerSplay
{
Thumb_Index = 0,
Index_Middle = 1,
Middle_Ring = 2,
Ring_Pinky = 3,
Count = 4,
}
public enum EVRSummaryType
{
FromAnimation = 0,
FromDevice = 1,
}
public enum EVRInputFilterCancelType
{
VRInputFilterCancel_Timers = 0,
VRInputFilterCancel_Momentum = 1,
}
public enum EVRInputStringBits
{
VRInputString_Hand = 1,
VRInputString_ControllerType = 2,
VRInputString_InputSource = 4,
VRInputString_All = -1,
}
public enum EIOBufferError
{
IOBuffer_Success = 0,
IOBuffer_OperationFailed = 100,
IOBuffer_InvalidHandle = 101,
IOBuffer_InvalidArgument = 102,
IOBuffer_PathExists = 103,
IOBuffer_PathDoesNotExist = 104,
IOBuffer_Permission = 105,
}
public enum EIOBufferMode
{
Read = 1,
Write = 2,
Create = 512,
}
public enum EVRDebugError
{
Success = 0,
BadParameter = 1,
}
public enum EPropertyWriteType
{
PropertyWrite_Set = 0,
PropertyWrite_Erase = 1,
PropertyWrite_SetError = 2,
}
public enum EBlockQueueError
{
None = 0,
QueueAlreadyExists = 1,
QueueNotFound = 2,
BlockNotAvailable = 3,
InvalidHandle = 4,
InvalidParam = 5,
ParamMismatch = 6,
InternalError = 7,
AlreadyInitialized = 8,
OperationIsServerOnly = 9,
TooManyConnections = 10,
}
public enum EBlockQueueReadType
{
BlockQueueRead_Latest = 0,
BlockQueueRead_New = 1,
BlockQueueRead_Next = 2,
}
[StructLayout(LayoutKind.Explicit)] public struct VREvent_Data_t
{
[FieldOffset(0)] public VREvent_Reserved_t reserved;
[FieldOffset(0)] public VREvent_Controller_t controller;
[FieldOffset(0)] public VREvent_Mouse_t mouse;
[FieldOffset(0)] public VREvent_Scroll_t scroll;
[FieldOffset(0)] public VREvent_Process_t process;
[FieldOffset(0)] public VREvent_Notification_t notification;
[FieldOffset(0)] public VREvent_Overlay_t overlay;
[FieldOffset(0)] public VREvent_Status_t status;
[FieldOffset(0)] public VREvent_Ipd_t ipd;
[FieldOffset(0)] public VREvent_Chaperone_t chaperone;
[FieldOffset(0)] public VREvent_PerformanceTest_t performanceTest;
[FieldOffset(0)] public VREvent_TouchPadMove_t touchPadMove;
[FieldOffset(0)] public VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset;
[FieldOffset(0)] public VREvent_Screenshot_t screenshot;
[FieldOffset(0)] public VREvent_ScreenshotProgress_t screenshotProgress;
[FieldOffset(0)] public VREvent_ApplicationLaunch_t applicationLaunch;
[FieldOffset(0)] public VREvent_EditingCameraSurface_t cameraSurface;
[FieldOffset(0)] public VREvent_MessageOverlay_t messageOverlay;
[FieldOffset(0)] public VREvent_Property_t property;
[FieldOffset(0)] public VREvent_HapticVibration_t hapticVibration;
[FieldOffset(0)] public VREvent_WebConsole_t webConsole;
[FieldOffset(0)] public VREvent_InputBindingLoad_t inputBinding;
[FieldOffset(0)] public VREvent_SpatialAnchor_t spatialAnchor;
[FieldOffset(0)] public VREvent_InputActionManifestLoad_t actionManifest;
[FieldOffset(0)] public VREvent_ProgressUpdate_t progressUpdate;
[FieldOffset(0)] public VREvent_ShowUI_t showUi;
[FieldOffset(0)] public VREvent_ShowDevTools_t showDevTools;
[FieldOffset(0)] public VREvent_HDCPError_t hdcpError;
[FieldOffset(0)] public VREvent_Keyboard_t keyboard; // This has to be at the end due to a mono bug
}
[StructLayout(LayoutKind.Explicit)] public struct VROverlayIntersectionMaskPrimitive_Data_t
{
[FieldOffset(0)] public IntersectionMaskRectangle_t m_Rectangle;
[FieldOffset(0)] public IntersectionMaskCircle_t m_Circle;
}
[StructLayout(LayoutKind.Sequential)] public struct HmdMatrix34_t
{
public float m0; //float[3][4]
public float m1;
public float m2;
public float m3;
public float m4;
public float m5;
public float m6;
public float m7;
public float m8;
public float m9;
public float m10;
public float m11;
#if UNITY_5_3_OR_NEWER
public Vector3 GetPosition()
{
return new Vector3(m3, m7, -m11);
}
public bool IsRotationValid()
{
return ((m2 != 0 || m6 != 0 || m10 != 0) && (m1 != 0 || m5 != 0 || m9 != 0));
}
public Quaternion GetRotation()
{
if (IsRotationValid())
{
float w = Mathf.Sqrt(Mathf.Max(0, 1 + m0 + m5 + m10)) / 2;
float x = Mathf.Sqrt(Mathf.Max(0, 1 + m0 - m5 - m10)) / 2;
float y = Mathf.Sqrt(Mathf.Max(0, 1 - m0 + m5 - m10)) / 2;
float z = Mathf.Sqrt(Mathf.Max(0, 1 - m0 - m5 + m10)) / 2;
_copysign(ref x, -m9 - -m6);
_copysign(ref y, -m2 - -m8);
_copysign(ref z, m4 - m1);
return new Quaternion(x, y, z, w);
}
return Quaternion.identity;
}
private static void _copysign(ref float sizeval, float signval)
{
if (signval > 0 != sizeval > 0)
sizeval = -sizeval;
}
#endif
}
[StructLayout(LayoutKind.Sequential)] public struct HmdMatrix33_t
{
public float m0; //float[3][3]
public float m1;
public float m2;
public float m3;
public float m4;
public float m5;
public float m6;
public float m7;
public float m8;
}
[StructLayout(LayoutKind.Sequential)] public struct HmdMatrix44_t
{
public float m0; //float[4][4]
public float m1;
public float m2;
public float m3;
public float m4;
public float m5;
public float m6;
public float m7;
public float m8;
public float m9;
public float m10;
public float m11;
public float m12;
public float m13;
public float m14;
public float m15;
}
[StructLayout(LayoutKind.Sequential)] public struct HmdVector3_t
{
public float v0; //float[3]
public float v1;
public float v2;
}
[StructLayout(LayoutKind.Sequential)] public struct HmdVector4_t
{
public float v0; //float[4]
public float v1;
public float v2;
public float v3;
}
[StructLayout(LayoutKind.Sequential)] public struct HmdVector3d_t
{
public double v0; //double[3]
public double v1;
public double v2;
}
[StructLayout(LayoutKind.Sequential)] public struct HmdVector2_t
{
public float v0; //float[2]
public float v1;
}
[StructLayout(LayoutKind.Sequential)] public struct HmdQuaternion_t
{
public double w;
public double x;
public double y;
public double z;
}
[StructLayout(LayoutKind.Sequential)] public struct HmdQuaternionf_t
{
public float w;
public float x;
public float y;
public float z;
}
[StructLayout(LayoutKind.Sequential)] public struct HmdColor_t
{
public float r;
public float g;
public float b;
public float a;
}
[StructLayout(LayoutKind.Sequential)] public struct HmdQuad_t
{
public HmdVector3_t vCorners0; //HmdVector3_t[4]
public HmdVector3_t vCorners1;
public HmdVector3_t vCorners2;
public HmdVector3_t vCorners3;
}
[StructLayout(LayoutKind.Sequential)] public struct HmdRect2_t
{
public HmdVector2_t vTopLeft;
public HmdVector2_t vBottomRight;
}
[StructLayout(LayoutKind.Sequential)] public struct DistortionCoordinates_t
{
public float rfRed0; //float[2]
public float rfRed1;
public float rfGreen0; //float[2]
public float rfGreen1;
public float rfBlue0; //float[2]
public float rfBlue1;
}
[StructLayout(LayoutKind.Sequential)] public struct Texture_t
{
public IntPtr handle; // void *
public ETextureType eType;
public EColorSpace eColorSpace;
}
[StructLayout(LayoutKind.Sequential)] public struct TrackedDevicePose_t
{
public HmdMatrix34_t mDeviceToAbsoluteTracking;
public HmdVector3_t vVelocity;
public HmdVector3_t vAngularVelocity;
public ETrackingResult eTrackingResult;
[MarshalAs(UnmanagedType.I1)]
public bool bPoseIsValid;
[MarshalAs(UnmanagedType.I1)]
public bool bDeviceIsConnected;
}
[StructLayout(LayoutKind.Sequential)] public struct VRTextureBounds_t
{
public float uMin;
public float vMin;
public float uMax;
public float vMax;
}
[StructLayout(LayoutKind.Sequential)] public struct VRTextureWithPose_t
{
public HmdMatrix34_t mDeviceToAbsoluteTracking;
}
[StructLayout(LayoutKind.Sequential)] public struct VRTextureDepthInfo_t
{
public IntPtr handle; // void *
public HmdMatrix44_t mProjection;
public HmdVector2_t vRange;
}
[StructLayout(LayoutKind.Sequential)] public struct VRTextureWithDepth_t
{
public VRTextureDepthInfo_t depth;
}
[StructLayout(LayoutKind.Sequential)] public struct VRTextureWithPoseAndDepth_t
{
public VRTextureDepthInfo_t depth;
}
[StructLayout(LayoutKind.Sequential)] public struct VRVulkanTextureData_t
{
public ulong m_nImage;
public IntPtr m_pDevice; // struct VkDevice_T *
public IntPtr m_pPhysicalDevice; // struct VkPhysicalDevice_T *
public IntPtr m_pInstance; // struct VkInstance_T *
public IntPtr m_pQueue; // struct VkQueue_T *
public uint m_nQueueFamilyIndex;
public uint m_nWidth;
public uint m_nHeight;
public uint m_nFormat;
public uint m_nSampleCount;
}
[StructLayout(LayoutKind.Sequential)] public struct VRVulkanTextureArrayData_t
{
public uint m_unArrayIndex;
public uint m_unArraySize;
}
[StructLayout(LayoutKind.Sequential)] public struct D3D12TextureData_t
{
public IntPtr m_pResource; // struct ID3D12Resource *
public IntPtr m_pCommandQueue; // struct ID3D12CommandQueue *
public uint m_nNodeMask;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_Controller_t
{
public uint button;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_Mouse_t
{
public float x;
public float y;
public uint button;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_Scroll_t
{
public float xdelta;
public float ydelta;
public uint unused;
public float viewportscale;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_TouchPadMove_t
{
[MarshalAs(UnmanagedType.I1)]
public bool bFingerDown;
public float flSecondsFingerDown;
public float fValueXFirst;
public float fValueYFirst;
public float fValueXRaw;
public float fValueYRaw;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_Notification_t
{
public ulong ulUserValue;
public uint notificationId;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_Process_t
{
public uint pid;
public uint oldPid;
[MarshalAs(UnmanagedType.I1)]
public bool bForced;
[MarshalAs(UnmanagedType.I1)]
public bool bConnectionLost;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_Overlay_t
{
public ulong overlayHandle;
public ulong devicePath;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_Status_t
{
public uint statusState;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_Keyboard_t
{
public byte cNewInput0,cNewInput1,cNewInput2,cNewInput3,cNewInput4,cNewInput5,cNewInput6,cNewInput7;
public string cNewInput
{
get
{
return new string(new char[] {
(char)cNewInput0,
(char)cNewInput1,
(char)cNewInput2,
(char)cNewInput3,
(char)cNewInput4,
(char)cNewInput5,
(char)cNewInput6,
(char)cNewInput7
}).TrimEnd('\0');
}
}
public ulong uUserValue;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_Ipd_t
{
public float ipdMeters;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_Chaperone_t
{
public ulong m_nPreviousUniverse;
public ulong m_nCurrentUniverse;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_Reserved_t
{
public ulong reserved0;
public ulong reserved1;
public ulong reserved2;
public ulong reserved3;
public ulong reserved4;
public ulong reserved5;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_PerformanceTest_t
{
public uint m_nFidelityLevel;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_SeatedZeroPoseReset_t
{
[MarshalAs(UnmanagedType.I1)]
public bool bResetBySystemMenu;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_Screenshot_t
{
public uint handle;
public uint type;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_ScreenshotProgress_t
{
public float progress;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_ApplicationLaunch_t
{
public uint pid;
public uint unArgsHandle;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_EditingCameraSurface_t
{
public ulong overlayHandle;
public uint nVisualMode;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_MessageOverlay_t
{
public uint unVRMessageOverlayResponse;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_Property_t
{
public ulong container;
public ETrackedDeviceProperty prop;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_HapticVibration_t
{
public ulong containerHandle;
public ulong componentHandle;
public float fDurationSeconds;
public float fFrequency;
public float fAmplitude;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_WebConsole_t
{
public ulong webConsoleHandle;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_InputBindingLoad_t
{
public ulong ulAppContainer;
public ulong pathMessage;
public ulong pathUrl;
public ulong pathControllerType;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_InputActionManifestLoad_t
{
public ulong pathAppKey;
public ulong pathMessage;
public ulong pathMessageParam;
public ulong pathManifestPath;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_SpatialAnchor_t
{
public uint unHandle;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_ProgressUpdate_t
{
public ulong ulApplicationPropertyContainer;
public ulong pathDevice;
public ulong pathInputSource;
public ulong pathProgressAction;
public ulong pathIcon;
public float fProgress;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_ShowUI_t
{
public EShowUIType eType;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_ShowDevTools_t
{
public int nBrowserIdentifier;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_HDCPError_t
{
public EHDCPError eCode;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_t
{
public uint eventType;
public uint trackedDeviceIndex;
public float eventAgeSeconds;
public VREvent_Data_t data;
}
// This structure is for backwards binary compatibility on Linux and OSX only
[StructLayout(LayoutKind.Sequential, Pack = 4)] public struct VREvent_t_Packed
{
public uint eventType;
public uint trackedDeviceIndex;
public float eventAgeSeconds;
public VREvent_Data_t data;
public VREvent_t_Packed(VREvent_t unpacked)
{
this.eventType = unpacked.eventType;
this.trackedDeviceIndex = unpacked.trackedDeviceIndex;
this.eventAgeSeconds = unpacked.eventAgeSeconds;
this.data = unpacked.data;
}
public void Unpack(ref VREvent_t unpacked)
{
unpacked.eventType = this.eventType;
unpacked.trackedDeviceIndex = this.trackedDeviceIndex;
unpacked.eventAgeSeconds = this.eventAgeSeconds;
unpacked.data = this.data;
}
}
[StructLayout(LayoutKind.Sequential)] public struct RenderModel_ComponentState_t
{
public HmdMatrix34_t mTrackingToComponentRenderModel;
public HmdMatrix34_t mTrackingToComponentLocal;
public uint uProperties;
}
[StructLayout(LayoutKind.Sequential)] public struct HiddenAreaMesh_t
{
public IntPtr pVertexData; // const struct vr::HmdVector2_t *
public uint unTriangleCount;
}
[StructLayout(LayoutKind.Sequential)] public struct VRControllerAxis_t
{
public float x;
public float y;
}
[StructLayout(LayoutKind.Sequential)] public struct VRControllerState_t
{
public uint unPacketNum;
public ulong ulButtonPressed;
public ulong ulButtonTouched;
public VRControllerAxis_t rAxis0; //VRControllerAxis_t[5]
public VRControllerAxis_t rAxis1;
public VRControllerAxis_t rAxis2;
public VRControllerAxis_t rAxis3;
public VRControllerAxis_t rAxis4;
}
// This structure is for backwards binary compatibility on Linux and OSX only
[StructLayout(LayoutKind.Sequential, Pack = 4)] public struct VRControllerState_t_Packed
{
public uint unPacketNum;
public ulong ulButtonPressed;
public ulong ulButtonTouched;
public VRControllerAxis_t rAxis0; //VRControllerAxis_t[5]
public VRControllerAxis_t rAxis1;
public VRControllerAxis_t rAxis2;
public VRControllerAxis_t rAxis3;
public VRControllerAxis_t rAxis4;
public VRControllerState_t_Packed(VRControllerState_t unpacked)
{
this.unPacketNum = unpacked.unPacketNum;
this.ulButtonPressed = unpacked.ulButtonPressed;
this.ulButtonTouched = unpacked.ulButtonTouched;
this.rAxis0 = unpacked.rAxis0;
this.rAxis1 = unpacked.rAxis1;
this.rAxis2 = unpacked.rAxis2;
this.rAxis3 = unpacked.rAxis3;
this.rAxis4 = unpacked.rAxis4;
}
public void Unpack(ref VRControllerState_t unpacked)
{
unpacked.unPacketNum = this.unPacketNum;
unpacked.ulButtonPressed = this.ulButtonPressed;
unpacked.ulButtonTouched = this.ulButtonTouched;
unpacked.rAxis0 = this.rAxis0;
unpacked.rAxis1 = this.rAxis1;
unpacked.rAxis2 = this.rAxis2;
unpacked.rAxis3 = this.rAxis3;
unpacked.rAxis4 = this.rAxis4;
}
}
[StructLayout(LayoutKind.Sequential)] public struct VRBoneTransform_t
{
public HmdVector4_t position;
public HmdQuaternionf_t orientation;
}
[StructLayout(LayoutKind.Sequential)] public struct CameraVideoStreamFrameHeader_t
{
public EVRTrackedCameraFrameType eFrameType;
public uint nWidth;
public uint nHeight;
public uint nBytesPerPixel;
public uint nFrameSequence;
public TrackedDevicePose_t trackedDevicePose;
public ulong ulFrameExposureTime;
}
[StructLayout(LayoutKind.Sequential)] public struct Compositor_FrameTiming
{
public uint m_nSize;
public uint m_nFrameIndex;
public uint m_nNumFramePresents;
public uint m_nNumMisPresented;
public uint m_nNumDroppedFrames;
public uint m_nReprojectionFlags;
public double m_flSystemTimeInSeconds;
public float m_flPreSubmitGpuMs;
public float m_flPostSubmitGpuMs;
public float m_flTotalRenderGpuMs;
public float m_flCompositorRenderGpuMs;
public float m_flCompositorRenderCpuMs;
public float m_flCompositorIdleCpuMs;
public float m_flClientFrameIntervalMs;
public float m_flPresentCallCpuMs;
public float m_flWaitForPresentCpuMs;
public float m_flSubmitFrameMs;
public float m_flWaitGetPosesCalledMs;
public float m_flNewPosesReadyMs;
public float m_flNewFrameReadyMs;
public float m_flCompositorUpdateStartMs;
public float m_flCompositorUpdateEndMs;
public float m_flCompositorRenderStartMs;
public TrackedDevicePose_t m_HmdPose;
public uint m_nNumVSyncsReadyForUse;
public uint m_nNumVSyncsToFirstView;
}
[StructLayout(LayoutKind.Sequential)] public struct Compositor_BenchmarkResults
{
public float m_flMegaPixelsPerSecond;
public float m_flHmdRecommendedMegaPixelsPerSecond;
}
[StructLayout(LayoutKind.Sequential)] public struct DriverDirectMode_FrameTiming
{
public uint m_nSize;
public uint m_nNumFramePresents;
public uint m_nNumMisPresented;
public uint m_nNumDroppedFrames;
public uint m_nReprojectionFlags;
}
[StructLayout(LayoutKind.Sequential)] public struct ImuSample_t
{
public double fSampleTime;
public HmdVector3d_t vAccel;
public HmdVector3d_t vGyro;
public uint unOffScaleFlags;
}
[StructLayout(LayoutKind.Sequential)] public struct AppOverrideKeys_t
{
public IntPtr pchKey; // const char *
public IntPtr pchValue; // const char *
}
[StructLayout(LayoutKind.Sequential)] public struct Compositor_CumulativeStats
{
public uint m_nPid;
public uint m_nNumFramePresents;
public uint m_nNumDroppedFrames;
public uint m_nNumReprojectedFrames;
public uint m_nNumFramePresentsOnStartup;
public uint m_nNumDroppedFramesOnStartup;
public uint m_nNumReprojectedFramesOnStartup;
public uint m_nNumLoading;
public uint m_nNumFramePresentsLoading;
public uint m_nNumDroppedFramesLoading;
public uint m_nNumReprojectedFramesLoading;
public uint m_nNumTimedOut;
public uint m_nNumFramePresentsTimedOut;
public uint m_nNumDroppedFramesTimedOut;
public uint m_nNumReprojectedFramesTimedOut;
}
[StructLayout(LayoutKind.Sequential)] public struct Compositor_StageRenderSettings
{
public HmdColor_t m_PrimaryColor;
public HmdColor_t m_SecondaryColor;
public float m_flVignetteInnerRadius;
public float m_flVignetteOuterRadius;
public float m_flFresnelStrength;
[MarshalAs(UnmanagedType.I1)]
public bool m_bBackfaceCulling;
[MarshalAs(UnmanagedType.I1)]
public bool m_bGreyscale;
[MarshalAs(UnmanagedType.I1)]
public bool m_bWireframe;
}
[StructLayout(LayoutKind.Sequential)] public struct VROverlayIntersectionParams_t
{
public HmdVector3_t vSource;
public HmdVector3_t vDirection;
public ETrackingUniverseOrigin eOrigin;
}
[StructLayout(LayoutKind.Sequential)] public struct VROverlayIntersectionResults_t
{
public HmdVector3_t vPoint;
public HmdVector3_t vNormal;
public HmdVector2_t vUVs;
public float fDistance;
}
[StructLayout(LayoutKind.Sequential)] public struct IntersectionMaskRectangle_t
{
public float m_flTopLeftX;
public float m_flTopLeftY;
public float m_flWidth;
public float m_flHeight;
}
[StructLayout(LayoutKind.Sequential)] public struct IntersectionMaskCircle_t
{
public float m_flCenterX;
public float m_flCenterY;
public float m_flRadius;
}
[StructLayout(LayoutKind.Sequential)] public struct VROverlayIntersectionMaskPrimitive_t
{
public EVROverlayIntersectionMaskPrimitiveType m_nPrimitiveType;
public VROverlayIntersectionMaskPrimitive_Data_t m_Primitive;
}
[StructLayout(LayoutKind.Sequential)] public struct VROverlayView_t
{
public ulong overlayHandle;
public Texture_t texture;
public VRTextureBounds_t textureBounds;
}
[StructLayout(LayoutKind.Sequential)] public struct VRVulkanDevice_t
{
public IntPtr m_pInstance; // struct VkInstance_T *
public IntPtr m_pDevice; // struct VkDevice_T *
public IntPtr m_pPhysicalDevice; // struct VkPhysicalDevice_T *
public IntPtr m_pQueue; // struct VkQueue_T *
public uint m_uQueueFamilyIndex;
}
[StructLayout(LayoutKind.Sequential)] public struct VRNativeDevice_t
{
public IntPtr handle; // void *
public EDeviceType eType;
}
[StructLayout(LayoutKind.Sequential)] public struct RenderModel_Vertex_t
{
public HmdVector3_t vPosition;
public HmdVector3_t vNormal;
public float rfTextureCoord0; //float[2]
public float rfTextureCoord1;
}
[StructLayout(LayoutKind.Sequential)] public struct RenderModel_TextureMap_t
{
public ushort unWidth;
public ushort unHeight;
public IntPtr rubTextureMapData; // const uint8_t *
public EVRRenderModelTextureFormat format;
}
// This structure is for backwards binary compatibility on Linux and OSX only
[StructLayout(LayoutKind.Sequential, Pack = 4)] public struct RenderModel_TextureMap_t_Packed
{
public ushort unWidth;
public ushort unHeight;
public IntPtr rubTextureMapData; // const uint8_t *
public EVRRenderModelTextureFormat format;
public RenderModel_TextureMap_t_Packed(RenderModel_TextureMap_t unpacked)
{
this.unWidth = unpacked.unWidth;
this.unHeight = unpacked.unHeight;
this.rubTextureMapData = unpacked.rubTextureMapData;
this.format = unpacked.format;
}
public void Unpack(ref RenderModel_TextureMap_t unpacked)
{
unpacked.unWidth = this.unWidth;
unpacked.unHeight = this.unHeight;
unpacked.rubTextureMapData = this.rubTextureMapData;
unpacked.format = this.format;
}
}
[StructLayout(LayoutKind.Sequential)] public struct RenderModel_t
{
public IntPtr rVertexData; // const struct vr::RenderModel_Vertex_t *
public uint unVertexCount;
public IntPtr rIndexData; // const uint16_t *
public uint unTriangleCount;
public int diffuseTextureId;
}
// This structure is for backwards binary compatibility on Linux and OSX only
[StructLayout(LayoutKind.Sequential, Pack = 4)] public struct RenderModel_t_Packed
{
public IntPtr rVertexData; // const struct vr::RenderModel_Vertex_t *
public uint unVertexCount;
public IntPtr rIndexData; // const uint16_t *
public uint unTriangleCount;
public int diffuseTextureId;
public RenderModel_t_Packed(RenderModel_t unpacked)
{
this.rVertexData = unpacked.rVertexData;
this.unVertexCount = unpacked.unVertexCount;
this.rIndexData = unpacked.rIndexData;
this.unTriangleCount = unpacked.unTriangleCount;
this.diffuseTextureId = unpacked.diffuseTextureId;
}
public void Unpack(ref RenderModel_t unpacked)
{
unpacked.rVertexData = this.rVertexData;
unpacked.unVertexCount = this.unVertexCount;
unpacked.rIndexData = this.rIndexData;
unpacked.unTriangleCount = this.unTriangleCount;
unpacked.diffuseTextureId = this.diffuseTextureId;
}
}
[StructLayout(LayoutKind.Sequential)] public struct RenderModel_ControllerMode_State_t
{
[MarshalAs(UnmanagedType.I1)]
public bool bScrollWheelVisible;
}
[StructLayout(LayoutKind.Sequential)] public struct NotificationBitmap_t
{
public IntPtr m_pImageData; // void *
public int m_nWidth;
public int m_nHeight;
public int m_nBytesPerPixel;
}
[StructLayout(LayoutKind.Sequential)] public struct CVRSettingHelper
{
public IntPtr m_pSettings; // class vr::IVRSettings *
}
[StructLayout(LayoutKind.Sequential)] public struct InputAnalogActionData_t
{
[MarshalAs(UnmanagedType.I1)]
public bool bActive;
public ulong activeOrigin;
public float x;
public float y;
public float z;
public float deltaX;
public float deltaY;
public float deltaZ;
public float fUpdateTime;
}
[StructLayout(LayoutKind.Sequential)] public struct InputDigitalActionData_t
{
[MarshalAs(UnmanagedType.I1)]
public bool bActive;
public ulong activeOrigin;
[MarshalAs(UnmanagedType.I1)]
public bool bState;
[MarshalAs(UnmanagedType.I1)]
public bool bChanged;
public float fUpdateTime;
}
[StructLayout(LayoutKind.Sequential)] public struct InputPoseActionData_t
{
[MarshalAs(UnmanagedType.I1)]
public bool bActive;
public ulong activeOrigin;
public TrackedDevicePose_t pose;
}
[StructLayout(LayoutKind.Sequential)] public struct InputSkeletalActionData_t
{
[MarshalAs(UnmanagedType.I1)]
public bool bActive;
public ulong activeOrigin;
}
[StructLayout(LayoutKind.Sequential)] public struct InputOriginInfo_t
{
public ulong devicePath;
public uint trackedDeviceIndex;
public byte rchRenderModelComponentName0,rchRenderModelComponentName1,rchRenderModelComponentName2,rchRenderModelComponentName3,rchRenderModelComponentName4,rchRenderModelComponentName5,rchRenderModelComponentName6,rchRenderModelComponentName7,rchRenderModelComponentName8,rchRenderModelComponentName9,rchRenderModelComponentName10,rchRenderModelComponentName11,rchRenderModelComponentName12,rchRenderModelComponentName13,rchRenderModelComponentName14,rchRenderModelComponentName15,rchRenderModelComponentName16,rchRenderModelComponentName17,rchRenderModelComponentName18,rchRenderModelComponentName19,rchRenderModelComponentName20,rchRenderModelComponentName21,rchRenderModelComponentName22,rchRenderModelComponentName23,rchRenderModelComponentName24,rchRenderModelComponentName25,rchRenderModelComponentName26,rchRenderModelComponentName27,rchRenderModelComponentName28,rchRenderModelComponentName29,rchRenderModelComponentName30,rchRenderModelComponentName31,rchRenderModelComponentName32,rchRenderModelComponentName33,rchRenderModelComponentName34,rchRenderModelComponentName35,rchRenderModelComponentName36,rchRenderModelComponentName37,rchRenderModelComponentName38,rchRenderModelComponentName39,rchRenderModelComponentName40,rchRenderModelComponentName41,rchRenderModelComponentName42,rchRenderModelComponentName43,rchRenderModelComponentName44,rchRenderModelComponentName45,rchRenderModelComponentName46,rchRenderModelComponentName47,rchRenderModelComponentName48,rchRenderModelComponentName49,rchRenderModelComponentName50,rchRenderModelComponentName51,rchRenderModelComponentName52,rchRenderModelComponentName53,rchRenderModelComponentName54,rchRenderModelComponentName55,rchRenderModelComponentName56,rchRenderModelComponentName57,rchRenderModelComponentName58,rchRenderModelComponentName59,rchRenderModelComponentName60,rchRenderModelComponentName61,rchRenderModelComponentName62,rchRenderModelComponentName63,rchRenderModelComponentName64,rchRenderModelComponentName65,rchRenderModelComponentName66,rchRenderModelComponentName67,rchRenderModelComponentName68,rchRenderModelComponentName69,rchRenderModelComponentName70,rchRenderModelComponentName71,rchRenderModelComponentName72,rchRenderModelComponentName73,rchRenderModelComponentName74,rchRenderModelComponentName75,rchRenderModelComponentName76,rchRenderModelComponentName77,rchRenderModelComponentName78,rchRenderModelComponentName79,rchRenderModelComponentName80,rchRenderModelComponentName81,rchRenderModelComponentName82,rchRenderModelComponentName83,rchRenderModelComponentName84,rchRenderModelComponentName85,rchRenderModelComponentName86,rchRenderModelComponentName87,rchRenderModelComponentName88,rchRenderModelComponentName89,rchRenderModelComponentName90,rchRenderModelComponentName91,rchRenderModelComponentName92,rchRenderModelComponentName93,rchRenderModelComponentName94,rchRenderModelComponentName95,rchRenderModelComponentName96,rchRenderModelComponentName97,rchRenderModelComponentName98,rchRenderModelComponentName99,rchRenderModelComponentName100,rchRenderModelComponentName101,rchRenderModelComponentName102,rchRenderModelComponentName103,rchRenderModelComponentName104,rchRenderModelComponentName105,rchRenderModelComponentName106,rchRenderModelComponentName107,rchRenderModelComponentName108,rchRenderModelComponentName109,rchRenderModelComponentName110,rchRenderModelComponentName111,rchRenderModelComponentName112,rchRenderModelComponentName113,rchRenderModelComponentName114,rchRenderModelComponentName115,rchRenderModelComponentName116,rchRenderModelComponentName117,rchRenderModelComponentName118,rchRenderModelComponentName119,rchRenderModelComponentName120,rchRenderModelComponentName121,rchRenderModelComponentName122,rchRenderModelComponentName123,rchRenderModelComponentName124,rchRenderModelComponentName125,rchRenderModelComponentName126,rchRenderModelComponentName127;
public string rchRenderModelComponentName
{
get
{
return new string(new char[] {
(char)rchRenderModelComponentName0,
(char)rchRenderModelComponentName1,
(char)rchRenderModelComponentName2,
(char)rchRenderModelComponentName3,
(char)rchRenderModelComponentName4,
(char)rchRenderModelComponentName5,
(char)rchRenderModelComponentName6,
(char)rchRenderModelComponentName7,
(char)rchRenderModelComponentName8,
(char)rchRenderModelComponentName9,
(char)rchRenderModelComponentName10,
(char)rchRenderModelComponentName11,
(char)rchRenderModelComponentName12,
(char)rchRenderModelComponentName13,
(char)rchRenderModelComponentName14,
(char)rchRenderModelComponentName15,
(char)rchRenderModelComponentName16,
(char)rchRenderModelComponentName17,
(char)rchRenderModelComponentName18,
(char)rchRenderModelComponentName19,
(char)rchRenderModelComponentName20,
(char)rchRenderModelComponentName21,
(char)rchRenderModelComponentName22,
(char)rchRenderModelComponentName23,
(char)rchRenderModelComponentName24,
(char)rchRenderModelComponentName25,
(char)rchRenderModelComponentName26,
(char)rchRenderModelComponentName27,
(char)rchRenderModelComponentName28,
(char)rchRenderModelComponentName29,
(char)rchRenderModelComponentName30,
(char)rchRenderModelComponentName31,
(char)rchRenderModelComponentName32,
(char)rchRenderModelComponentName33,
(char)rchRenderModelComponentName34,
(char)rchRenderModelComponentName35,
(char)rchRenderModelComponentName36,
(char)rchRenderModelComponentName37,
(char)rchRenderModelComponentName38,
(char)rchRenderModelComponentName39,
(char)rchRenderModelComponentName40,
(char)rchRenderModelComponentName41,
(char)rchRenderModelComponentName42,
(char)rchRenderModelComponentName43,
(char)rchRenderModelComponentName44,
(char)rchRenderModelComponentName45,
(char)rchRenderModelComponentName46,
(char)rchRenderModelComponentName47,
(char)rchRenderModelComponentName48,
(char)rchRenderModelComponentName49,
(char)rchRenderModelComponentName50,
(char)rchRenderModelComponentName51,
(char)rchRenderModelComponentName52,
(char)rchRenderModelComponentName53,
(char)rchRenderModelComponentName54,
(char)rchRenderModelComponentName55,
(char)rchRenderModelComponentName56,
(char)rchRenderModelComponentName57,
(char)rchRenderModelComponentName58,
(char)rchRenderModelComponentName59,
(char)rchRenderModelComponentName60,
(char)rchRenderModelComponentName61,
(char)rchRenderModelComponentName62,
(char)rchRenderModelComponentName63,
(char)rchRenderModelComponentName64,
(char)rchRenderModelComponentName65,
(char)rchRenderModelComponentName66,
(char)rchRenderModelComponentName67,
(char)rchRenderModelComponentName68,
(char)rchRenderModelComponentName69,
(char)rchRenderModelComponentName70,
(char)rchRenderModelComponentName71,
(char)rchRenderModelComponentName72,
(char)rchRenderModelComponentName73,
(char)rchRenderModelComponentName74,
(char)rchRenderModelComponentName75,
(char)rchRenderModelComponentName76,
(char)rchRenderModelComponentName77,
(char)rchRenderModelComponentName78,
(char)rchRenderModelComponentName79,
(char)rchRenderModelComponentName80,
(char)rchRenderModelComponentName81,
(char)rchRenderModelComponentName82,
(char)rchRenderModelComponentName83,
(char)rchRenderModelComponentName84,
(char)rchRenderModelComponentName85,
(char)rchRenderModelComponentName86,
(char)rchRenderModelComponentName87,
(char)rchRenderModelComponentName88,
(char)rchRenderModelComponentName89,
(char)rchRenderModelComponentName90,
(char)rchRenderModelComponentName91,
(char)rchRenderModelComponentName92,
(char)rchRenderModelComponentName93,
(char)rchRenderModelComponentName94,
(char)rchRenderModelComponentName95,
(char)rchRenderModelComponentName96,
(char)rchRenderModelComponentName97,
(char)rchRenderModelComponentName98,
(char)rchRenderModelComponentName99,
(char)rchRenderModelComponentName100,
(char)rchRenderModelComponentName101,
(char)rchRenderModelComponentName102,
(char)rchRenderModelComponentName103,
(char)rchRenderModelComponentName104,
(char)rchRenderModelComponentName105,
(char)rchRenderModelComponentName106,
(char)rchRenderModelComponentName107,
(char)rchRenderModelComponentName108,
(char)rchRenderModelComponentName109,
(char)rchRenderModelComponentName110,
(char)rchRenderModelComponentName111,
(char)rchRenderModelComponentName112,
(char)rchRenderModelComponentName113,
(char)rchRenderModelComponentName114,
(char)rchRenderModelComponentName115,
(char)rchRenderModelComponentName116,
(char)rchRenderModelComponentName117,
(char)rchRenderModelComponentName118,
(char)rchRenderModelComponentName119,
(char)rchRenderModelComponentName120,
(char)rchRenderModelComponentName121,
(char)rchRenderModelComponentName122,
(char)rchRenderModelComponentName123,
(char)rchRenderModelComponentName124,
(char)rchRenderModelComponentName125,
(char)rchRenderModelComponentName126,
(char)rchRenderModelComponentName127
}).TrimEnd('\0');
}
}
}
[StructLayout(LayoutKind.Sequential)] public struct InputBindingInfo_t
{
public byte rchDevicePathName0,rchDevicePathName1,rchDevicePathName2,rchDevicePathName3,rchDevicePathName4,rchDevicePathName5,rchDevicePathName6,rchDevicePathName7,rchDevicePathName8,rchDevicePathName9,rchDevicePathName10,rchDevicePathName11,rchDevicePathName12,rchDevicePathName13,rchDevicePathName14,rchDevicePathName15,rchDevicePathName16,rchDevicePathName17,rchDevicePathName18,rchDevicePathName19,rchDevicePathName20,rchDevicePathName21,rchDevicePathName22,rchDevicePathName23,rchDevicePathName24,rchDevicePathName25,rchDevicePathName26,rchDevicePathName27,rchDevicePathName28,rchDevicePathName29,rchDevicePathName30,rchDevicePathName31,rchDevicePathName32,rchDevicePathName33,rchDevicePathName34,rchDevicePathName35,rchDevicePathName36,rchDevicePathName37,rchDevicePathName38,rchDevicePathName39,rchDevicePathName40,rchDevicePathName41,rchDevicePathName42,rchDevicePathName43,rchDevicePathName44,rchDevicePathName45,rchDevicePathName46,rchDevicePathName47,rchDevicePathName48,rchDevicePathName49,rchDevicePathName50,rchDevicePathName51,rchDevicePathName52,rchDevicePathName53,rchDevicePathName54,rchDevicePathName55,rchDevicePathName56,rchDevicePathName57,rchDevicePathName58,rchDevicePathName59,rchDevicePathName60,rchDevicePathName61,rchDevicePathName62,rchDevicePathName63,rchDevicePathName64,rchDevicePathName65,rchDevicePathName66,rchDevicePathName67,rchDevicePathName68,rchDevicePathName69,rchDevicePathName70,rchDevicePathName71,rchDevicePathName72,rchDevicePathName73,rchDevicePathName74,rchDevicePathName75,rchDevicePathName76,rchDevicePathName77,rchDevicePathName78,rchDevicePathName79,rchDevicePathName80,rchDevicePathName81,rchDevicePathName82,rchDevicePathName83,rchDevicePathName84,rchDevicePathName85,rchDevicePathName86,rchDevicePathName87,rchDevicePathName88,rchDevicePathName89,rchDevicePathName90,rchDevicePathName91,rchDevicePathName92,rchDevicePathName93,rchDevicePathName94,rchDevicePathName95,rchDevicePathName96,rchDevicePathName97,rchDevicePathName98,rchDevicePathName99,rchDevicePathName100,rchDevicePathName101,rchDevicePathName102,rchDevicePathName103,rchDevicePathName104,rchDevicePathName105,rchDevicePathName106,rchDevicePathName107,rchDevicePathName108,rchDevicePathName109,rchDevicePathName110,rchDevicePathName111,rchDevicePathName112,rchDevicePathName113,rchDevicePathName114,rchDevicePathName115,rchDevicePathName116,rchDevicePathName117,rchDevicePathName118,rchDevicePathName119,rchDevicePathName120,rchDevicePathName121,rchDevicePathName122,rchDevicePathName123,rchDevicePathName124,rchDevicePathName125,rchDevicePathName126,rchDevicePathName127;
public string rchDevicePathName
{
get
{
return new string(new char[] {
(char)rchDevicePathName0,
(char)rchDevicePathName1,
(char)rchDevicePathName2,
(char)rchDevicePathName3,
(char)rchDevicePathName4,
(char)rchDevicePathName5,
(char)rchDevicePathName6,
(char)rchDevicePathName7,
(char)rchDevicePathName8,
(char)rchDevicePathName9,
(char)rchDevicePathName10,
(char)rchDevicePathName11,
(char)rchDevicePathName12,
(char)rchDevicePathName13,
(char)rchDevicePathName14,
(char)rchDevicePathName15,
(char)rchDevicePathName16,
(char)rchDevicePathName17,
(char)rchDevicePathName18,
(char)rchDevicePathName19,
(char)rchDevicePathName20,
(char)rchDevicePathName21,
(char)rchDevicePathName22,
(char)rchDevicePathName23,
(char)rchDevicePathName24,
(char)rchDevicePathName25,
(char)rchDevicePathName26,
(char)rchDevicePathName27,
(char)rchDevicePathName28,
(char)rchDevicePathName29,
(char)rchDevicePathName30,
(char)rchDevicePathName31,
(char)rchDevicePathName32,
(char)rchDevicePathName33,
(char)rchDevicePathName34,
(char)rchDevicePathName35,
(char)rchDevicePathName36,
(char)rchDevicePathName37,
(char)rchDevicePathName38,
(char)rchDevicePathName39,
(char)rchDevicePathName40,
(char)rchDevicePathName41,
(char)rchDevicePathName42,
(char)rchDevicePathName43,
(char)rchDevicePathName44,
(char)rchDevicePathName45,
(char)rchDevicePathName46,
(char)rchDevicePathName47,
(char)rchDevicePathName48,
(char)rchDevicePathName49,
(char)rchDevicePathName50,
(char)rchDevicePathName51,
(char)rchDevicePathName52,
(char)rchDevicePathName53,
(char)rchDevicePathName54,
(char)rchDevicePathName55,
(char)rchDevicePathName56,
(char)rchDevicePathName57,
(char)rchDevicePathName58,
(char)rchDevicePathName59,
(char)rchDevicePathName60,
(char)rchDevicePathName61,
(char)rchDevicePathName62,
(char)rchDevicePathName63,
(char)rchDevicePathName64,
(char)rchDevicePathName65,
(char)rchDevicePathName66,
(char)rchDevicePathName67,
(char)rchDevicePathName68,
(char)rchDevicePathName69,
(char)rchDevicePathName70,
(char)rchDevicePathName71,
(char)rchDevicePathName72,
(char)rchDevicePathName73,
(char)rchDevicePathName74,
(char)rchDevicePathName75,
(char)rchDevicePathName76,
(char)rchDevicePathName77,
(char)rchDevicePathName78,
(char)rchDevicePathName79,
(char)rchDevicePathName80,
(char)rchDevicePathName81,
(char)rchDevicePathName82,
(char)rchDevicePathName83,
(char)rchDevicePathName84,
(char)rchDevicePathName85,
(char)rchDevicePathName86,
(char)rchDevicePathName87,
(char)rchDevicePathName88,
(char)rchDevicePathName89,
(char)rchDevicePathName90,
(char)rchDevicePathName91,
(char)rchDevicePathName92,
(char)rchDevicePathName93,
(char)rchDevicePathName94,
(char)rchDevicePathName95,
(char)rchDevicePathName96,
(char)rchDevicePathName97,
(char)rchDevicePathName98,
(char)rchDevicePathName99,
(char)rchDevicePathName100,
(char)rchDevicePathName101,
(char)rchDevicePathName102,
(char)rchDevicePathName103,
(char)rchDevicePathName104,
(char)rchDevicePathName105,
(char)rchDevicePathName106,
(char)rchDevicePathName107,
(char)rchDevicePathName108,
(char)rchDevicePathName109,
(char)rchDevicePathName110,
(char)rchDevicePathName111,
(char)rchDevicePathName112,
(char)rchDevicePathName113,
(char)rchDevicePathName114,
(char)rchDevicePathName115,
(char)rchDevicePathName116,
(char)rchDevicePathName117,
(char)rchDevicePathName118,
(char)rchDevicePathName119,
(char)rchDevicePathName120,
(char)rchDevicePathName121,
(char)rchDevicePathName122,
(char)rchDevicePathName123,
(char)rchDevicePathName124,
(char)rchDevicePathName125,
(char)rchDevicePathName126,
(char)rchDevicePathName127
}).TrimEnd('\0');
}
}
public byte rchInputPathName0,rchInputPathName1,rchInputPathName2,rchInputPathName3,rchInputPathName4,rchInputPathName5,rchInputPathName6,rchInputPathName7,rchInputPathName8,rchInputPathName9,rchInputPathName10,rchInputPathName11,rchInputPathName12,rchInputPathName13,rchInputPathName14,rchInputPathName15,rchInputPathName16,rchInputPathName17,rchInputPathName18,rchInputPathName19,rchInputPathName20,rchInputPathName21,rchInputPathName22,rchInputPathName23,rchInputPathName24,rchInputPathName25,rchInputPathName26,rchInputPathName27,rchInputPathName28,rchInputPathName29,rchInputPathName30,rchInputPathName31,rchInputPathName32,rchInputPathName33,rchInputPathName34,rchInputPathName35,rchInputPathName36,rchInputPathName37,rchInputPathName38,rchInputPathName39,rchInputPathName40,rchInputPathName41,rchInputPathName42,rchInputPathName43,rchInputPathName44,rchInputPathName45,rchInputPathName46,rchInputPathName47,rchInputPathName48,rchInputPathName49,rchInputPathName50,rchInputPathName51,rchInputPathName52,rchInputPathName53,rchInputPathName54,rchInputPathName55,rchInputPathName56,rchInputPathName57,rchInputPathName58,rchInputPathName59,rchInputPathName60,rchInputPathName61,rchInputPathName62,rchInputPathName63,rchInputPathName64,rchInputPathName65,rchInputPathName66,rchInputPathName67,rchInputPathName68,rchInputPathName69,rchInputPathName70,rchInputPathName71,rchInputPathName72,rchInputPathName73,rchInputPathName74,rchInputPathName75,rchInputPathName76,rchInputPathName77,rchInputPathName78,rchInputPathName79,rchInputPathName80,rchInputPathName81,rchInputPathName82,rchInputPathName83,rchInputPathName84,rchInputPathName85,rchInputPathName86,rchInputPathName87,rchInputPathName88,rchInputPathName89,rchInputPathName90,rchInputPathName91,rchInputPathName92,rchInputPathName93,rchInputPathName94,rchInputPathName95,rchInputPathName96,rchInputPathName97,rchInputPathName98,rchInputPathName99,rchInputPathName100,rchInputPathName101,rchInputPathName102,rchInputPathName103,rchInputPathName104,rchInputPathName105,rchInputPathName106,rchInputPathName107,rchInputPathName108,rchInputPathName109,rchInputPathName110,rchInputPathName111,rchInputPathName112,rchInputPathName113,rchInputPathName114,rchInputPathName115,rchInputPathName116,rchInputPathName117,rchInputPathName118,rchInputPathName119,rchInputPathName120,rchInputPathName121,rchInputPathName122,rchInputPathName123,rchInputPathName124,rchInputPathName125,rchInputPathName126,rchInputPathName127;
public string rchInputPathName
{
get
{
return new string(new char[] {
(char)rchInputPathName0,
(char)rchInputPathName1,
(char)rchInputPathName2,
(char)rchInputPathName3,
(char)rchInputPathName4,
(char)rchInputPathName5,
(char)rchInputPathName6,
(char)rchInputPathName7,
(char)rchInputPathName8,
(char)rchInputPathName9,
(char)rchInputPathName10,
(char)rchInputPathName11,
(char)rchInputPathName12,
(char)rchInputPathName13,
(char)rchInputPathName14,
(char)rchInputPathName15,
(char)rchInputPathName16,
(char)rchInputPathName17,
(char)rchInputPathName18,
(char)rchInputPathName19,
(char)rchInputPathName20,
(char)rchInputPathName21,
(char)rchInputPathName22,
(char)rchInputPathName23,
(char)rchInputPathName24,
(char)rchInputPathName25,
(char)rchInputPathName26,
(char)rchInputPathName27,
(char)rchInputPathName28,
(char)rchInputPathName29,
(char)rchInputPathName30,
(char)rchInputPathName31,
(char)rchInputPathName32,
(char)rchInputPathName33,
(char)rchInputPathName34,
(char)rchInputPathName35,
(char)rchInputPathName36,
(char)rchInputPathName37,
(char)rchInputPathName38,
(char)rchInputPathName39,
(char)rchInputPathName40,
(char)rchInputPathName41,
(char)rchInputPathName42,
(char)rchInputPathName43,
(char)rchInputPathName44,
(char)rchInputPathName45,
(char)rchInputPathName46,
(char)rchInputPathName47,
(char)rchInputPathName48,
(char)rchInputPathName49,
(char)rchInputPathName50,
(char)rchInputPathName51,
(char)rchInputPathName52,
(char)rchInputPathName53,
(char)rchInputPathName54,
(char)rchInputPathName55,
(char)rchInputPathName56,
(char)rchInputPathName57,
(char)rchInputPathName58,
(char)rchInputPathName59,
(char)rchInputPathName60,
(char)rchInputPathName61,
(char)rchInputPathName62,
(char)rchInputPathName63,
(char)rchInputPathName64,
(char)rchInputPathName65,
(char)rchInputPathName66,
(char)rchInputPathName67,
(char)rchInputPathName68,
(char)rchInputPathName69,
(char)rchInputPathName70,
(char)rchInputPathName71,
(char)rchInputPathName72,
(char)rchInputPathName73,
(char)rchInputPathName74,
(char)rchInputPathName75,
(char)rchInputPathName76,
(char)rchInputPathName77,
(char)rchInputPathName78,
(char)rchInputPathName79,
(char)rchInputPathName80,
(char)rchInputPathName81,
(char)rchInputPathName82,
(char)rchInputPathName83,
(char)rchInputPathName84,
(char)rchInputPathName85,
(char)rchInputPathName86,
(char)rchInputPathName87,
(char)rchInputPathName88,
(char)rchInputPathName89,
(char)rchInputPathName90,
(char)rchInputPathName91,
(char)rchInputPathName92,
(char)rchInputPathName93,
(char)rchInputPathName94,
(char)rchInputPathName95,
(char)rchInputPathName96,
(char)rchInputPathName97,
(char)rchInputPathName98,
(char)rchInputPathName99,
(char)rchInputPathName100,
(char)rchInputPathName101,
(char)rchInputPathName102,
(char)rchInputPathName103,
(char)rchInputPathName104,
(char)rchInputPathName105,
(char)rchInputPathName106,
(char)rchInputPathName107,
(char)rchInputPathName108,
(char)rchInputPathName109,
(char)rchInputPathName110,
(char)rchInputPathName111,
(char)rchInputPathName112,
(char)rchInputPathName113,
(char)rchInputPathName114,
(char)rchInputPathName115,
(char)rchInputPathName116,
(char)rchInputPathName117,
(char)rchInputPathName118,
(char)rchInputPathName119,
(char)rchInputPathName120,
(char)rchInputPathName121,
(char)rchInputPathName122,
(char)rchInputPathName123,
(char)rchInputPathName124,
(char)rchInputPathName125,
(char)rchInputPathName126,
(char)rchInputPathName127
}).TrimEnd('\0');
}
}
public byte rchModeName0,rchModeName1,rchModeName2,rchModeName3,rchModeName4,rchModeName5,rchModeName6,rchModeName7,rchModeName8,rchModeName9,rchModeName10,rchModeName11,rchModeName12,rchModeName13,rchModeName14,rchModeName15,rchModeName16,rchModeName17,rchModeName18,rchModeName19,rchModeName20,rchModeName21,rchModeName22,rchModeName23,rchModeName24,rchModeName25,rchModeName26,rchModeName27,rchModeName28,rchModeName29,rchModeName30,rchModeName31,rchModeName32,rchModeName33,rchModeName34,rchModeName35,rchModeName36,rchModeName37,rchModeName38,rchModeName39,rchModeName40,rchModeName41,rchModeName42,rchModeName43,rchModeName44,rchModeName45,rchModeName46,rchModeName47,rchModeName48,rchModeName49,rchModeName50,rchModeName51,rchModeName52,rchModeName53,rchModeName54,rchModeName55,rchModeName56,rchModeName57,rchModeName58,rchModeName59,rchModeName60,rchModeName61,rchModeName62,rchModeName63,rchModeName64,rchModeName65,rchModeName66,rchModeName67,rchModeName68,rchModeName69,rchModeName70,rchModeName71,rchModeName72,rchModeName73,rchModeName74,rchModeName75,rchModeName76,rchModeName77,rchModeName78,rchModeName79,rchModeName80,rchModeName81,rchModeName82,rchModeName83,rchModeName84,rchModeName85,rchModeName86,rchModeName87,rchModeName88,rchModeName89,rchModeName90,rchModeName91,rchModeName92,rchModeName93,rchModeName94,rchModeName95,rchModeName96,rchModeName97,rchModeName98,rchModeName99,rchModeName100,rchModeName101,rchModeName102,rchModeName103,rchModeName104,rchModeName105,rchModeName106,rchModeName107,rchModeName108,rchModeName109,rchModeName110,rchModeName111,rchModeName112,rchModeName113,rchModeName114,rchModeName115,rchModeName116,rchModeName117,rchModeName118,rchModeName119,rchModeName120,rchModeName121,rchModeName122,rchModeName123,rchModeName124,rchModeName125,rchModeName126,rchModeName127;
public string rchModeName
{
get
{
return new string(new char[] {
(char)rchModeName0,
(char)rchModeName1,
(char)rchModeName2,
(char)rchModeName3,
(char)rchModeName4,
(char)rchModeName5,
(char)rchModeName6,
(char)rchModeName7,
(char)rchModeName8,
(char)rchModeName9,
(char)rchModeName10,
(char)rchModeName11,
(char)rchModeName12,
(char)rchModeName13,
(char)rchModeName14,
(char)rchModeName15,
(char)rchModeName16,
(char)rchModeName17,
(char)rchModeName18,
(char)rchModeName19,
(char)rchModeName20,
(char)rchModeName21,
(char)rchModeName22,
(char)rchModeName23,
(char)rchModeName24,
(char)rchModeName25,
(char)rchModeName26,
(char)rchModeName27,
(char)rchModeName28,
(char)rchModeName29,
(char)rchModeName30,
(char)rchModeName31,
(char)rchModeName32,
(char)rchModeName33,
(char)rchModeName34,
(char)rchModeName35,
(char)rchModeName36,
(char)rchModeName37,
(char)rchModeName38,
(char)rchModeName39,
(char)rchModeName40,
(char)rchModeName41,
(char)rchModeName42,
(char)rchModeName43,
(char)rchModeName44,
(char)rchModeName45,
(char)rchModeName46,
(char)rchModeName47,
(char)rchModeName48,
(char)rchModeName49,
(char)rchModeName50,
(char)rchModeName51,
(char)rchModeName52,
(char)rchModeName53,
(char)rchModeName54,
(char)rchModeName55,
(char)rchModeName56,
(char)rchModeName57,
(char)rchModeName58,
(char)rchModeName59,
(char)rchModeName60,
(char)rchModeName61,
(char)rchModeName62,
(char)rchModeName63,
(char)rchModeName64,
(char)rchModeName65,
(char)rchModeName66,
(char)rchModeName67,
(char)rchModeName68,
(char)rchModeName69,
(char)rchModeName70,
(char)rchModeName71,
(char)rchModeName72,
(char)rchModeName73,
(char)rchModeName74,
(char)rchModeName75,
(char)rchModeName76,
(char)rchModeName77,
(char)rchModeName78,
(char)rchModeName79,
(char)rchModeName80,
(char)rchModeName81,
(char)rchModeName82,
(char)rchModeName83,
(char)rchModeName84,
(char)rchModeName85,
(char)rchModeName86,
(char)rchModeName87,
(char)rchModeName88,
(char)rchModeName89,
(char)rchModeName90,
(char)rchModeName91,
(char)rchModeName92,
(char)rchModeName93,
(char)rchModeName94,
(char)rchModeName95,
(char)rchModeName96,
(char)rchModeName97,
(char)rchModeName98,
(char)rchModeName99,
(char)rchModeName100,
(char)rchModeName101,
(char)rchModeName102,
(char)rchModeName103,
(char)rchModeName104,
(char)rchModeName105,
(char)rchModeName106,
(char)rchModeName107,
(char)rchModeName108,
(char)rchModeName109,
(char)rchModeName110,
(char)rchModeName111,
(char)rchModeName112,
(char)rchModeName113,
(char)rchModeName114,
(char)rchModeName115,
(char)rchModeName116,
(char)rchModeName117,
(char)rchModeName118,
(char)rchModeName119,
(char)rchModeName120,
(char)rchModeName121,
(char)rchModeName122,
(char)rchModeName123,
(char)rchModeName124,
(char)rchModeName125,
(char)rchModeName126,
(char)rchModeName127
}).TrimEnd('\0');
}
}
public byte rchSlotName0,rchSlotName1,rchSlotName2,rchSlotName3,rchSlotName4,rchSlotName5,rchSlotName6,rchSlotName7,rchSlotName8,rchSlotName9,rchSlotName10,rchSlotName11,rchSlotName12,rchSlotName13,rchSlotName14,rchSlotName15,rchSlotName16,rchSlotName17,rchSlotName18,rchSlotName19,rchSlotName20,rchSlotName21,rchSlotName22,rchSlotName23,rchSlotName24,rchSlotName25,rchSlotName26,rchSlotName27,rchSlotName28,rchSlotName29,rchSlotName30,rchSlotName31,rchSlotName32,rchSlotName33,rchSlotName34,rchSlotName35,rchSlotName36,rchSlotName37,rchSlotName38,rchSlotName39,rchSlotName40,rchSlotName41,rchSlotName42,rchSlotName43,rchSlotName44,rchSlotName45,rchSlotName46,rchSlotName47,rchSlotName48,rchSlotName49,rchSlotName50,rchSlotName51,rchSlotName52,rchSlotName53,rchSlotName54,rchSlotName55,rchSlotName56,rchSlotName57,rchSlotName58,rchSlotName59,rchSlotName60,rchSlotName61,rchSlotName62,rchSlotName63,rchSlotName64,rchSlotName65,rchSlotName66,rchSlotName67,rchSlotName68,rchSlotName69,rchSlotName70,rchSlotName71,rchSlotName72,rchSlotName73,rchSlotName74,rchSlotName75,rchSlotName76,rchSlotName77,rchSlotName78,rchSlotName79,rchSlotName80,rchSlotName81,rchSlotName82,rchSlotName83,rchSlotName84,rchSlotName85,rchSlotName86,rchSlotName87,rchSlotName88,rchSlotName89,rchSlotName90,rchSlotName91,rchSlotName92,rchSlotName93,rchSlotName94,rchSlotName95,rchSlotName96,rchSlotName97,rchSlotName98,rchSlotName99,rchSlotName100,rchSlotName101,rchSlotName102,rchSlotName103,rchSlotName104,rchSlotName105,rchSlotName106,rchSlotName107,rchSlotName108,rchSlotName109,rchSlotName110,rchSlotName111,rchSlotName112,rchSlotName113,rchSlotName114,rchSlotName115,rchSlotName116,rchSlotName117,rchSlotName118,rchSlotName119,rchSlotName120,rchSlotName121,rchSlotName122,rchSlotName123,rchSlotName124,rchSlotName125,rchSlotName126,rchSlotName127;
public string rchSlotName
{
get
{
return new string(new char[] {
(char)rchSlotName0,
(char)rchSlotName1,
(char)rchSlotName2,
(char)rchSlotName3,
(char)rchSlotName4,
(char)rchSlotName5,
(char)rchSlotName6,
(char)rchSlotName7,
(char)rchSlotName8,
(char)rchSlotName9,
(char)rchSlotName10,
(char)rchSlotName11,
(char)rchSlotName12,
(char)rchSlotName13,
(char)rchSlotName14,
(char)rchSlotName15,
(char)rchSlotName16,
(char)rchSlotName17,
(char)rchSlotName18,
(char)rchSlotName19,
(char)rchSlotName20,
(char)rchSlotName21,
(char)rchSlotName22,
(char)rchSlotName23,
(char)rchSlotName24,
(char)rchSlotName25,
(char)rchSlotName26,
(char)rchSlotName27,
(char)rchSlotName28,
(char)rchSlotName29,
(char)rchSlotName30,
(char)rchSlotName31,
(char)rchSlotName32,
(char)rchSlotName33,
(char)rchSlotName34,
(char)rchSlotName35,
(char)rchSlotName36,
(char)rchSlotName37,
(char)rchSlotName38,
(char)rchSlotName39,
(char)rchSlotName40,
(char)rchSlotName41,
(char)rchSlotName42,
(char)rchSlotName43,
(char)rchSlotName44,
(char)rchSlotName45,
(char)rchSlotName46,
(char)rchSlotName47,
(char)rchSlotName48,
(char)rchSlotName49,
(char)rchSlotName50,
(char)rchSlotName51,
(char)rchSlotName52,
(char)rchSlotName53,
(char)rchSlotName54,
(char)rchSlotName55,
(char)rchSlotName56,
(char)rchSlotName57,
(char)rchSlotName58,
(char)rchSlotName59,
(char)rchSlotName60,
(char)rchSlotName61,
(char)rchSlotName62,
(char)rchSlotName63,
(char)rchSlotName64,
(char)rchSlotName65,
(char)rchSlotName66,
(char)rchSlotName67,
(char)rchSlotName68,
(char)rchSlotName69,
(char)rchSlotName70,
(char)rchSlotName71,
(char)rchSlotName72,
(char)rchSlotName73,
(char)rchSlotName74,
(char)rchSlotName75,
(char)rchSlotName76,
(char)rchSlotName77,
(char)rchSlotName78,
(char)rchSlotName79,
(char)rchSlotName80,
(char)rchSlotName81,
(char)rchSlotName82,
(char)rchSlotName83,
(char)rchSlotName84,
(char)rchSlotName85,
(char)rchSlotName86,
(char)rchSlotName87,
(char)rchSlotName88,
(char)rchSlotName89,
(char)rchSlotName90,
(char)rchSlotName91,
(char)rchSlotName92,
(char)rchSlotName93,
(char)rchSlotName94,
(char)rchSlotName95,
(char)rchSlotName96,
(char)rchSlotName97,
(char)rchSlotName98,
(char)rchSlotName99,
(char)rchSlotName100,
(char)rchSlotName101,
(char)rchSlotName102,
(char)rchSlotName103,
(char)rchSlotName104,
(char)rchSlotName105,
(char)rchSlotName106,
(char)rchSlotName107,
(char)rchSlotName108,
(char)rchSlotName109,
(char)rchSlotName110,
(char)rchSlotName111,
(char)rchSlotName112,
(char)rchSlotName113,
(char)rchSlotName114,
(char)rchSlotName115,
(char)rchSlotName116,
(char)rchSlotName117,
(char)rchSlotName118,
(char)rchSlotName119,
(char)rchSlotName120,
(char)rchSlotName121,
(char)rchSlotName122,
(char)rchSlotName123,
(char)rchSlotName124,
(char)rchSlotName125,
(char)rchSlotName126,
(char)rchSlotName127
}).TrimEnd('\0');
}
}
public byte rchInputSourceType0,rchInputSourceType1,rchInputSourceType2,rchInputSourceType3,rchInputSourceType4,rchInputSourceType5,rchInputSourceType6,rchInputSourceType7,rchInputSourceType8,rchInputSourceType9,rchInputSourceType10,rchInputSourceType11,rchInputSourceType12,rchInputSourceType13,rchInputSourceType14,rchInputSourceType15,rchInputSourceType16,rchInputSourceType17,rchInputSourceType18,rchInputSourceType19,rchInputSourceType20,rchInputSourceType21,rchInputSourceType22,rchInputSourceType23,rchInputSourceType24,rchInputSourceType25,rchInputSourceType26,rchInputSourceType27,rchInputSourceType28,rchInputSourceType29,rchInputSourceType30,rchInputSourceType31;
public string rchInputSourceType
{
get
{
return new string(new char[] {
(char)rchInputSourceType0,
(char)rchInputSourceType1,
(char)rchInputSourceType2,
(char)rchInputSourceType3,
(char)rchInputSourceType4,
(char)rchInputSourceType5,
(char)rchInputSourceType6,
(char)rchInputSourceType7,
(char)rchInputSourceType8,
(char)rchInputSourceType9,
(char)rchInputSourceType10,
(char)rchInputSourceType11,
(char)rchInputSourceType12,
(char)rchInputSourceType13,
(char)rchInputSourceType14,
(char)rchInputSourceType15,
(char)rchInputSourceType16,
(char)rchInputSourceType17,
(char)rchInputSourceType18,
(char)rchInputSourceType19,
(char)rchInputSourceType20,
(char)rchInputSourceType21,
(char)rchInputSourceType22,
(char)rchInputSourceType23,
(char)rchInputSourceType24,
(char)rchInputSourceType25,
(char)rchInputSourceType26,
(char)rchInputSourceType27,
(char)rchInputSourceType28,
(char)rchInputSourceType29,
(char)rchInputSourceType30,
(char)rchInputSourceType31
}).TrimEnd('\0');
}
}
}
[StructLayout(LayoutKind.Sequential)] public struct VRActiveActionSet_t
{
public ulong ulActionSet;
public ulong ulRestrictedToDevice;
public ulong ulSecondaryActionSet;
public uint unPadding;
public int nPriority;
}
[StructLayout(LayoutKind.Sequential)] public struct VRSkeletalSummaryData_t
{
public float flFingerCurl0; //float[5]
public float flFingerCurl1;
public float flFingerCurl2;
public float flFingerCurl3;
public float flFingerCurl4;
public float flFingerSplay0; //float[4]
public float flFingerSplay1;
public float flFingerSplay2;
public float flFingerSplay3;
}
[StructLayout(LayoutKind.Sequential)] public struct SpatialAnchorPose_t
{
public HmdMatrix34_t mAnchorToAbsoluteTracking;
}
[StructLayout(LayoutKind.Sequential)] public struct COpenVRContext
{
public IntPtr m_pVRSystem; // class vr::IVRSystem *
public IntPtr m_pVRChaperone; // class vr::IVRChaperone *
public IntPtr m_pVRChaperoneSetup; // class vr::IVRChaperoneSetup *
public IntPtr m_pVRCompositor; // class vr::IVRCompositor *
public IntPtr m_pVRHeadsetView; // class vr::IVRHeadsetView *
public IntPtr m_pVROverlay; // class vr::IVROverlay *
public IntPtr m_pVROverlayView; // class vr::IVROverlayView *
public IntPtr m_pVRResources; // class vr::IVRResources *
public IntPtr m_pVRRenderModels; // class vr::IVRRenderModels *
public IntPtr m_pVRExtendedDisplay; // class vr::IVRExtendedDisplay *
public IntPtr m_pVRSettings; // class vr::IVRSettings *
public IntPtr m_pVRApplications; // class vr::IVRApplications *
public IntPtr m_pVRTrackedCamera; // class vr::IVRTrackedCamera *
public IntPtr m_pVRScreenshots; // class vr::IVRScreenshots *
public IntPtr m_pVRDriverManager; // class vr::IVRDriverManager *
public IntPtr m_pVRInput; // class vr::IVRInput *
public IntPtr m_pVRIOBuffer; // class vr::IVRIOBuffer *
public IntPtr m_pVRSpatialAnchors; // class vr::IVRSpatialAnchors *
public IntPtr m_pVRDebug; // class vr::IVRDebug *
public IntPtr m_pVRNotifications; // class vr::IVRNotifications *
}
[StructLayout(LayoutKind.Sequential)] public struct PropertyWrite_t
{
public ETrackedDeviceProperty prop;
public EPropertyWriteType writeType;
public ETrackedPropertyError eSetError;
public IntPtr pvBuffer; // void *
public uint unBufferSize;
public uint unTag;
public ETrackedPropertyError eError;
}
[StructLayout(LayoutKind.Sequential)] public struct PropertyRead_t
{
public ETrackedDeviceProperty prop;
public IntPtr pvBuffer; // void *
public uint unBufferSize;
public uint unTag;
public uint unRequiredBufferSize;
public ETrackedPropertyError eError;
}
[StructLayout(LayoutKind.Sequential)] public struct CVRPropertyHelpers
{
public IntPtr m_pProperties; // class vr::IVRProperties *
}
[StructLayout(LayoutKind.Sequential)] public struct PathWrite_t
{
public ulong ulPath;
public EPropertyWriteType writeType;
public ETrackedPropertyError eSetError;
public IntPtr pvBuffer; // void *
public uint unBufferSize;
public uint unTag;
public ETrackedPropertyError eError;
public IntPtr pszPath; // const char *
}
[StructLayout(LayoutKind.Sequential)] public struct PathRead_t
{
public ulong ulPath;
public IntPtr pvBuffer; // void *
public uint unBufferSize;
public uint unTag;
public uint unRequiredBufferSize;
public ETrackedPropertyError eError;
public IntPtr pszPath; // const char *
}
public class OpenVR
{
public static uint InitInternal(ref EVRInitError peError, EVRApplicationType eApplicationType)
{
return OpenVRInterop.InitInternal(ref peError, eApplicationType);
}
public static uint InitInternal2(ref EVRInitError peError, EVRApplicationType eApplicationType, string pchStartupInfo)
{
return OpenVRInterop.InitInternal2(ref peError, eApplicationType, pchStartupInfo);
}
public static void ShutdownInternal()
{
OpenVRInterop.ShutdownInternal();
}
public static bool IsHmdPresent()
{
return OpenVRInterop.IsHmdPresent();
}
public static bool IsRuntimeInstalled()
{
return OpenVRInterop.IsRuntimeInstalled();
}
public static string RuntimePath()
{
try
{
uint pathSize = 512;
uint requiredPathSize = 512;
System.Text.StringBuilder path = new System.Text.StringBuilder((int)pathSize);
bool success = OpenVRInterop.GetRuntimePath(path, pathSize, ref requiredPathSize);
if (success == false)
{
return null;
}
return path.ToString();
} catch
{
return OpenVRInterop.RuntimePath(); //this api is deprecated but here to support older unity versions
}
}
public static string GetStringForHmdError(EVRInitError error)
{
return Marshal.PtrToStringAnsi(OpenVRInterop.GetStringForHmdError(error));
}
public static IntPtr GetGenericInterface(string pchInterfaceVersion, ref EVRInitError peError)
{
return OpenVRInterop.GetGenericInterface(pchInterfaceVersion, ref peError);
}
public static bool IsInterfaceVersionValid(string pchInterfaceVersion)
{
return OpenVRInterop.IsInterfaceVersionValid(pchInterfaceVersion);
}
public static uint GetInitToken()
{
return OpenVRInterop.GetInitToken();
}
public const uint k_nDriverNone = 4294967295;
public const uint k_unMaxDriverDebugResponseSize = 32768;
public const uint k_unTrackedDeviceIndex_Hmd = 0;
public const uint k_unMaxTrackedDeviceCount = 64;
public const uint k_unTrackedDeviceIndexOther = 4294967294;
public const uint k_unTrackedDeviceIndexInvalid = 4294967295;
public const ulong k_ulInvalidPropertyContainer = 0;
public const uint k_unInvalidPropertyTag = 0;
public const ulong k_ulInvalidDriverHandle = 0;
public const uint k_unFloatPropertyTag = 1;
public const uint k_unInt32PropertyTag = 2;
public const uint k_unUint64PropertyTag = 3;
public const uint k_unBoolPropertyTag = 4;
public const uint k_unStringPropertyTag = 5;
public const uint k_unErrorPropertyTag = 6;
public const uint k_unDoublePropertyTag = 7;
public const uint k_unHmdMatrix34PropertyTag = 20;
public const uint k_unHmdMatrix44PropertyTag = 21;
public const uint k_unHmdVector3PropertyTag = 22;
public const uint k_unHmdVector4PropertyTag = 23;
public const uint k_unHmdVector2PropertyTag = 24;
public const uint k_unHmdQuadPropertyTag = 25;
public const uint k_unHiddenAreaPropertyTag = 30;
public const uint k_unPathHandleInfoTag = 31;
public const uint k_unActionPropertyTag = 32;
public const uint k_unInputValuePropertyTag = 33;
public const uint k_unWildcardPropertyTag = 34;
public const uint k_unHapticVibrationPropertyTag = 35;
public const uint k_unSkeletonPropertyTag = 36;
public const uint k_unSpatialAnchorPosePropertyTag = 40;
public const uint k_unJsonPropertyTag = 41;
public const uint k_unActiveActionSetPropertyTag = 42;
public const uint k_unOpenVRInternalReserved_Start = 1000;
public const uint k_unOpenVRInternalReserved_End = 10000;
public const uint k_unMaxPropertyStringSize = 32768;
public const ulong k_ulInvalidActionHandle = 0;
public const ulong k_ulInvalidActionSetHandle = 0;
public const ulong k_ulInvalidInputValueHandle = 0;
public const uint k_unControllerStateAxisCount = 5;
public const ulong k_ulOverlayHandleInvalid = 0;
public const uint k_unMaxDistortionFunctionParameters = 8;
public const uint k_unScreenshotHandleInvalid = 0;
public const string IVRSystem_Version = "IVRSystem_021";
public const string IVRExtendedDisplay_Version = "IVRExtendedDisplay_001";
public const string IVRTrackedCamera_Version = "IVRTrackedCamera_006";
public const uint k_unMaxApplicationKeyLength = 128;
public const string k_pch_MimeType_HomeApp = "vr/home";
public const string k_pch_MimeType_GameTheater = "vr/game_theater";
public const string IVRApplications_Version = "IVRApplications_007";
public const string IVRChaperone_Version = "IVRChaperone_003";
public const string IVRChaperoneSetup_Version = "IVRChaperoneSetup_006";
public const string IVRCompositor_Version = "IVRCompositor_026";
public const uint k_unVROverlayMaxKeyLength = 128;
public const uint k_unVROverlayMaxNameLength = 128;
public const uint k_unMaxOverlayCount = 128;
public const uint k_unMaxOverlayIntersectionMaskPrimitivesCount = 32;
public const string IVROverlay_Version = "IVROverlay_024";
public const string IVROverlayView_Version = "IVROverlayView_003";
public const uint k_unHeadsetViewMaxWidth = 3840;
public const uint k_unHeadsetViewMaxHeight = 2160;
public const string k_pchHeadsetViewOverlayKey = "system.HeadsetView";
public const string IVRHeadsetView_Version = "IVRHeadsetView_001";
public const string k_pch_Controller_Component_GDC2015 = "gdc2015";
public const string k_pch_Controller_Component_Base = "base";
public const string k_pch_Controller_Component_Tip = "tip";
public const string k_pch_Controller_Component_HandGrip = "handgrip";
public const string k_pch_Controller_Component_Status = "status";
public const string IVRRenderModels_Version = "IVRRenderModels_006";
public const uint k_unNotificationTextMaxSize = 256;
public const string IVRNotifications_Version = "IVRNotifications_002";
public const uint k_unMaxSettingsKeyLength = 128;
public const string IVRSettings_Version = "IVRSettings_003";
public const string k_pch_SteamVR_Section = "steamvr";
public const string k_pch_SteamVR_RequireHmd_String = "requireHmd";
public const string k_pch_SteamVR_ForcedDriverKey_String = "forcedDriver";
public const string k_pch_SteamVR_ForcedHmdKey_String = "forcedHmd";
public const string k_pch_SteamVR_DisplayDebug_Bool = "displayDebug";
public const string k_pch_SteamVR_DebugProcessPipe_String = "debugProcessPipe";
public const string k_pch_SteamVR_DisplayDebugX_Int32 = "displayDebugX";
public const string k_pch_SteamVR_DisplayDebugY_Int32 = "displayDebugY";
public const string k_pch_SteamVR_SendSystemButtonToAllApps_Bool = "sendSystemButtonToAllApps";
public const string k_pch_SteamVR_LogLevel_Int32 = "loglevel";
public const string k_pch_SteamVR_IPD_Float = "ipd";
public const string k_pch_SteamVR_Background_String = "background";
public const string k_pch_SteamVR_BackgroundUseDomeProjection_Bool = "backgroundUseDomeProjection";
public const string k_pch_SteamVR_BackgroundCameraHeight_Float = "backgroundCameraHeight";
public const string k_pch_SteamVR_BackgroundDomeRadius_Float = "backgroundDomeRadius";
public const string k_pch_SteamVR_GridColor_String = "gridColor";
public const string k_pch_SteamVR_PlayAreaColor_String = "playAreaColor";
public const string k_pch_SteamVR_TrackingLossColor_String = "trackingLossColor";
public const string k_pch_SteamVR_ShowStage_Bool = "showStage";
public const string k_pch_SteamVR_ActivateMultipleDrivers_Bool = "activateMultipleDrivers";
public const string k_pch_SteamVR_UsingSpeakers_Bool = "usingSpeakers";
public const string k_pch_SteamVR_SpeakersForwardYawOffsetDegrees_Float = "speakersForwardYawOffsetDegrees";
public const string k_pch_SteamVR_BaseStationPowerManagement_Int32 = "basestationPowerManagement";
public const string k_pch_SteamVR_ShowBaseStationPowerManagementTip_Int32 = "ShowBaseStationPowerManagementTip";
public const string k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses";
public const string k_pch_SteamVR_SupersampleScale_Float = "supersampleScale";
public const string k_pch_SteamVR_MaxRecommendedResolution_Int32 = "maxRecommendedResolution";
public const string k_pch_SteamVR_MotionSmoothing_Bool = "motionSmoothing";
public const string k_pch_SteamVR_MotionSmoothingOverride_Int32 = "motionSmoothingOverride";
public const string k_pch_SteamVR_DisableAsyncReprojection_Bool = "disableAsync";
public const string k_pch_SteamVR_ForceFadeOnBadTracking_Bool = "forceFadeOnBadTracking";
public const string k_pch_SteamVR_DefaultMirrorView_Int32 = "mirrorView";
public const string k_pch_SteamVR_ShowLegacyMirrorView_Bool = "showLegacyMirrorView";
public const string k_pch_SteamVR_MirrorViewVisibility_Bool = "showMirrorView";
public const string k_pch_SteamVR_MirrorViewDisplayMode_Int32 = "mirrorViewDisplayMode";
public const string k_pch_SteamVR_MirrorViewEye_Int32 = "mirrorViewEye";
public const string k_pch_SteamVR_MirrorViewGeometry_String = "mirrorViewGeometry";
public const string k_pch_SteamVR_MirrorViewGeometryMaximized_String = "mirrorViewGeometryMaximized";
public const string k_pch_SteamVR_PerfGraphVisibility_Bool = "showPerfGraph";
public const string k_pch_SteamVR_StartMonitorFromAppLaunch = "startMonitorFromAppLaunch";
public const string k_pch_SteamVR_StartCompositorFromAppLaunch_Bool = "startCompositorFromAppLaunch";
public const string k_pch_SteamVR_StartDashboardFromAppLaunch_Bool = "startDashboardFromAppLaunch";
public const string k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool = "startOverlayAppsFromDashboard";
public const string k_pch_SteamVR_EnableHomeApp = "enableHomeApp";
public const string k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32 = "CycleBackgroundImageTimeSec";
public const string k_pch_SteamVR_RetailDemo_Bool = "retailDemo";
public const string k_pch_SteamVR_IpdOffset_Float = "ipdOffset";
public const string k_pch_SteamVR_AllowSupersampleFiltering_Bool = "allowSupersampleFiltering";
public const string k_pch_SteamVR_SupersampleManualOverride_Bool = "supersampleManualOverride";
public const string k_pch_SteamVR_EnableLinuxVulkanAsync_Bool = "enableLinuxVulkanAsync";
public const string k_pch_SteamVR_AllowDisplayLockedMode_Bool = "allowDisplayLockedMode";
public const string k_pch_SteamVR_HaveStartedTutorialForNativeChaperoneDriver_Bool = "haveStartedTutorialForNativeChaperoneDriver";
public const string k_pch_SteamVR_ForceWindows32bitVRMonitor = "forceWindows32BitVRMonitor";
public const string k_pch_SteamVR_DebugInputBinding = "debugInputBinding";
public const string k_pch_SteamVR_DoNotFadeToGrid = "doNotFadeToGrid";
public const string k_pch_SteamVR_RenderCameraMode = "renderCameraMode";
public const string k_pch_SteamVR_EnableSharedResourceJournaling = "enableSharedResourceJournaling";
public const string k_pch_SteamVR_EnableSafeMode = "enableSafeMode";
public const string k_pch_SteamVR_PreferredRefreshRate = "preferredRefreshRate";
public const string k_pch_SteamVR_LastVersionNotice = "lastVersionNotice";
public const string k_pch_SteamVR_LastVersionNoticeDate = "lastVersionNoticeDate";
public const string k_pch_SteamVR_HmdDisplayColorGainR_Float = "hmdDisplayColorGainR";
public const string k_pch_SteamVR_HmdDisplayColorGainG_Float = "hmdDisplayColorGainG";
public const string k_pch_SteamVR_HmdDisplayColorGainB_Float = "hmdDisplayColorGainB";
public const string k_pch_SteamVR_CustomIconStyle_String = "customIconStyle";
public const string k_pch_SteamVR_CustomOffIconStyle_String = "customOffIconStyle";
public const string k_pch_SteamVR_CustomIconForceUpdate_String = "customIconForceUpdate";
public const string k_pch_SteamVR_AllowGlobalActionSetPriority = "globalActionSetPriority";
public const string k_pch_SteamVR_OverlayRenderQuality = "overlayRenderQuality_2";
public const string k_pch_SteamVR_BlockOculusSDKOnOpenVRLaunchOption_Bool = "blockOculusSDKOnOpenVRLaunchOption";
public const string k_pch_SteamVR_BlockOculusSDKOnAllLaunches_Bool = "blockOculusSDKOnAllLaunches";
public const string k_pch_DirectMode_Section = "direct_mode";
public const string k_pch_DirectMode_Enable_Bool = "enable";
public const string k_pch_DirectMode_Count_Int32 = "count";
public const string k_pch_DirectMode_EdidVid_Int32 = "edidVid";
public const string k_pch_DirectMode_EdidPid_Int32 = "edidPid";
public const string k_pch_Lighthouse_Section = "driver_lighthouse";
public const string k_pch_Lighthouse_DisableIMU_Bool = "disableimu";
public const string k_pch_Lighthouse_DisableIMUExceptHMD_Bool = "disableimuexcepthmd";
public const string k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation";
public const string k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug";
public const string k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation";
public const string k_pch_Lighthouse_DBHistory_Bool = "dbhistory";
public const string k_pch_Lighthouse_EnableBluetooth_Bool = "enableBluetooth";
public const string k_pch_Lighthouse_PowerManagedBaseStations_String = "PowerManagedBaseStations";
public const string k_pch_Lighthouse_PowerManagedBaseStations2_String = "PowerManagedBaseStations2";
public const string k_pch_Lighthouse_InactivityTimeoutForBaseStations_Int32 = "InactivityTimeoutForBaseStations";
public const string k_pch_Lighthouse_EnableImuFallback_Bool = "enableImuFallback";
public const string k_pch_Null_Section = "driver_null";
public const string k_pch_Null_SerialNumber_String = "serialNumber";
public const string k_pch_Null_ModelNumber_String = "modelNumber";
public const string k_pch_Null_WindowX_Int32 = "windowX";
public const string k_pch_Null_WindowY_Int32 = "windowY";
public const string k_pch_Null_WindowWidth_Int32 = "windowWidth";
public const string k_pch_Null_WindowHeight_Int32 = "windowHeight";
public const string k_pch_Null_RenderWidth_Int32 = "renderWidth";
public const string k_pch_Null_RenderHeight_Int32 = "renderHeight";
public const string k_pch_Null_SecondsFromVsyncToPhotons_Float = "secondsFromVsyncToPhotons";
public const string k_pch_Null_DisplayFrequency_Float = "displayFrequency";
public const string k_pch_WindowsMR_Section = "driver_holographic";
public const string k_pch_UserInterface_Section = "userinterface";
public const string k_pch_UserInterface_StatusAlwaysOnTop_Bool = "StatusAlwaysOnTop";
public const string k_pch_UserInterface_MinimizeToTray_Bool = "MinimizeToTray";
public const string k_pch_UserInterface_HidePopupsWhenStatusMinimized_Bool = "HidePopupsWhenStatusMinimized";
public const string k_pch_UserInterface_Screenshots_Bool = "screenshots";
public const string k_pch_UserInterface_ScreenshotType_Int = "screenshotType";
public const string k_pch_Notifications_Section = "notifications";
public const string k_pch_Notifications_DoNotDisturb_Bool = "DoNotDisturb";
public const string k_pch_Keyboard_Section = "keyboard";
public const string k_pch_Keyboard_TutorialCompletions = "TutorialCompletions";
public const string k_pch_Keyboard_ScaleX = "ScaleX";
public const string k_pch_Keyboard_ScaleY = "ScaleY";
public const string k_pch_Keyboard_OffsetLeftX = "OffsetLeftX";
public const string k_pch_Keyboard_OffsetRightX = "OffsetRightX";
public const string k_pch_Keyboard_OffsetY = "OffsetY";
public const string k_pch_Keyboard_Smoothing = "Smoothing";
public const string k_pch_Perf_Section = "perfcheck";
public const string k_pch_Perf_PerfGraphInHMD_Bool = "perfGraphInHMD";
public const string k_pch_Perf_AllowTimingStore_Bool = "allowTimingStore";
public const string k_pch_Perf_SaveTimingsOnExit_Bool = "saveTimingsOnExit";
public const string k_pch_Perf_TestData_Float = "perfTestData";
public const string k_pch_Perf_GPUProfiling_Bool = "GPUProfiling";
public const string k_pch_CollisionBounds_Section = "collisionBounds";
public const string k_pch_CollisionBounds_Style_Int32 = "CollisionBoundsStyle";
public const string k_pch_CollisionBounds_GroundPerimeterOn_Bool = "CollisionBoundsGroundPerimeterOn";
public const string k_pch_CollisionBounds_CenterMarkerOn_Bool = "CollisionBoundsCenterMarkerOn";
public const string k_pch_CollisionBounds_PlaySpaceOn_Bool = "CollisionBoundsPlaySpaceOn";
public const string k_pch_CollisionBounds_FadeDistance_Float = "CollisionBoundsFadeDistance";
public const string k_pch_CollisionBounds_WallHeight_Float = "CollisionBoundsWallHeight";
public const string k_pch_CollisionBounds_ColorGammaR_Int32 = "CollisionBoundsColorGammaR";
public const string k_pch_CollisionBounds_ColorGammaG_Int32 = "CollisionBoundsColorGammaG";
public const string k_pch_CollisionBounds_ColorGammaB_Int32 = "CollisionBoundsColorGammaB";
public const string k_pch_CollisionBounds_ColorGammaA_Int32 = "CollisionBoundsColorGammaA";
public const string k_pch_CollisionBounds_EnableDriverImport = "enableDriverBoundsImport";
public const string k_pch_Camera_Section = "camera";
public const string k_pch_Camera_EnableCamera_Bool = "enableCamera";
public const string k_pch_Camera_EnableCameraInDashboard_Bool = "enableCameraInDashboard";
public const string k_pch_Camera_EnableCameraForCollisionBounds_Bool = "enableCameraForCollisionBounds";
public const string k_pch_Camera_EnableCameraForRoomView_Bool = "enableCameraForRoomView";
public const string k_pch_Camera_BoundsColorGammaR_Int32 = "cameraBoundsColorGammaR";
public const string k_pch_Camera_BoundsColorGammaG_Int32 = "cameraBoundsColorGammaG";
public const string k_pch_Camera_BoundsColorGammaB_Int32 = "cameraBoundsColorGammaB";
public const string k_pch_Camera_BoundsColorGammaA_Int32 = "cameraBoundsColorGammaA";
public const string k_pch_Camera_BoundsStrength_Int32 = "cameraBoundsStrength";
public const string k_pch_Camera_RoomViewMode_Int32 = "cameraRoomViewMode";
public const string k_pch_audio_Section = "audio";
public const string k_pch_audio_SetOsDefaultPlaybackDevice_Bool = "setOsDefaultPlaybackDevice";
public const string k_pch_audio_EnablePlaybackDeviceOverride_Bool = "enablePlaybackDeviceOverride";
public const string k_pch_audio_PlaybackDeviceOverride_String = "playbackDeviceOverride";
public const string k_pch_audio_PlaybackDeviceOverrideName_String = "playbackDeviceOverrideName";
public const string k_pch_audio_SetOsDefaultRecordingDevice_Bool = "setOsDefaultRecordingDevice";
public const string k_pch_audio_EnableRecordingDeviceOverride_Bool = "enableRecordingDeviceOverride";
public const string k_pch_audio_RecordingDeviceOverride_String = "recordingDeviceOverride";
public const string k_pch_audio_RecordingDeviceOverrideName_String = "recordingDeviceOverrideName";
public const string k_pch_audio_EnablePlaybackMirror_Bool = "enablePlaybackMirror";
public const string k_pch_audio_PlaybackMirrorDevice_String = "playbackMirrorDevice";
public const string k_pch_audio_PlaybackMirrorDeviceName_String = "playbackMirrorDeviceName";
public const string k_pch_audio_OldPlaybackMirrorDevice_String = "onPlaybackMirrorDevice";
public const string k_pch_audio_ActiveMirrorDevice_String = "activePlaybackMirrorDevice";
public const string k_pch_audio_EnablePlaybackMirrorIndependentVolume_Bool = "enablePlaybackMirrorIndependentVolume";
public const string k_pch_audio_LastHmdPlaybackDeviceId_String = "lastHmdPlaybackDeviceId";
public const string k_pch_audio_VIVEHDMIGain = "viveHDMIGain";
public const string k_pch_Power_Section = "power";
public const string k_pch_Power_PowerOffOnExit_Bool = "powerOffOnExit";
public const string k_pch_Power_TurnOffScreensTimeout_Float = "turnOffScreensTimeout";
public const string k_pch_Power_TurnOffControllersTimeout_Float = "turnOffControllersTimeout";
public const string k_pch_Power_ReturnToWatchdogTimeout_Float = "returnToWatchdogTimeout";
public const string k_pch_Power_AutoLaunchSteamVROnButtonPress = "autoLaunchSteamVROnButtonPress";
public const string k_pch_Power_PauseCompositorOnStandby_Bool = "pauseCompositorOnStandby";
public const string k_pch_Dashboard_Section = "dashboard";
public const string k_pch_Dashboard_EnableDashboard_Bool = "enableDashboard";
public const string k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode";
public const string k_pch_Dashboard_Position = "position";
public const string k_pch_Dashboard_DesktopScale = "desktopScale";
public const string k_pch_Dashboard_DashboardScale = "dashboardScale";
public const string k_pch_modelskin_Section = "modelskins";
public const string k_pch_Driver_Enable_Bool = "enable";
public const string k_pch_Driver_BlockedBySafemode_Bool = "blocked_by_safe_mode";
public const string k_pch_Driver_LoadPriority_Int32 = "loadPriority";
public const string k_pch_WebInterface_Section = "WebInterface";
public const string k_pch_VRWebHelper_Section = "VRWebHelper";
public const string k_pch_VRWebHelper_DebuggerEnabled_Bool = "DebuggerEnabled";
public const string k_pch_VRWebHelper_DebuggerPort_Int32 = "DebuggerPort";
public const string k_pch_TrackingOverride_Section = "TrackingOverrides";
public const string k_pch_App_BindingAutosaveURLSuffix_String = "AutosaveURL";
public const string k_pch_App_BindingLegacyAPISuffix_String = "_legacy";
public const string k_pch_App_BindingSteamVRInputAPISuffix_String = "_steamvrinput";
public const string k_pch_App_BindingCurrentURLSuffix_String = "CurrentURL";
public const string k_pch_App_BindingPreviousURLSuffix_String = "PreviousURL";
public const string k_pch_App_NeedToUpdateAutosaveSuffix_Bool = "NeedToUpdateAutosave";
public const string k_pch_App_DominantHand_Int32 = "DominantHand";
public const string k_pch_App_BlockOculusSDK_Bool = "blockOculusSDK";
public const string k_pch_Trackers_Section = "trackers";
public const string k_pch_DesktopUI_Section = "DesktopUI";
public const string k_pch_LastKnown_Section = "LastKnown";
public const string k_pch_LastKnown_HMDManufacturer_String = "HMDManufacturer";
public const string k_pch_LastKnown_HMDModel_String = "HMDModel";
public const string k_pch_DismissedWarnings_Section = "DismissedWarnings";
public const string k_pch_Input_Section = "input";
public const string k_pch_Input_LeftThumbstickRotation_Float = "leftThumbstickRotation";
public const string k_pch_Input_RightThumbstickRotation_Float = "rightThumbstickRotation";
public const string k_pch_Input_ThumbstickDeadzone_Float = "thumbstickDeadzone";
public const string k_pch_GpuSpeed_Section = "GpuSpeed";
public const string IVRScreenshots_Version = "IVRScreenshots_001";
public const string IVRResources_Version = "IVRResources_001";
public const string IVRDriverManager_Version = "IVRDriverManager_001";
public const uint k_unMaxActionNameLength = 64;
public const uint k_unMaxActionSetNameLength = 64;
public const uint k_unMaxActionOriginCount = 16;
public const uint k_unMaxBoneNameLength = 32;
public const int k_nActionSetOverlayGlobalPriorityMin = 16777216;
public const int k_nActionSetOverlayGlobalPriorityMax = 33554431;
public const int k_nActionSetPriorityReservedMin = 33554432;
public const string IVRInput_Version = "IVRInput_010";
public const ulong k_ulInvalidIOBufferHandle = 0;
public const string IVRIOBuffer_Version = "IVRIOBuffer_002";
public const uint k_ulInvalidSpatialAnchorHandle = 0;
public const string IVRSpatialAnchors_Version = "IVRSpatialAnchors_001";
public const string IVRDebug_Version = "IVRDebug_001";
public const ulong k_ulDisplayRedirectContainer = 25769803779;
public const string IVRProperties_Version = "IVRProperties_001";
public const string k_pchPathUserHandRight = "/user/hand/right";
public const string k_pchPathUserHandLeft = "/user/hand/left";
public const string k_pchPathUserHandPrimary = "/user/hand/primary";
public const string k_pchPathUserHandSecondary = "/user/hand/secondary";
public const string k_pchPathUserHead = "/user/head";
public const string k_pchPathUserGamepad = "/user/gamepad";
public const string k_pchPathUserTreadmill = "/user/treadmill";
public const string k_pchPathUserStylus = "/user/stylus";
public const string k_pchPathDevices = "/devices";
public const string k_pchPathDevicePath = "/device_path";
public const string k_pchPathBestAliasPath = "/best_alias_path";
public const string k_pchPathBoundTrackerAliasPath = "/bound_tracker_path";
public const string k_pchPathBoundTrackerRole = "/bound_tracker_role";
public const string k_pchPathPoseRaw = "/pose/raw";
public const string k_pchPathPoseTip = "/pose/tip";
public const string k_pchPathSystemButtonClick = "/input/system/click";
public const string k_pchPathProximity = "/proximity";
public const string k_pchPathControllerTypePrefix = "/controller_type/";
public const string k_pchPathInputProfileSuffix = "/input_profile";
public const string k_pchPathBindingNameSuffix = "/binding_name";
public const string k_pchPathBindingUrlSuffix = "/binding_url";
public const string k_pchPathBindingErrorSuffix = "/binding_error";
public const string k_pchPathActiveActionSets = "/active_action_sets";
public const string k_pchPathComponentUpdates = "/total_component_updates";
public const string k_pchPathUserFootLeft = "/user/foot/left";
public const string k_pchPathUserFootRight = "/user/foot/right";
public const string k_pchPathUserShoulderLeft = "/user/shoulder/left";
public const string k_pchPathUserShoulderRight = "/user/shoulder/right";
public const string k_pchPathUserElbowLeft = "/user/elbow/left";
public const string k_pchPathUserElbowRight = "/user/elbow/right";
public const string k_pchPathUserKneeLeft = "/user/knee/left";
public const string k_pchPathUserKneeRight = "/user/knee/right";
public const string k_pchPathUserWaist = "/user/waist";
public const string k_pchPathUserChest = "/user/chest";
public const string k_pchPathUserCamera = "/user/camera";
public const string k_pchPathUserKeyboard = "/user/keyboard";
public const string k_pchPathClientAppKey = "/client_info/app_key";
public const ulong k_ulInvalidPathHandle = 0;
public const string IVRPaths_Version = "IVRPaths_001";
public const string IVRBlockQueue_Version = "IVRBlockQueue_004";
static uint VRToken { get; set; }
const string FnTable_Prefix = "FnTable:";
class COpenVRContext
{
public COpenVRContext() { Clear(); }
public void Clear()
{
m_pVRSystem = null;
m_pVRChaperone = null;
m_pVRChaperoneSetup = null;
m_pVRCompositor = null;
m_pVRHeadsetView = null;
m_pVROverlay = null;
m_pVROverlayView = null;
m_pVRRenderModels = null;
m_pVRExtendedDisplay = null;
m_pVRSettings = null;
m_pVRApplications = null;
m_pVRScreenshots = null;
m_pVRTrackedCamera = null;
m_pVRInput = null;
m_pVRIOBuffer = null;
m_pVRSpatialAnchors = null;
m_pVRNotifications = null;
m_pVRDebug = null;
}
void CheckClear()
{
if (VRToken != GetInitToken())
{
Clear();
VRToken = GetInitToken();
}
}
public CVRSystem VRSystem()
{
CheckClear();
if (m_pVRSystem == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRSystem_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRSystem = new CVRSystem(pInterface);
}
return m_pVRSystem;
}
public CVRChaperone VRChaperone()
{
CheckClear();
if (m_pVRChaperone == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRChaperone_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRChaperone = new CVRChaperone(pInterface);
}
return m_pVRChaperone;
}
public CVRChaperoneSetup VRChaperoneSetup()
{
CheckClear();
if (m_pVRChaperoneSetup == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRChaperoneSetup_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRChaperoneSetup = new CVRChaperoneSetup(pInterface);
}
return m_pVRChaperoneSetup;
}
public CVRCompositor VRCompositor()
{
CheckClear();
if (m_pVRCompositor == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRCompositor_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRCompositor = new CVRCompositor(pInterface);
}
return m_pVRCompositor;
}
public CVRHeadsetView VRHeadsetView()
{
CheckClear();
if (m_pVRHeadsetView == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRHeadsetView_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRHeadsetView = new CVRHeadsetView(pInterface);
}
return m_pVRHeadsetView;
}
public CVROverlay VROverlay()
{
CheckClear();
if (m_pVROverlay == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVROverlay_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVROverlay = new CVROverlay(pInterface);
}
return m_pVROverlay;
}
public CVROverlayView VROverlayView()
{
CheckClear();
if (m_pVROverlayView == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVROverlayView_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVROverlayView = new CVROverlayView(pInterface);
}
return m_pVROverlayView;
}
public CVRRenderModels VRRenderModels()
{
CheckClear();
if (m_pVRRenderModels == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRRenderModels_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRRenderModels = new CVRRenderModels(pInterface);
}
return m_pVRRenderModels;
}
public CVRExtendedDisplay VRExtendedDisplay()
{
CheckClear();
if (m_pVRExtendedDisplay == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRExtendedDisplay_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRExtendedDisplay = new CVRExtendedDisplay(pInterface);
}
return m_pVRExtendedDisplay;
}
public CVRSettings VRSettings()
{
CheckClear();
if (m_pVRSettings == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRSettings_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRSettings = new CVRSettings(pInterface);
}
return m_pVRSettings;
}
public CVRApplications VRApplications()
{
CheckClear();
if (m_pVRApplications == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRApplications_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRApplications = new CVRApplications(pInterface);
}
return m_pVRApplications;
}
public CVRScreenshots VRScreenshots()
{
CheckClear();
if (m_pVRScreenshots == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRScreenshots_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRScreenshots = new CVRScreenshots(pInterface);
}
return m_pVRScreenshots;
}
public CVRTrackedCamera VRTrackedCamera()
{
CheckClear();
if (m_pVRTrackedCamera == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRTrackedCamera_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRTrackedCamera = new CVRTrackedCamera(pInterface);
}
return m_pVRTrackedCamera;
}
public CVRInput VRInput()
{
CheckClear();
if (m_pVRInput == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRInput_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRInput = new CVRInput(pInterface);
}
return m_pVRInput;
}
public CVRIOBuffer VRIOBuffer()
{
CheckClear();
if (m_pVRIOBuffer == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix + IVRIOBuffer_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRIOBuffer = new CVRIOBuffer(pInterface);
}
return m_pVRIOBuffer;
}
public CVRSpatialAnchors VRSpatialAnchors()
{
CheckClear();
if (m_pVRSpatialAnchors == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix + IVRSpatialAnchors_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRSpatialAnchors = new CVRSpatialAnchors(pInterface);
}
return m_pVRSpatialAnchors;
}
public CVRDebug VRDebug()
{
CheckClear();
if (m_pVRDebug == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix + IVRDebug_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRDebug = new CVRDebug(pInterface);
}
return m_pVRDebug;
}
public CVRNotifications VRNotifications()
{
CheckClear();
if (m_pVRNotifications == null)
{
var eError = EVRInitError.None;
var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix + IVRNotifications_Version, ref eError);
if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
m_pVRNotifications = new CVRNotifications(pInterface);
}
return m_pVRNotifications;
}
private CVRSystem m_pVRSystem;
private CVRChaperone m_pVRChaperone;
private CVRChaperoneSetup m_pVRChaperoneSetup;
private CVRCompositor m_pVRCompositor;
private CVRHeadsetView m_pVRHeadsetView;
private CVROverlay m_pVROverlay;
private CVROverlayView m_pVROverlayView;
private CVRRenderModels m_pVRRenderModels;
private CVRExtendedDisplay m_pVRExtendedDisplay;
private CVRSettings m_pVRSettings;
private CVRApplications m_pVRApplications;
private CVRScreenshots m_pVRScreenshots;
private CVRTrackedCamera m_pVRTrackedCamera;
private CVRInput m_pVRInput;
private CVRIOBuffer m_pVRIOBuffer;
private CVRSpatialAnchors m_pVRSpatialAnchors;
private CVRNotifications m_pVRNotifications;
private CVRDebug m_pVRDebug;
};
private static COpenVRContext _OpenVRInternal_ModuleContext = null;
static COpenVRContext OpenVRInternal_ModuleContext
{
get
{
if (_OpenVRInternal_ModuleContext == null)
_OpenVRInternal_ModuleContext = new COpenVRContext();
return _OpenVRInternal_ModuleContext;
}
}
public static CVRSystem System { get { return OpenVRInternal_ModuleContext.VRSystem(); } }
public static CVRChaperone Chaperone { get { return OpenVRInternal_ModuleContext.VRChaperone(); } }
public static CVRChaperoneSetup ChaperoneSetup { get { return OpenVRInternal_ModuleContext.VRChaperoneSetup(); } }
public static CVRCompositor Compositor { get { return OpenVRInternal_ModuleContext.VRCompositor(); } }
public static CVRHeadsetView HeadsetView { get { return OpenVRInternal_ModuleContext.VRHeadsetView(); } }
public static CVROverlay Overlay { get { return OpenVRInternal_ModuleContext.VROverlay(); } }
public static CVROverlayView OverlayView { get { return OpenVRInternal_ModuleContext.VROverlayView(); } }
public static CVRRenderModels RenderModels { get { return OpenVRInternal_ModuleContext.VRRenderModels(); } }
public static CVRExtendedDisplay ExtendedDisplay { get { return OpenVRInternal_ModuleContext.VRExtendedDisplay(); } }
public static CVRSettings Settings { get { return OpenVRInternal_ModuleContext.VRSettings(); } }
public static CVRApplications Applications { get { return OpenVRInternal_ModuleContext.VRApplications(); } }
public static CVRScreenshots Screenshots { get { return OpenVRInternal_ModuleContext.VRScreenshots(); } }
public static CVRTrackedCamera TrackedCamera { get { return OpenVRInternal_ModuleContext.VRTrackedCamera(); } }
public static CVRInput Input { get { return OpenVRInternal_ModuleContext.VRInput(); } }
public static CVRIOBuffer IOBuffer { get { return OpenVRInternal_ModuleContext.VRIOBuffer(); } }
public static CVRSpatialAnchors SpatialAnchors { get { return OpenVRInternal_ModuleContext.VRSpatialAnchors(); } }
public static CVRNotifications Notifications { get { return OpenVRInternal_ModuleContext.VRNotifications(); } }
public static CVRDebug Debug { get { return OpenVRInternal_ModuleContext.VRDebug(); } }
/** Finds the active installation of vrclient.dll and initializes it */
public static CVRSystem Init(ref EVRInitError peError, EVRApplicationType eApplicationType = EVRApplicationType.VRApplication_Scene, string pchStartupInfo= "")
{
try
{
VRToken = InitInternal2(ref peError, eApplicationType, pchStartupInfo);
}
catch (EntryPointNotFoundException)
{
VRToken = InitInternal(ref peError, eApplicationType);
}
OpenVRInternal_ModuleContext.Clear();
if (peError != EVRInitError.None)
return null;
bool bInterfaceValid = IsInterfaceVersionValid(IVRSystem_Version);
if (!bInterfaceValid)
{
ShutdownInternal();
peError = EVRInitError.Init_InterfaceNotFound;
return null;
}
return OpenVR.System;
}
/** unloads vrclient.dll. Any interface pointers from the interface are
* invalid after this point */
public static void Shutdown()
{
ShutdownInternal();
}
}
}
#endif | 41.596982 | 3,871 | 0.834169 | [
"MIT"
] | mathmotta/vr-tests | Assets/SteamVR/Plugins/openvr_api.cs | 339,057 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using PetrpkuWeb.Server.Data;
using PetrpkuWeb.Shared.Models;
using Microsoft.EntityFrameworkCore;
using PetrpkuWeb.Shared.ViewModels;
using AutoMapper;
using Microsoft.AspNetCore.Authorization;
using PetrpkuWeb.Shared.Extensions;
namespace PetrpkuWeb.Server.Controllers
{
[Route("api/articles")]
[ApiController]
public class ArticlesController : ControllerBase
{
private readonly AppDbContext _db;
private readonly IMapper _mapper;
public ArticlesController(AppDbContext db, IMapper mapper)
{
_db = db;
_mapper = mapper;
}
[AllowAnonymous]
[HttpGet("all")]
public async Task<ActionResult<List<Article>>> GetArticles()
{
return await _db.Articles
.Include(a => a.Attachments)
.Include(a => a.Author)
.Include(ct =>ct.CssType)
.OrderByDescending(d => d.PublishDate)
.AsNoTracking()
.ToListAsync();
}
[Authorize(Roles = AuthRole.ANY)]
[HttpPost("create")]
public async Task<ActionResult<Article>> CreateArticle(ArticleViewModel articleVM)
{
if (articleVM is null)
return BadRequest();
var article = _mapper.Map<Article>(articleVM);
var cssType = await _db.CssTypes.SingleOrDefaultAsync(ct => ct.CssTypeId == articleVM.CssTypeId);
article.CssType = cssType;
article.PublishDate = DateTime.Now;
_db.Attachments.UpdateRange(article.Attachments);
_db.SaveChanges();
await _db.Articles.AddAsync(article);
await _db.SaveChangesAsync();
return Ok(article);
}
[AllowAnonymous]
[HttpGet("show/{articleId:int}")]
public async Task<ActionResult<Article>> GetArticle(int articleId)
{
var article = await _db.Articles
.Include(a => a.Attachments)
.Include(a => a.Author)
.Include(ct => ct.CssType)
.AsNoTracking()
.SingleOrDefaultAsync(u => u.ArticleId == articleId);
if (article is null)
return BadRequest();
return Ok(article);
}
[Authorize(Roles = AuthRole.ANY)]
[HttpPut("update/{articleId:int}")]
public async Task<ActionResult<Post>> PutUserAsync(int articleId, Article article)
{
if (articleId == article.ArticleId)
{
var cssType = await _db.CssTypes.SingleOrDefaultAsync(ct => ct.CssTypeId == article.CssTypeId);
article.CssType = cssType;
article.UpdateDate = DateTime.Now;
//_db.Attach(article).State = EntityState.Modified;
_db.Articles.Update(article);
await _db.SaveChangesAsync();
return Ok(article);
}
return BadRequest();
}
[Authorize(Roles = AuthRole.ANY)]
[HttpDelete("delete/{articleId:int}")]
public async Task<IActionResult> Delete(int articleId)
{
if (ModelState.IsValid)
{
var article = await _db.Articles
.Include(a => a.Attachments)
.Include(a => a.Author)
.SingleOrDefaultAsync(u => u.ArticleId == articleId);
if (article is null)
{
return NotFound();
}
_db.Articles.Remove(article);
await _db.SaveChangesAsync();
return NoContent();
}
return BadRequest(ModelState);
}
}
} | 31.723577 | 111 | 0.556894 | [
"MIT"
] | kaanlab/PetrpkuWeb | PetrpkuWeb.Server/Controllers/ArticlesController.cs | 3,902 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
public class FilterLOD : EditorWindow
{
[MenuItem("Tools/FilterLOD")]
static void Filter()
{
GetWindow<FilterLOD>();
}
private List<GameObject> lodGroupWithUnaprented = new List<GameObject>();
private Vector2 scrollPos;
private void OnEnable()
{
scrollPos = Vector2.zero;
lodGroupWithUnaprented.Clear();
var gos = EditorSceneManager.GetActiveScene().GetRootGameObjects();
for(int i = 0; i < gos.Length; ++i)
{
HierarchicalDown(gos[i]);
}
}
private void OnGUI()
{
scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
for (int i = 0; i < lodGroupWithUnaprented.Count; ++i)
{
if (GUILayout.Button(lodGroupWithUnaprented[i].name))
{
Selection.activeGameObject = lodGroupWithUnaprented[i];
EditorGUIUtility.PingObject(lodGroupWithUnaprented[i]);
}
}
EditorGUILayout.EndScrollView();
}
void HierarchicalDown(GameObject parent)
{
LODGroup grp = parent.GetComponent<LODGroup>();
if (grp != null)
{
int expectMeshRenderer = 0;
for (int i = 0; i < grp.lodCount; ++i)
{
expectMeshRenderer += grp.GetLODs()[i].renderers.Length;
}
int actualRenderer = 0;
foreach (Transform t in grp.transform)
{
if (t.GetComponent<Renderer>() != null)
actualRenderer += 1;
}
if (expectMeshRenderer != actualRenderer)
{
lodGroupWithUnaprented.Add(parent);
}
}
else
{
for (int i = 0; i < parent.transform.childCount; ++i)
{
HierarchicalDown(parent.transform.GetChild(i).gameObject);
}
}
}
}
| 25.962025 | 77 | 0.550951 | [
"MIT"
] | AlmaCeax/DataAnalysisD2 | Assets/3DGamekitLite/Scripts/Editor/FilterLOD.cs | 2,051 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace Wivuu.DataSeed
{
[Obsolete("Deprecated -- Use AddOrUpdate")]
public static class Mapping
{
private static Dictionary<ValueTuple<Type, bool>, object> _selfMappers
= new Dictionary<ValueTuple<Type, bool>, object>();
private static Dictionary<Type, object> _dictMappers
= new Dictionary<Type, object>();
/// <summary>
/// Map the source to the destination
/// </summary>
/// <returns>The destination</returns>
public static T Map<T>(T destination, T source, bool mapAll)
where T : class, new()
{
var type = typeof(T);
if (destination == null)
destination = new T();
var key = ValueTuple.Create(type, mapAll);
object mappingBox;
Action<T, T> mapping;
if (!_selfMappers.TryGetValue(key, out mappingBox))
{
// Create Mapping logic
mapping = CreateMap(source, mapAll);
_selfMappers[key] = mapping;
}
else
mapping = mappingBox as Action<T, T>;
mapping(destination, source);
return destination;
}
/// <summary>
/// Map the source to the destination
/// </summary>
/// <returns>The destination</returns>
public static T Map<T>(T destination, object source)
where T : class, new()
{
var type = source.GetType();
if (destination == null)
destination = new T();
var key = ValueTuple.Create(type, true);
object mappingBox;
Action<T, object> mapping;
if (!_selfMappers.TryGetValue(key, out mappingBox))
{
// Create Mapping logic
mapping = CreateMap(destination, source);
_selfMappers[key] = mapping;
}
else
mapping = mappingBox as Action<T, object>;
mapping(destination, source);
return destination;
}
/// <summary>
/// Map the source dictionary to the destination
/// </summary>
/// <returns>The destination</returns>
public static T MapDictionary<T>(T destination, IDictionary<string, object> source)
where T : class, new()
{
var type = typeof(T);
if (destination == null)
destination = new T();
object mappingBox;
Action<T, IDictionary<string, object>> mapping;
if (!_dictMappers.TryGetValue(type, out mappingBox))
{
// Create Mapping logic
mapping = CreateMap(destination);
_dictMappers[type] = mapping;
}
else
mapping = mappingBox as Action<T, IDictionary<string, object>>;
mapping(destination, source);
return destination;
}
private static Action<T, IDictionary<string, object>> CreateMap<T>(T value)
{
var owner = typeof(T);
var sourceType = typeof(IDictionary<string, object>);
var props = owner.GetProperties(BindingFlags.Public | BindingFlags.Instance);
ParameterExpression
destination = Expression.Parameter(owner),
source = Expression.Parameter(sourceType);
var variables = new List<ParameterExpression>();
var expressions = new List<Expression>(capacity: props.Length);
var tryGetValue = sourceType.GetMethod(nameof(IDictionary<string, object>.TryGetValue));
var local = Expression.Variable(typeof(object));
variables.Add(local);
// Loop through properties and assign them one by one
for (var i = 0; i < props.Length; ++i)
{
var prop = props[i];
var propType = prop.PropertyType;
// Try to get the value
var tryGetLocal = Expression.Call(source, tryGetValue, Expression.Constant(prop.Name), local);
var doAssign = Expression.Call(destination,
prop.SetMethod, Expression.Convert(local, prop.PropertyType));
expressions.Add(
Expression.IfThen(tryGetLocal, doAssign)
);
}
// Build body of lambda
var body = Expression.Block(
variables,
expressions
);
var action = Expression.Lambda<Action<T, IDictionary<string, object>>>(
body, destination, source
);
return action.Compile();
}
private static Action<T, T> CreateMap<T>(T value, bool mapAll)
{
var owner = typeof(T);
var props = owner.GetProperties(BindingFlags.Public | BindingFlags.Instance);
ParameterExpression
destination = Expression.Parameter(owner),
source = Expression.Parameter(owner);
var variables = new List<ParameterExpression>(capacity: props.Length);
var expressions = new List<Expression>(capacity: props.Length);
// Loop through properties and assign them one by one
for (var i = 0; i < props.Length; ++i)
{
var prop = props[i];
var propType = prop.PropertyType;
if (mapAll)
{
var get = Expression.Call(source, prop.GetMethod);
var set = Expression.Call(destination, prop.SetMethod, get);
expressions.Add(set);
}
else
{
if (ShouldCopy(propType) == false)
continue;
// Create copy
var cached = Expression.Variable(propType);
variables.Add(cached);
var doAssign = Expression.Call(destination, prop.SetMethod, cached);
var test = Expression.NotEqual(cached, Expression.Default(propType));
expressions.Add(Expression.Assign(
cached, Expression.Call(source, prop.GetMethod)));
expressions.Add(Expression.IfThen(
test, doAssign));
}
}
// Build body of lambda
var body = Expression.Block(
variables,
expressions
);
var action = Expression.Lambda<Action<T, T>>(
body, destination, source
);
return action.Compile();
}
private static Action<T, K> CreateMap<T, K>(T destValue, K sourceValue)
{
var destType = typeof(T);
var sourceType = sourceValue.GetType();
var destProps = destType.GetProperties(BindingFlags.Public | BindingFlags.Instance).ToDictionary(t => t.Name.ToLower());
var sourceProps = sourceType.GetProperties(BindingFlags.Public | BindingFlags.Instance);
ParameterExpression
destination = Expression.Parameter(destType),
source = Expression.Parameter(typeof(K));
var sourceT = Expression.Variable(sourceType);
var variables = new List<ParameterExpression>(capacity: sourceProps.Length)
{
sourceT
};
var expressions = new List<Expression>(capacity: sourceProps.Length)
{
Expression.Assign(sourceT, Expression.Convert(source, sourceType))
};
// Loop through properties and assign them one by one
for (var i = 0; i < sourceProps.Length; ++i)
{
var prop = sourceProps[i];
var propType = prop.PropertyType;
// Check if this matches a destination property
PropertyInfo destProp;
if (destProps.TryGetValue(prop.Name.ToLower(), out destProp) == false)
continue;
expressions.Add(
// dest.set_Prop =
Expression.Call(destination, destProp.SetMethod,
// source.get_Prop`()
Expression.Call(sourceT, prop.GetMethod)));
}
// Build body of lambda
var body = Expression.Block(
variables,
expressions
);
var action = Expression.Lambda<Action<T, K>>(
body, destination, source
);
return action.Compile();
}
private static bool ShouldCopy(Type t)
{
if (t.IsPrimitive)
return true;
reprocess:
switch (t.Name)
{
case nameof(Nullable):
case "Nullable`1":
t = Nullable.GetUnderlyingType(t);
goto reprocess;
case "String":
case "DateTime":
case "DateTimeOffset":
case "Guid":
return true;
default:
return false;
}
}
}
} | 34.182143 | 134 | 0.51259 | [
"MIT"
] | onionhammer/Wivuu.DataSeed | Wivuu.DataSeed/Obsolete/Mapping.cs | 9,573 | C# |
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Web;
using NUnit.Framework;
using QuantConnect.Api;
using QuantConnect.Configuration;
namespace QuantConnect.Tests.API
{
[TestFixture, Explicit("These tests require QC User ID and API Token in the configuration")]
class RestApiTests
{
private int _testAccount;
private string _testToken;
private string _dataFolder;
private Api.Api _api;
/// <summary>
/// Run before test
/// </summary>
[OneTimeSetUp]
public void Setup()
{
_testAccount = Config.GetInt("job-user-id", 1);
_testToken = Config.Get("api-access-token", "ec87b337ac970da4cbea648f24f1c851");
_dataFolder = Config.Get("data-folder");
_api = new Api.Api();
_api.Initialize(_testAccount, _testToken, _dataFolder);
}
/// <summary>
/// Test creating and deleting projects with the Api
/// </summary>
[Test]
public void Projects_CanBeCreatedAndDeleted_Successfully()
{
var name = "Test Project " + DateTime.Now.ToStringInvariant();
//Test create a new project successfully
var project = _api.CreateProject(name, Language.CSharp);
Assert.IsTrue(project.Success);
Assert.IsTrue(project.Projects.First().ProjectId > 0);
Assert.IsTrue(project.Projects.First().Name == name);
// Delete the project
var deleteProject = _api.DeleteProject(project.Projects.First().ProjectId);
Assert.IsTrue(deleteProject.Success);
// Make sure the project is really deleted
var projectList = _api.ListProjects();
Assert.IsFalse(projectList.Projects.Any(p => p.ProjectId == project.Projects.First().ProjectId));
}
/// <summary>
/// Test successfully authenticating with the ApiConnection using valid credentials.
/// </summary>
[Test]
public void ApiConnectionWillAuthenticate_ValidCredentials_Successfully()
{
var connection = new ApiConnection(_testAccount, _testToken);
Assert.IsTrue(connection.Connected);
}
/// <summary>
/// Test successfully authenticating with the API using valid credentials.
/// </summary>
[Test]
public void ApiWillAuthenticate_ValidCredentials_Successfully()
{
var api = new Api.Api();
api.Initialize(_testAccount, _testToken, _dataFolder);
Assert.IsTrue(api.Connected);
}
/// <summary>
/// Test that the ApiConnection will reject invalid credentials
/// </summary>
[Test]
public void ApiConnectionWillAuthenticate_InvalidCredentials_Unsuccessfully()
{
var connection = new ApiConnection(_testAccount, "");
Assert.IsFalse(connection.Connected);
}
/// <summary>
/// Test that the Api will reject invalid credentials
/// </summary>
[Test]
public void ApiWillAuthenticate_InvalidCredentials_Unsuccessfully()
{
var api = new Api.Api();
api.Initialize(_testAccount, "", _dataFolder);
Assert.IsFalse(api.Connected);
}
/// <summary>
/// Test updating the files associated with a project
/// </summary>
[Test]
public void CRUD_ProjectFiles_Successfully()
{
var fakeFile = new ProjectFile
{
Name = "Hello.cs",
Code = HttpUtility.HtmlEncode("Hello, world!")
};
var realFile = new ProjectFile
{
Name = "main.cs",
Code = HttpUtility.HtmlEncode(File.ReadAllText("../../../Algorithm.CSharp/BasicTemplateAlgorithm.cs"))
};
var secondRealFile = new ProjectFile()
{
Name = "lol.cs",
Code = HttpUtility.HtmlEncode(File.ReadAllText("../../../Algorithm.CSharp/BubbleAlgorithm.cs"))
};
// Create a new project and make sure there are no files
var project = _api.CreateProject($"Test project - {DateTime.Now.ToStringInvariant()}", Language.CSharp);
Assert.IsTrue(project.Success);
Assert.IsTrue(project.Projects.First().ProjectId > 0);
// Add random file
var randomAdd = _api.AddProjectFile(project.Projects.First().ProjectId, fakeFile.Name, fakeFile.Code);
Assert.IsTrue(randomAdd.Success);
Assert.IsTrue(randomAdd.Files.First().Code == fakeFile.Code);
Assert.IsTrue(randomAdd.Files.First().Name == fakeFile.Name);
// Update names of file
var updatedName = _api.UpdateProjectFileName(project.Projects.First().ProjectId, randomAdd.Files.First().Name, realFile.Name);
Assert.IsTrue(updatedName.Success);
// Replace content of file
var updateContents = _api.UpdateProjectFileContent(project.Projects.First().ProjectId, realFile.Name, realFile.Code);
Assert.IsTrue(updateContents.Success);
// Read single file
var readFile = _api.ReadProjectFile(project.Projects.First().ProjectId, realFile.Name);
Assert.IsTrue(readFile.Success);
Assert.IsTrue(readFile.Files.First().Code == realFile.Code);
Assert.IsTrue(readFile.Files.First().Name == realFile.Name);
// Add a second file
var secondFile = _api.AddProjectFile(project.Projects.First().ProjectId, secondRealFile.Name, secondRealFile.Code);
Assert.IsTrue(secondFile.Success);
Assert.IsTrue(secondFile.Files.First().Code == secondRealFile.Code);
Assert.IsTrue(secondFile.Files.First().Name == secondRealFile.Name);
// Read multiple files
var readFiles = _api.ReadProjectFiles(project.Projects.First().ProjectId);
Assert.IsTrue(readFiles.Success);
Assert.IsTrue(readFiles.Files.Count == 2);
// Delete the second file
var deleteFile = _api.DeleteProjectFile(project.Projects.First().ProjectId, secondRealFile.Name);
Assert.IsTrue(deleteFile.Success);
// Read files
var readFilesAgain = _api.ReadProjectFiles(project.Projects.First().ProjectId);
Assert.IsTrue(readFilesAgain.Success);
Assert.IsTrue(readFilesAgain.Files.Count == 1);
Assert.IsTrue(readFilesAgain.Files.First().Name == realFile.Name);
// Delete the project
var deleteProject = _api.DeleteProject(project.Projects.First().ProjectId);
Assert.IsTrue(deleteProject.Success);
}
/// <summary>
/// Test downloading data that does not come with the repo (Oanda)
/// Requires that your account has this data; its free at quantconnect.com/data
/// </summary>
[Test, Ignore("Requires EURUSD daily data and minute data for 10/2013 in cloud data library")]
public void BacktestingData_CanBeDownloadedAndSaved_Successfully()
{
var minutePath = Path.Combine(_dataFolder, "forex/oanda/minute/eurusd/20131011_quote.zip");
var dailyPath = Path.Combine(_dataFolder, "forex/oanda/daily/eurusd.zip");
if (File.Exists(dailyPath))
File.Delete(dailyPath);
if (File.Exists(minutePath))
File.Delete(minutePath);
var downloadedMinuteData = _api.DownloadData(new Symbol(SecurityIdentifier.GenerateForex("EURUSD", Market.Oanda), "EURUSD"),
Resolution.Minute, new DateTime(2013, 10, 11));
var downloadedDailyData = _api.DownloadData(new Symbol(SecurityIdentifier.GenerateForex("EURUSD", Market.Oanda), "EURUSD"),
Resolution.Daily, new DateTime(2013, 10, 07));
Assert.IsTrue(downloadedMinuteData);
Assert.IsTrue(downloadedDailyData);
Assert.IsTrue(File.Exists(dailyPath));
Assert.IsTrue(File.Exists(minutePath));
}
/// <summary>
/// Test downloading non existent data
/// </summary>
[Test]
public void NonExistantData_WillBeDownloaded_Unsuccessfully()
{
var nonExistentData = _api.DownloadData(new Symbol(SecurityIdentifier.GenerateForex("EURUSD", Market.Oanda), "EURUSD"),
Resolution.Minute, new DateTime(1989, 10, 11));
Assert.IsFalse(nonExistentData);
}
/// <summary>
/// Test creating, compiling and backtesting a C# project via the Api
/// </summary>
[Test]
public void CSharpProject_CreatedCompiledAndBacktested_Successully()
{
var language = Language.CSharp;
var code = File.ReadAllText("../../../Algorithm.CSharp/BasicTemplateAlgorithm.cs");
var algorithmName = "main.cs";
var projectName = $"{DateTime.UtcNow.ToStringInvariant("u")} Test {_testAccount} Lang {language}";
Perform_CreateCompileBackTest_Tests(projectName, language, algorithmName, code);
}
/// <summary>
/// Test creating, compiling and backtesting a Python project via the Api
/// </summary>
[Test]
public void PythonProject_CreatedCompiledAndBacktested_Successully()
{
var language = Language.Python;
var code = File.ReadAllText("../../../Algorithm.Python/BasicTemplateAlgorithm.py");
var algorithmName = "main.py";
var projectName = $"{DateTime.UtcNow.ToStringInvariant("u")} Test {_testAccount} Lang {language}";
Perform_CreateCompileBackTest_Tests(projectName, language, algorithmName, code);
}
/// <summary>
/// Test getting links to forex data for FXCM
/// </summary>
[Test, Ignore("Requires configured FXCM account")]
public void FXCMDataLinks_CanBeRetrieved_Successfully()
{
var minuteDataLink = _api.ReadDataLink(new Symbol(SecurityIdentifier.GenerateForex("EURUSD", Market.FXCM), "EURUSD"),
Resolution.Minute, new DateTime(2013, 10, 07));
var dailyDataLink = _api.ReadDataLink(new Symbol(SecurityIdentifier.GenerateForex("EURUSD", Market.FXCM), "EURUSD"),
Resolution.Daily, new DateTime(2013, 10, 07));
Assert.IsTrue(minuteDataLink.Success);
Assert.IsTrue(dailyDataLink.Success);
}
/// <summary>
/// Test getting links to forex data for Oanda
/// </summary>
[Test, Ignore("Requires configured Oanda account")]
public void OandaDataLinks_CanBeRetrieved_Successfully()
{
var minuteDataLink = _api.ReadDataLink(new Symbol(SecurityIdentifier.GenerateForex("EURUSD", Market.Oanda), "EURUSD"),
Resolution.Minute, new DateTime(2013, 10, 07));
var dailyDataLink = _api.ReadDataLink(new Symbol(SecurityIdentifier.GenerateForex("EURUSD", Market.Oanda), "EURUSD"),
Resolution.Daily, new DateTime(2013, 10, 07));
Assert.IsTrue(minuteDataLink.Success);
Assert.IsTrue(dailyDataLink.Success);
}
[TestCase("organizationId")]
[TestCase("")]
public void ReadAccount(string organizationId)
{
var account = _api.ReadAccount(organizationId);
Assert.IsTrue(account.Success);
Assert.IsNotEmpty(account.OrganizationId);
Assert.IsNotNull(account.Card);
Assert.AreNotEqual(default(DateTime),account.Card.Expiration);
Assert.IsNotEmpty(account.Card.Brand);
Assert.AreNotEqual(0, account.Card.LastFourDigits);
}
private void Perform_CreateCompileBackTest_Tests(string projectName, Language language, string algorithmName, string code)
{
//Test create a new project successfully
var project = _api.CreateProject(projectName, language);
Assert.IsTrue(project.Success);
Assert.IsTrue(project.Projects.First().ProjectId > 0);
Assert.IsTrue(project.Projects.First().Name == projectName);
// Make sure the project just created is now present
var projects = _api.ListProjects();
Assert.IsTrue(projects.Success);
Assert.IsTrue(projects.Projects.Any(p => p.ProjectId == project.Projects.First().ProjectId));
// Test read back the project we just created
var readProject = _api.ReadProject(project.Projects.First().ProjectId);
Assert.IsTrue(readProject.Success);
Assert.IsTrue(readProject.Projects.First().Name == projectName);
// Test set a project file for the project
var file = new ProjectFile { Name = algorithmName, Code = code };
var addProjectFile = _api.AddProjectFile(project.Projects.First().ProjectId, file.Name, file.Code);
Assert.IsTrue(addProjectFile.Success);
// Download the project again to validate its got the new file
var verifyRead = _api.ReadProject(project.Projects.First().ProjectId);
Assert.IsTrue(verifyRead.Success);
// Compile the project we've created
var compileCreate = _api.CreateCompile(project.Projects.First().ProjectId);
Assert.IsTrue(compileCreate.Success);
Assert.IsTrue(compileCreate.State == CompileState.InQueue);
// Read out the compile
var compileSuccess = WaitForCompilerResponse(project.Projects.First().ProjectId, compileCreate.CompileId);
Assert.IsTrue(compileSuccess.Success);
Assert.IsTrue(compileSuccess.State == CompileState.BuildSuccess);
// Update the file, create a build error, test we get build error
file.Code += "[Jibberish at end of the file to cause a build error]";
_api.UpdateProjectFileContent(project.Projects.First().ProjectId, file.Name, file.Code);
var compileError = _api.CreateCompile(project.Projects.First().ProjectId);
compileError = WaitForCompilerResponse(project.Projects.First().ProjectId, compileError.CompileId);
Assert.IsTrue(compileError.Success); // Successfully processed rest request.
Assert.IsTrue(compileError.State == CompileState.BuildError); //Resulting in build fail.
// Using our successful compile; launch a backtest!
var backtestName = $"{DateTime.Now.ToStringInvariant("u")} API Backtest";
var backtest = _api.CreateBacktest(project.Projects.First().ProjectId, compileSuccess.CompileId, backtestName);
Assert.IsTrue(backtest.Success);
// Now read the backtest and wait for it to complete
var backtestRead = WaitForBacktestCompletion(project.Projects.First().ProjectId, backtest.BacktestId);
Assert.IsTrue(backtestRead.Success);
Assert.IsTrue(backtestRead.Progress == 1);
Assert.IsTrue(backtestRead.Name == backtestName);
Assert.IsTrue(backtestRead.Result.Statistics["Total Trades"] == "1");
// Verify we have the backtest in our project
var listBacktests = _api.ListBacktests(project.Projects.First().ProjectId);
Assert.IsTrue(listBacktests.Success);
Assert.IsTrue(listBacktests.Backtests.Count >= 1);
Assert.IsTrue(listBacktests.Backtests[0].Name == backtestName);
// Update the backtest name and test its been updated
backtestName += "-Amendment";
var renameBacktest = _api.UpdateBacktest(project.Projects.First().ProjectId, backtest.BacktestId, backtestName);
Assert.IsTrue(renameBacktest.Success);
backtestRead = _api.ReadBacktest(project.Projects.First().ProjectId, backtest.BacktestId);
Assert.IsTrue(backtestRead.Name == backtestName);
//Update the note and make sure its been updated:
var newNote = DateTime.Now.ToStringInvariant("u");
var noteBacktest = _api.UpdateBacktest(project.Projects.First().ProjectId, backtest.BacktestId, note: newNote);
Assert.IsTrue(noteBacktest.Success);
backtestRead = _api.ReadBacktest(project.Projects.First().ProjectId, backtest.BacktestId);
Assert.IsTrue(backtestRead.Note == newNote);
// Delete the backtest we just created
var deleteBacktest = _api.DeleteBacktest(project.Projects.First().ProjectId, backtest.BacktestId);
Assert.IsTrue(deleteBacktest.Success);
// Test delete the project we just created
var deleteProject = _api.DeleteProject(project.Projects.First().ProjectId);
Assert.IsTrue(deleteProject.Success);
}
/// <summary>
/// Wait for the compiler to respond to a specified compile request
/// </summary>
/// <param name="projectId">Id of the project</param>
/// <param name="compileId">Id of the compilation of the project</param>
/// <returns></returns>
private Compile WaitForCompilerResponse(int projectId, string compileId)
{
var compile = new Compile();
var finish = DateTime.Now.AddSeconds(60);
while (DateTime.Now < finish)
{
compile = _api.ReadCompile(projectId, compileId);
if (compile.State == CompileState.BuildSuccess) break;
Thread.Sleep(1000);
}
return compile;
}
/// <summary>
/// Wait for the backtest to complete
/// </summary>
/// <param name="projectId">Project id to scan</param>
/// <param name="backtestId">Backtest id previously started</param>
/// <returns>Completed backtest object</returns>
private Backtest WaitForBacktestCompletion(int projectId, string backtestId)
{
var result = new Backtest();
var finish = DateTime.Now.AddSeconds(60);
while (DateTime.Now < finish)
{
result = _api.ReadBacktest(projectId, backtestId);
if (result.Progress == 1) break;
if (!result.Success) break;
Thread.Sleep(1000);
}
return result;
}
}
}
| 45.145199 | 138 | 0.629507 | [
"Apache-2.0"
] | scalptrader/Lean | Tests/Api/ApiTests.cs | 19,279 | C# |
using System.IO;
using System.Linq;
using AsmResolver.IO;
using AsmResolver.PE.DotNet.Builder;
using AsmResolver.PE.Exports;
using Xunit;
namespace AsmResolver.PE.Tests.Exports
{
public class ExportDirectoryTest
{
[Fact]
public void ReadName()
{
var image = PEImage.FromBytes(Properties.Resources.SimpleDll_Exports);
Assert.Equal("SimpleDll.dll", image.Exports?.Name);
}
[Fact]
public void ReadExportNames()
{
var image = PEImage.FromBytes(Properties.Resources.SimpleDll_Exports);
Assert.Equal(new[]
{
"NamedExport1",
"NamedExport2",
}, image.Exports?.Entries.Select(e => e.Name));
}
[Fact]
public void ReadExportAddresses()
{
var image = PEImage.FromBytes(Properties.Resources.SimpleDll_Exports);
Assert.Equal(new[]
{
0x000111DBu,
0x00011320u,
}, image.Exports?.Entries.Select(e => e.Address.Rva));
}
[Fact]
public void ReadOrdinals()
{
var image = PEImage.FromBytes(Properties.Resources.SimpleDll_Exports);
Assert.Equal(new[]
{
1u,
2u,
}, image.Exports?.Entries.Select(e => e.Ordinal));
}
[Fact]
public void ChangeBaseOrdinalShouldUpdateAllOrdinals()
{
var image = PEImage.FromBytes(Properties.Resources.SimpleDll_Exports);
image.Exports!.BaseOrdinal = 10;
Assert.Equal(new[]
{
10u,
11u,
}, image.Exports.Entries.Select(e => e.Ordinal));
}
[Fact]
public void RemoveExportShouldUpdateOrdinals()
{
var image = PEImage.FromBytes(Properties.Resources.SimpleDll_Exports);
var export = image.Exports!.Entries[0];
image.Exports.Entries.RemoveAt(0);
Assert.Equal(0u, export.Ordinal);
Assert.Equal(1u, image.Exports.Entries[0].Ordinal);
}
[Fact]
public void InsertExportShouldUpdateOrdinals()
{
var image = PEImage.FromBytes(Properties.Resources.SimpleDll_Exports);
image.Exports!.Entries.Insert(0, new ExportedSymbol(new VirtualAddress(0x1234), "NewExport"));
Assert.Equal(new[]
{
1u,
2u,
3u,
}, image.Exports.Entries.Select(e => e.Ordinal));
}
private static IPEImage RebuildAndReloadManagedPE(IPEImage image)
{
// Build.
using var tempStream = new MemoryStream();
var builder = new ManagedPEFileBuilder();
var newPeFile = builder.CreateFile(image);
newPeFile.Write(new BinaryStreamWriter(tempStream));
// Reload.
var newImage = PEImage.FromBytes(tempStream.ToArray());
return newImage;
}
[Fact]
public void PersistentExportLibraryName()
{
var image = PEImage.FromBytes(Properties.Resources.HelloWorld);
image.Exports = new ExportDirectory("HelloWorld.dll")
{
Entries = {new ExportedSymbol(new VirtualAddress(0x12345678), "TestExport")}
};
var newImage = RebuildAndReloadManagedPE(image);
Assert.Equal(image.Exports.Name, newImage.Exports?.Name);
}
[Fact]
public void PersistentExportedSymbol()
{
var image = PEImage.FromBytes(Properties.Resources.HelloWorld);
// Prepare mock.
var exportDirectory = new ExportDirectory("HelloWorld.dll");
var exportedSymbol = new ExportedSymbol(new VirtualAddress(0x12345678), "TestExport");
exportDirectory.Entries.Add(exportedSymbol);
image.Exports = exportDirectory;
// Rebuild.
var newImage = RebuildAndReloadManagedPE(image);
// Verify.
Assert.Equal(1, newImage.Exports!.Entries.Count);
var newExportedSymbol = newImage.Exports.Entries[0];
Assert.Equal(exportedSymbol.Name, newExportedSymbol.Name);
Assert.Equal(exportedSymbol.Ordinal, newExportedSymbol.Ordinal);
Assert.Equal(exportedSymbol.Address.Rva, newExportedSymbol.Address.Rva);
}
}
}
| 33.266667 | 106 | 0.571365 | [
"MIT"
] | ElektroKill/AsmResolver | test/AsmResolver.PE.Tests/Exports/ExportDirectoryTest.cs | 4,491 | C# |
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Server;
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Xunit;
namespace tomware.OpenIddict.UI.Tests.Helpers
{
public class IntegrationContext : IClassFixture<IntegrationApplicationFactory<Startup>>
{
private readonly IntegrationApplicationFactory<Startup> _factory;
private readonly HttpClient _client;
private readonly string _accessToken;
protected IntegrationContext(IntegrationApplicationFactory<Server.Startup> factory)
{
_factory = factory;
_client = factory.CreateClient(new WebApplicationFactoryClientOptions
{
BaseAddress = new Uri("https://localhost:5001"),
AllowAutoRedirect = false
});
_accessToken = _factory.AccessToken;
}
protected static T Deserialize<T>(string responseBody)
{
return JsonSerializer.Deserialize<T>(responseBody, new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
});
}
protected async Task<HttpResponseMessage> GetAsync(
string endpoint,
bool authorized = true
)
{
return await GetClient(authorized)
.GetAsync(endpoint);
}
protected async Task<HttpResponseMessage> PostAsync<T>(
string endpoint,
T content,
bool authorized = true
)
{
var payload = JsonSerializer.Serialize<T>(content);
var httpContent = new StringContent(payload, Encoding.UTF8, "application/json");
return await GetClient(authorized)
.PostAsync(endpoint, httpContent);
}
protected async Task<HttpResponseMessage> PutAsync<T>(
string endpoint,
T content,
bool authorized = true
)
{
var payload = JsonSerializer.Serialize<T>(content);
var httpContent = new StringContent(payload, Encoding.UTF8, "application/json");
return await GetClient(authorized)
.PutAsync(endpoint, httpContent);
}
protected async Task<HttpResponseMessage> DeleteAsync(
string endpoint,
bool authorized = true
)
{
return await GetClient(authorized)
.DeleteAsync(endpoint);
}
protected T GetRequiredService<T>()
{
return _factory.Services.GetRequiredService<T>();
}
private HttpClient GetClient(bool authorized = true)
{
if (_client.DefaultRequestHeaders.Authorization != null)
{
_client.DefaultRequestHeaders.Authorization = null;
}
if (authorized)
{
if (_client.DefaultRequestHeaders.Authorization == null)
{
_client.DefaultRequestHeaders.Authorization
= new AuthenticationHeaderValue("Bearer", _accessToken);
}
}
return _client;
}
}
} | 26.504587 | 89 | 0.681551 | [
"MIT"
] | Soruk/openiddict-ui | tests/Helpers/IntegrationContext.cs | 2,889 | C# |
// -------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// -------------------------------------------------------------------------------------------------
using System.Collections.Generic;
using Microsoft.Health.Fhir.Core.Features.Search.Expressions;
using Microsoft.Health.Fhir.Core.Models;
using Microsoft.Health.Fhir.SqlServer.Features.Search.Expressions;
using Microsoft.Health.Fhir.SqlServer.Features.Search.Expressions.Visitors;
using Xunit;
namespace Microsoft.Health.Fhir.SqlServer.UnitTests.Features.Search.Expressions
{
public class NotExpressionRewriterTests
{
[Fact]
public void GivenExpressionWithNotExpression_WhenVisited_AllExpressionPrependedToExpressionList()
{
var subExpression = Expression.StringEquals(FieldName.TokenCode, 0, "TestValue123", false);
var searchParamTableExpressions = new List<SearchParamTableExpression>
{
new SearchParamTableExpression(null, new SearchParameterExpression(new SearchParameterInfo("TestParam", "TestParam"), Expression.Not(subExpression)), SearchParamTableExpressionKind.Normal),
};
var inputExpression = SqlRootExpression.WithSearchParamTableExpressions(searchParamTableExpressions);
var visitedExpression = (SqlRootExpression)inputExpression.AcceptVisitor(NotExpressionRewriter.Instance);
Assert.Collection(
visitedExpression.SearchParamTableExpressions,
e => { Assert.Equal(SearchParamTableExpressionKind.All, e.Kind); },
e => { ValidateNotExpression(subExpression, e); });
Assert.Equal(searchParamTableExpressions.Count + 1, visitedExpression.SearchParamTableExpressions.Count);
}
[Fact]
public void GivenExpressionWithNoNotExpression_WhenVisited_OriginalExpressionReturned()
{
var searchParamTableExpressions = new List<SearchParamTableExpression>
{
new SearchParamTableExpression(null, null, SearchParamTableExpressionKind.Normal),
};
var inputExpression = SqlRootExpression.WithSearchParamTableExpressions(searchParamTableExpressions);
var visitedExpression = (SqlRootExpression)inputExpression.AcceptVisitor(NotExpressionRewriter.Instance);
Assert.Equal(inputExpression, visitedExpression);
}
[Fact]
public void GivenExpressionWithNotExpressionLast_WhenVisited_NotExpressionUnwrapped()
{
var subExpression = Expression.StringEquals(FieldName.TokenCode, 0, "TestValue123", false);
var searchParamTableExpressions = new List<SearchParamTableExpression>
{
new SearchParamTableExpression(null, null, SearchParamTableExpressionKind.Normal),
new SearchParamTableExpression(null, new SearchParameterExpression(new SearchParameterInfo("TestParam", "TestParam"), Expression.Not(subExpression)), SearchParamTableExpressionKind.Normal),
};
var inputExpression = SqlRootExpression.WithSearchParamTableExpressions(searchParamTableExpressions);
var visitedExpression = (SqlRootExpression)inputExpression.AcceptVisitor(NotExpressionRewriter.Instance);
Assert.Collection(
visitedExpression.SearchParamTableExpressions,
e => { Assert.Equal(searchParamTableExpressions[0], e); },
e => { ValidateNotExpression(subExpression, e); });
}
private static void ValidateNotExpression(Expression subExpression, SearchParamTableExpression expressionToValidate)
{
Assert.Equal(SearchParamTableExpressionKind.NotExists, expressionToValidate.Kind);
var spExpression = Assert.IsType<SearchParameterExpression>(expressionToValidate.Predicate);
Assert.Equal(subExpression, spExpression.Expression);
}
}
}
| 55.013333 | 205 | 0.689287 | [
"MIT"
] | BearerPipelineTest/fhir-server | src/Microsoft.Health.Fhir.SqlServer.UnitTests/Features/Search/Expressions/NotExpressionRewriterTests.cs | 4,128 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System.Collections.Generic;
using System.Text.Json;
using Azure.Core;
namespace Azure.ResourceManager.Sql.Models
{
public partial class JobTargetGroup : IUtf8JsonSerializable
{
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
{
writer.WriteStartObject();
writer.WritePropertyName("properties");
writer.WriteStartObject();
if (Optional.IsCollectionDefined(Members))
{
writer.WritePropertyName("members");
writer.WriteStartArray();
foreach (var item in Members)
{
writer.WriteObjectValue(item);
}
writer.WriteEndArray();
}
writer.WriteEndObject();
writer.WriteEndObject();
}
internal static JobTargetGroup DeserializeJobTargetGroup(JsonElement element)
{
Optional<string> id = default;
Optional<string> name = default;
Optional<string> type = default;
Optional<IList<JobTarget>> members = default;
foreach (var property in element.EnumerateObject())
{
if (property.NameEquals("id"))
{
id = property.Value.GetString();
continue;
}
if (property.NameEquals("name"))
{
name = property.Value.GetString();
continue;
}
if (property.NameEquals("type"))
{
type = property.Value.GetString();
continue;
}
if (property.NameEquals("properties"))
{
foreach (var property0 in property.Value.EnumerateObject())
{
if (property0.NameEquals("members"))
{
List<JobTarget> array = new List<JobTarget>();
foreach (var item in property0.Value.EnumerateArray())
{
array.Add(JobTarget.DeserializeJobTarget(item));
}
members = array;
continue;
}
}
continue;
}
}
return new JobTargetGroup(id.Value, name.Value, type.Value, Optional.ToList(members));
}
}
}
| 33.9 | 98 | 0.476032 | [
"MIT"
] | AbelHu/azure-sdk-for-net | sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/JobTargetGroup.Serialization.cs | 2,712 | C# |
using System;
using System.Globalization;
using Xamarin.Forms;
namespace AppTokiota.Users.Converters
{
public class FormatTimeEntry: IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value.ToString();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
}
| 23.85 | 103 | 0.660377 | [
"MIT"
] | ioadres/AppTokiota | AppTokiota.Users/Converters/FormatTimeEntry.cs | 479 | 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 appflow-2020-08-23.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.Appflow.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.Appflow.Model.Internal.MarshallTransformations
{
/// <summary>
/// SingularConnectorProfileCredentials Marshaller
/// </summary>
public class SingularConnectorProfileCredentialsMarshaller : IRequestMarshaller<SingularConnectorProfileCredentials, 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(SingularConnectorProfileCredentials requestObject, JsonMarshallerContext context)
{
if(requestObject.IsSetApiKey())
{
context.Writer.WritePropertyName("apiKey");
context.Writer.Write(requestObject.ApiKey);
}
}
/// <summary>
/// Singleton Marshaller.
/// </summary>
public readonly static SingularConnectorProfileCredentialsMarshaller Instance = new SingularConnectorProfileCredentialsMarshaller();
}
} | 35.612903 | 145 | 0.681612 | [
"Apache-2.0"
] | philasmar/aws-sdk-net | sdk/src/Services/Appflow/Generated/Model/Internal/MarshallTransformations/SingularConnectorProfileCredentialsMarshaller.cs | 2,208 | C# |
using Piranha.Extend;
using Piranha.Extend.Fields;
using Piranha.Models;
namespace NorthwindCms.Models
{
public class ProductRegion
{
[Field(Title = "Product ID")]
public NumberField ProductID { get; set; }
[Field(Title = "Product name")]
public TextField ProductName { get; set; }
[Field(Title = "Unit price", Options = FieldOption.HalfWidth)]
public StringField UnitPrice { get; set; }
[Field(Title = "Units in stock", Options = FieldOption.HalfWidth)]
public NumberField UnitsInStock { get; set; }
}
} | 26 | 70 | 0.690476 | [
"MIT"
] | zherar7ordoya/AP3 | (CSharp)/1) Mark Price/Code/PracticalApps/NorthwindCms/Models/ProductRegion.cs | 546 | C# |
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
namespace JsonWebToken.Performance
{
[Config(typeof(DefaultCoreConfig))]
[BenchmarkCategory("CI-CD")]
public class ValidateInvalidTokenBenchmark : ValidateInvalidToken
{
public override IEnumerable<string> GetTokens()
{
yield return "JWS 16 claims";
}
}
}
| 23.875 | 69 | 0.688482 | [
"MIT"
] | signature-opensource/Jwt | perf/Sandbox/ValidateInvalidTokenBenchmark.cs | 384 | C# |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package heap provides heap operations for any type that implements
// heap.Interface. A heap is a tree with the property that each node is the
// minimum-valued node in its subtree.
//
// The minimum element in the tree is the root, at index 0.
//
// A heap is a common way to implement a priority queue. To build a priority
// queue, implement the Heap interface with the (negative) priority as the
// ordering for the Less method, so Push adds items while Pop removes the
// highest-priority item from the queue. The Examples include such an
// implementation; the file example_pq_test.go has the complete source.
//
// package heap -- go2cs converted at 2020 October 09 05:19:29 UTC
// import "container/heap" ==> using heap = go.container.heap_package
// Original source: C:\Go\src\container\heap\heap.go
using sort = go.sort_package;
using static go.builtin;
namespace go {
namespace container
{
public static partial class heap_package
{
// The Interface type describes the requirements
// for a type using the routines in this package.
// Any type that implements it may be used as a
// min-heap with the following invariants (established after
// Init has been called or if the data is empty or sorted):
//
// !h.Less(j, i) for 0 <= i < h.Len() and 2*i+1 <= j <= 2*i+2 and j < h.Len()
//
// Note that Push and Pop in this interface are for package heap's
// implementation to call. To add and remove things from the heap,
// use heap.Push and heap.Pop.
public partial interface Interface : sort.Interface
{
void Push(object x); // add x as element Len()
void Pop(); // remove and return element Len() - 1.
}
// Init establishes the heap invariants required by the other routines in this package.
// Init is idempotent with respect to the heap invariants
// and may be called whenever the heap invariants may have been invalidated.
// The complexity is O(n) where n = h.Len().
public static void Init(Interface h)
{
// heapify
var n = h.Len();
for (var i = n / 2L - 1L; i >= 0L; i--)
{
down(h, i, n);
}
}
// Push pushes the element x onto the heap.
// The complexity is O(log n) where n = h.Len().
public static void Push(Interface h, object x)
{
h.Push(x);
up(h, h.Len() - 1L);
}
// Pop removes and returns the minimum element (according to Less) from the heap.
// The complexity is O(log n) where n = h.Len().
// Pop is equivalent to Remove(h, 0).
public static void Pop(Interface h)
{
var n = h.Len() - 1L;
h.Swap(0L, n);
down(h, 0L, n);
return h.Pop();
}
// Remove removes and returns the element at index i from the heap.
// The complexity is O(log n) where n = h.Len().
public static void Remove(Interface h, long i)
{
var n = h.Len() - 1L;
if (n != i)
{
h.Swap(i, n);
if (!down(h, i, n))
{
up(h, i);
}
}
return h.Pop();
}
// Fix re-establishes the heap ordering after the element at index i has changed its value.
// Changing the value of the element at index i and then calling Fix is equivalent to,
// but less expensive than, calling Remove(h, i) followed by a Push of the new value.
// The complexity is O(log n) where n = h.Len().
public static void Fix(Interface h, long i)
{
if (!down(h, i, h.Len()))
{
up(h, i);
}
}
private static void up(Interface h, long j)
{
while (true)
{
var i = (j - 1L) / 2L; // parent
if (i == j || !h.Less(j, i))
{
break;
}
h.Swap(i, j);
j = i;
}
}
private static bool down(Interface h, long i0, long n)
{
var i = i0;
while (true)
{
long j1 = 2L * i + 1L;
if (j1 >= n || j1 < 0L)
{ // j1 < 0 after int overflow
break;
}
var j = j1; // left child
{
var j2 = j1 + 1L;
if (j2 < n && h.Less(j2, j1))
{
j = j2; // = 2*i + 2 // right child
}
}
if (!h.Less(j, i))
{
break;
}
h.Swap(i, j);
i = j;
}
return i > i0;
}
}
}}
| 30.857143 | 99 | 0.5 | [
"MIT"
] | GridProtectionAlliance/go2cs | src/go-src-converted/container/heap/heap.cs | 5,184 | C# |
using Halcyon.HAL.Attributes;
using Test.Controllers;
using Test.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Threax.AspNetCore.Halcyon.Ext;
using Threax.AspNetCore.Halcyon.Ext.ValueProviders;
using Threax.AspNetCore.Models;
using System.ComponentModel.DataAnnotations;
namespace Test.InputModels
{
[HalModel]
public partial class ValueQuery : PagedCollectionQuery, IValueQuery
{
/// <summary>
/// Lookup a value by id.
/// </summary>
public Guid? ValueId { get; set; }
/// <summary>
/// Populate an IQueryable for values. Does not apply the skip or limit.
/// </summary>
/// <param name="query">The query to populate.</param>
/// <returns>The query passed in populated with additional conditions.</returns>
public IQueryable<T> Create<T>(IQueryable<T> query) where T : IValue, IValueId
{
if (ValueId != null)
{
query = query.Where(i => i.ValueId == ValueId);
}
else
{
OnCreate(ref query);
}
return query;
}
partial void OnCreate<T>(ref IQueryable<T> query) where T : IValue, IValueId;
}
} | 28.8 | 88 | 0.609568 | [
"Apache-2.0"
] | threax/AspNetCore.Swashbuckle.Convention | test/Threax.ModelGen.Tests/TestFiles/AbstractOnEntityTests/InputModels/ValueQuery.Generated.cs | 1,296 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace JamSoft.Prism.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("JamSoft.Prism.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to _Exit.
/// </summary>
public static string ExitString {
get {
return ResourceManager.GetString("ExitString", resourceCulture);
}
}
}
}
| 41.958904 | 179 | 0.601371 | [
"MIT"
] | jamsoft/PrismArchitectureDemo | JamSoft.Prism/Properties/Resources.Designer.cs | 3,065 | C# |
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
using System.CommandLine.Binding;
using System.CommandLine.Parsing;
using System.Linq;
namespace System.CommandLine
{
/// <summary>
/// A symbol defining a named parameter and a value for that parameter.
/// </summary>
/// <seealso cref="System.CommandLine.IdentifierSymbol" />
/// <seealso cref="System.CommandLine.IOption" />
public class Option :
IdentifierSymbol,
IOption
{
private string? _implicitName;
private protected readonly HashSet<string> _unprefixedAliases = new();
/// <summary>
/// Initializes a new instance of the <see cref="Option"/> class.
/// </summary>
/// <param name="name">The name of the option, which can be used to specify it on the command line.</param>
/// <param name="description">The description of the option shown in help.</param>
/// <param name="argumentType">The type that the option's argument(s) can be parsed to.</param>
/// <param name="getDefaultValue">A delegate used to get a default value for the option when it is not specified on the command line.</param>
/// <param name="arity">The arity of the option.</param>
public Option(
string name,
string? description = null,
Type? argumentType = null,
Func<object?>? getDefaultValue = null,
IArgumentArity? arity = null)
: this(new[] { name }, description, argumentType, getDefaultValue, arity)
{ }
/// <summary>
/// Initializes a new instance of the <see cref="Option"/> class.
/// </summary>
/// <param name="aliases">The set of strings that can be used on the command line to specify the option.</param>
/// <param name="description">The description of the option shown in help.</param>
/// <param name="argumentType">The type that the option's argument(s) can be parsed to.</param>
/// <param name="getDefaultValue">A delegate used to get a default value for the option when it is not specified on the command line.</param>
/// <param name="arity">The arity of the option.</param>
public Option(
string[] aliases,
string? description = null,
Type? argumentType = null,
Func<object?>? getDefaultValue = null,
IArgumentArity? arity = null)
: this(aliases, description, CreateArgument(argumentType, getDefaultValue, arity))
{ }
internal Option(
string[] aliases,
string? description,
Argument? argument)
: base(description)
{
if (aliases is null)
{
throw new ArgumentNullException(nameof(aliases));
}
if (aliases.Length == 0)
{
throw new ArgumentException("An option must have at least one alias.", nameof(aliases));
}
for (var i = 0; i < aliases.Length; i++)
{
var alias = aliases[i];
AddAlias(alias);
}
if (argument != null)
{
AddArgumentInner(argument);
}
}
private static Argument? CreateArgument(Type? argumentType, Func<object?>? getDefaultValue, IArgumentArity? arity)
{
if (argumentType is null &&
getDefaultValue is null &&
arity is null)
{
return null;
}
var rv = new Argument();
if (argumentType != null)
{
rv.ArgumentType = argumentType;
}
if (getDefaultValue != null)
{
rv.SetDefaultValueFactory(getDefaultValue);
}
if (arity != null)
{
rv.Arity = arity;
}
return rv;
}
internal virtual Argument Argument
{
get
{
switch (Children.Arguments.Count)
{
case 0:
var none = Argument.None();
AddSymbol(none);
return none;
default:
DebugAssert.ThrowIf(Children.Arguments.Count > 1, $"Unexpected number of option arguments: {Children.Arguments.Count}");
return Children.Arguments[0];
}
}
}
/// <summary>
/// Gets or sets the name of the argument when displayed in help.
/// </summary>
/// <value>
/// The name of the argument when displayed in help.
/// </value>
public string? ArgumentHelpName
{
get => Argument.HelpName;
set => Argument.HelpName = value;
}
/// <summary>
/// Gets or sets the arity of the option.
/// </summary>
public virtual IArgumentArity Arity
{
get => Argument.Arity;
init
{
if (value.MaximumNumberOfValues > 0)
{
Argument.ArgumentType = typeof(string);
}
Argument.Arity = value;
}
}
internal bool DisallowBinding { get; init; }
/// <inheritdoc />
public override string Name
{
get => base.Name;
set
{
if (!HasAlias(value))
{
_implicitName = null;
RemoveAlias(DefaultName);
}
base.Name = value;
}
}
internal List<ValidateSymbolResult<OptionResult>> Validators { get; } = new();
/// <summary>
/// Adds an alias for the option, which can be used to specify the option on the command line.
/// </summary>
/// <param name="alias">The alias to add.</param>
public void AddAlias(string alias) => AddAliasInner(alias);
private protected override void AddAliasInner(string alias)
{
ThrowIfAliasIsInvalid(alias);
base.AddAliasInner(alias);
var unprefixedAlias = alias.RemovePrefix();
_unprefixedAliases.Add(unprefixedAlias!);
}
/// <summary>
/// Adds a validator that will be called when the option is matched by the parser.
/// </summary>
/// <param name="validate">A <see cref="ValidateSymbolResult{OptionResult}"/> delegate used to validate the <see cref="OptionResult"/> produced during parsing.</param>
public void AddValidator(ValidateSymbolResult<OptionResult> validate) => Validators.Add(validate);
/// <summary>
/// Indicates whether a given alias exists on the option, regardless of its prefix.
/// </summary>
/// <param name="alias">The alias, which can include a prefix.</param>
/// <returns><see langword="true"/> if the alias exists; otherwise, <see langword="false"/>.</returns>
public bool HasAliasIgnoringPrefix(string alias) => _unprefixedAliases.Contains(alias.RemovePrefix());
private protected override void RemoveAlias(string alias)
{
_unprefixedAliases.Remove(alias);
base.RemoveAlias(alias);
}
/// <summary>
/// Sets the default value for the option.
/// </summary>
/// <param name="value">The default value for the option.</param>
public void SetDefaultValue(object? value) =>
Argument.SetDefaultValue(value);
/// <summary>
/// Sets a delegate to invoke when the default value for the option is required.
/// </summary>
/// <param name="getDefaultValue">The delegate to invoke to return the default value.</param>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="getDefaultValue"/> is null.</exception>
public void SetDefaultValueFactory(Func<object?> getDefaultValue) =>
Argument.SetDefaultValueFactory(getDefaultValue);
IArgument IOption.Argument => Argument;
/// <inheritdoc/>
public bool AllowMultipleArgumentsPerToken { get; set; }
/// <summary>
/// Indicates whether the option is required when its parent command is invoked.
/// </summary>
/// <remarks>When an option is required and its parent command is invoked without it, an error results.</remarks>
public bool IsRequired { get; set; }
string IValueDescriptor.ValueName => Name;
/// <summary>
/// The <see cref="System.Type"/> that the option's arguments are expected to be parsed as.
/// </summary>
public Type ValueType => Argument.ArgumentType;
bool IValueDescriptor.HasDefaultValue => Argument.HasDefaultValue;
object? IValueDescriptor.GetDefaultValue() => Argument.GetDefaultValue();
private protected override string DefaultName =>
_implicitName ??= Aliases
.OrderBy(a => a.Length)
.Last()
.RemovePrefix();
}
}
| 36.782946 | 175 | 0.556164 | [
"MIT"
] | zyj0021/command-line-api | src/System.CommandLine/Option.cs | 9,492 | C# |
//
// UnityOSC - Open Sound Control interface for the Unity3d game engine
//
// Copyright (c) 2012 Jorge Garcia Martin
// Last edit: Gerard Llorach 2nd August 2017
//
// 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.
//
// Inspired by http://www.unifycommunity.com/wiki/index.php?title=AManagerClass
using System;
using System.Net;
using System.Collections.Generic;
using UnityEngine;
using UnityOSC;
/// <summary>
/// Models a log of a server composed by an OSCServer, a List of OSCPacket and a List of
/// strings that represent the current messages in the log.
/// </summary>
public struct ServerLog
{
public OSCServer server;
public List<OSCPacket> packets;
public List<string> log;
}
/// <summary>
/// Models a log of a client composed by an OSCClient, a List of OSCMessage and a List of
/// strings that represent the current messages in the log.
/// </summary>
public struct ClientLog
{
public OSCClient client;
public List<OSCMessage> messages;
public List<string> log;
}
/// <summary>
/// Handles all the OSC servers and clients of the current Unity game/application.
/// Tracks incoming and outgoing messages.
/// </summary>
public class OSCHandler : MonoBehaviour
{
#region Singleton Constructors
static OSCHandler()
{
}
OSCHandler()
{
}
public static OSCHandler Instance
{
get
{
if (_instance == null)
{
_instance = new GameObject("OSCHandler").AddComponent<OSCHandler>();
}
return _instance;
}
}
#endregion
#region Member Variables
private static OSCHandler _instance = null;
private Dictionary<string, ClientLog> _clients = new Dictionary<string, ClientLog>();
private Dictionary<string, ServerLog> _servers = new Dictionary<string, ServerLog>();
public List<OSCPacket> packets = new List<OSCPacket>();
private const int _loglength = 100;
#endregion
/// <summary>
/// Initializes the OSC Handler.
/// Here you can create the OSC servers and clientes.
/// </summary>
public void Init()
{
//Initialize OSC clients (transmitters)
//PureData:
// CreateClient("PureData", IPAddress.Parse("127.0.0.1"), 8765);
CreateClient("myClient", IPAddress.Parse("127.0.0.1"), 8765);
//Initialize OSC servers (listeners)
//Example:
//CreateServer("AndroidPhone", 6666);
}
#region Properties
public Dictionary<string, ClientLog> Clients
{
get
{
return _clients;
}
}
public Dictionary<string, ServerLog> Servers
{
get
{
return _servers;
}
}
#endregion
#region Methods
/// <summary>
/// Ensure that the instance is destroyed when the game is stopped in the Unity editor
/// Close all the OSC clients and servers
/// </summary>
void OnApplicationQuit()
{
foreach(KeyValuePair<string,ClientLog> pair in _clients)
{
pair.Value.client.Close();
}
foreach(KeyValuePair<string,ServerLog> pair in _servers)
{
pair.Value.server.Close();
}
_instance = null;
}
/// <summary>
/// Creates an OSC Client (sends OSC messages) given an outgoing port and address.
/// </summary>
/// <param name="clientId">
/// A <see cref="System.String"/>
/// </param>
/// <param name="destination">
/// A <see cref="IPAddress"/>
/// </param>
/// <param name="port">
/// A <see cref="System.Int32"/>
/// </param>
public void CreateClient(string clientId, IPAddress destination, int port)
{
ClientLog clientitem = new ClientLog();
clientitem.client = new OSCClient(destination, port);
clientitem.log = new List<string>();
clientitem.messages = new List<OSCMessage>();
_clients.Add(clientId, clientitem);
// Send test message
string testaddress = "/test/alive/";
OSCMessage message = new OSCMessage(testaddress, destination.ToString());
message.Append(port); message.Append("OK");
_clients[clientId].log.Add(String.Concat(DateTime.UtcNow.ToString(),".",
FormatMilliseconds(DateTime.Now.Millisecond), " : ",
testaddress," ", DataToString(message.Data)));
_clients[clientId].messages.Add(message);
_clients[clientId].client.Send(message);
}
/// <summary>
/// Creates an OSC Server (listens to upcoming OSC messages) given an incoming port.
/// </summary>
/// <param name="serverId">
/// A <see cref="System.String"/>
/// </param>
/// <param name="port">
/// A <see cref="System.Int32"/>
/// </param>
public OSCServer CreateServer(string serverId, int port)
{
OSCServer server = new OSCServer(port);
server.PacketReceivedEvent += OnPacketReceived;
ServerLog serveritem = new ServerLog();
serveritem.server = server;
serveritem.log = new List<string>();
serveritem.packets = new List<OSCPacket>();
_servers.Add(serverId, serveritem);
return server;
}
/// <summary>
/// Callback when a message is received. It stores the messages in a list of the oscControl
void OnPacketReceived(OSCServer server, OSCPacket packet)
{
// Remember origin
packet.server = server;
// Limit buffer
if (packets.Count > _loglength)
{
packets.RemoveRange(0, packets.Count - _loglength);
}
// Add to OSCPackets list
packets.Add(packet);
}
/// <summary>
/// Sends an OSC message to a specified client, given its clientId (defined at the OSC client construction),
/// OSC address and a single value. Also updates the client log.
/// </summary>
/// <param name="clientId">
/// A <see cref="System.String"/>
/// </param>
/// <param name="address">
/// A <see cref="System.String"/>
/// </param>
/// <param name="value">
/// A <see cref="T"/>
/// </param>
public void SendMessageToClient<T>(string clientId, string address, T value)
{
List<object> temp = new List<object>();
temp.Add(value);
SendMessageToClient(clientId, address, temp);
}
/// <summary>
/// Sends an OSC message to a specified client, given its clientId (defined at the OSC client construction),
/// OSC address and a list of values. Also updates the client log.
/// </summary>
/// <param name="clientId">
/// A <see cref="System.String"/>
/// </param>
/// <param name="address">
/// A <see cref="System.String"/>
/// </param>
/// <param name="values">
/// A <see cref="List<T>"/>
/// </param>
public void SendMessageToClient<T>(string clientId, string address, List<T> values)
{
if(_clients.ContainsKey(clientId))
{
OSCMessage message = new OSCMessage(address);
foreach(T msgvalue in values)
{
message.Append(msgvalue);
}
if(_clients[clientId].log.Count < _loglength)
{
_clients[clientId].log.Add(String.Concat(DateTime.UtcNow.ToString(),".",
FormatMilliseconds(DateTime.Now.Millisecond),
" : ", address, " ", DataToString(message.Data)));
_clients[clientId].messages.Add(message);
}
else
{
_clients[clientId].log.RemoveAt(0);
_clients[clientId].messages.RemoveAt(0);
_clients[clientId].log.Add(String.Concat(DateTime.UtcNow.ToString(),".",
FormatMilliseconds(DateTime.Now.Millisecond),
" : ", address, " ", DataToString(message.Data)));
_clients[clientId].messages.Add(message);
}
_clients[clientId].client.Send(message);
}
else
{
// Hiding Debug Error that showed up when app was not running.
// Debug.LogError(string.Format("Can't send OSC messages to {0}. Client doesn't exist.", clientId));
}
}
/// <summary>
/// Updates clients and servers logs.
/// NOTE: Only used by the editor helper script (OSCHelper.cs), could be removed
/// </summary>
public void UpdateLogs()
{
foreach(KeyValuePair<string,ServerLog> pair in _servers)
{
if(_servers[pair.Key].server.LastReceivedPacket != null)
{
//Initialization for the first packet received
if(_servers[pair.Key].log.Count == 0)
{
_servers[pair.Key].packets.Add(_servers[pair.Key].server.LastReceivedPacket);
_servers[pair.Key].log.Add(String.Concat(DateTime.UtcNow.ToString(), ".",
FormatMilliseconds(DateTime.Now.Millisecond)," : ",
_servers[pair.Key].server.LastReceivedPacket.Address," ",
DataToString(_servers[pair.Key].server.LastReceivedPacket.Data)));
break;
}
if(_servers[pair.Key].server.LastReceivedPacket.TimeStamp
!= _servers[pair.Key].packets[_servers[pair.Key].packets.Count - 1].TimeStamp)
{
if(_servers[pair.Key].log.Count > _loglength - 1)
{
_servers[pair.Key].log.RemoveAt(0);
_servers[pair.Key].packets.RemoveAt(0);
}
_servers[pair.Key].packets.Add(_servers[pair.Key].server.LastReceivedPacket);
_servers[pair.Key].log.Add(String.Concat(DateTime.UtcNow.ToString(), ".",
FormatMilliseconds(DateTime.Now.Millisecond)," : ",
_servers[pair.Key].server.LastReceivedPacket.Address," ",
DataToString(_servers[pair.Key].server.LastReceivedPacket.Data)));
}
}
}
}
/// <summary>
/// Converts a collection of object values to a concatenated string.
/// </summary>
/// <param name="data">
/// A <see cref="List<System.Object>"/>
/// </param>
/// <returns>
/// A <see cref="System.String"/>
/// </returns>
private string DataToString(List<object> data)
{
string buffer = "";
for(int i = 0; i < data.Count; i++)
{
buffer += data[i].ToString() + " ";
}
buffer += "\n";
return buffer;
}
/// <summary>
/// Formats a milliseconds number to a 000 format. E.g. given 50, it outputs 050. Given 5, it outputs 005
/// </summary>
/// <param name="milliseconds">
/// A <see cref="System.Int32"/>
/// </param>
/// <returns>
/// A <see cref="System.String"/>
/// </returns>
private string FormatMilliseconds(int milliseconds)
{
if(milliseconds < 100)
{
if(milliseconds < 10)
return String.Concat("00",milliseconds.ToString());
return String.Concat("0",milliseconds.ToString());
}
return milliseconds.ToString();
}
#endregion
}
| 30.986979 | 120 | 0.616186 | [
"Unlicense"
] | NiccoloGranieri/Leapity | LeapToOSC/Assets/OSC/OSCHandler.cs | 11,899 | C# |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
using System;
using System.Collections.Generic;
using Aliyun.Acs.Core.Transform;
using Aliyun.Acs.Dds.Model.V20151201;
namespace Aliyun.Acs.Dds.Transform.V20151201
{
public class DescribeTagsResponseUnmarshaller
{
public static DescribeTagsResponse Unmarshall(UnmarshallerContext _ctx)
{
DescribeTagsResponse describeTagsResponse = new DescribeTagsResponse();
describeTagsResponse.HttpResponse = _ctx.HttpResponse;
describeTagsResponse.RequestId = _ctx.StringValue("DescribeTags.RequestId");
describeTagsResponse.NextToken = _ctx.StringValue("DescribeTags.NextToken");
List<DescribeTagsResponse.DescribeTags_Tag> describeTagsResponse_tags = new List<DescribeTagsResponse.DescribeTags_Tag>();
for (int i = 0; i < _ctx.Length("DescribeTags.Tags.Length"); i++) {
DescribeTagsResponse.DescribeTags_Tag tag = new DescribeTagsResponse.DescribeTags_Tag();
tag.TagKey = _ctx.StringValue("DescribeTags.Tags["+ i +"].TagKey");
List<string> tag_tagValues = new List<string>();
for (int j = 0; j < _ctx.Length("DescribeTags.Tags["+ i +"].TagValues.Length"); j++) {
tag_tagValues.Add(_ctx.StringValue("DescribeTags.Tags["+ i +"].TagValues["+ j +"]"));
}
tag.TagValues = tag_tagValues;
describeTagsResponse_tags.Add(tag);
}
describeTagsResponse.Tags = describeTagsResponse_tags;
return describeTagsResponse;
}
}
}
| 40.017857 | 126 | 0.734047 | [
"Apache-2.0"
] | AxiosCros/aliyun-openapi-net-sdk | aliyun-net-sdk-dds/Dds/Transform/V20151201/DescribeTagsResponseUnmarshaller.cs | 2,241 | C# |
using System;
using EtlLib.Data;
using EtlLib.Pipeline.Builders;
namespace EtlLib.Pipeline.Operations
{
public abstract class AbstractEtlProcess : AbstractEtlOperationWithNoResult
{
private IEtlOperationWithNoResult _etlProcess;
private IEtlProcessBuilder _builder;
private Action<IEtlProcessBuilder> _bootstrapBuilder;
protected void Build(Action<IEtlProcessBuilder> builder)
{
_bootstrapBuilder = builder;
}
public override IEtlOperationResult Execute(EtlPipelineContext context)
{
_builder = EtlProcessBuilder.Create(context);
_bootstrapBuilder(_builder);
_etlProcess = ((EtlProcessBuilder)_builder).Build();
Named(_etlProcess.Name);
return _etlProcess.Execute(context);
}
}
public abstract class AbstractEtlProcess<T> : AbstractEtlOperationWithEnumerableResult<T>
where T : class, INodeOutput<T>, new()
{
private IEtlOperationWithEnumerableResult<T> _etlProcess;
private IEtlProcessBuilder _builder;
private Action<IEtlProcessBuilder> _bootstrapBuilder;
protected void Build(Action<IEtlProcessBuilder> builder)
{
_bootstrapBuilder = builder;
}
public override IEnumerableEtlOperationResult<T> ExecuteWithResult(EtlPipelineContext context)
{
_builder = EtlProcessBuilder.Create(context);
_bootstrapBuilder(_builder);
_etlProcess = ((EtlProcessBuilder)_builder).Build<T>();
Named(_etlProcess.Name);
return _etlProcess.ExecuteWithResult(context);
}
}
} | 32.754717 | 103 | 0.653802 | [
"MIT"
] | cylewitruk/EtlLib | src/EtlLib/Pipeline/Operations/AbstractEtlProcess.cs | 1,738 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WebApp;
using WebApp.Controllers;
namespace WebApp.Tests.Controllers
{
[TestClass]
public class HomeControllerTest
{
[TestMethod]
public void Index()
{
// Arrange
HomeController controller = new HomeController();
// Act
ViewResult result = controller.Index() as ViewResult;
// Assert
Assert.IsNotNull(result);
}
[TestMethod]
public void About()
{
// Arrange
HomeController controller = new HomeController();
// Act
ViewResult result = controller.About() as ViewResult;
// Assert
Assert.AreEqual("Your application description page.", result.ViewBag.Message);
}
[TestMethod]
public void Contact()
{
// Arrange
HomeController controller = new HomeController();
// Act
ViewResult result = controller.Contact() as ViewResult;
// Assert
Assert.IsNotNull(result);
}
}
}
| 23.036364 | 90 | 0.568272 | [
"MIT"
] | Edblack991/INE_PATRONOS_NEW | INE_Patronos_New/WebApp.Tests/Controllers/HomeControllerTest.cs | 1,269 | C# |
using System;
using UniRx.Operators;
namespace UniRx.Operators
{
internal class RefCountObservable<T> : OperatorObservableBase<T>
{
readonly IConnectableObservable<T> source;
readonly object gate = new object();
int refCount = 0;
IDisposable connection;
public RefCountObservable(IConnectableObservable<T> source)
: base(source.IsRequiredSubscribeOnCurrentThread())
{
this.source = source;
}
protected override IDisposable SubscribeCore(IObserver<T> observer, IDisposable cancel)
{
return new RefCount(this, observer, cancel).Run();
}
class RefCount : OperatorObserverBase<T, T>
{
readonly RefCountObservable<T> parent;
public RefCount(RefCountObservable<T> parent, IObserver<T> observer, IDisposable cancel) : base(observer, cancel)
{
this.parent = parent;
}
public IDisposable Run()
{
var subcription = parent.source.Subscribe(this);
lock (parent.gate)
{
if (++parent.refCount == 1)
{
parent.connection = parent.source.Connect();
}
}
return Disposable.Create(() =>
{
subcription.Dispose();
lock (parent.gate)
{
if (--parent.refCount == 0)
{
parent.connection.Dispose();
}
}
});
}
public override void OnNext(T value)
{
base.observer.OnNext(value);
}
public override void OnError(Exception error)
{
try { observer.OnError(error); }
finally { Dispose(); }
}
public override void OnCompleted()
{
try { observer.OnCompleted(); }
finally { Dispose(); }
}
}
}
} | 28.38961 | 125 | 0.467063 | [
"MIT"
] | 142333lzg/jynew | jyx2/Assets/Plugins/UniRx/Scripts/Operators/RefCount.cs | 2,188 | C# |
namespace Aviant.Core.Reflection;
public interface ITypeFinder
{
Type[] Find(Func<Type, bool> predicate);
Type[] FindAll();
}
| 15.111111 | 44 | 0.698529 | [
"MIT"
] | panosru/Aviant | src/Kernel/Core/Reflection/ITypeFinder.cs | 136 | C# |
namespace StardewMods.FuryCore.Services;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Text;
using Common.Helpers;
using HarmonyLib;
using StardewMods.FuryCore.Attributes;
using StardewMods.FuryCore.Enums;
using StardewMods.FuryCore.Interfaces;
using StardewMods.FuryCore.Models;
/// <inheritdoc cref="IHarmonyHelper" />
[FuryCoreService(true)]
internal class HarmonyHelper : IHarmonyHelper, IModService
{
private readonly IDictionary<string, Harmony> _harmony = new Dictionary<string, Harmony>();
private readonly IDictionary<string, List<SavedPatch>> _savedPatches = new Dictionary<string, List<SavedPatch>>();
/// <inheritdoc />
public void AddPatch(string id, MethodBase original, Type type, string name, PatchType patchType = PatchType.Prefix)
{
this.AddPatches(
id,
new[]
{
new SavedPatch(original, type, name, patchType),
});
}
/// <inheritdoc />
public void AddPatches(string id, IEnumerable<SavedPatch> patches)
{
if (!this._savedPatches.TryGetValue(id, out var savedPatches))
{
savedPatches = new();
this._savedPatches.Add(id, savedPatches);
}
savedPatches.AddRange(patches);
}
/// <inheritdoc />
public void ApplyPatches(string id)
{
if (!this._savedPatches.TryGetValue(id, out var patches))
{
return;
}
if (!this._harmony.TryGetValue(id, out var harmony))
{
harmony = new(id);
this._harmony.Add(id, harmony);
}
foreach (var patch in patches)
{
try
{
switch (patch.PatchType)
{
case PatchType.Prefix:
harmony.Patch(patch.Original, patch.Patch);
break;
case PatchType.Postfix:
harmony.Patch(patch.Original, postfix: patch.Patch);
break;
case PatchType.Transpiler:
harmony.Patch(patch.Original, transpiler: patch.Patch);
break;
default:
throw new ArgumentOutOfRangeException($"Failed to patch {nameof(patch.Type)}.{patch.Name}");
}
}
catch (Exception ex)
{
var sb = new StringBuilder();
sb.Append($"This mod failed in {patch.Method.Name}");
if (patch.Method.DeclaringType?.Name is not null)
{
sb.Append($" of {patch.Method.DeclaringType.Name}. Technical details:\n");
}
sb.Append(ex.Message);
var st = new StackTrace(ex, true);
var frame = st.GetFrame(0);
if (frame?.GetFileName() is { } fileName)
{
var line = frame.GetFileLineNumber().ToString();
sb.Append($" at {fileName}:line {line}");
}
Log.Error(sb.ToString());
}
}
}
/// <inheritdoc />
public void UnapplyPatches(string id)
{
if (!this._savedPatches.TryGetValue(id, out var patches))
{
return;
}
if (!this._harmony.TryGetValue(id, out var harmony))
{
harmony = new(id);
this._harmony.Add(id, harmony);
}
foreach (var patch in patches)
{
harmony.Unpatch(patch.Original, patch.Method);
}
}
} | 30.7 | 120 | 0.535288 | [
"MIT"
] | Brex09/StardewMods | FuryCore/Services/HarmonyHelper.cs | 3,686 | C# |
using System;
using Microsoft.Build.Utilities;
using Xamarin.Build;
using static System.Threading.Tasks.TaskExtensions;
namespace Xamarin.Android.Tasks
{
// We use this task to ensure that no unhandled exceptions
// escape our tasks which would cause an MSB4018
public abstract class AndroidTask : Task
{
public abstract string TaskPrefix { get; }
public override bool Execute ()
{
try {
return RunTask ();
} catch (Exception ex) {
Log.LogUnhandledException (TaskPrefix, ex);
return false;
}
}
public abstract bool RunTask ();
}
public abstract class AndroidAsyncTask : AsyncTask
{
/// <summary>
/// A helper for non-async overrides of RunTaskAsync, etc.
/// </summary>
public static readonly System.Threading.Tasks.Task Done =
System.Threading.Tasks.Task.FromResult (true);
public abstract string TaskPrefix { get; }
[Obsolete ("You should not use the 'Log' property directly for AsyncTask. Use the 'Log*' methods instead.", error: true)]
public new TaskLoggingHelper Log {
get => base.Log;
}
public override bool Execute ()
{
try {
return RunTask ();
} catch (Exception ex) {
this.LogUnhandledException (TaskPrefix, ex);
return false;
}
}
public virtual bool RunTask ()
{
Yield ();
try {
this.RunTask (() => RunTaskAsync ())
.Unwrap ()
.ContinueWith (Complete);
// This blocks on AsyncTask.Execute, until Complete is called
return base.Execute ();
} finally {
Reacquire ();
}
}
/// <summary>
/// Override this method for simplicity of AsyncTask usage:
/// * Yield / Reacquire is handled for you
/// * RunTaskAsync is already on a background thread
/// </summary>
public virtual System.Threading.Tasks.Task RunTaskAsync () => Done;
}
public abstract class AndroidToolTask : ToolTask
{
public abstract string TaskPrefix { get; }
public override bool Execute ()
{
try {
return RunTask ();
} catch (Exception ex) {
Log.LogUnhandledException (TaskPrefix, ex);
return false;
}
}
// Most ToolTask's do not override Execute and
// just expect the base to be called
public virtual bool RunTask () => base.Execute ();
}
}
| 23.5 | 123 | 0.672703 | [
"MIT"
] | AArnott/xamarin-android | src/Xamarin.Android.Build.Tasks/Tasks/AndroidTask.cs | 2,209 | C# |
// <auto-generated>
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Bing.EntitySearch.Models
{
/// <summary>
/// Defines values for SafeSearch.
/// </summary>
public static class SafeSearch
{
public const string Off = "Off";
public const string Moderate = "Moderate";
public const string Strict = "Strict";
}
}
| 25.1 | 71 | 0.659363 | [
"MIT"
] | josmperez1/bing-search-sdk-for-net-1 | sdk/EntitySearch/src/Generated/Models/SafeSearch.cs | 502 | C# |
using System.Reflection;
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("AWSSDK.Lambda")]
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (3.5) - AWS Lambda. AWS Lambda is a compute service that runs your code in response to events and automatically manages the compute resources for you, making it easy to build applications that respond quickly to new information.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Amazon Web Services SDK for .NET")]
[assembly: AssemblyCompany("Amazon.com, Inc")]
[assembly: AssemblyCopyright("Copyright 2009-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.")]
[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)]
// 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("3.3")]
[assembly: AssemblyFileVersion("3.3.110.12")] | 49.125 | 300 | 0.754453 | [
"Apache-2.0"
] | SammyEnigma/aws-sdk-net | sdk/code-analysis/ServiceAnalysis/Lambda/Properties/AssemblyInfo.cs | 1,572 | C# |
namespace PowerShell.Infrastructure.Utilities
{
public static class Characters
{
public static class String
{
public static string[] Letters = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
}
public static class Char
{
public static char[] LineTerminators = { '\u000A', '\u000D' };
public static char[] Whitespace = { '\u0009', '\u000A', '\u000B', '\u000C', '\u000D', '\u0020' };
public static char[] Punctuation = { '!', '"', '#', '%', '&', '\'', '(', ')', '*', ',', '-', '.', '/', ':', ';', '?', '@', '[', '\\', ']', '_', '{', '}' };
public static char[] Digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
public static char[] HexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F' };
public static char[] LowerCaseLetters = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
public static char[] UpperCaseLetters = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
public static char[] Letters = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
}
}
}
| 78.391304 | 308 | 0.324459 | [
"MIT"
] | Ollon/PowerShellModules | src/Infrastructure/Utilities/Characters.cs | 1,805 | C# |
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Build.Framework;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.NET.Build.Tasks.ConflictResolution
{
public class ResolveOverlappingItemGroupConflicts : TaskBase
{
[Required]
public ITaskItem[] ItemGroup1 { get; set; }
[Required]
public ITaskItem[] ItemGroup2 { get; set; }
public string[] PreferredPackages { get; set; }
public ITaskItem[] PackageOverrides { get; set; }
[Output]
public ITaskItem[] RemovedItemGroup1 { get; set; }
[Output]
public ITaskItem[] RemovedItemGroup2 { get; set; }
protected override void ExecuteCore()
{
var packageRanks = new PackageRank(PreferredPackages);
var packageOverrides = new PackageOverrideResolver<ConflictItem>(PackageOverrides);
var conflicts = new HashSet<ConflictItem>();
var conflictItemGroup1 = GetConflictTaskItems(ItemGroup1, ConflictItemType.CopyLocal);
var conflictItemGroup2 = GetConflictTaskItems(ItemGroup2, ConflictItemType.CopyLocal);
using (var conflictResolver = new ConflictResolver<ConflictItem>(packageRanks, packageOverrides, Log))
{
var allConflicts = conflictItemGroup1.Concat(conflictItemGroup2);
conflictResolver.ResolveConflicts(allConflicts,
ci => ItemUtilities.GetReferenceTargetPath(ci.OriginalItem),
(ConflictItem winner, ConflictItem loser) => { conflicts.Add(loser); });
var conflictItems = conflicts.Select(i => i.OriginalItem);
RemovedItemGroup1 = ItemGroup1.Intersect(conflictItems).ToArray();
RemovedItemGroup2 = ItemGroup2.Intersect(conflictItems).ToArray();
}
}
private IEnumerable<ConflictItem> GetConflictTaskItems(ITaskItem[] items, ConflictItemType itemType)
{
return (items != null) ? items.Select(i => new ConflictItem(i, itemType)) : Enumerable.Empty<ConflictItem>();
}
}
}
| 40.285714 | 121 | 0.664894 | [
"MIT"
] | 01xOfFoo/sdk | src/Tasks/Common/ConflictResolution/ResolvePublishOutputConflicts.cs | 2,258 | C# |
namespace ClassLib121
{
public class Class031
{
public static string Property => "ClassLib121";
}
}
| 15 | 55 | 0.633333 | [
"MIT"
] | 333fred/performance | src/scenarios/weblarge2.0/src/ClassLib121/Class031.cs | 120 | C# |
// *****************************************************************************
//
// © Component Factory Pty Ltd 2012. All rights reserved.
// The software and associated documentation supplied hereunder are the
// proprietary information of Component Factory Pty Ltd, 17/267 Nepean Hwy,
// Seaford, Vic 3198, Australia and are supplied subject to licence terms.
//
// Version 4.4.1.0 www.ComponentFactory.com
// *****************************************************************************
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;
namespace ComponentFactory.Krypton.Toolkit
{
/// <summary>
/// Restrict a controls collection of child controls.
/// </summary>
public class KryptonReadOnlyControls : KryptonControlCollection
{
#region Instance Fields
private bool _allowRemove;
#endregion
#region Identity
/// <summary>
/// Initialize a new instance of the KryptonReadOnlyControls class.
/// </summary>
/// <param name="owner">Owning control.</param>
public KryptonReadOnlyControls(Control owner)
: base(owner)
{
_allowRemove = false;
}
#endregion
#region Public
/// <summary>
/// Clear out all the entries in the collection.
/// </summary>
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public bool AllowRemoveInternal
{
get { return _allowRemove; }
set { _allowRemove = value; }
}
#endregion
#region Public Overrides
/// <summary>
/// Adds the specified control to the control collection.
/// </summary>
/// <param name="value">The Control to add to the control collection.</param>
public override void Add(Control value)
{
if (AllowRemoveInternal)
base.Add(value);
else
throw new NotSupportedException("ReadOnly controls collection");
}
/// <summary>
/// Adds an array of control objects to the collection.
/// </summary>
/// <param name="controls">An array of Control objects to add to the collection.</param>
public override void AddRange(Control[] controls)
{
if (AllowRemoveInternal)
base.AddRange(controls);
else
throw new NotSupportedException("ReadOnly controls collection");
}
/// <summary>
/// Removes the specified control from the control collection.
/// </summary>
/// <param name="value">The Control to remove from the Control.ControlCollection.</param>
public override void Remove(Control value)
{
if (AllowRemoveInternal)
base.Remove(value);
else
{
if (Contains(value))
throw new NotSupportedException("ReadOnly controls collection");
}
}
/// <summary>
/// Removes the child control with the specified key.
/// </summary>
/// <param name="key">The name of the child control to remove.</param>
public override void RemoveByKey(string key)
{
if (AllowRemoveInternal)
base.RemoveByKey(key);
else
{
if (ContainsKey(key))
throw new NotSupportedException("ReadOnly controls collection");
}
}
/// <summary>
/// Removes all controls from the collection.
/// </summary>
public override void Clear()
{
if (AllowRemoveInternal)
base.Clear();
else
{
if (Count > 0)
throw new NotSupportedException("ReadOnly controls collection");
}
}
#endregion
}
}
| 32.596774 | 97 | 0.544038 | [
"BSD-3-Clause"
] | Cocotteseb/Krypton | Source/Krypton Components/ComponentFactory.Krypton.Toolkit/General/KryptonReadOnlyControls.cs | 4,045 | C# |
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using myEventCloud.EntityFrameworkCore;
namespace myEventCloud.Migrations
{
[DbContext(typeof(myEventCloudDbContext))]
[Migration("20170608053244_Upgraded_To_Abp_2_1_0")]
partial class Upgraded_To_Abp_2_1_0
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.1.2")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Abp.Application.Editions.Edition", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64);
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(32);
b.HasKey("Id");
b.ToTable("AbpEditions");
});
modelBuilder.Entity("Abp.Application.Features.FeatureSetting", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Discriminator")
.IsRequired();
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000);
b.HasKey("Id");
b.ToTable("AbpFeatures");
b.HasDiscriminator<string>("Discriminator").HasValue("FeatureSetting");
});
modelBuilder.Entity("Abp.Auditing.AuditLog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BrowserInfo")
.HasMaxLength(256);
b.Property<string>("ClientIpAddress")
.HasMaxLength(64);
b.Property<string>("ClientName")
.HasMaxLength(128);
b.Property<string>("CustomData")
.HasMaxLength(2000);
b.Property<string>("Exception")
.HasMaxLength(2000);
b.Property<int>("ExecutionDuration");
b.Property<DateTime>("ExecutionTime");
b.Property<int?>("ImpersonatorTenantId");
b.Property<long?>("ImpersonatorUserId");
b.Property<string>("MethodName")
.HasMaxLength(256);
b.Property<string>("Parameters")
.HasMaxLength(1024);
b.Property<string>("ServiceName")
.HasMaxLength(256);
b.Property<int?>("TenantId");
b.Property<long?>("UserId");
b.HasKey("Id");
b.HasIndex("TenantId", "ExecutionDuration");
b.HasIndex("TenantId", "ExecutionTime");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpAuditLogs");
});
modelBuilder.Entity("Abp.Authorization.PermissionSetting", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Discriminator")
.IsRequired();
b.Property<bool>("IsGranted");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpPermissions");
b.HasDiscriminator<string>("Discriminator").HasValue("PermissionSetting");
});
modelBuilder.Entity("Abp.Authorization.Roles.RoleClaim", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<int>("RoleId");
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("RoleId");
b.HasIndex("TenantId", "ClaimType");
b.ToTable("AbpRoleClaims");
});
modelBuilder.Entity("Abp.Authorization.Users.UserAccount", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("EmailAddress");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastLoginTime");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.Property<long?>("UserLinkId");
b.Property<string>("UserName");
b.HasKey("Id");
b.HasIndex("EmailAddress");
b.HasIndex("UserName");
b.HasIndex("TenantId", "EmailAddress");
b.HasIndex("TenantId", "UserId");
b.HasIndex("TenantId", "UserName");
b.ToTable("AbpUserAccounts");
});
modelBuilder.Entity("Abp.Authorization.Users.UserClaim", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "ClaimType");
b.ToTable("AbpUserClaims");
});
modelBuilder.Entity("Abp.Authorization.Users.UserLogin", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("LoginProvider")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(256);
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "UserId");
b.HasIndex("TenantId", "LoginProvider", "ProviderKey");
b.ToTable("AbpUserLogins");
});
modelBuilder.Entity("Abp.Authorization.Users.UserLoginAttempt", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("BrowserInfo")
.HasMaxLength(256);
b.Property<string>("ClientIpAddress")
.HasMaxLength(64);
b.Property<string>("ClientName")
.HasMaxLength(128);
b.Property<DateTime>("CreationTime");
b.Property<byte>("Result");
b.Property<string>("TenancyName")
.HasMaxLength(64);
b.Property<int?>("TenantId");
b.Property<long?>("UserId");
b.Property<string>("UserNameOrEmailAddress")
.HasMaxLength(255);
b.HasKey("Id");
b.HasIndex("UserId", "TenantId");
b.HasIndex("TenancyName", "UserNameOrEmailAddress", "Result");
b.ToTable("AbpUserLoginAttempts");
});
modelBuilder.Entity("Abp.Authorization.Users.UserOrganizationUnit", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long>("OrganizationUnitId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("TenantId", "OrganizationUnitId");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpUserOrganizationUnits");
});
modelBuilder.Entity("Abp.Authorization.Users.UserRole", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<int>("RoleId");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "RoleId");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpUserRoles");
});
modelBuilder.Entity("Abp.Authorization.Users.UserToken", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("LoginProvider");
b.Property<string>("Name");
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.Property<string>("Value");
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "UserId");
b.ToTable("AbpUserTokens");
});
modelBuilder.Entity("Abp.BackgroundJobs.BackgroundJobInfo", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<bool>("IsAbandoned");
b.Property<string>("JobArgs")
.IsRequired()
.HasMaxLength(1048576);
b.Property<string>("JobType")
.IsRequired()
.HasMaxLength(512);
b.Property<DateTime?>("LastTryTime");
b.Property<DateTime>("NextTryTime");
b.Property<byte>("Priority");
b.Property<short>("TryCount");
b.HasKey("Id");
b.HasIndex("IsAbandoned", "NextTryTime");
b.ToTable("AbpBackgroundJobs");
});
modelBuilder.Entity("Abp.Configuration.Setting", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256);
b.Property<int?>("TenantId");
b.Property<long?>("UserId");
b.Property<string>("Value")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpSettings");
});
modelBuilder.Entity("Abp.Localization.ApplicationLanguage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64);
b.Property<string>("Icon")
.HasMaxLength(128);
b.Property<bool>("IsDeleted");
b.Property<bool>("IsDisabled");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(10);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpLanguages");
});
modelBuilder.Entity("Abp.Localization.ApplicationLanguageText", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("LanguageName")
.IsRequired()
.HasMaxLength(10);
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Source")
.IsRequired()
.HasMaxLength(128);
b.Property<int?>("TenantId");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(67108864);
b.HasKey("Id");
b.HasIndex("TenantId", "Source", "LanguageName", "Key");
b.ToTable("AbpLanguageTexts");
});
modelBuilder.Entity("Abp.Notifications.NotificationInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Data")
.HasMaxLength(1048576);
b.Property<string>("DataTypeName")
.HasMaxLength(512);
b.Property<string>("EntityId")
.HasMaxLength(96);
b.Property<string>("EntityTypeAssemblyQualifiedName")
.HasMaxLength(512);
b.Property<string>("EntityTypeName")
.HasMaxLength(250);
b.Property<string>("ExcludedUserIds")
.HasMaxLength(131072);
b.Property<string>("NotificationName")
.IsRequired()
.HasMaxLength(96);
b.Property<byte>("Severity");
b.Property<string>("TenantIds")
.HasMaxLength(131072);
b.Property<string>("UserIds")
.HasMaxLength(131072);
b.HasKey("Id");
b.ToTable("AbpNotifications");
});
modelBuilder.Entity("Abp.Notifications.NotificationSubscriptionInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("EntityId")
.HasMaxLength(96);
b.Property<string>("EntityTypeAssemblyQualifiedName")
.HasMaxLength(512);
b.Property<string>("EntityTypeName")
.HasMaxLength(250);
b.Property<string>("NotificationName")
.HasMaxLength(96);
b.Property<int?>("TenantId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("NotificationName", "EntityTypeName", "EntityId", "UserId");
b.HasIndex("TenantId", "NotificationName", "EntityTypeName", "EntityId", "UserId");
b.ToTable("AbpNotificationSubscriptions");
});
modelBuilder.Entity("Abp.Notifications.TenantNotificationInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<string>("Data")
.HasMaxLength(1048576);
b.Property<string>("DataTypeName")
.HasMaxLength(512);
b.Property<string>("EntityId")
.HasMaxLength(96);
b.Property<string>("EntityTypeAssemblyQualifiedName")
.HasMaxLength(512);
b.Property<string>("EntityTypeName")
.HasMaxLength(250);
b.Property<string>("NotificationName")
.IsRequired()
.HasMaxLength(96);
b.Property<byte>("Severity");
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("TenantId");
b.ToTable("AbpTenantNotifications");
});
modelBuilder.Entity("Abp.Notifications.UserNotificationInfo", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime");
b.Property<int>("State");
b.Property<int?>("TenantId");
b.Property<Guid>("TenantNotificationId");
b.Property<long>("UserId");
b.HasKey("Id");
b.HasIndex("UserId", "State", "CreationTime");
b.ToTable("AbpUserNotifications");
});
modelBuilder.Entity("Abp.Organizations.OrganizationUnit", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Code")
.IsRequired()
.HasMaxLength(95);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(128);
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<long?>("ParentId");
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("ParentId");
b.HasIndex("TenantId", "Code");
b.ToTable("AbpOrganizationUnits");
});
modelBuilder.Entity("myEventCloud.Authorization.Roles.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("DisplayName")
.IsRequired()
.HasMaxLength(64);
b.Property<bool>("IsDefault");
b.Property<bool>("IsDeleted");
b.Property<bool>("IsStatic");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(32);
b.Property<string>("NormalizedName")
.IsRequired()
.HasMaxLength(32);
b.Property<int?>("TenantId");
b.HasKey("Id");
b.HasIndex("CreatorUserId");
b.HasIndex("DeleterUserId");
b.HasIndex("LastModifierUserId");
b.HasIndex("TenantId", "NormalizedName");
b.ToTable("AbpRoles");
});
modelBuilder.Entity("myEventCloud.Authorization.Users.User", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("AuthenticationSource")
.HasMaxLength(64);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("EmailAddress")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("EmailConfirmationCode")
.HasMaxLength(328);
b.Property<bool>("IsActive");
b.Property<bool>("IsDeleted");
b.Property<bool>("IsEmailConfirmed");
b.Property<bool>("IsLockoutEnabled");
b.Property<bool>("IsPhoneNumberConfirmed");
b.Property<bool>("IsTwoFactorEnabled");
b.Property<DateTime?>("LastLoginTime");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<DateTime?>("LockoutEndDateUtc");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(32);
b.Property<string>("NormalizedEmailAddress")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.IsRequired()
.HasMaxLength(32);
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("PasswordResetCode")
.HasMaxLength(328);
b.Property<string>("PhoneNumber");
b.Property<string>("SecurityStamp");
b.Property<string>("Surname")
.IsRequired()
.HasMaxLength(32);
b.Property<int?>("TenantId");
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(32);
b.HasKey("Id");
b.HasIndex("CreatorUserId");
b.HasIndex("DeleterUserId");
b.HasIndex("LastModifierUserId");
b.HasIndex("TenantId", "NormalizedEmailAddress");
b.HasIndex("TenantId", "NormalizedUserName");
b.ToTable("AbpUsers");
});
modelBuilder.Entity("myEventCloud.MultiTenancy.Tenant", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConnectionString")
.HasMaxLength(1024);
b.Property<DateTime>("CreationTime");
b.Property<long?>("CreatorUserId");
b.Property<long?>("DeleterUserId");
b.Property<DateTime?>("DeletionTime");
b.Property<int?>("EditionId");
b.Property<bool>("IsActive");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<long?>("LastModifierUserId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("TenancyName")
.IsRequired()
.HasMaxLength(64);
b.HasKey("Id");
b.HasIndex("CreatorUserId");
b.HasIndex("DeleterUserId");
b.HasIndex("EditionId");
b.HasIndex("LastModifierUserId");
b.HasIndex("TenancyName");
b.ToTable("AbpTenants");
});
modelBuilder.Entity("Abp.Application.Features.EditionFeatureSetting", b =>
{
b.HasBaseType("Abp.Application.Features.FeatureSetting");
b.Property<int>("EditionId");
b.HasIndex("EditionId", "Name");
b.ToTable("AbpFeatures");
b.HasDiscriminator().HasValue("EditionFeatureSetting");
});
modelBuilder.Entity("Abp.MultiTenancy.TenantFeatureSetting", b =>
{
b.HasBaseType("Abp.Application.Features.FeatureSetting");
b.Property<int>("TenantId");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpFeatures");
b.HasDiscriminator().HasValue("TenantFeatureSetting");
});
modelBuilder.Entity("Abp.Authorization.Roles.RolePermissionSetting", b =>
{
b.HasBaseType("Abp.Authorization.PermissionSetting");
b.Property<int>("RoleId");
b.HasIndex("RoleId");
b.ToTable("AbpPermissions");
b.HasDiscriminator().HasValue("RolePermissionSetting");
});
modelBuilder.Entity("Abp.Authorization.Users.UserPermissionSetting", b =>
{
b.HasBaseType("Abp.Authorization.PermissionSetting");
b.Property<long>("UserId");
b.HasIndex("UserId");
b.ToTable("AbpPermissions");
b.HasDiscriminator().HasValue("UserPermissionSetting");
});
modelBuilder.Entity("Abp.Authorization.Roles.RoleClaim", b =>
{
b.HasOne("myEventCloud.Authorization.Roles.Role")
.WithMany("Claims")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserClaim", b =>
{
b.HasOne("myEventCloud.Authorization.Users.User")
.WithMany("Claims")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserLogin", b =>
{
b.HasOne("myEventCloud.Authorization.Users.User")
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserRole", b =>
{
b.HasOne("myEventCloud.Authorization.Users.User")
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserToken", b =>
{
b.HasOne("myEventCloud.Authorization.Users.User")
.WithMany("Tokens")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Configuration.Setting", b =>
{
b.HasOne("myEventCloud.Authorization.Users.User")
.WithMany("Settings")
.HasForeignKey("UserId");
});
modelBuilder.Entity("Abp.Organizations.OrganizationUnit", b =>
{
b.HasOne("Abp.Organizations.OrganizationUnit", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId");
});
modelBuilder.Entity("myEventCloud.Authorization.Roles.Role", b =>
{
b.HasOne("myEventCloud.Authorization.Users.User", "CreatorUser")
.WithMany()
.HasForeignKey("CreatorUserId");
b.HasOne("myEventCloud.Authorization.Users.User", "DeleterUser")
.WithMany()
.HasForeignKey("DeleterUserId");
b.HasOne("myEventCloud.Authorization.Users.User", "LastModifierUser")
.WithMany()
.HasForeignKey("LastModifierUserId");
});
modelBuilder.Entity("myEventCloud.Authorization.Users.User", b =>
{
b.HasOne("myEventCloud.Authorization.Users.User", "CreatorUser")
.WithMany()
.HasForeignKey("CreatorUserId");
b.HasOne("myEventCloud.Authorization.Users.User", "DeleterUser")
.WithMany()
.HasForeignKey("DeleterUserId");
b.HasOne("myEventCloud.Authorization.Users.User", "LastModifierUser")
.WithMany()
.HasForeignKey("LastModifierUserId");
});
modelBuilder.Entity("myEventCloud.MultiTenancy.Tenant", b =>
{
b.HasOne("myEventCloud.Authorization.Users.User", "CreatorUser")
.WithMany()
.HasForeignKey("CreatorUserId");
b.HasOne("myEventCloud.Authorization.Users.User", "DeleterUser")
.WithMany()
.HasForeignKey("DeleterUserId");
b.HasOne("Abp.Application.Editions.Edition", "Edition")
.WithMany()
.HasForeignKey("EditionId");
b.HasOne("myEventCloud.Authorization.Users.User", "LastModifierUser")
.WithMany()
.HasForeignKey("LastModifierUserId");
});
modelBuilder.Entity("Abp.Application.Features.EditionFeatureSetting", b =>
{
b.HasOne("Abp.Application.Editions.Edition", "Edition")
.WithMany()
.HasForeignKey("EditionId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Roles.RolePermissionSetting", b =>
{
b.HasOne("myEventCloud.Authorization.Roles.Role")
.WithMany("Permissions")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Abp.Authorization.Users.UserPermissionSetting", b =>
{
b.HasOne("myEventCloud.Authorization.Users.User")
.WithMany("Permissions")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
}
}
}
| 31.789282 | 117 | 0.441229 | [
"MIT"
] | lyzr2507/myEventCloud | aspnet-core/src/myEventCloud.EntityFrameworkCore/Migrations/20170608053244_Upgraded_To_Abp_2_1_0.Designer.cs | 35,002 | C# |
namespace EncompassRest.Loans
{
/// <summary>
/// PriceAdjustmentLogRecord
/// </summary>
public sealed partial class PriceAdjustmentLogRecord : DirtyExtensibleObject, IIdentifiable
{
private DirtyValue<string> _description;
private DirtyValue<string> _id;
private DirtyValue<decimal?> _rate;
/// <summary>
/// PriceAdjustmentLogRecord Description
/// </summary>
public string Description { get => _description; set => SetField(ref _description, value); }
/// <summary>
/// PriceAdjustmentLogRecord Id
/// </summary>
public string Id { get => _id; set => SetField(ref _id, value); }
/// <summary>
/// PriceAdjustmentLogRecord Rate
/// </summary>
public decimal? Rate { get => _rate; set => SetField(ref _rate, value); }
}
} | 32.222222 | 100 | 0.606897 | [
"MIT"
] | walkeryan/EncompassRest | src/EncompassRest/Loans/PriceAdjustmentLogRecord.cs | 870 | C# |
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
// 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("AWSSDK.CodePipeline")]
#if BCL35
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (3.5) - AWS CodePipeline. AWS CodePipeline is a continuous delivery service for fast and reliable application updates.")]
#elif BCL45
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (4.5) - AWS CodePipeline. AWS CodePipeline is a continuous delivery service for fast and reliable application updates.")]
#elif NETSTANDARD20
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (NetStandard 2.0) - AWS CodePipeline. AWS CodePipeline is a continuous delivery service for fast and reliable application updates.")]
#elif NETCOREAPP3_1
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (.NET Core 3.1) - AWS CodePipeline. AWS CodePipeline is a continuous delivery service for fast and reliable application updates.")]
#else
#error Unknown platform constant - unable to set correct AssemblyDescription
#endif
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Amazon Web Services SDK for .NET")]
[assembly: AssemblyCompany("Amazon.com, Inc")]
[assembly: AssemblyCopyright("Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.")]
[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)]
// 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("3.3")]
[assembly: AssemblyFileVersion("3.7.0.17")]
[assembly: System.CLSCompliant(true)]
#if BCL
[assembly: System.Security.AllowPartiallyTrustedCallers]
#endif | 46.45098 | 202 | 0.771211 | [
"Apache-2.0"
] | KenHundley/aws-sdk-net | sdk/src/Services/CodePipeline/Properties/AssemblyInfo.cs | 2,369 | C# |
using System;
using NetOffice;
namespace NetOffice.OWC10Api.Enums
{
/// <summary>
/// SupportByVersion OWC10 1
/// </summary>
[SupportByVersionAttribute("OWC10", 1)]
[EntityTypeAttribute(EntityType.IsEnum)]
public enum ChartFillStyleEnum
{
/// <summary>
/// SupportByVersion OWC10 1
/// </summary>
/// <remarks>-1</remarks>
[SupportByVersionAttribute("OWC10", 1)]
chNone = -1,
/// <summary>
/// SupportByVersion OWC10 1
/// </summary>
/// <remarks>0</remarks>
[SupportByVersionAttribute("OWC10", 1)]
chSolid = 0
}
} | 21.653846 | 42 | 0.648313 | [
"MIT"
] | Engineerumair/NetOffice | Source/OWC10/Enums/ChartFillStyleEnum.cs | 563 | C# |
// The MIT License(MIT)
//
// Copyright(c) 2021 Alberto Rodriguez Orozco & LiveCharts Contributors
//
// 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.Linq;
using LiveChartsCore.Drawing;
namespace LiveChartsCore.Kernel
{
/// <summary>
/// Defines the points states dictionary class.
/// </summary>
/// <typeparam name="TDrawingContext">The type of the drawing context.</typeparam>
public class PointStatesDictionary<TDrawingContext>
where TDrawingContext : DrawingContext
{
private readonly Dictionary<string, StrokeAndFillDrawable<TDrawingContext>> _states = new();
/// <summary>
/// Gets or sets the stroke and fill for the specified state name.
/// </summary>
/// <value>
/// The stroke and fill.
/// </value>
/// <param name="stateName">Name of the state.</param>
/// <returns></returns>
/// <exception cref="InvalidOperationException">$"A null instance is not valid at this point, to delete a key please use the {nameof(DeleteState)}() method.</exception>
public StrokeAndFillDrawable<TDrawingContext>? this[string stateName]
{
get => !_states.TryGetValue(stateName, out var state) ? null : state;
set
{
if (value is null)
throw new InvalidOperationException(
$"A null instance is not valid at this point, to delete a key please use the {nameof(DeleteState)}() method.");
if (_states.ContainsKey(stateName)) RemoveState(_states[stateName]);
_states[stateName] = value;
if (Chart is null) return;
if (value.Fill is not null) Chart.Canvas.AddDrawableTask(value.Fill);
if (value.Stroke is not null) Chart.Canvas.AddDrawableTask(value.Stroke);
}
}
/// <summary>
/// Gets the chart.
/// </summary>
/// <value>
/// The chart.
/// </value>
public Chart<TDrawingContext>? Chart { get; internal set; }
/// <summary>
/// Gets the states.
/// </summary>
/// <returns></returns>
public StrokeAndFillDrawable<TDrawingContext>[] GetStates()
{
return _states.Values.ToArray();
}
/// <summary>
/// Add the visual state for the given key.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="fill">The fill.</param>
/// <param name="stroke">The stroke.</param>
/// <param name="isHoverState">Indicates whether the state should be remover when the pointer goes out of a chart.</param>
/// <returns></returns>
public PointStatesDictionary<TDrawingContext> WithState(
string key,
IPaint<TDrawingContext>? fill,
IPaint<TDrawingContext>? stroke,
bool isHoverState = false)
{
_states.Add(key, new StrokeAndFillDrawable<TDrawingContext>(fill, stroke, isHoverState));
return this;
}
/// <summary>
/// Deletes the state.
/// </summary>
/// <param name="stateName">Name of the state.</param>
/// <returns></returns>
public void DeleteState(string stateName)
{
RemoveState(_states[stateName]);
_ = _states.Remove(stateName);
}
/// <summary>
/// Removes the state.
/// </summary>
/// <param name="state">The state.</param>
/// <returns></returns>
private void RemoveState(StrokeAndFillDrawable<TDrawingContext> state)
{
if (Chart is null) return;
if (state.Fill is not null) Chart.Canvas.RemovePaintTask(state.Fill);
if (state.Stroke is not null) Chart.Canvas.RemovePaintTask(state.Stroke);
}
}
}
| 38.392308 | 176 | 0.618714 | [
"MIT"
] | Diademics-Pty-Ltd/LiveCharts2 | src/LiveChartsCore/Kernel/PointStatesDictionary.cs | 4,993 | C# |
#nullable enable
using SkiaSharp;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
using Uno;
using Uno.Extensions;
using Uno.Foundation.Logging;
using Uno.UI.Xaml;
using Windows.Foundation;
using Windows.Storage;
using Windows.UI.Text;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
namespace Windows.UI.Composition
{
internal class TextVisual : Visual
{
private readonly SKPaint _paint;
private static readonly Func<string, SKFontStyleWeight, SKFontStyleWidth, SKFontStyleSlant, SKTypeface> _getTypeFace =
Funcs.CreateMemoized<string, SKFontStyleWeight, SKFontStyleWidth, SKFontStyleSlant, SKTypeface>(
(nm, wt, wh, sl) => FromFamilyName(nm, wt, wh, sl));
private readonly TextBlock _owner;
private string? _previousRenderText;
private string[]? _textLines;
private static SKTypeface FromFamilyName(
string name,
SKFontStyleWeight weight,
SKFontStyleWidth width,
SKFontStyleSlant slant)
{
if (name.StartsWith(XamlFilePathHelper.AppXIdentifier))
{
var path = new Uri(name).PathAndQuery;
var filePath = global::System.IO.Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, path.TrimStart('/').Replace('/', global::System.IO.Path.DirectorySeparatorChar));
var font = SKTypeface.FromFile(filePath);
return font;
}
else
{
if (string.Equals(name, "XamlAutoFontFamily", StringComparison.OrdinalIgnoreCase))
{
return SKTypeface.FromFamilyName(null, weight, width, slant);
}
var typeFace = SKTypeface.FromFamilyName(name, weight, width, slant);
// FromFontFamilyName may return null: https://github.com/mono/SkiaSharp/issues/1058
if (typeFace == null)
{
if (typeof(TextVisual).Log().IsEnabled(LogLevel.Warning))
{
typeof(TextVisual).Log().LogWarning($"The font {name} could not be found, using system default");
}
typeFace = SKTypeface.FromFamilyName(null, weight, width, slant);
}
return typeFace;
}
}
public TextVisual(Compositor compositor, TextBlock owner) : base(compositor)
{
_owner = owner;
_paint = new SKPaint
{
TextEncoding = SKTextEncoding.Utf16,
IsStroke = false,
IsAntialias = true,
LcdRenderText = true,
SubpixelText = true
};
}
internal Size Measure(Size availableSize)
{
if (_owner.FontFamily?.Source != null)
{
var weight = _owner.FontWeight.ToSkiaWeight();
//var width = _owner.FontStretch.ToSkiaWidth(); -- FontStretch not supported by Uno yet
var width = SKFontStyleWidth.Normal;
var slant = _owner.FontStyle.ToSkiaSlant();
var font = _getTypeFace(_owner.FontFamily.Source, weight, width, slant);
_paint.Typeface = font;
}
_paint.TextSize = (float)_owner.FontSize;
var metrics = _paint.FontMetrics;
var descent = metrics.Descent;
var ascent = metrics.Ascent;
var lineHeight = descent - ascent;
if (_textLines == null || _previousRenderText != _owner.Text)
{
_textLines = _owner.Text.Split(
new[] { "\r\n", "\r", "\n" },
StringSplitOptions.None
);
_previousRenderText = _owner.Text;
}
var bounds = new SKRect(0, 0, (float)availableSize.Width, (float)availableSize.Height);
_paint.MeasureText(string.IsNullOrEmpty(_owner.Text) ? " " : _owner.Text, ref bounds);
var size = bounds.Size;
size.Height = lineHeight * _textLines.Length;
return new Size(size.Width, size.Height);
}
public void UpdateForeground()
{
switch (_owner.Foreground)
{
case SolidColorBrush scb:
_paint.Color = new SKColor(
red: scb.Color.R,
green: scb.Color.G,
blue: scb.Color.B,
alpha: (byte)(scb.Color.A * Compositor.CurrentOpacity));
break;
}
}
internal override void Render(SKSurface surface, SKImageInfo info)
{
if (!string.IsNullOrEmpty(_owner.Text))
{
UpdateForeground();
var metrics = _paint.FontMetrics;
var descent = metrics.Descent;
var ascent = metrics.Ascent;
var lineHeight = descent - ascent;
_textLines ??= new[] {_owner.Text};
var y = -ascent;
foreach (var line in _textLines)
{
surface.Canvas.DrawText(line, 0, y, _paint);
y += lineHeight;
}
}
}
}
}
| 25.89697 | 198 | 0.69202 | [
"Apache-2.0"
] | AbdalaMask/uno | src/Uno.UI/UI/Xaml/Controls/TextBlock/TextVisual.skia.cs | 4,277 | C# |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
using System.Collections.Generic;
using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Http;
using Aliyun.Acs.Core.Transform;
using Aliyun.Acs.Core.Utils;
using Aliyun.Acs.Domain;
using Aliyun.Acs.Domain.Transform;
using Aliyun.Acs.Domain.Transform.V20180129;
namespace Aliyun.Acs.Domain.Model.V20180129
{
public class SaveBatchTaskForDomainNameProxyServiceRequest : RpcAcsRequest<SaveBatchTaskForDomainNameProxyServiceResponse>
{
public SaveBatchTaskForDomainNameProxyServiceRequest()
: base("Domain", "2018-01-29", "SaveBatchTaskForDomainNameProxyService")
{
if (this.GetType().GetProperty("ProductEndpointMap") != null && this.GetType().GetProperty("ProductEndpointType") != null)
{
this.GetType().GetProperty("ProductEndpointMap").SetValue(this, Aliyun.Acs.Domain.Endpoint.endpointMap, null);
this.GetType().GetProperty("ProductEndpointType").SetValue(this, Aliyun.Acs.Domain.Endpoint.endpointRegionalType, null);
}
Method = MethodType.POST;
}
private List<string> domainNames = new List<string>(){ };
private string userClientIp;
private string lang;
private bool? status;
public List<string> DomainNames
{
get
{
return domainNames;
}
set
{
domainNames = value;
for (int i = 0; i < domainNames.Count; i++)
{
DictionaryUtil.Add(QueryParameters,"DomainName." + (i + 1) , domainNames[i]);
}
}
}
public string UserClientIp
{
get
{
return userClientIp;
}
set
{
userClientIp = value;
DictionaryUtil.Add(QueryParameters, "UserClientIp", value);
}
}
public string Lang
{
get
{
return lang;
}
set
{
lang = value;
DictionaryUtil.Add(QueryParameters, "Lang", value);
}
}
public bool? Status
{
get
{
return status;
}
set
{
status = value;
DictionaryUtil.Add(QueryParameters, "Status", value.ToString());
}
}
public override SaveBatchTaskForDomainNameProxyServiceResponse GetResponse(UnmarshallerContext unmarshallerContext)
{
return SaveBatchTaskForDomainNameProxyServiceResponseUnmarshaller.Unmarshall(unmarshallerContext);
}
}
}
| 27.421053 | 136 | 0.676903 | [
"Apache-2.0"
] | aliyun/aliyun-openapi-net-sdk | aliyun-net-sdk-domain/Domain/Model/V20180129/SaveBatchTaskForDomainNameProxyServiceRequest.cs | 3,126 | C# |
namespace OpenKh.Imaging
{
public interface IImageRead : IImage
{
/// <summary>
/// Get pixel data
/// </summary>
/// <remarks>
/// PixelFormat == Rgba8888
/// - 4 bytes [B, G, R, A] per pixel.
/// </remarks>
byte[] GetData();
byte[] GetClut();
}
}
| 20.117647 | 46 | 0.444444 | [
"Apache-2.0"
] | CartoonFan/OpenKh | OpenKh.Imaging/IImageRead.cs | 344 | C# |
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using PureCloudPlatform.Client.V2.Client;
namespace PureCloudPlatform.Client.V2.Model
{
/// <summary>
/// PhysicalInterfaceEntityListing
/// </summary>
[DataContract]
public partial class PhysicalInterfaceEntityListing : IEquatable<PhysicalInterfaceEntityListing>, IPagedResource<DomainPhysicalInterface>
{
/// <summary>
/// Initializes a new instance of the <see cref="PhysicalInterfaceEntityListing" /> class.
/// </summary>
/// <param name="Entities">Entities.</param>
/// <param name="PageSize">PageSize.</param>
/// <param name="PageNumber">PageNumber.</param>
/// <param name="Total">Total.</param>
/// <param name="FirstUri">FirstUri.</param>
/// <param name="SelfUri">SelfUri.</param>
/// <param name="NextUri">NextUri.</param>
/// <param name="PreviousUri">PreviousUri.</param>
/// <param name="LastUri">LastUri.</param>
/// <param name="PageCount">PageCount.</param>
public PhysicalInterfaceEntityListing(List<DomainPhysicalInterface> Entities = null, int? PageSize = null, int? PageNumber = null, long? Total = null, string FirstUri = null, string SelfUri = null, string NextUri = null, string PreviousUri = null, string LastUri = null, int? PageCount = null)
{
this.Entities = Entities;
this.PageSize = PageSize;
this.PageNumber = PageNumber;
this.Total = Total;
this.FirstUri = FirstUri;
this.SelfUri = SelfUri;
this.NextUri = NextUri;
this.PreviousUri = PreviousUri;
this.LastUri = LastUri;
this.PageCount = PageCount;
}
/// <summary>
/// Gets or Sets Entities
/// </summary>
[DataMember(Name="entities", EmitDefaultValue=false)]
public List<DomainPhysicalInterface> Entities { get; set; }
/// <summary>
/// Gets or Sets PageSize
/// </summary>
[DataMember(Name="pageSize", EmitDefaultValue=false)]
public int? PageSize { get; set; }
/// <summary>
/// Gets or Sets PageNumber
/// </summary>
[DataMember(Name="pageNumber", EmitDefaultValue=false)]
public int? PageNumber { get; set; }
/// <summary>
/// Gets or Sets Total
/// </summary>
[DataMember(Name="total", EmitDefaultValue=false)]
public long? Total { get; set; }
/// <summary>
/// Gets or Sets FirstUri
/// </summary>
[DataMember(Name="firstUri", EmitDefaultValue=false)]
public string FirstUri { get; set; }
/// <summary>
/// Gets or Sets SelfUri
/// </summary>
[DataMember(Name="selfUri", EmitDefaultValue=false)]
public string SelfUri { get; set; }
/// <summary>
/// Gets or Sets NextUri
/// </summary>
[DataMember(Name="nextUri", EmitDefaultValue=false)]
public string NextUri { get; set; }
/// <summary>
/// Gets or Sets PreviousUri
/// </summary>
[DataMember(Name="previousUri", EmitDefaultValue=false)]
public string PreviousUri { get; set; }
/// <summary>
/// Gets or Sets LastUri
/// </summary>
[DataMember(Name="lastUri", EmitDefaultValue=false)]
public string LastUri { get; set; }
/// <summary>
/// Gets or Sets PageCount
/// </summary>
[DataMember(Name="pageCount", EmitDefaultValue=false)]
public int? PageCount { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class PhysicalInterfaceEntityListing {\n");
sb.Append(" Entities: ").Append(Entities).Append("\n");
sb.Append(" PageSize: ").Append(PageSize).Append("\n");
sb.Append(" PageNumber: ").Append(PageNumber).Append("\n");
sb.Append(" Total: ").Append(Total).Append("\n");
sb.Append(" FirstUri: ").Append(FirstUri).Append("\n");
sb.Append(" SelfUri: ").Append(SelfUri).Append("\n");
sb.Append(" NextUri: ").Append(NextUri).Append("\n");
sb.Append(" PreviousUri: ").Append(PreviousUri).Append("\n");
sb.Append(" LastUri: ").Append(LastUri).Append("\n");
sb.Append(" PageCount: ").Append(PageCount).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
// credit: http://stackoverflow.com/a/10454552/677735
return this.Equals(obj as PhysicalInterfaceEntityListing);
}
/// <summary>
/// Returns true if PhysicalInterfaceEntityListing instances are equal
/// </summary>
/// <param name="other">Instance of PhysicalInterfaceEntityListing to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(PhysicalInterfaceEntityListing other)
{
// credit: http://stackoverflow.com/a/10454552/677735
if (other == null)
return false;
return true &&
(
this.Entities == other.Entities ||
this.Entities != null &&
this.Entities.SequenceEqual(other.Entities)
) &&
(
this.PageSize == other.PageSize ||
this.PageSize != null &&
this.PageSize.Equals(other.PageSize)
) &&
(
this.PageNumber == other.PageNumber ||
this.PageNumber != null &&
this.PageNumber.Equals(other.PageNumber)
) &&
(
this.Total == other.Total ||
this.Total != null &&
this.Total.Equals(other.Total)
) &&
(
this.FirstUri == other.FirstUri ||
this.FirstUri != null &&
this.FirstUri.Equals(other.FirstUri)
) &&
(
this.SelfUri == other.SelfUri ||
this.SelfUri != null &&
this.SelfUri.Equals(other.SelfUri)
) &&
(
this.NextUri == other.NextUri ||
this.NextUri != null &&
this.NextUri.Equals(other.NextUri)
) &&
(
this.PreviousUri == other.PreviousUri ||
this.PreviousUri != null &&
this.PreviousUri.Equals(other.PreviousUri)
) &&
(
this.LastUri == other.LastUri ||
this.LastUri != null &&
this.LastUri.Equals(other.LastUri)
) &&
(
this.PageCount == other.PageCount ||
this.PageCount != null &&
this.PageCount.Equals(other.PageCount)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
// credit: http://stackoverflow.com/a/263416/677735
unchecked // Overflow is fine, just wrap
{
int hash = 41;
// Suitable nullity checks etc, of course :)
if (this.Entities != null)
hash = hash * 59 + this.Entities.GetHashCode();
if (this.PageSize != null)
hash = hash * 59 + this.PageSize.GetHashCode();
if (this.PageNumber != null)
hash = hash * 59 + this.PageNumber.GetHashCode();
if (this.Total != null)
hash = hash * 59 + this.Total.GetHashCode();
if (this.FirstUri != null)
hash = hash * 59 + this.FirstUri.GetHashCode();
if (this.SelfUri != null)
hash = hash * 59 + this.SelfUri.GetHashCode();
if (this.NextUri != null)
hash = hash * 59 + this.NextUri.GetHashCode();
if (this.PreviousUri != null)
hash = hash * 59 + this.PreviousUri.GetHashCode();
if (this.LastUri != null)
hash = hash * 59 + this.LastUri.GetHashCode();
if (this.PageCount != null)
hash = hash * 59 + this.PageCount.GetHashCode();
return hash;
}
}
}
}
| 31.5 | 301 | 0.470837 | [
"MIT"
] | seowleng/platform-client-sdk-dotnet | build/src/PureCloudPlatform.Client.V2/Model/PhysicalInterfaceEntityListing.cs | 10,647 | C# |
using System;
using System.Net.Sockets;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
namespace MySqlConnector.Utilities
{
// See http://blogs.msdn.com/b/pfxteam/archive/2011/12/15/10248293.aspx
internal sealed class SocketAwaitable : INotifyCompletion
{
public SocketAwaitable(SocketAsyncEventArgs eventArgs)
{
EventArgs = eventArgs ?? throw new ArgumentNullException(nameof(eventArgs));
eventArgs.Completed += (s, e) => (m_continuation ?? Interlocked.CompareExchange(ref m_continuation, s_sentinel, null))?.Invoke();
}
public SocketAwaitable GetAwaiter() => this;
public bool IsCompleted => WasCompleted;
public void OnCompleted(Action continuation)
{
if (m_continuation == s_sentinel || Interlocked.CompareExchange(ref m_continuation, continuation, null) == s_sentinel)
Task.Run(continuation);
}
public void GetResult()
{
if (EventArgs.SocketError != SocketError.Success)
throw new SocketException((int) EventArgs.SocketError);
}
internal bool WasCompleted { get; set; }
internal SocketAsyncEventArgs EventArgs { get; }
internal void Reset()
{
WasCompleted = false;
m_continuation = null;
}
static readonly Action s_sentinel = () => { };
Action m_continuation;
}
}
| 27.425532 | 132 | 0.740884 | [
"Apache-2.0"
] | agnicore/nfx | src/providers/NFX.MySQL/MySqlConnector/Utilities/SocketAwaitable.cs | 1,289 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace User_Record.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
| 35.5 | 151 | 0.58216 | [
"MIT"
] | gbouzon/app-dev | Assignments/Assignment 04 - JSON & RESTful Web APIs/User Record/Properties/Settings.Designer.cs | 1,067 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Routing.Matching;
namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure
{
internal class PageLoaderMatcherPolicy : MatcherPolicy, IEndpointSelectorPolicy
{
private readonly PageLoader _loader;
public PageLoaderMatcherPolicy(PageLoader loader)
{
if (loader == null)
{
throw new ArgumentNullException(nameof(loader));
}
_loader = loader;
}
public override int Order => int.MinValue + 100;
public bool AppliesToEndpoints(IReadOnlyList<Endpoint> endpoints)
{
if (endpoints == null)
{
throw new ArgumentNullException(nameof(endpoints));
}
// We don't mark Pages as dynamic endpoints because that causes all matcher policies
// to run in *slow mode*. Instead we produce the same metadata for things that would affect matcher
// policies on both endpoints (uncompiled and compiled).
//
// This means that something like putting [Consumes] on a page wouldn't work. We've never said that it would.
for (var i = 0; i < endpoints.Count; i++)
{
var page = endpoints[i].Metadata.GetMetadata<PageActionDescriptor>();
if (page is not null and not CompiledPageActionDescriptor)
{
// Found an uncompiled page
return true;
}
}
return false;
}
public Task ApplyAsync(HttpContext httpContext, CandidateSet candidates)
{
if (httpContext == null)
{
throw new ArgumentNullException(nameof(httpContext));
}
if (candidates == null)
{
throw new ArgumentNullException(nameof(candidates));
}
for (var i = 0; i < candidates.Count; i++)
{
if (!candidates.IsValidCandidate(i))
{
continue;
}
ref var candidate = ref candidates[i];
var endpoint = candidate.Endpoint;
var page = endpoint.Metadata.GetMetadata<PageActionDescriptor>();
if (page != null)
{
// We found an endpoint instance that has a PageActionDescriptor, but not a
// CompiledPageActionDescriptor. Update the CandidateSet.
var compiled = _loader.LoadAsync(page, endpoint.Metadata);
if (compiled.IsCompletedSuccessfully)
{
candidates.ReplaceEndpoint(i, compiled.Result.Endpoint, candidate.Values);
}
else
{
// In the most common case, GetOrAddAsync will return a synchronous result.
// Avoid going async since this is a fairly hot path.
return ApplyAsyncAwaited(candidates, compiled, i);
}
}
}
return Task.CompletedTask;
}
private async Task ApplyAsyncAwaited(CandidateSet candidates, Task<CompiledPageActionDescriptor> actionDescriptorTask, int index)
{
var compiled = await actionDescriptorTask;
candidates.ReplaceEndpoint(index, compiled.Endpoint, candidates[index].Values);
for (var i = index + 1; i < candidates.Count; i++)
{
if (!candidates.IsValidCandidate(i))
{
continue;
}
var candidate = candidates[i];
var endpoint = candidate.Endpoint;
var page = endpoint.Metadata.GetMetadata<PageActionDescriptor>();
if (page != null)
{
compiled = await _loader.LoadAsync(page, endpoint.Metadata);
candidates.ReplaceEndpoint(i, compiled.Endpoint, candidates[i].Values);
}
}
}
}
}
| 35.349206 | 137 | 0.546475 | [
"MIT"
] | 48355746/AspNetCore | src/Mvc/Mvc.Razor.RuntimeCompilation/src/PageLoaderMatcherPolicy.cs | 4,454 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NoRainForum.Computer.FrontWeb.Models;
using NoRainForumCommon;
using NoRainSDK.Models;
using NoRainSDK.src;
namespace NoRainForum.Computer.FrontWeb.Controllers
{
public class LoginController : Controller
{
public UserService UserSvc { get; set; }
public SendEmailService SendEmailSvc { get; set; }
public LoginController(UserService UserSvc, SendEmailService SendEmailSvc)
{
this.UserSvc = UserSvc;
this.SendEmailSvc = SendEmailSvc;
}
[HttpGet]
public IActionResult Index()
{
if (TempData[ConstList.USERID] != null)
{
return Redirect("/user/home");
}
return View();
}
[HttpPost]
public async Task<IActionResult> Index(FrontUserLoginModel model)
{
if (TempData[ConstList.USERID] != null)
{
return Json(new AjaxResult { Status = "redirect",Data= "/user/home" });
}
if (TempData[ConstList.VALIDCODE] == null)
{
return Json(new AjaxResult { Status = "error", ErrorMsg = "验证码过期" });
}
string code = (string)TempData[ConstList.VALIDCODE];
TempData[ConstList.VALIDCODE] = null;
if (!code.Equals(model.ValidCode, StringComparison.InvariantCultureIgnoreCase))
{
return Json(new AjaxResult { Status = "error", ErrorMsg = "验证码错误" });
}
UserLoginModel login = new UserLoginModel();
login.Email = model.Email;
login.Password = model.Password;
var user = await UserSvc.LoginAsync(login);
if (user==null)
{
return Json(new AjaxResult {Status="error",ErrorMsg=UserSvc.ErrorMsg });
}
HttpContext.Session.SetString(ConstList.USERID, user.Id.ToString());
return Json(new AjaxResult { Status = "redirect",Data="/User/Home" });
}
[HttpGet]
public IActionResult FoundPassword()
{
return View();
}
[HttpPost]
public async Task<IActionResult> FoundPassword(FoundPasswordModel model)
{
if (TempData[ConstList.EMAILVALIDCODE] == null)
{
return Json(new AjaxResult { Status = "error", ErrorMsg = "验证码过期" });
}
if (TempData[ConstList.REGISTERORFOUNDPASSEMAIL] == null)
{
return Json(new AjaxResult { Status = "error", ErrorMsg = "表单过期" });
}
string email = (string)TempData[ConstList.REGISTERORFOUNDPASSEMAIL];
string emailCode = (string)TempData[ConstList.EMAILVALIDCODE];
TempData[ConstList.EMAILVALIDCODE] = null;
if (!emailCode.Equals(model.EmailCode, StringComparison.InvariantCultureIgnoreCase))
{
return Json(new AjaxResult { Status = "error", ErrorMsg = "验证码错误" });
}
if (!email.Equals(model.Email, StringComparison.InvariantCultureIgnoreCase))
{
return Json(new AjaxResult { Status = "error", ErrorMsg = "邮箱不一致" });
}
RePasswordModel pass = new RePasswordModel();
pass.Email = model.Email;
pass.NewPassword = model.NewPassword;
if (!await UserSvc.EditPasswordAsync(pass))
{
return Json(new AjaxResult { Status = "error", ErrorMsg = UserSvc.ErrorMsg });
}
return Json(new AjaxResult { Status = "ok" });
}
[HttpPost]
public async Task<IActionResult> SendFoundPassEmail(EmailValidCodeModel model)
{
if (TempData[ConstList.VALIDCODE] == null)
{
return Json(new AjaxResult { Status = "error", ErrorMsg = "验证码过期" });
}
string code = (string)TempData[ConstList.VALIDCODE];
TempData[ConstList.VALIDCODE] = null;
if (!code.Equals(model.ValidCode, StringComparison.InvariantCultureIgnoreCase))
{
return Json(new AjaxResult { Status = "error", ErrorMsg = "验证码错误" });
}
SendEmailModel send = new SendEmailModel();
send.RecipientEmail = model.RecipientEmail;
send.SendType = SendType.FoundPassword;
string emailCode = await SendEmailSvc.SendRegisterEmailAsync(send);
if (string.IsNullOrEmpty(emailCode))
{
return Json(new AjaxResult { Status = "error", ErrorMsg = SendEmailSvc.ErrorMsg });
}
TempData[ConstList.EMAILVALIDCODE] = emailCode;
TempData[ConstList.REGISTERORFOUNDPASSEMAIL] = model.RecipientEmail;
return Json(new AjaxResult { Status = "ok" });
}
}
} | 40.524194 | 99 | 0.577512 | [
"Apache-2.0"
] | MapleWithoutWords/NoRainForum-MicroService | NoRainForum/NoRainForum.Computer.FrontWeb/Controllers/LoginController.cs | 5,105 | C# |
// <copyright company="Aspose Pty Ltd">
// Copyright (C) 2011-2020 GroupDocs. All Rights Reserved.
// </copyright>
namespace GroupDocs.Parser.Examples.CSharp.AdvancedUsage.ExtractDataFromVariousFormats.PowerPoint
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using GroupDocs.Parser.Data;
/// <summary>
/// This example shows how to extract a text from Microsoft Office PowerPoint presentation.
/// </summary>
static class ExtractText
{
public static void Run()
{
// Create an instance of Parser class
using (Parser parser = new Parser(Constants.SamplePptx))
{
// Extract a text into the reader
using (TextReader reader = parser.GetText())
{
// Print a text from the presentation
Console.WriteLine(reader.ReadToEnd());
}
}
}
}
}
| 30.96875 | 97 | 0.590313 | [
"MIT"
] | groupdocs-parser/GroupDocs.Parser-for-.NET | Examples/GroupDocs.Parser.Examples.CSharp/AdvancedUsage/ExtractDataFromVariousFormats/PowerPoint/ExtractText.cs | 991 | C# |
using System;
namespace Example
{
public interface IBase
{
void Hello();
}
public interface IMore : IBase
{
void World();
}
public class MoreExplicit : IMore
{
void IBase.Hello() { }
void IMore.World() { }
}
public interface IConflict
{
string TestProperty { get; }
string TestField { get; }
void Hello();
}
public class Conflicted : IBase, IConflict
{
void IBase.Hello() { }
void IConflict.Hello() { }
public void Hello() { }
string IConflict.TestProperty
{
get { return "IConflict.TestProperty"; }
}
public static string TestProperty
{
get { return "TestProperty"; }
}
string IConflict.TestField
{
get { return "IConflict.TestField"; }
}
public static string TestField = "TestField";
}
}
| 16.859649 | 53 | 0.515088 | [
"MIT"
] | Xamarui/Embeddinator-4000 | tests/MonoEmbeddinator4000.Tests/Samples/Interfaces.cs | 963 | C# |
// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
// https://github.com/angularsen/UnitsNet
//
// 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;
// ReSharper disable once CheckNamespace
namespace UnitsNet
{
// Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components
// Public structures can't have any members other than public fields, and those fields must be value types or strings.
// Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic.
#if WINDOWS_UWP
public sealed partial class MassFlow
#else
public partial struct MassFlow
#endif
{
#if !WINDOWS_UWP
public static Mass operator *(MassFlow massFlow, TimeSpan time)
{
return Mass.FromKilograms(massFlow.KilogramsPerSecond * time.TotalSeconds);
}
public static Mass operator *(TimeSpan time, MassFlow massFlow)
{
return Mass.FromKilograms(massFlow.KilogramsPerSecond * time.TotalSeconds);
}
public static Mass operator *(MassFlow massFlow, Duration duration)
{
return Mass.FromKilograms(massFlow.KilogramsPerSecond * duration.Seconds);
}
public static Mass operator *(Duration duration, MassFlow massFlow)
{
return Mass.FromKilograms(massFlow.KilogramsPerSecond * duration.Seconds);
}
public static Power operator /(MassFlow massFlow, BrakeSpecificFuelConsumption bsfc)
{
return Power.FromWatts(massFlow.KilogramsPerSecond / bsfc.KilogramsPerJoule);
}
public static BrakeSpecificFuelConsumption operator /(MassFlow massFlow, Power power)
{
return BrakeSpecificFuelConsumption.FromKilogramsPerJoule(massFlow.KilogramsPerSecond / power.Watts);
}
public static Power operator *(MassFlow massFlow, SpecificEnergy specificEnergy)
{
return Power.FromWatts(massFlow.KilogramsPerSecond * specificEnergy.JoulesPerKilogram);
}
public static MassFlux operator /(MassFlow massFlow, Area area)
{
return MassFlux.FromKilogramsPerSecondPerSquareMeter(massFlow.KilogramsPerSecond / area.SquareMeters);
}
public static Area operator /(MassFlow massFlow, MassFlux massFlux)
{
return Area.FromSquareMeters(massFlow.KilogramsPerSecond / massFlux.KilogramsPerSecondPerSquareMeter);
}
public static Density operator /(MassFlow massFlow, VolumeFlow volumeFlow)
{
return Density.FromKilogramsPerCubicMeter(massFlow.KilogramsPerSecond / volumeFlow.CubicMetersPerSecond);
}
public static VolumeFlow operator /(MassFlow massFlow, Density density)
{
return VolumeFlow.FromCubicMetersPerSecond(massFlow.KilogramsPerSecond / density.KilogramsPerCubicMeter);
}
#endif
}
}
| 44.308511 | 223 | 0.72389 | [
"MIT"
] | tongbong/UnitsNet | UnitsNet/CustomCode/Quantities/MassFlow.extra.cs | 4,167 | C# |
// Runtime: 48 ms, faster than 65.14% of C# online submissions for Pow(x, n).
// Memory Usage: 15 MB, less than 76.65% of C# online submissions for Pow(x, n).
public class Solution {
public double MyPow(double x, int n)
{
bool neg = n < 0;
double p;
if (n == 0)
return 1;
if (neg)
n *= -1;
p = MyPow(x, n / 2);
p *= p;
if (n % 2 == 1)
p *= x;
if (neg && double.IsInfinity(p))
return 0;
if (double.IsInfinity(p))
return 0;
if (neg)
return 1 / p;
return p;
}
} | 21.2 | 80 | 0.443396 | [
"MIT"
] | Leralite/leetcode | 50. Power/Power(1).cs | 636 | C# |
#region PDFsharp - A .NET library for processing PDF
//
// Authors:
// Stefan Lange
//
// Copyright (c) 2005-2019 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://sourceforge.net/projects/pdfsharp
//
// 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.
#endregion
namespace PdfSharp.Pdf.Content
{
/// <summary>
/// Terminal symbols recognized by PDF content stream lexer.
/// </summary>
public enum CSymbol
{
#pragma warning disable 1591
None,
Comment,
Integer,
Real,
/*Boolean?,*/
String,
HexString,
UnicodeString,
UnicodeHexString,
Name,
Operator,
BeginArray,
EndArray,
Dictionary, // HACK: << ... >> is scanned as string literal.
Eof,
Error = -1,
}
}
| 33.321429 | 77 | 0.685959 | [
"MIT"
] | 0xced/PDFsharp | src/PdfSharp/Pdf.Content/enums/Symbol.cs | 1,866 | C# |
using System;
using System.Collections.Generic;
namespace Baseball.ApiSharp.Data.Lahman
{
public partial class AwardsSharePlayers
{
public string AwardId { get; set; }
public short YearId { get; set; }
public string LgId { get; set; }
public string PlayerId { get; set; }
public double? PointsWon { get; set; }
public short? PointsMax { get; set; }
public double? VotesFirst { get; set; }
}
}
| 27.235294 | 47 | 0.62203 | [
"MIT"
] | krwittmer/Baseball.ApiSharp | Baseball.ApiSharp.Data.Lahman/AwardsSharePlayers.cs | 465 | C# |
using System;
namespace OdinSerializer
{
/// <summary>
/// Defines default loggers for serialization and deserialization. This class and all of its loggers are thread safe.
/// </summary>
public static class DefaultLoggers
{
private static readonly object LOCK = new object();
private static volatile ILogger unityLogger;
/// <summary>
/// The default logger - usually this is <see cref="UnityLogger"/>.
/// </summary>
public static ILogger DefaultLogger
{
get
{
return UnityLogger;
}
}
/// <summary>
/// Logs messages using Unity's <see cref="UnityEngine.Debug"/> class.
/// </summary>
public static ILogger UnityLogger
{
get
{
if (unityLogger == null)
{
lock (LOCK)
{
if (unityLogger == null)
{
unityLogger = new CustomLogger(Console.WriteLine, Console.WriteLine, Console.WriteLine);
}
}
}
return unityLogger;
}
}
}
} | 27.652174 | 121 | 0.46934 | [
"MIT"
] | futouyiba/ClubET | ThirdParty/OdinSerializer/Core/Misc/DefaultLoggers.cs | 1,274 | C# |
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Google.Api.Ads.Common.Util;
using Google.Api.Ads.AdManager.Lib;
using Google.Api.Ads.AdManager.Util.v202108;
using Google.Api.Ads.AdManager.v202108;
using System;
using System.Collections.Generic;
namespace Google.Api.Ads.AdManager.Examples.CSharp.v202108
{
/// <summary>
/// This code example gets all line items which have a name beginning with
/// "line item". This code example may take a while to run.
/// </summary>
public class GetLineItemsNamedLike : SampleBase
{
/// <summary>
/// Returns a description about the code example.
/// </summary>
public override string Description
{
get
{
return "This code example gets all line items which have a name beginning with " +
"'line item'. This code example may take a while to run.";
}
}
/// <summary>
/// Main method, to run this code example as a standalone application.
/// </summary>
public static void Main()
{
GetLineItemsNamedLike codeExample = new GetLineItemsNamedLike();
Console.WriteLine(codeExample.Description);
codeExample.Run(new AdManagerUser());
}
/// <summary>
/// Run the code example.
/// </summary>
public void Run(AdManagerUser user)
{
using (PublisherQueryLanguageService pqlService =
user.GetService<PublisherQueryLanguageService>())
{
// Create statement to select all line items named like 'line item%'.
StatementBuilder statementBuilder = new StatementBuilder()
.Select("Id, Name, Status").From("Line_Item")
.Where("Name LIKE 'line item%'")
.OrderBy("Id ASC")
.Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
List<Row> allRows = new List<Row>();
ResultSet resultSet;
int resultSetSize = 0;
try
{
do
{
// Get line items like 'line item%'.
resultSet = pqlService.select(statementBuilder.ToStatement());
// Collect all line items from each page.
allRows.AddRange(resultSet.rows);
// Display results.
Console.WriteLine(PqlUtilities.ResultSetToString(resultSet));
statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
resultSetSize = resultSet.rows == null ? 0 : resultSet.rows.Length;
} while (resultSetSize == StatementBuilder.SUGGESTED_PAGE_LIMIT);
Console.WriteLine("Number of results found: " + allRows.Count);
// Optionally, save all rows to a CSV.
// Get a string array representation of the data rows.
resultSet.rows = allRows.ToArray();
List<String[]> rows = PqlUtilities.ResultSetToStringArrayList(resultSet);
// Write the contents to a csv file.
CsvFile file = new CsvFile();
file.Headers.AddRange(rows[0]);
file.Records.AddRange(rows.GetRange(1, rows.Count - 1).ToArray());
file.Write("line_items_named_like_" + GetTimeStamp() + ".csv");
}
catch (Exception e)
{
Console.WriteLine("Failed to get line items. Exception says \"{0}\"",
e.Message);
}
}
}
}
}
| 39.171171 | 98 | 0.563937 | [
"Apache-2.0"
] | googleads/googleads-dotnet-lib | examples/AdManager/CSharp/v202108/PublisherQueryLanguageService/GetLineItemsNamedLike.cs | 4,348 | C# |
using System.Security.Cryptography;
using Microsoft.AspNetCore.Cryptography.KeyDerivation;
using System;
using IdentityServer4.MongoDB.Model.Setting;
using Microsoft.Extensions.Options;
namespace IdentityServer4.MongoDB.Service
{
public class PasswordService : IPasswordService
{
private readonly PasswordSetting _passwordSetting;
public PasswordService(IOptions<PasswordSetting> passwordSetting)
{
_passwordSetting = passwordSetting.Value;
}
public byte[] GenerateSalt()
{
// generate a 128-bit salt using a secure PRNG
byte[] salt = new byte[128 / 8];
using (var rng = RandomNumberGenerator.Create())
{
rng.GetBytes(salt);
}
return salt;
}
public string CreateHash(string password, byte[] salt)
{
// derive a 512-bit subkey (use HMACSHA1 with 10,000 iterations)
return Convert.ToBase64String(KeyDerivation.Pbkdf2(
password: password,
salt: salt,
prf: KeyDerivationPrf.HMACSHA256,
iterationCount: _passwordSetting.HaschCount,
numBytesRequested: 512 / 8));
}
public bool CompareHash(string password, string hash, byte[] salt)
{
string compareHashe = CreateHash(password, salt);
return hash == compareHashe;
}
}
}
| 30.5 | 76 | 0.60724 | [
"Apache-2.0"
] | fredrikstrandin/Miniblog.Core | src/IdentityServer4.MongoDB/Service/PasswordService.cs | 1,466 | C# |
using System;
using System.Diagnostics;
using Microsoft.Extensions.Logging;
namespace Frank.Libraries.Logging.Exceptions
{
public class LoggerException<TLogger> : Exception
where TLogger : ILogger
{
private readonly string _loggerName;
public LoggerException(string message) : base(message)
{
_loggerName = typeof(TLogger).Name;
}
public string GetLoggerName() => _loggerName;
public StackTrace GetStackTrace() => new StackTrace(this);
}
} | 26.15 | 66 | 0.67304 | [
"MIT"
] | frankhaugen/Frank.Extensions | src/Frank.Libraries.Logging/Exceptions/LoggerException.cs | 525 | C# |
using CoreDdd.Nhibernate.TestHelpers;
using IntegrationTestsShared;
using IntegrationTestsShared.EntitiesWithNonIntegerId;
using NUnit.Framework;
using Shouldly;
namespace CoreDdd.Nhibernate.Tests.EntitiesWithNonIntegerIdPersistence
{
[TestFixture]
public class when_persisting_entity_with_composite_id : BasePersistenceTest
{
[Test]
public void entity_with_composite_id_can_be_persisted_and_retreieved()
{
var entityWithCompositeId = new EntityWithCompositeId(new CompositeId(23, "string id"));
UnitOfWork.Save<EntityWithCompositeId, CompositeId>(entityWithCompositeId);
UnitOfWork.Clear();
var fetchedEntityWithCompositeId = UnitOfWork.Get<EntityWithCompositeId, CompositeId>(entityWithCompositeId.Id);
(fetchedEntityWithCompositeId == entityWithCompositeId).ShouldBeTrue();
(fetchedEntityWithCompositeId.Id.IdOne == entityWithCompositeId.Id.IdOne).ShouldBeTrue();
(fetchedEntityWithCompositeId.Id.IdTwo == entityWithCompositeId.Id.IdTwo).ShouldBeTrue();
}
}
} | 40.703704 | 124 | 0.749773 | [
"MIT"
] | Buthrakaur/coreddd | src/CoreDdd.Nhibernate.Tests/EntitiesWithNonIntegerIdPersistence/when_persisting_entity_with_composite_id.cs | 1,101 | C# |
using System;
namespace FromTeraByteToByte
{
class FromTeraByteToByte
{
static void Main()
{
var terabyte = Console.ReadLine();
double newTerabyte = double.Parse(terabyte);
double terabyteToBits = newTerabyte * 8796093022208;
Console.WriteLine(terabyteToBits);
}
}
}
| 17.85 | 64 | 0.591036 | [
"MIT"
] | hristokrastev/MasteringC | Data_Types_Exercises/FromTeraByteToByte/FromTeraByteToByte/FromTeraByteToByte.cs | 359 | C# |
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using STAN.Client;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Vls.Abp.Stan;
using Volo.Abp;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Threading;
namespace Vls.Abp.EventBus.Stan
{
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IDistributedEventBus), typeof(StanMqDistributedEventBus))]
public sealed class StanMqDistributedEventBus : EventBusBase, IDistributedEventBus, IDisposable, ISingletonDependency
{
private readonly IStanConnectionPool _connectionManager;
private readonly ConcurrentDictionary<Type, List<IEventHandlerFactory>> _handlerFactories;
private readonly ConcurrentDictionary<string, Type> _eventTypes;
private readonly ConcurrentDictionary<string, IDisposable> _eventSubscriptions;
private readonly IStanSerializer _serializer;
private readonly AbpDistributedEventBusOptions _distributedEventBusOptions;
public StanMqDistributedEventBus(
IStanConnectionPool connectionManager,
IServiceScopeFactory serviceScopeFactory,
ICurrentTenant currentTenant,
IStanSerializer serializer,
IOptions<AbpDistributedEventBusOptions> distributedEventBusOptions)
: base(serviceScopeFactory, currentTenant)
{
_connectionManager = connectionManager;
_serializer = serializer;
_distributedEventBusOptions = distributedEventBusOptions.Value;
_handlerFactories = new ConcurrentDictionary<Type, List<IEventHandlerFactory>>();
_eventTypes = new ConcurrentDictionary<string, Type>();
_eventSubscriptions = new ConcurrentDictionary<string, IDisposable>();
}
public void Initialize()
{
SubscribeHandlers(_distributedEventBusOptions.Handlers);
foreach (var eventName in _eventTypes.Keys)
{
var subscription = _connectionManager.GetConnection(nameof(StanMqDistributedEventBus))
.Subscribe(eventName, ProcessEventAsync);
_eventSubscriptions.TryAdd(eventName, subscription);
}
}
private async void ProcessEventAsync(object sender, StanMsgHandlerArgs e)
{
var eventName = e.Message.Subject;
var eventType = _eventTypes.GetOrDefault(eventName);
if (eventType == null)
{
return;
}
var eventData = _serializer.Deserialize(e.Message.Data, eventType);
await TriggerHandlersAsync(eventType, eventData);
}
public override Task PublishAsync(Type eventType, object eventData)
{
var eventName = EventNameAttribute.GetNameOrDefault(eventType);
var body = _serializer.Serialize(eventData);
_connectionManager.GetConnection(nameof(StanMqDistributedEventBus)).Publish(eventName, body);
return Task.CompletedTask;
}
public IDisposable Subscribe<TEvent>(IDistributedEventHandler<TEvent> handler)
where TEvent : class
{
return Subscribe(typeof(TEvent), handler);
}
public override IDisposable Subscribe(Type eventType, IEventHandlerFactory factory)
{
var handlerFactories = GetOrCreateHandlerFactories(eventType);
if (factory.IsInFactories(handlerFactories))
{
return NullDisposable.Instance;
}
handlerFactories.Add(factory);
return new EventHandlerFactoryUnregistrar(this, eventType, factory);
}
public override void Unsubscribe<TEvent>(Func<TEvent, Task> action)
{
Check.NotNull(action, nameof(action));
GetOrCreateHandlerFactories(typeof(TEvent))
.Locking(factories =>
{
factories.RemoveAll(
factory =>
{
var singleInstanceFactory = factory as SingleInstanceHandlerFactory;
if (singleInstanceFactory == null)
{
return false;
}
var actionHandler = singleInstanceFactory.HandlerInstance as ActionEventHandler<TEvent>;
if (actionHandler == null)
{
return false;
}
return actionHandler.Action == action;
});
});
}
public override void Unsubscribe(Type eventType, IEventHandler handler)
{
GetOrCreateHandlerFactories(eventType)
.Locking(factories =>
{
factories.RemoveAll(
factory =>
factory is SingleInstanceHandlerFactory &&
(factory as SingleInstanceHandlerFactory).HandlerInstance == handler
);
});
}
public override void Unsubscribe(Type eventType, IEventHandlerFactory factory)
{
GetOrCreateHandlerFactories(eventType).Locking(factories => factories.Remove(factory));
}
public override void UnsubscribeAll(Type eventType)
{
GetOrCreateHandlerFactories(eventType).Locking(factories => factories.Clear());
}
private List<IEventHandlerFactory> GetOrCreateHandlerFactories(Type eventType)
{
return _handlerFactories.GetOrAdd(
eventType,
type =>
{
var eventName = EventNameAttribute.GetNameOrDefault(type);
_eventTypes[eventName] = type;
return new List<IEventHandlerFactory>();
}
);
}
protected override IEnumerable<EventTypeWithEventHandlerFactories> GetHandlerFactories(Type eventType)
{
var handlerFactoryList = new List<EventTypeWithEventHandlerFactories>();
foreach (var handlerFactory in _handlerFactories.Where(hf => ShouldTriggerEventForHandler(eventType, hf.Key)))
{
handlerFactoryList.Add(new EventTypeWithEventHandlerFactories(handlerFactory.Key, handlerFactory.Value));
}
return handlerFactoryList.ToArray();
}
private static bool ShouldTriggerEventForHandler(Type targetEventType, Type handlerEventType)
{
//Should trigger same type
if (handlerEventType == targetEventType)
{
return true;
}
//TODO: Support inheritance? But it does not support on subscription to RabbitMq!
//Should trigger for inherited types
if (handlerEventType.IsAssignableFrom(targetEventType))
{
return true;
}
return false;
}
public void Dispose()
{
foreach (var subscription in _eventSubscriptions.Values)
{
subscription.Dispose();
}
_eventSubscriptions.Clear();
}
}
}
| 36.287081 | 122 | 0.604167 | [
"MIT"
] | vicecop/Vlc.Abp | Stan/src/Vls.Abp.EventBus.Stan/StanMqDistributedEventBus.cs | 7,586 | C# |
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// 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.Text.RegularExpressions;
using SharpGen.Config;
using SharpGen.CppModel;
using System.Reflection;
using SharpGen.Transform;
using System.Collections.Generic;
namespace SharpGen.Model
{
public static class CppElementExtensions
{
/// <summary>
/// Finds the specified elements by regex.
/// </summary>
/// <typeparam name = "T"></typeparam>
/// <param name = "regex">The regex.</param>
/// <param name="finder">The C++ element finder instance to use.</param>
/// <param name="mode">The selection mode for selecting matched elements.</param>
/// <returns></returns>
public static IEnumerable<T> Find<T>(
this CppElementFinder finder,
string regex,
CppElementFinder.SelectionMode mode = CppElementFinder.SelectionMode.MatchedElement)
where T : CppElement
=> finder.Find<T>(BuildFullRegex(regex), mode);
/// <summary>
/// Strips the regex. Removes ^ and $ at the end of the string
/// </summary>
/// <param name = "regex">The regex.</param>
/// <returns></returns>
private static Regex BuildFullRegex(string regex)
{
string friendlyRegex = regex;
// Remove ^ and $
if (friendlyRegex.StartsWith("^"))
friendlyRegex = friendlyRegex.Substring(1);
if (friendlyRegex.EndsWith("$"))
friendlyRegex = friendlyRegex.Substring(0, friendlyRegex.Length - 1);
return new Regex($"^{friendlyRegex}$");
}
public static bool ExecuteRule<T>(this CppElementFinder finder, string regex, MappingRule rule) where T : CppElement
{
var mode = CppElementFinder.SelectionMode.MatchedElement;
var matchedAny = false;
if (regex.StartsWith("#"))
{
mode = CppElementFinder.SelectionMode.Parent;
regex = regex.Substring(1);
}
var fullRegex = BuildFullRegex(regex);
foreach (var item in finder.Find<T>(fullRegex, mode))
{
matchedAny = true;
ProcessRule(item, rule, fullRegex);
}
return matchedAny;
}
public static string GetTypeNameWithMapping(this CppElement cppType)
{
var rule = cppType.GetMappingRule();
if (rule != null && rule.MappingType != null)
return rule.MappingType;
if (cppType is CppEnum cppEnum)
return cppEnum.UnderlyingType;
if (cppType is CppMarshallable type)
return type.TypeName;
throw new ArgumentException(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Cannot get type name from type {0}", cppType));
}
private static string RegexRename(Regex regex, string fromName, string replaceName)
{
return replaceName.Contains("$")? regex.Replace(fromName, replaceName) : replaceName;
}
/// <summary>
/// Fully rename a type and all references
/// </summary>
/// <param name = "newRule"></param>
/// <returns></returns>
private static void ProcessRule(CppElement element, MappingRule newRule, Regex patchRegex)
{
var tag = element.Rule;
if (tag == null)
{
element.Rule = tag = new MappingRule();
}
if (newRule.Assembly != null) tag.Assembly = newRule.Assembly;
if (newRule.Namespace != null) tag.Namespace = newRule.Namespace;
if (newRule.DefaultValue != null) tag.DefaultValue = newRule.DefaultValue;
if (newRule.MethodCheckReturnType.HasValue) tag.MethodCheckReturnType = newRule.MethodCheckReturnType;
if (newRule.AlwaysReturnHResult.HasValue) tag.AlwaysReturnHResult = newRule.AlwaysReturnHResult;
if (newRule.RawPtr.HasValue) tag.RawPtr = newRule.RawPtr;
if (newRule.Visibility.HasValue) tag.Visibility = newRule.Visibility;
if (newRule.NativeCallbackVisibility.HasValue) tag.NativeCallbackVisibility = newRule.NativeCallbackVisibility;
if (newRule.NativeCallbackName != null)
tag.NativeCallbackName = RegexRename(patchRegex, element.FullName, newRule.NativeCallbackName);
if (newRule.Property.HasValue) tag.Property = newRule.Property;
if (newRule.CustomVtbl.HasValue) tag.CustomVtbl = newRule.CustomVtbl;
if (newRule.Persist.HasValue) tag.Persist = newRule.Persist;
if (newRule.MappingName != null)
tag.MappingName = RegexRename(patchRegex, element.FullName, newRule.MappingName);
if (newRule.NamingFlags.HasValue) tag.NamingFlags = newRule.NamingFlags.Value;
if (newRule.IsFinalMappingName != null) tag.IsFinalMappingName = newRule.IsFinalMappingName;
if (newRule.StructPack != null) tag.StructPack = newRule.StructPack;
if (newRule.StructHasNativeValueType != null) tag.StructHasNativeValueType = newRule.StructHasNativeValueType;
if (newRule.StructToClass != null) tag.StructToClass = newRule.StructToClass;
if (newRule.StructCustomMarshal != null) tag.StructCustomMarshal = newRule.StructCustomMarshal;
if (newRule.StructCustomNew != null) tag.StructCustomNew = newRule.StructCustomNew;
if (newRule.IsStaticMarshal != null) tag.IsStaticMarshal = newRule.IsStaticMarshal;
if (newRule.MappingType != null) tag.MappingType = RegexRename(patchRegex, element.FullName, newRule.MappingType);
if (newRule.OverrideNativeType != null) tag.OverrideNativeType = newRule.OverrideNativeType;
if (element is CppMarshallable cppType)
{
if (tag.OverrideNativeType == true)
{
cppType.TypeName = tag.MappingType;
}
if (newRule.Pointer != null)
{
cppType.Pointer = newRule.Pointer;
tag.Pointer = newRule.Pointer;
}
if (newRule.TypeArrayDimension != null)
{
cppType.ArrayDimension = newRule.TypeArrayDimension;
if (newRule.TypeArrayDimension == null)
cppType.IsArray = false;
tag.TypeArrayDimension = newRule.TypeArrayDimension;
}
}
if (newRule.EnumHasFlags != null) tag.EnumHasFlags = newRule.EnumHasFlags;
if (newRule.EnumHasNone != null) tag.EnumHasNone = newRule.EnumHasNone;
if (newRule.IsCallbackInterface != null) tag.IsCallbackInterface = newRule.IsCallbackInterface;
if (newRule.IsDualCallbackInterface != null) tag.IsDualCallbackInterface = newRule.IsDualCallbackInterface;
if (newRule.AutoGenerateShadow != null) tag.AutoGenerateShadow = newRule.AutoGenerateShadow;
if (newRule.ShadowName != null) tag.ShadowName = RegexRename(patchRegex, element.FullName, newRule.ShadowName);
if (newRule.VtblName != null) tag.VtblName = RegexRename(patchRegex, element.FullName, newRule.VtblName);
if (newRule.IsKeepImplementPublic != null) tag.IsKeepImplementPublic = newRule.IsKeepImplementPublic;
if (newRule.FunctionDllName != null) tag.FunctionDllName = RegexRename(patchRegex, element.FullName, newRule.FunctionDllName);
if (newRule.Group != null) tag.Group = newRule.Group;
if (newRule.ParameterAttribute != null && element is CppParameter param)
{
param.Attribute = newRule.ParameterAttribute.Value;
tag.ParameterAttribute = newRule.ParameterAttribute.Value;
}
if (newRule.ParameterUsedAsReturnType != null) tag.ParameterUsedAsReturnType = newRule.ParameterUsedAsReturnType;
if (newRule.Relation != null) tag.Relation = newRule.Relation;
if (newRule.Hidden != null) tag.Hidden = newRule.Hidden;
}
}
} | 51.357143 | 153 | 0.639136 | [
"MIT"
] | andrew-boyarshin/SharpGenTools | SharpGen/Model/CppElement.Extensions.cs | 9,349 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour {
Animator anim;
float h, v;
public float speed;
// Use this for initialization
void Start () {
anim = gameObject.GetComponent<Animator> ();
}
// Update is called once per frame
void Update () {
h = Input.GetAxis ("Horizontal");
v = Input.GetAxis ("Vertical");
anim.SetFloat ("Horizontal", h);
anim.SetFloat ("Vertical", v);
transform.Translate (new Vector3 (h * speed * Time.deltaTime, v * speed * Time.deltaTime));
}
}
| 17.117647 | 93 | 0.685567 | [
"MIT"
] | geoffatSAE/Lighting-Pixel-Art | Assets/PlayerController.cs | 584 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Nonoeil : Ennemies
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
| 15.052632 | 52 | 0.615385 | [
"MIT"
] | Matteo-Grellier/Land-Of-Denuo | Assets/Scripts/Characters/Enemie/Nonoeil.cs | 286 | C# |
using System.IO;
using CP77.CR2W.Reflection;
using FastMember;
using static CP77.CR2W.Types.Enums;
namespace CP77.CR2W.Types
{
[REDMeta]
public class SetDesiredReaction : AIbehaviortaskScript
{
[Ordinal(0)] [RED("behaviorArgumentFloatPriority")] public CName BehaviorArgumentFloatPriority { get; set; }
[Ordinal(1)] [RED("behaviorArgumentNameFlag")] public CName BehaviorArgumentNameFlag { get; set; }
[Ordinal(2)] [RED("behaviorArgumentNameTag")] public CName BehaviorArgumentNameTag { get; set; }
[Ordinal(3)] [RED("reactionData")] public CHandle<AIReactionData> ReactionData { get; set; }
public SetDesiredReaction(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name) { }
}
}
| 38.789474 | 112 | 0.734057 | [
"MIT"
] | Eingin/CP77Tools | CP77.CR2W/Types/cp77/SetDesiredReaction.cs | 719 | C# |
using UnityEngine;
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
namespace TMPro
{
public enum VertexSortingOrder { Normal, Reverse };
/// <summary>
/// Structure which contains the vertex attributes (geometry) of the text object.
/// </summary>
public struct TMP_MeshInfo
{
private static readonly Color32 s_DefaultColor = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
private static readonly Vector3 s_DefaultNormal = new Vector3(0.0f, 0.0f, -1f);
private static readonly Vector4 s_DefaultTangent = new Vector4(-1f, 0.0f, 0.0f, 1f);
private static readonly Bounds s_DefaultBounds = new Bounds();
public Mesh mesh;
public int vertexCount;
public Vector3[] vertices;
public Vector3[] normals;
public Vector4[] tangents;
public Vector2[] uvs0;
public Vector2[] uvs2;
//public Vector2[] uvs4;
public Color32[] colors32;
public int[] triangles;
public Material material;
/// <summary>
/// Function to pre-allocate vertex attributes for a mesh of size X.
/// </summary>
/// <param name="mesh"></param>
/// <param name="size"></param>
public TMP_MeshInfo(Mesh mesh, int size)
{
// Reference to the TMP Text Component.
//this.textComponent = null;
// Clear existing mesh data
if (mesh == null)
mesh = new Mesh();
else
mesh.Clear();
this.mesh = mesh;
// Limit the mesh to less than 65535 vertices which is the limit for Unity's Mesh.
size = Mathf.Min(size, 16383);
int sizeX4 = size * 4;
int sizeX6 = size * 6;
this.vertexCount = 0;
this.vertices = new Vector3[sizeX4];
this.uvs0 = new Vector2[sizeX4];
this.uvs2 = new Vector2[sizeX4];
//this.uvs4 = new Vector2[sizeX4]; // SDF scale data
this.colors32 = new Color32[sizeX4];
this.normals = new Vector3[sizeX4];
this.tangents = new Vector4[sizeX4];
this.triangles = new int[sizeX6];
int index_X6 = 0;
int index_X4 = 0;
while (index_X4 / 4 < size)
{
for (int i = 0; i < 4; i++)
{
this.vertices[index_X4 + i] = Vector3.zero;
this.uvs0[index_X4 + i] = Vector2.zero;
this.uvs2[index_X4 + i] = Vector2.zero;
//this.uvs4[index_X4 + i] = Vector2.zero;
this.colors32[index_X4 + i] = s_DefaultColor;
this.normals[index_X4 + i] = s_DefaultNormal;
this.tangents[index_X4 + i] = s_DefaultTangent;
}
this.triangles[index_X6 + 0] = index_X4 + 0;
this.triangles[index_X6 + 1] = index_X4 + 1;
this.triangles[index_X6 + 2] = index_X4 + 2;
this.triangles[index_X6 + 3] = index_X4 + 2;
this.triangles[index_X6 + 4] = index_X4 + 3;
this.triangles[index_X6 + 5] = index_X4 + 0;
index_X4 += 4;
index_X6 += 6;
}
// Pre-assign base vertex attributes.
this.mesh.vertices = this.vertices;
this.mesh.normals = this.normals;
this.mesh.tangents = this.tangents;
this.mesh.triangles = this.triangles;
this.mesh.bounds = s_DefaultBounds;
this.material = null;
}
/// <summary>
/// Function to pre-allocate vertex attributes for a mesh of size X.
/// </summary>
/// <param name="mesh"></param>
/// <param name="size"></param>
/// <param name="isVolumetric"></param>
public TMP_MeshInfo(Mesh mesh, int size, bool isVolumetric)
{
// Reference to the TMP Text Component.
//this.textComponent = null;
// Clear existing mesh data
if (mesh == null)
mesh = new Mesh();
else
mesh.Clear();
this.mesh = mesh;
int s0 = !isVolumetric ? 4 : 8;
int s1 = !isVolumetric ? 6 : 36;
// Limit the mesh to less than 65535 vertices which is the limit for Unity's Mesh.
size = Mathf.Min(size, 65532 / s0);
int size_x_s0 = size * s0;
int size_x_s1 = size * s1;
this.vertexCount = 0;
this.vertices = new Vector3[size_x_s0];
this.uvs0 = new Vector2[size_x_s0];
this.uvs2 = new Vector2[size_x_s0];
//this.uvs4 = new Vector2[sizeX8]; // SDF scale data
this.colors32 = new Color32[size_x_s0];
this.normals = new Vector3[size_x_s0];
this.tangents = new Vector4[size_x_s0];
this.triangles = new int[size_x_s1];
int index_x_s0 = 0;
int index_x_s1 = 0;
while (index_x_s0 / s0 < size)
{
for (int i = 0; i < s0; i++)
{
this.vertices[index_x_s0 + i] = Vector3.zero;
this.uvs0[index_x_s0 + i] = Vector2.zero;
this.uvs2[index_x_s0 + i] = Vector2.zero;
//this.uvs4[index_X4 + i] = Vector2.zero;
this.colors32[index_x_s0 + i] = s_DefaultColor;
this.normals[index_x_s0 + i] = s_DefaultNormal;
this.tangents[index_x_s0 + i] = s_DefaultTangent;
}
// Front Face
this.triangles[index_x_s1 + 0] = index_x_s0 + 0;
this.triangles[index_x_s1 + 1] = index_x_s0 + 1;
this.triangles[index_x_s1 + 2] = index_x_s0 + 2;
this.triangles[index_x_s1 + 3] = index_x_s0 + 2;
this.triangles[index_x_s1 + 4] = index_x_s0 + 3;
this.triangles[index_x_s1 + 5] = index_x_s0 + 0;
if (isVolumetric)
{
// Left Face
this.triangles[index_x_s1 + 6] = index_x_s0 + 4;
this.triangles[index_x_s1 + 7] = index_x_s0 + 5;
this.triangles[index_x_s1 + 8] = index_x_s0 + 1;
this.triangles[index_x_s1 + 9] = index_x_s0 + 1;
this.triangles[index_x_s1 + 10] = index_x_s0 + 0;
this.triangles[index_x_s1 + 11] = index_x_s0 + 4;
// Right Face
this.triangles[index_x_s1 + 12] = index_x_s0 + 3;
this.triangles[index_x_s1 + 13] = index_x_s0 + 2;
this.triangles[index_x_s1 + 14] = index_x_s0 + 6;
this.triangles[index_x_s1 + 15] = index_x_s0 + 6;
this.triangles[index_x_s1 + 16] = index_x_s0 + 7;
this.triangles[index_x_s1 + 17] = index_x_s0 + 3;
// Top Face
this.triangles[index_x_s1 + 18] = index_x_s0 + 1;
this.triangles[index_x_s1 + 19] = index_x_s0 + 5;
this.triangles[index_x_s1 + 20] = index_x_s0 + 6;
this.triangles[index_x_s1 + 21] = index_x_s0 + 6;
this.triangles[index_x_s1 + 22] = index_x_s0 + 2;
this.triangles[index_x_s1 + 23] = index_x_s0 + 1;
// Bottom Face
this.triangles[index_x_s1 + 24] = index_x_s0 + 4;
this.triangles[index_x_s1 + 25] = index_x_s0 + 0;
this.triangles[index_x_s1 + 26] = index_x_s0 + 3;
this.triangles[index_x_s1 + 27] = index_x_s0 + 3;
this.triangles[index_x_s1 + 28] = index_x_s0 + 7;
this.triangles[index_x_s1 + 29] = index_x_s0 + 4;
// Back Face
this.triangles[index_x_s1 + 30] = index_x_s0 + 7;
this.triangles[index_x_s1 + 31] = index_x_s0 + 6;
this.triangles[index_x_s1 + 32] = index_x_s0 + 5;
this.triangles[index_x_s1 + 33] = index_x_s0 + 5;
this.triangles[index_x_s1 + 34] = index_x_s0 + 4;
this.triangles[index_x_s1 + 35] = index_x_s0 + 7;
}
index_x_s0 += s0;
index_x_s1 += s1;
}
// Pre-assign base vertex attributes.
this.mesh.vertices = this.vertices;
this.mesh.normals = this.normals;
this.mesh.tangents = this.tangents;
this.mesh.triangles = this.triangles;
this.mesh.bounds = s_DefaultBounds;
this.material = null;
}
/// <summary>
/// Function to resized the content of MeshData and re-assign normals, tangents and triangles.
/// </summary>
/// <param name="meshData"></param>
/// <param name="size"></param>
public void ResizeMeshInfo(int size)
{
// Limit the mesh to less than 65535 vertices which is the limit for Unity's Mesh.
size = Mathf.Min(size, 16383);
int size_X4 = size * 4;
int size_X6 = size * 6;
int previousSize = this.vertices.Length / 4;
Array.Resize(ref this.vertices, size_X4);
Array.Resize(ref this.normals, size_X4);
Array.Resize(ref this.tangents, size_X4);
Array.Resize(ref this.uvs0, size_X4);
Array.Resize(ref this.uvs2, size_X4);
//Array.Resize(ref this.uvs4, size_X4);
Array.Resize(ref this.colors32, size_X4);
Array.Resize(ref this.triangles, size_X6);
// Re-assign Normals, Tangents and Triangles
if (size <= previousSize)
{
this.mesh.triangles = this.triangles;
this.mesh.vertices = this.vertices;
this.mesh.normals = this.normals;
this.mesh.tangents = this.tangents;
return;
}
for (int i = previousSize; i < size; i++)
{
int index_X4 = i * 4;
int index_X6 = i * 6;
this.normals[0 + index_X4] = s_DefaultNormal;
this.normals[1 + index_X4] = s_DefaultNormal;
this.normals[2 + index_X4] = s_DefaultNormal;
this.normals[3 + index_X4] = s_DefaultNormal;
this.tangents[0 + index_X4] = s_DefaultTangent;
this.tangents[1 + index_X4] = s_DefaultTangent;
this.tangents[2 + index_X4] = s_DefaultTangent;
this.tangents[3 + index_X4] = s_DefaultTangent;
// Setup Triangles
this.triangles[0 + index_X6] = 0 + index_X4;
this.triangles[1 + index_X6] = 1 + index_X4;
this.triangles[2 + index_X6] = 2 + index_X4;
this.triangles[3 + index_X6] = 2 + index_X4;
this.triangles[4 + index_X6] = 3 + index_X4;
this.triangles[5 + index_X6] = 0 + index_X4;
}
this.mesh.vertices = this.vertices;
this.mesh.normals = this.normals;
this.mesh.tangents = this.tangents;
this.mesh.triangles = this.triangles;
}
/// <summary>
/// Function to resized the content of MeshData and re-assign normals, tangents and triangles.
/// </summary>
/// <param name="size"></param>
/// <param name="isVolumetric"></param>
public void ResizeMeshInfo(int size, bool isVolumetric)
{
int s0 = !isVolumetric ? 4 : 8;
int s1 = !isVolumetric ? 6 : 36;
// Limit the mesh to less than 65535 vertices which is the limit for Unity's Mesh.
size = Mathf.Min(size, 65532 / s0);
int size_X4 = size * s0;
int size_X6 = size * s1;
int previousSize = this.vertices.Length / s0;
Array.Resize(ref this.vertices, size_X4);
Array.Resize(ref this.normals, size_X4);
Array.Resize(ref this.tangents, size_X4);
Array.Resize(ref this.uvs0, size_X4);
Array.Resize(ref this.uvs2, size_X4);
//Array.Resize(ref this.uvs4, size_X4);
Array.Resize(ref this.colors32, size_X4);
Array.Resize(ref this.triangles, size_X6);
// Re-assign Normals, Tangents and Triangles
if (size <= previousSize)
{
this.mesh.triangles = this.triangles;
this.mesh.vertices = this.vertices;
this.mesh.normals = this.normals;
this.mesh.tangents = this.tangents;
return;
}
for (int i = previousSize; i < size; i++)
{
int index_X4 = i * s0;
int index_X6 = i * s1;
this.normals[0 + index_X4] = s_DefaultNormal;
this.normals[1 + index_X4] = s_DefaultNormal;
this.normals[2 + index_X4] = s_DefaultNormal;
this.normals[3 + index_X4] = s_DefaultNormal;
this.tangents[0 + index_X4] = s_DefaultTangent;
this.tangents[1 + index_X4] = s_DefaultTangent;
this.tangents[2 + index_X4] = s_DefaultTangent;
this.tangents[3 + index_X4] = s_DefaultTangent;
if (isVolumetric)
{
this.normals[4 + index_X4] = s_DefaultNormal;
this.normals[5 + index_X4] = s_DefaultNormal;
this.normals[6 + index_X4] = s_DefaultNormal;
this.normals[7 + index_X4] = s_DefaultNormal;
this.tangents[4 + index_X4] = s_DefaultTangent;
this.tangents[5 + index_X4] = s_DefaultTangent;
this.tangents[6 + index_X4] = s_DefaultTangent;
this.tangents[7 + index_X4] = s_DefaultTangent;
}
// Setup Triangles
this.triangles[0 + index_X6] = 0 + index_X4;
this.triangles[1 + index_X6] = 1 + index_X4;
this.triangles[2 + index_X6] = 2 + index_X4;
this.triangles[3 + index_X6] = 2 + index_X4;
this.triangles[4 + index_X6] = 3 + index_X4;
this.triangles[5 + index_X6] = 0 + index_X4;
if (isVolumetric)
{
// Left Face
this.triangles[index_X6 + 6] = index_X4 + 4;
this.triangles[index_X6 + 7] = index_X4 + 5;
this.triangles[index_X6 + 8] = index_X4 + 1;
this.triangles[index_X6 + 9] = index_X4 + 1;
this.triangles[index_X6 + 10] = index_X4 + 0;
this.triangles[index_X6 + 11] = index_X4 + 4;
// Right Face
this.triangles[index_X6 + 12] = index_X4 + 3;
this.triangles[index_X6 + 13] = index_X4 + 2;
this.triangles[index_X6 + 14] = index_X4 + 6;
this.triangles[index_X6 + 15] = index_X4 + 6;
this.triangles[index_X6 + 16] = index_X4 + 7;
this.triangles[index_X6 + 17] = index_X4 + 3;
// Top Face
this.triangles[index_X6 + 18] = index_X4 + 1;
this.triangles[index_X6 + 19] = index_X4 + 5;
this.triangles[index_X6 + 20] = index_X4 + 6;
this.triangles[index_X6 + 21] = index_X4 + 6;
this.triangles[index_X6 + 22] = index_X4 + 2;
this.triangles[index_X6 + 23] = index_X4 + 1;
// Bottom Face
this.triangles[index_X6 + 24] = index_X4 + 4;
this.triangles[index_X6 + 25] = index_X4 + 0;
this.triangles[index_X6 + 26] = index_X4 + 3;
this.triangles[index_X6 + 27] = index_X4 + 3;
this.triangles[index_X6 + 28] = index_X4 + 7;
this.triangles[index_X6 + 29] = index_X4 + 4;
// Back Face
this.triangles[index_X6 + 30] = index_X4 + 7;
this.triangles[index_X6 + 31] = index_X4 + 6;
this.triangles[index_X6 + 32] = index_X4 + 5;
this.triangles[index_X6 + 33] = index_X4 + 5;
this.triangles[index_X6 + 34] = index_X4 + 4;
this.triangles[index_X6 + 35] = index_X4 + 7;
}
}
this.mesh.vertices = this.vertices;
this.mesh.normals = this.normals;
this.mesh.tangents = this.tangents;
this.mesh.triangles = this.triangles;
}
/// <summary>
/// Function to clear the vertices while preserving the Triangles, Normals and Tangents.
/// </summary>
public void Clear()
{
if (this.vertices == null) return;
Array.Clear(this.vertices, 0, this.vertices.Length);
this.vertexCount = 0;
if (this.mesh != null)
this.mesh.vertices = this.vertices;
}
/// <summary>
/// Function to clear the vertices while preserving the Triangles, Normals and Tangents.
/// </summary>
public void Clear(bool uploadChanges)
{
if (this.vertices == null) return;
Array.Clear(this.vertices, 0, this.vertices.Length);
this.vertexCount = 0;
if (uploadChanges && this.mesh != null)
this.mesh.vertices = this.vertices;
if (this.mesh != null)
this.mesh.bounds = s_DefaultBounds;
}
/// <summary>
/// Function to clear the vertices while preserving the Triangles, Normals and Tangents.
/// </summary>
public void ClearUnusedVertices()
{
int length = vertices.Length - vertexCount;
if (length > 0)
Array.Clear(vertices, vertexCount, length);
}
/// <summary>
/// Function used to mark unused vertices as degenerate.
/// </summary>
/// <param name="startIndex"></param>
public void ClearUnusedVertices(int startIndex)
{
int length = this.vertices.Length - startIndex;
if (length > 0)
Array.Clear(this.vertices, startIndex, length);
}
/// <summary>
/// Function used to mark unused vertices as degenerate an upload resulting data to the mesh.
/// </summary>
/// <param name="startIndex"></param>
public void ClearUnusedVertices(int startIndex, bool updateMesh)
{
int length = this.vertices.Length - startIndex;
if (length > 0)
Array.Clear(this.vertices, startIndex, length);
if (updateMesh && mesh != null)
this.mesh.vertices = this.vertices;
}
public void SortGeometry (VertexSortingOrder order)
{
switch (order)
{
case VertexSortingOrder.Normal:
// Do nothing
break;
case VertexSortingOrder.Reverse:
int size = vertexCount / 4;
for (int i = 0; i < size; i++)
{
int src = i * 4;
int dst = (size - i - 1) * 4;
if (src < dst)
SwapVertexData(src, dst);
}
break;
//case VertexSortingOrder.Depth:
// break;
}
}
/// <summary>
/// Function to rearrange the quads of the text object to change their rendering order.
/// </summary>
/// <param name="sortingOrder"></param>
public void SortGeometry(IList<int> sortingOrder)
{
// Make sure the sorting order array is not larger than the vertices array.
int indexCount = sortingOrder.Count;
if (indexCount * 4 > vertices.Length) return;
int src_index;
for (int dst_index = 0; dst_index < indexCount; dst_index++)
{
src_index = sortingOrder[dst_index];
while (src_index < dst_index)
{
src_index = sortingOrder[src_index];
}
// Swap items
if (src_index != dst_index)
SwapVertexData(src_index * 4, dst_index * 4);
//Debug.Log("Swap element [" + dst_index + "] with [" + src_index + "]. Vertex[" + dst_index + "] is " + vertices[dst_index * 4].z);
}
}
/// <summary>
/// Method to swap the vertex attributes between src and dst quads.
/// </summary>
/// <param name="src">Index of the first vertex attribute of the source character / quad.</param>
/// <param name="dst">Index of the first vertex attribute of the destination character / quad.</param>
public void SwapVertexData(int src, int dst)
{
int src_Index = src; // * 4;
int dst_Index = dst; // * 4;
// Swap vertices
Vector3 vertex;
vertex = vertices[dst_Index + 0];
vertices[dst_Index + 0] = vertices[src_Index + 0];
vertices[src_Index + 0] = vertex;
vertex = vertices[dst_Index + 1];
vertices[dst_Index + 1] = vertices[src_Index + 1];
vertices[src_Index + 1] = vertex;
vertex = vertices[dst_Index + 2];
vertices[dst_Index + 2] = vertices[src_Index + 2];
vertices[src_Index + 2] = vertex;
vertex = vertices[dst_Index + 3];
vertices[dst_Index + 3] = vertices[src_Index + 3];
vertices[src_Index + 3] = vertex;
//Swap UVs0
Vector2 uvs;
uvs = uvs0[dst_Index + 0];
uvs0[dst_Index + 0] = uvs0[src_Index + 0];
uvs0[src_Index + 0] = uvs;
uvs = uvs0[dst_Index + 1];
uvs0[dst_Index + 1] = uvs0[src_Index + 1];
uvs0[src_Index + 1] = uvs;
uvs = uvs0[dst_Index + 2];
uvs0[dst_Index + 2] = uvs0[src_Index + 2];
uvs0[src_Index + 2] = uvs;
uvs = uvs0[dst_Index + 3];
uvs0[dst_Index + 3] = uvs0[src_Index + 3];
uvs0[src_Index + 3] = uvs;
// Swap UVs2
uvs = uvs2[dst_Index + 0];
uvs2[dst_Index + 0] = uvs2[src_Index + 0];
uvs2[src_Index + 0] = uvs;
uvs = uvs2[dst_Index + 1];
uvs2[dst_Index + 1] = uvs2[src_Index + 1];
uvs2[src_Index + 1] = uvs;
uvs = uvs2[dst_Index + 2];
uvs2[dst_Index + 2] = uvs2[src_Index + 2];
uvs2[src_Index + 2] = uvs;
uvs = uvs2[dst_Index + 3];
uvs2[dst_Index + 3] = uvs2[src_Index + 3];
uvs2[src_Index + 3] = uvs;
// Vertex Colors
Color32 color;
color = colors32[dst_Index + 0];
colors32[dst_Index + 0] = colors32[src_Index + 0];
colors32[src_Index + 0] = color;
color = colors32[dst_Index + 1];
colors32[dst_Index + 1] = colors32[src_Index + 1];
colors32[src_Index + 1] = color;
color = colors32[dst_Index + 2];
colors32[dst_Index + 2] = colors32[src_Index + 2];
colors32[src_Index + 2] = color;
color = colors32[dst_Index + 3];
colors32[dst_Index + 3] = colors32[src_Index + 3];
colors32[src_Index + 3] = color;
}
//int Partition (int start, int end)
//{
// float pivot = vertices[end].z;
// int partitionIndex = start;
// for (int i = start; i < end; i++)
// {
// if (vertices[i].z <= pivot)
// {
// Swap(vertices[i], vertices[partitionIndex]);
// partitionIndex += 1;
// }
// }
// Swap(vertices[partitionIndex], vertices[end]);
// return partitionIndex;
//}
//void Swap(Vector3 a, Vector3 b)
//{
// Vector3 temp = a;
// a = b;
// b = a;
//}
}
}
| 37.894502 | 149 | 0.490099 | [
"MIT"
] | Hamburgerboi/george-royale | Library/PackageCache/com.unity.textmeshpro@3.0.0-preview.1/Scripts/Runtime/TMP_MeshInfo.cs | 25,505 | C# |
#region PDFsharp - A .NET library for processing PDF
//
// Authors:
// Stefan Lange
//
// Copyright (c) 2005-2016 empira Software GmbH, Cologne Area (Germany)
//
// http://www.PdfSharp.com
// http://sourceforge.net/projects/pdfsharp
//
// 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.
#endregion
using System;
using System.Diagnostics;
using System.Globalization;
namespace PdfSharpCore.Pdf
{
/// <summary>
/// Represents a PDF object identifier, a pair of object and generation number.
/// </summary>
[DebuggerDisplay("{DebuggerDisplay}")]
public struct PdfObjectID : IComparable
{
/// <summary>
/// Initializes a new instance of the <see cref="PdfObjectID"/> class.
/// </summary>
/// <param name="objectNumber">The object number.</param>
public PdfObjectID(int objectNumber)
{
Debug.Assert(objectNumber >= 1, "Object number out of range.");
_objectNumber = objectNumber;
_generationNumber = 0;
#if DEBUG_
// Just a place for a breakpoint during debugging.
if (objectNumber == 5894)
GetType();
#endif
}
/// <summary>
/// Initializes a new instance of the <see cref="PdfObjectID"/> class.
/// </summary>
/// <param name="objectNumber">The object number.</param>
/// <param name="generationNumber">The generation number.</param>
public PdfObjectID(int objectNumber, int generationNumber)
{
Debug.Assert(objectNumber >= 1, "Object number out of range.");
//Debug.Assert(generationNumber >= 0 && generationNumber <= 65535, "Generation number out of range.");
#if DEBUG_
// iText creates generation numbers with a value of 65536...
if (generationNumber > 65535)
Debug.WriteLine(String.Format("Generation number: {0}", generationNumber));
#endif
_objectNumber = objectNumber;
_generationNumber = (ushort)generationNumber;
}
/// <summary>
/// Gets or sets the object number.
/// </summary>
public int ObjectNumber
{
get { return _objectNumber; }
}
readonly int _objectNumber;
/// <summary>
/// Gets or sets the generation number.
/// </summary>
public int GenerationNumber
{
get { return _generationNumber; }
}
readonly ushort _generationNumber;
/// <summary>
/// Indicates whether this object is an empty object identifier.
/// </summary>
public bool IsEmpty
{
get { return _objectNumber == 0; }
}
/// <summary>
/// Indicates whether this instance and a specified object are equal.
/// </summary>
public override bool Equals(object obj)
{
if (obj is PdfObjectID)
{
PdfObjectID id = (PdfObjectID)obj;
if (_objectNumber == id._objectNumber)
return _generationNumber == id._generationNumber;
}
return false;
}
/// <summary>
/// Returns the hash code for this instance.
/// </summary>
public override int GetHashCode()
{
return _objectNumber ^ _generationNumber;
}
/// <summary>
/// Determines whether the two objects are equal.
/// </summary>
public static bool operator ==(PdfObjectID left, PdfObjectID right)
{
return left.Equals(right);
}
/// <summary>
/// Determines whether the tow objects not are equal.
/// </summary>
public static bool operator !=(PdfObjectID left, PdfObjectID right)
{
return !left.Equals(right);
}
/// <summary>
/// Returns the object and generation numbers as a string.
/// </summary>
public override string ToString()
{
return _objectNumber.ToString(CultureInfo.InvariantCulture) + " " + _generationNumber.ToString(CultureInfo.InvariantCulture);
}
/// <summary>
/// Creates an empty object identifier.
/// </summary>
public static PdfObjectID Empty
{
get { return new PdfObjectID(); }
}
/// <summary>
/// Compares the current object id with another object.
/// </summary>
public int CompareTo(object obj)
{
if (obj is PdfObjectID)
{
PdfObjectID id = (PdfObjectID)obj;
if (_objectNumber == id._objectNumber)
return _generationNumber - id._generationNumber;
return _objectNumber - id._objectNumber;
}
return 1;
}
/// <summary>
/// Gets the DebuggerDisplayAttribute text.
/// </summary>
internal string DebuggerDisplay
{
get { return String.Format("id=({0})", ToString()); }
}
}
}
| 34.005556 | 137 | 0.59353 | [
"MIT"
] | 929496959/PdfSharpCore | PdfSharpCore/Pdf/PdfObjectID.cs | 6,121 | C# |
#if ! (UNITY_DASHBOARD_WIDGET || UNITY_WEBPLAYER || UNITY_WII || UNITY_WIIU || UNITY_NACL || UNITY_FLASH || UNITY_BLACKBERRY) // Disable under unsupported platforms.
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.11
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public enum AkChannelConfigType {
AK_ChannelConfigType_Anonymous = 0x0,
AK_ChannelConfigType_Standard = 0x1,
AK_ChannelConfigType_Ambisonic = 0x2
}
#endif // #if ! (UNITY_DASHBOARD_WIDGET || UNITY_WEBPLAYER || UNITY_WII || UNITY_WIIU || UNITY_NACL || UNITY_FLASH || UNITY_BLACKBERRY) // Disable under unsupported platforms. | 54.3125 | 175 | 0.617952 | [
"MIT"
] | Clement-R/ggj_2018 | Assets/Wwise/Deployment/API/Generated/Common/AkChannelConfigType.cs | 869 | C# |
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1055:Uri return values should not be strings", Scope = "member", Target = "~M:Amazon.Polly.SynthesizeSpeechUtil.GeneratePresignedUrl(Amazon.RegionEndpoint,Amazon.Polly.Model.SynthesizeSpeechRequest)~System.String")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1055:Uri return values should not be strings", Scope = "member", Target = "~M:Amazon.Polly.SynthesizeSpeechUtil.GeneratePresignedUrl(Amazon.Runtime.AWSCredentials,Amazon.RegionEndpoint,Amazon.Polly.Model.SynthesizeSpeechRequest)~System.String")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1055:Uri return values should not be strings", Scope = "member", Target = "~M:Amazon.Polly.SynthesizeSpeechUtil.GeneratePresignedUrl(Amazon.Runtime.AWSCredentials,Amazon.RegionEndpoint,Amazon.Polly.Model.SynthesizeSpeechRequest,Amazon.Polly.PreSignerOptions)~System.String")]
| 120.5 | 347 | 0.815768 | [
"Apache-2.0"
] | EbstaLimited/aws-sdk-net | sdk/src/Services/Polly/GlobalSuppressions.cs | 1,207 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Android.App;
// 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("CrossControls.Sample.Android")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CrossControls.Sample.Android")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
// 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")]
// Add some common permissions, these can be removed if not needed
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
| 37.228571 | 84 | 0.759018 | [
"MIT"
] | krdmllr/CrossControls | sample/CrossControls.Sample/CrossControls.Sample.Android/Properties/AssemblyInfo.cs | 1,306 | C# |
// Copyright (c) 2010-2013 SharpDX - Alexandre Mutel
//
// 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.IO;
using System.Text;
using System.Text.RegularExpressions;
using RazorEngine;
using RazorEngine.Compilation;
using RazorEngine.Templating;
using SharpCore;
using SharpCore.Logging;
using SharpDoc.Model;
namespace SharpDoc
{
/// <summary>
/// Template context used by all templates.
/// </summary>
public class TemplateContext : ITemplateResolver
{
private const string StyleDirectory = "Styles";
private List<TagExpandItem> _regexItems;
private MsdnRegistry _msnRegistry;
private bool assembliesProcessed;
private bool topicsProcessed;
private ICompilerServiceFactory razorCompiler;
private TemplateService razor;
/// <summary>
/// Initializes a new instance of the <see cref="TemplateContext"/> class.
/// </summary>
public TemplateContext()
{
StyleDirectories = new List<string>();
_regexItems = new List<TagExpandItem>();
_msnRegistry = new MsdnRegistry();
Param = new DynamicParam();
Style = new DynamicParam();
}
/// <summary>
/// Finds a <see cref="IModelReference"/> from an id.
/// </summary>
/// <param name="id">The id.</param>
/// <returns>
/// A registered reference or null if it's an external or invalid reference
/// </returns>
private IModelReference FindLocalReference(string id)
{
return Registry.FindById(id);
}
/// <summary>
/// Gets the param dynamic properties.
/// </summary>
/// <value>The param dynamic properties.</value>
public dynamic Param { get; private set; }
/// <summary>
/// Gets the style dynamic properties.
/// </summary>
/// <value>The style dynamic properties.</value>
public dynamic Style { get; private set; }
/// <summary>
/// Gets or sets the style manager.
/// </summary>
/// <value>The style manager.</value>
public StyleManager StyleManager { get; set; }
/// <summary>
/// Gets or sets the registry.
/// </summary>
/// <value>The registry.</value>
public MemberRegistry Registry { get; set; }
/// <summary>
/// Gets or sets the topics.
/// </summary>
/// <value>The topics.</value>
public NTopic RootTopic { get; set; }
/// <summary>
/// Gets or sets the search topic.
/// </summary>
/// <value>The search topic.</value>
public NTopic SearchTopic { get; set;}
/// <summary>
/// Gets or sets the class library topic.
/// </summary>
/// <value>
/// The class library topic.
/// </value>
public NTopic ClassLibraryTopic { get; set; }
/// <summary>
/// Gets or sets the assemblies.
/// </summary>
/// <value>The assemblies.</value>
public List<NNamespace> Namespaces { get; set; }
/// <summary>
/// Gets or sets the current topic.
/// </summary>
/// <value>The current topic.</value>
public NTopic Topic { get; set; }
/// <summary>
/// Gets or sets the current assembly being processed.
/// </summary>
/// <value>The current assembly being processed.</value>
public NAssembly Assembly { get; set; }
/// <summary>
/// Gets or sets the current namespace being processed.
/// </summary>
/// <value>The current namespace being processed.</value>
public NNamespace Namespace { get; set; }
/// <summary>
/// Gets or sets the current type being processed.
/// </summary>
/// <value>The current type being processed.</value>
public NType Type { get; set; }
/// <summary>
/// Gets or sets the current member being processed.
/// </summary>
/// <value>The current member.</value>
public NMember Member { get; set; }
/// <summary>
/// Gets or sets the style directories.
/// </summary>
/// <value>The style directories.</value>
private List<string> StyleDirectories {get; set;}
/// <summary>
/// Gets or sets the output directory.
/// </summary>
/// <value>The output directory.</value>
public string OutputDirectory { get; set; }
/// <summary>
/// Gets or sets the link resolver.
/// </summary>
/// <value>The link resolver.</value>
public Func<LinkDescriptor, string> LinkResolver { get; set; }
/// <summary>
/// Gets or sets the page id function.
/// </summary>
/// <value>
/// The page id function.
/// </value>
public Func<IModelReference, string> PageIdFunction { get; set; }
/// <summary>
/// Gets or sets the write to function.
/// </summary>
/// <value>
/// The write to function.
/// </value>
public Action<IModelReference, string> WriteTo { get; set; }
/// <summary>
/// Gets or sets the name of the current style.
/// </summary>
/// <value>
/// The name of the current style.
/// </value>
public string CurrentStyleName { get; set; }
/// <summary>
/// Gets or sets the config.
/// </summary>
/// <value>
/// The config.
/// </value>
public Config Config { get; set; }
private ModelProcessor modelProcessor;
private TopicBuilder topicBuilder;
/// <summary>
/// Initializes this instance.
/// </summary>
public void Initialize()
{
Config.FilePath = Config.FilePath ?? Path.Combine(Environment.CurrentDirectory, "unknown.xml");
OutputDirectory = Config.AbsoluteOutputDirectory;
// Set title
Param.DocumentationTitle = Config.Title;
// Add parameters
if (Config.Parameters.Count > 0)
{
var dictionary = (DynamicParam)Param;
foreach (var configParam in Config.Parameters)
{
dictionary.Properties.Remove(configParam.Name);
dictionary.Properties.Add(configParam.Name, configParam.value);
}
}
// Add styles
if (Config.StyleParameters.Count > 0)
{
var dictionary = (IDictionary<string, object>)Style;
foreach (var configParam in Config.StyleParameters)
{
dictionary.Remove(configParam.Name);
dictionary.Add(configParam.Name, configParam.value);
}
}
}
/// <summary>
/// Processes the assemblies.
/// </summary>
public void ProcessAssemblies()
{
if (!assembliesProcessed)
{
// Process the assemblies
modelProcessor = new ModelProcessor { AssemblyManager = new MonoCecilAssemblyManager(), ModelBuilder = new MonoCecilModelBuilder(), PageIdFunction = PageIdFunction };
modelProcessor.Run(Config);
if (Logger.HasErrors)
Logger.Fatal("Too many errors in config file. Check previous message.");
Namespaces = new List<NNamespace>(modelProcessor.Namespaces);
Registry = modelProcessor.Registry;
assembliesProcessed = true;
}
}
/// <summary>
/// Processes the topics.
/// </summary>
public void ProcessTopics()
{
if (!topicsProcessed)
{
// Build the topics
topicBuilder = new TopicBuilder() { Namespaces = modelProcessor.Namespaces, Registry = modelProcessor.Registry };
topicBuilder.Run(Config, PageIdFunction);
if (Logger.HasErrors)
Logger.Fatal("Too many errors in config file. Check previous message.");
RootTopic = topicBuilder.RootTopic;
SearchTopic = topicBuilder.SearchTopic;
ClassLibraryTopic = topicBuilder.ClassLibraryTopic;
topicsProcessed = true;
}
}
/// <summary>
/// Finds the topic by id.
/// </summary>
/// <param name="topicId">The topic id.</param>
/// <returns></returns>
public NTopic FindTopicById(string topicId)
{
if (RootTopic == null)
return null;
return RootTopic.FindTopicById(topicId);
}
/// <summary>
/// Gets the current context.
/// </summary>
/// <value>The current context.</value>
public IModelReference CurrentContext
{
get
{
if (Type != null)
return Type;
if (Namespace != null)
return Namespace;
if (Assembly != null)
return Assembly;
if (Topic != null)
return Topic;
return null;
}
}
/// <summary>
/// Resolve a local element Id (i.e. "T:System.Object") to a URL.
/// </summary>
/// <param name="reference">The reference.</param>
/// <param name="linkName">Name of the link.</param>
/// <param name="forceLocal">if set to <c>true</c> [force local].</param>
/// <param name="attributes">The attributes.</param>
/// <param name="useSelf">if set to <c>true</c> [use self when possible].</param>
/// <returns></returns>
public string ToUrl(IModelReference reference, string linkName = null, bool forceLocal = false, string attributes = null, bool useSelf = true)
{
return ToUrl(reference.Id, linkName, forceLocal, attributes, reference, useSelf);
}
/// <summary>
/// Resolve a document Id (i.e. "T:System.Object") to an URL.
/// </summary>
/// <param name="id">The id.</param>
/// <param name="linkName">Name of the link.</param>
/// <param name="forceLocal">if set to <c>true</c> [force local].</param>
/// <param name="attributes">The attributes.</param>
/// <param name="localReference">The local reference.</param>
/// <param name="useSelf"></param>
/// <returns></returns>
public string ToUrl(string id, string linkName = null, bool forceLocal = false, string attributes = null, IModelReference localReference = null, bool useSelf = true)
{
var linkDescriptor = new LinkDescriptor { Type = LinkType.None, Index = -1 };
var typeReference = localReference as NTypeReference;
NTypeReference genericInstance = null;
bool isGenericInstance = typeReference != null && typeReference.IsGenericInstance;
bool isGenericParameter = typeReference != null && typeReference.IsGenericParameter;
if (isGenericInstance)
{
var elementType = typeReference.ElementType;
id = elementType.Id;
genericInstance = typeReference;
linkName = elementType.Name.Substring(0, elementType.Name.IndexOf('<'));
}
linkDescriptor.LocalReference = FindLocalReference(id);
if (isGenericParameter)
{
linkDescriptor.Name = typeReference.Name;
} else if (linkDescriptor.LocalReference != null)
{
// For local references, use short name
linkDescriptor.Name = linkDescriptor.LocalReference.Name;
linkDescriptor.PageId = linkDescriptor.LocalReference.PageId;
linkDescriptor.Type = LinkType.Local;
linkDescriptor.Index = linkDescriptor.LocalReference.Index;
if (!forceLocal && CurrentContext != null && linkDescriptor.LocalReference is NMember)
{
var declaringType = ((NMember) linkDescriptor.LocalReference).DeclaringType;
// If link is self referencing the current context, then use a self link
if ((id == CurrentContext.Id || (declaringType != null && declaringType.Id == CurrentContext.Id && (!id.StartsWith("T:") && !declaringType.Id.StartsWith("T:")))) && useSelf)
{
linkDescriptor.Type = LinkType.Self;
}
}
} else
{
linkDescriptor.Location = _msnRegistry.FindUrl(id);
var reference = TextReferenceUtility.CreateReference(id);
if (linkDescriptor.Location != null)
{
linkDescriptor.Type = LinkType.Msdn;
linkDescriptor.Name = reference.FullName;
// Open MSDN documentation to a new window
attributes = (attributes ?? "") + " target='_blank'";
} else
{
linkDescriptor.Type = LinkType.None;
linkDescriptor.Name = reference.Name;
}
}
if (LinkResolver == null)
{
Logger.Warning("Model.LinkResolver must be set");
return id;
}
if (linkName != null)
linkDescriptor.Name = linkName;
linkDescriptor.Id = id;
linkDescriptor.Attributes = attributes;
var urlBuilder = new StringBuilder();
urlBuilder.Append(LinkResolver(linkDescriptor));
// Handle URL for generic instance
if (genericInstance != null)
{
urlBuilder.Append("<");
for (int i = 0; i < genericInstance.GenericArguments.Count; i++)
{
if (i > 0)
urlBuilder.Append(", ");
var genericArgument = genericInstance.GenericArguments[i];
// Recursive call here
urlBuilder.Append(ToUrl(genericArgument));
}
urlBuilder.Append(">");
}
return urlBuilder.ToString();
}
/// <summary>
/// Uses the style.
/// </summary>
/// <param name="styleName">Name of the style.</param>
/// <returns></returns>
internal void UseStyle(string styleName)
{
razorCompiler = new DefaultCompilerServiceFactory();
razor = new TemplateService(razorCompiler.CreateCompilerService(Language.CSharp, false, null), null);
razor.SetTemplateBase(typeof(TemplateHelperBase));
razor.AddResolver(this);
if (!StyleManager.StyleExist(styleName))
Logger.Fatal("Cannot us style [{0}]. Style doesn't exist", styleName);
CurrentStyleName = styleName;
StyleDirectories.Clear();
var includeBaseStyle = new List<string>();
var styles = StyleManager.AvailableStyles;
includeBaseStyle.Add(styleName);
bool isNotComplete = true;
// Compute directories to look, by following inheritance
// In the same order they are declared
while (isNotComplete)
{
isNotComplete = false;
// Build directories to look for this specific style and all its base style);
var toRemove = new List<StyleDefinition>();
foreach (var style in styles)
{
// Apply parameter inherited from style
if (style.Name == styleName)
{
foreach (var parameter in style.Parameters)
{
((DynamicParam)Param).Properties.Remove(parameter.Name);
((DynamicParam)Param).Properties.Add(parameter.Name, parameter.value);
}
}
if (includeBaseStyle.Contains(style.Name))
{
toRemove.Add(style);
StyleDirectories.Add(style.DirectoryPath);
isNotComplete = true;
if (style.HasBaseStyle)
includeBaseStyle.Add(style.BaseStyle);
}
}
// Remove the style that was processed by the previous loop
foreach (var styleDefinition in toRemove)
styles.Remove(styleDefinition);
}
foreach (var styleDirectory in StyleDirectories)
{
Logger.Message("Using Style Directory [{0}]", styleDirectory);
}
}
/// <summary>
/// Resolves a path from template directories.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>The path to the file or directory</returns>
public string ResolvePath(string path)
{
for (int i = 0; i < StyleDirectories.Count; i++)
{
string filePath = Path.Combine(StyleDirectories[i], path);
if (File.Exists(filePath))
return filePath;
}
return null;
}
/// <summary>
/// Resolves and load a file from template directories.
/// </summary>
/// <param name="file">The file.</param>
/// <returns>The content of the file</returns>
public string Loadfile(string file)
{
string filePath = ResolvePath(file);
if (filePath == null) {
Logger.Fatal("Cannot find file [{0}] from the following Template Directories [{1}]", file, string.Join(",", StyleDirectories));
// Fatal is stopping the process
return "";
}
return File.ReadAllText(filePath);
}
/// <summary>
/// Gets the template.
/// </summary>
/// <param name="name">The name.</param>
/// <returns></returns>
public string GetTemplate(string name, out string location)
{
location = ResolvePath(name + ".cshtml");
if (location == null)
location = ResolvePath(Path.Combine("html", name + ".cshtml"));
if (location == null)
{
Logger.Fatal("Cannot find template [{0}] from the following Template Directories [{1}]", name, string.Join(",", StyleDirectories));
// Fatal is stopping the process
return "";
}
return File.ReadAllText(location);
}
/// <summary>
/// Copies the content of the directory from all template directories.
/// using inheritance directory.
/// </summary>
/// <param name="directoryName">Name of the directory.</param>
public void CopyStyleContent(string directoryName)
{
for (int i = StyleDirectories.Count - 1; i >=0; i--)
{
var templateDirectory = StyleDirectories[i];
string filePath = Path.Combine(templateDirectory, directoryName);
if (Directory.Exists(filePath))
{
CopyDirectory(filePath, OutputDirectory, true);
}
}
}
/// <summary>
/// Copies the content of a local directory to the destination html directory.
/// </summary>
/// <param name="directoryNameOrFile">Name of the source directory.</param>
/// <param name="toDirectory">Name of the destination directory.</param>
public void CopyLocalContent(string directoryNameOrFile, string toDirectory)
{
var fileOrDir = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Config.FilePath), directoryNameOrFile));
var absoulteDirectory = Path.Combine(Config.AbsoluteOutputDirectory, toDirectory);
if (File.Exists(fileOrDir))
{
Logger.Message("Copying file from [{0}] to [{1}]", directoryNameOrFile, toDirectory);
File.Copy(fileOrDir, absoulteDirectory, true);
}
else
{
CopyDirectory(fileOrDir, absoulteDirectory, true);
}
}
public void CopyDirectory(string from, string to, bool includeFromDir = false)
{
// string source, destination; - folder paths
int basePathIndex = (includeFromDir ? from.Trim('/','\\').LastIndexOf('\\') : from.Length) + 1;
foreach (string filePath in Directory.GetFiles(from, "*.*", SearchOption.AllDirectories))
{
string subPath = filePath.Substring(basePathIndex);
string newpath = Path.Combine(to, subPath);
string dirPath = Path.GetDirectoryName(newpath);
if (!Directory.Exists(dirPath))
Directory.CreateDirectory(dirPath);
Logger.Message("Copying file from [{0}] to [{1}]", subPath, newpath);
File.Copy(filePath, newpath, true);
}
}
// private List<>
private class TagExpandItem
{
public TagExpandItem(Regex expression, string replaceString)
{
Expression = expression;
ReplaceString = replaceString;
}
public TagExpandItem(Regex expression, MatchEvaluator replaceEvaluator)
{
Expression = expression;
ReplaceEvaluator = replaceEvaluator;
}
Regex Expression;
string ReplaceString;
MatchEvaluator ReplaceEvaluator;
public string Replace(string content)
{
if (content == null)
return null;
if (ReplaceString != null)
return Expression.Replace(content, ReplaceString);
return Expression.Replace(content, ReplaceEvaluator);
}
}
/// <summary>
/// Add regular expression for TagExpand function.
/// </summary>
/// <param name="regexp">The regexp.</param>
/// <param name="substitution">The substitution.</param>
public void RegisterTagResolver(string regexp, string substitution)
{
_regexItems.Add( new TagExpandItem(new Regex(regexp), substitution));
}
/// <summary>
/// Add regular expression for RegexExpand function.
/// </summary>
/// <param name="regexp">The regexp.</param>
/// <param name="evaluator">The evaluator.</param>
public void RegisterTagResolver(string regexp, MatchEvaluator evaluator)
{
_regexItems.Add(new TagExpandItem(new Regex(regexp), evaluator));
}
/// <summary>
/// Perform regular expression expansion.
/// </summary>
/// <param name="content">The content to replace.</param>
/// <returns>The content replaced</returns>
public string TagExpand(string content)
{
foreach (var regexItem in _regexItems)
{
content = regexItem.Replace(content);
}
return content;
}
/// <summary>
/// Parses the specified template name.
/// </summary>
/// <param name="templateName">Name of the template.</param>
/// <returns></returns>
public string Parse(string templateName)
{
string location = null;
try
{
string template = GetTemplate(templateName, out location);
return razor.Parse(template, this, templateName, location);
}
catch (TemplateCompilationException ex)
{
foreach (var compilerError in ex.Errors)
{
Logger.PushLocation(location, compilerError.Line, compilerError.Column);
if (compilerError.IsWarning)
{
Logger.Warning("{0}: {1}", compilerError.ErrorNumber, compilerError.ErrorText);
} else
{
Logger.Error("{0}: {1}", compilerError.ErrorNumber, compilerError.ErrorText);
}
Logger.PopLocation();
}
Logger.PopLocation();
Logger.Fatal("Error when compiling template [{0}]", templateName);
} catch (Exception ex)
{
Logger.PushLocation(location);
Logger.Error("Unexpected exception", ex);
Logger.PopLocation();
throw ex;
}
return "";
}
}
} | 38.524752 | 194 | 0.525792 | [
"MIT"
] | shoelzer/SharpDX | Source/Tools/SharpDoc/TemplateContext.cs | 27,237 | C# |
#region Copyright
/*Copyright (C) 2015 Konstantin Udilovich
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kodestruct.Common.CalculationLogger.Interfaces;
using Kodestruct.Common.Section.Interfaces;
using Kodestruct.Steel.AISC.AISC360v10.General.Compactness;
using Kodestruct.Steel.AISC.Exceptions;
using Kodestruct.Steel.AISC.Interfaces;
namespace Kodestruct.Steel.AISC.AISC360v10.Flexure
{
public abstract partial class FlexuralMemberChsBase : FlexuralMember
{
public FlexuralMemberChsBase(ISteelSection section, ICalcLog CalcLog)
: base(section, CalcLog)
{
sectionPipe = null;
ISectionPipe s = Section.Shape as ISectionPipe;
if (s == null)
{
throw new SectionWrongTypeException(typeof(ISectionPipe));
}
else
{
sectionPipe = s;
//compactness = new ShapeCompactness.HollowMember(Section, CompressionLocation.Top);
}
}
private ISectionPipe sectionPipe;
public ISectionPipe SectionPipe
{
get { return sectionPipe; }
set { sectionPipe = value; }
}
ShapeCompactness.HollowMember compactness;
public CompactnessClassFlexure GetCompactnessClass()
{
return compactness.GetFlangeCompactnessFlexure();
}
}
}
| 28.828571 | 100 | 0.675421 | [
"Apache-2.0"
] | Kodestruct/Kodestruct.Design | Kodestruct.Steel/AISC/AISC360v10/F_Flexure/BaseClasses/FlexuralMemberChsBase.cs | 2,018 | C# |
using System.Threading.Tasks;
namespace BrokeredMessaging.Messaging
{
/// <summary>
/// A function that can process a received message.
/// </summary>
/// <param name="context">The <see cref="ReceiveContext"/> for the recieved message.</param>
/// <returns>A task that represents the process of the message.</returns>
public delegate Task ReceiveDelegate(ReceiveContext context);
}
| 34 | 96 | 0.705882 | [
"MIT"
] | BrokeredMessaging/MessagingAbstractions | src/BrokeredMessaging.Messaging.Abstractions/ReceiveDelegate.cs | 410 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
namespace System.Instants.Mathline
{
// assign and generate reckond loops
[Serializable]
public class CombinedFormula : Formula
{
int iI, lL;
public Formula expr;
public LeftFormula lexpr;
MathlineSize size
{ get { return expr.Size; } }
public bool partial = false;
public CombinedFormula(LeftFormula m, Formula e, bool partial = false)
{
lexpr = m;
expr = e;
this.partial = partial;
}
public override void Compile(ILGenerator g, CompilerContext cc)
{
bool biloop = size.rows > 1 && size.cols > 1;
if (cc.IsFirstPass())
{
if (!partial)
{
iI = cc.AllocIndexVariable(); // i
lL = cc.AllocIndexVariable(); // l
}
expr.Compile(g, cc);
lexpr.CompileAssign(g, cc, true, partial);
}
else
{
if (!partial)
{
int i, l, svi;
Label topLabel;
Label topLabelE;
topLabel = g.DefineLabel();
topLabelE = g.DefineLabel();
i = cc.GetIndexVariable(iI);
l = cc.GetIndexVariable(lL);
// then
svi = cc.GetIndexVariable(0);
cc.SetIndexVariable(0, i);
cc.SetIndexVariable(1, size.rows);
g.Emit(OpCodes.Ldc_I4_0); // i = 0
g.Emit(OpCodes.Stloc, i);
g.Emit(OpCodes.Ldarg_0);
g.Emit(OpCodes.Ldc_I4_0);
g.EmitCall(OpCodes.Callvirt, typeof(CombinedReckoner).GetMethod("GetRowCount", new Type[] { typeof(int) }), null);
g.Emit(OpCodes.Stloc, l);
if (size.rows > 1 || size.cols > 1)
{
// iterate rows, so move
int index;
int count;
index = i;
count = size.rows;
// just one loop. Set wich
g.MarkLabel(topLabel); // TP:
lexpr.CompileAssign(g, cc, false, false);
expr.Compile(g, cc); // value
lexpr.CompileAssign(g, cc, true, false);
// increment j
g.Emit(OpCodes.Ldloc, index); // 1
g.Emit(OpCodes.Ldc_I4_1); // j =>
g.Emit(OpCodes.Add); // +
g.Emit(OpCodes.Dup);
g.Emit(OpCodes.Stloc, index); // j <=
// here from first jump
//g.Emit(OpCodes.Ldc_I4, count); // j < cols
g.Emit(OpCodes.Ldloc, l);
g.Emit(OpCodes.Blt, topLabel);
}
else
{
lexpr.CompileAssign(g, cc, false, false);
expr.Compile(g, cc); // value
lexpr.CompileAssign(g, cc, true, false);
}
cc.SetIndexVariable(0, svi);
}
else
{
lexpr.CompileAssign(g, cc, false, true);
expr.Compile(g, cc); // value
lexpr.CompileAssign(g, cc, true, true);
}
}
}
//public override double Math(int i, int j)
//{
// for (int q = 0; q < size.rows; q++)
// {
// for (int k = 0; k < size.cols; k++)
// lexpr.Assign(q, k, expr.Math(q, k));
// }
// return 0;
//}
}
}
| 33.220472 | 134 | 0.388955 | [
"MIT"
] | undersoft-org/NET.Undersoft.Sdk.Research | NET.Undersoft.Mathline/Undersoft.System.Instants.Mathline/Formula/CombinedFormula.cs | 4,221 | C# |
using UnityEngine;
public class WorldObjectUser : MonoBehaviour {
//public float checkFrequency = 0.1f;
//public float checkTimer = 0f;
public GameObject helpText = null;
public bool isPlayer = false;
// Update is called once per frame
void Update() {
//checkTimer += Time.deltaTime;
//if (checkTimer>=checkFrequency) {
//checkTimer = 0;
if (isPlayer) CheckForObjects();
//}
}
private void CheckForObjects() {
var nearest = GetNearestUsableObject();
if (nearest == null || nearest.hide) ClearHelpText();
else SetHelpText(nearest);
}
private void ClearHelpText() {
if (helpText == null) helpText = GameObject.FindGameObjectWithTag("ObjectHelpText");
if (helpText != null) helpText.SetActive(false);
}
private void SetHelpText(UsableObject obj) {
if (helpText == null) helpText = GameObject.FindGameObjectWithTag("ObjectHelpText");
helpText.SetActive(true);
helpText.GetComponentInChildren<TextMesh>().text = "SPACE: " + obj.helpText;
helpText.transform.position = obj.transform.position + new Vector3(0, 5, 0);
}
public UsableObject GetNearestUsableObject() {
var hits = Physics.OverlapSphere(transform.position, 2f);
UsableObject nearestObj = null;
float closestDistance = Mathf.Infinity;
foreach (var hit in hits) {
var usable = hit.gameObject.GetComponent<UsableObject>();
if (usable == null) continue;
var distance = Vector3.Distance(usable.transform.position, transform.position);
if (distance < closestDistance) {
closestDistance = distance;
nearestObj = usable;
}
}
return nearestObj;
}
}
| 34.884615 | 92 | 0.627894 | [
"MIT"
] | caesuric/familiar-quest | FamiliarQuestMainGame/Assets/Scripts/Objects/WorldObjectUser.cs | 1,816 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.