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 |
|---|---|---|---|---|---|---|---|---|
//------------------------------------------------------------------------------
// <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 OverrideHostsFile.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.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;
}
}
}
}
| 39.703704 | 151 | 0.583955 | [
"MIT"
] | youstinus/hosts-editor-windows | OverrideHostsFile/Properties/Settings.Designer.cs | 1,074 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Общие сведения об этой сборке предоставляются следующим набором
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("EmptyBox.IO.macOS")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EmptyBox.IO.macOS")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
[assembly: ComVisible(false)]
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
[assembly: Guid("60cfd4b7-503e-4450-8063-b82faf9cc413")]
// Сведения о версии сборки состоят из следующих четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Редакция
//
// Можно задать все значения или принять номер сборки и номер редакции по умолчанию.
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 38.837838 | 99 | 0.7627 | [
"MIT"
] | EmptyBox-Team/EmptyBox.IO | EmptyBox.IO.macOS/Properties/AssemblyInfo.cs | 2,017 | C# |
using CefSharp.Puppeteer;
using PuppeteerSharp.Tests.Attributes;
using PuppeteerSharp.Xunit;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
namespace PuppeteerSharp.Tests.NetworkTests
{
[Collection(TestConstants.TestFixtureCollectionName)]
public class NetworkEventTests : PuppeteerPageBaseTest
{
public NetworkEventTests(ITestOutputHelper output) : base(output)
{
}
[PuppeteerTest("network.spec.ts", "Network Events", "Page.Events.Request")]
[PuppeteerFact]
public async Task PageEventsRequest()
{
var requests = new List<Request>();
DevToolsContext.Request += (_, e) => requests.Add(e.Request);
await DevToolsContext.GoToAsync(TestConstants.EmptyPage);
Assert.Single(requests);
Assert.Equal(TestConstants.EmptyPage, requests[0].Url);
Assert.Equal(ResourceType.Document, requests[0].ResourceType);
Assert.Equal(HttpMethod.Get, requests[0].Method);
Assert.NotNull(requests[0].Response);
Assert.Equal(DevToolsContext.MainFrame, requests[0].Frame);
Assert.Equal(TestConstants.EmptyPage, requests[0].Frame.Url);
}
[PuppeteerTest("network.spec.ts", "Network Events", "Page.Events.RequestServedFromCache")]
[PuppeteerFact]
public async Task PageEventsRequestServedFromCache()
{
var cached= new List<string>();
DevToolsContext.RequestServedFromCache += (_, e) => cached.Add(e.Request.Url.Split('/').Last());
await DevToolsContext.GoToAsync(TestConstants.ServerUrl + "/cached/one-style.html");
Assert.Empty(cached);
await DevToolsContext.ReloadAsync();
Assert.Equal(new[] { "one-style.css" }, cached);
}
[PuppeteerTest("network.spec.ts", "Network Events", "Page.Events.Response")]
[PuppeteerFact]
public async Task PageEventsResponse()
{
var responses = new List<Response>();
DevToolsContext.Response += (_, e) => responses.Add(e.Response);
await DevToolsContext.GoToAsync(TestConstants.EmptyPage);
Assert.Single(responses);
Assert.Equal(TestConstants.EmptyPage, responses[0].Url);
Assert.Equal(HttpStatusCode.OK, responses[0].Status);
Assert.False(responses[0].FromCache);
Assert.False(responses[0].FromServiceWorker);
Assert.NotNull(responses[0].Request);
var remoteAddress = responses[0].RemoteAddress;
// Either IPv6 or IPv4, depending on environment.
Assert.True(remoteAddress.IP == "[::1]" || remoteAddress.IP == "127.0.0.1");
Assert.Equal(TestConstants.Port, remoteAddress.Port);
}
[PuppeteerTest("network.spec.ts", "Network Events", "Page.Events.RequestFailed")]
[PuppeteerFact]
public async Task PageEventsRequestFailed()
{
await DevToolsContext.SetRequestInterceptionAsync(true);
DevToolsContext.Request += async (_, e) =>
{
if (e.Request.Url.EndsWith("css"))
{
await e.Request.AbortAsync();
}
else
{
await e.Request.ContinueAsync();
}
};
var failedRequests = new List<Request>();
DevToolsContext.RequestFailed += (_, e) => failedRequests.Add(e.Request);
await DevToolsContext.GoToAsync(TestConstants.ServerUrl + "/one-style.html");
Assert.Single(failedRequests);
Assert.Contains("one-style.css", failedRequests[0].Url);
Assert.Null(failedRequests[0].Response);
Assert.Equal(ResourceType.StyleSheet, failedRequests[0].ResourceType);
Assert.Equal("net::ERR_FAILED", failedRequests[0].Failure);
Assert.NotNull(failedRequests[0].Frame);
}
[PuppeteerTest("network.spec.ts", "Network Events", "Page.Events.RequestFinished")]
[PuppeteerFact]
public async Task PageEventsRequestFinished()
{
var requests = new List<Request>();
DevToolsContext.RequestFinished += (_, e) => requests.Add(e.Request);
await DevToolsContext.GoToAsync(TestConstants.EmptyPage);
Assert.Single(requests);
Assert.Equal(TestConstants.EmptyPage, requests[0].Url);
Assert.NotNull(requests[0].Response);
Assert.Equal(HttpMethod.Get, requests[0].Method);
Assert.Equal(DevToolsContext.MainFrame, requests[0].Frame);
Assert.Equal(TestConstants.EmptyPage, requests[0].Frame.Url);
}
[PuppeteerTest("network.spec.ts", "Network Events", "should fire events in proper order")]
[PuppeteerFact]
public async Task ShouldFireEventsInProperOrder()
{
var events = new List<string>();
DevToolsContext.Request += (_, _) => events.Add("request");
DevToolsContext.Response += (_, _) => events.Add("response");
DevToolsContext.RequestFinished += (_, _) => events.Add("requestfinished");
await DevToolsContext.GoToAsync(TestConstants.EmptyPage);
Assert.Equal(new[] { "request", "response", "requestfinished" }, events.ToArray());
}
[PuppeteerTest("network.spec.ts", "Network Events", "should support redirects")]
[PuppeteerFact]
public async Task ShouldSupportRedirects()
{
var events = new List<string>();
DevToolsContext.Request += (_, e) => events.Add($"{e.Request.Method} {e.Request.Url}");
DevToolsContext.Response += (_, e) => events.Add($"{(int)e.Response.Status} {e.Response.Url}");
DevToolsContext.RequestFinished += (_, e) => events.Add($"DONE {e.Request.Url}");
DevToolsContext.RequestFailed += (_, e) => events.Add($"FAIL {e.Request.Url}");
Server.SetRedirect("/foo.html", "/empty.html");
const string FOO_URL = TestConstants.ServerUrl + "/foo.html";
var response = await DevToolsContext.GoToAsync(FOO_URL);
Assert.Equal(new[] {
$"GET {FOO_URL}",
$"302 {FOO_URL}",
$"DONE {FOO_URL}",
$"GET {TestConstants.EmptyPage}",
$"200 {TestConstants.EmptyPage}",
$"DONE {TestConstants.EmptyPage}"
}, events.ToArray());
// Check redirect chain
var redirectChain = response.Request.RedirectChain;
Assert.Single(redirectChain);
Assert.Contains("/foo.html", redirectChain[0].Url);
Assert.Equal(TestConstants.Port, redirectChain[0].Response.RemoteAddress.Port);
}
}
}
| 45.155844 | 108 | 0.608571 | [
"MIT"
] | cefsharp/PuppeteerSharp.Embedded | lib/PuppeteerSharp.Tests/NetworkTests/NetworkEventTests.cs | 6,954 | C# |
using System;
using NUnit.Framework;
using UnityEngine;
namespace AltoFramework.Tests
{
public class ObjectPoolTest
{
class MyBehaviour : PoolableBehaviour {}
[Test]
public void TestObjectPoolBorrow()
{
var originalGameObj = new GameObject();
originalGameObj.AddComponent<MyBehaviour>();
var objPool = new AltoObjectPool<MyBehaviour>(originalGameObj, 3);
Assert.That(objPool.RemainCount, Is.EqualTo(3));
MyBehaviour obj1 = objPool.Get();
Assert.That(obj1.gameObject.activeSelf, Is.True);
Assert.That(objPool.RemainCount, Is.EqualTo(2));
MyBehaviour obj2 = objPool.Get();
Assert.That(objPool.RemainCount, Is.EqualTo(1));
MyBehaviour obj3 = objPool.Get();
Assert.That(objPool.RemainCount, Is.EqualTo(0));
MyBehaviour obj4 = objPool.Get();
Assert.That(objPool.RemainCount, Is.EqualTo(0));
}
[Test]
public void TestObjectPoolReturn()
{
var originalGameObj = new GameObject();
originalGameObj.AddComponent<MyBehaviour>();
var objPool = new AltoObjectPool<MyBehaviour>(originalGameObj, 3);
Assert.That(objPool.RemainCount, Is.EqualTo(3));
MyBehaviour obj1 = objPool.Get();
MyBehaviour obj2 = objPool.Get();
MyBehaviour obj3 = objPool.Get();
MyBehaviour obj4 = objPool.Get();
objPool.Return(obj2);
Assert.That(obj2.gameObject.activeSelf, Is.False);
Assert.That(objPool.RemainCount, Is.EqualTo(1));
objPool.Return(obj1);
objPool.Return(obj3);
objPool.Return(obj4);
Assert.That(objPool.RemainCount, Is.EqualTo(4));
}
}
}
| 31.254237 | 78 | 0.595445 | [
"MIT"
] | tatsuya-koyama/Alto-tascal-Unity-Lib | Assets/00_Altotascal/AltoFramework/Tests/EditMode/Editor/ObjectPoolTest.cs | 1,844 | C# |
using Microsoft.AspNetCore.Identity;
namespace PersonalWebsite.Models
{
public class ApplicationUser : IdentityUser
{
}
}
| 15.111111 | 47 | 0.735294 | [
"MIT"
] | nettsundere/PersonalWebsite | src/PersonalWebsite/Models/ApplicationUser.cs | 138 | C# |
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace NSConstellationGPS.GPS_Sentences
{
/// <summary>
/// This is the Master class that holds all of the possible GPS sentences that are coming from the GPS
/// </summary>
class GPS_Sentence_Master : INotifyPropertyChanged
{
private GPS_Sentence_GPRMC _gprmc;
public GPS_Sentence_GPRMC GPRMC { get { return _gprmc; } set { _gprmc = value; OnPropertyChanged("GPRMC"); } }
private GPS_Sentence_GPGGA _gpgga;
public GPS_Sentence_GPGGA GPGGA { get { return _gpgga; } set { _gpgga = value; OnPropertyChanged("GPGGA"); } }
private GPS_Sentence_GPGSA _gpgsa;
public GPS_Sentence_GPGSA GPGSA { get { return _gpgsa; } set { _gpgsa = value; OnPropertyChanged("GPGSA"); } }
private GPS_Sentence_GPGSV _gpgsv;
public GPS_Sentence_GPGSV GPGSV { get { return _gpgsv; } set { _gpgsv = value; OnPropertyChanged("GPGSV"); } }
private GPS_Sentence_GPVTG _gpvtg;
public GPS_Sentence_GPVTG GPVTG { get { return _gpvtg; } set { _gpvtg = value; OnPropertyChanged("GPVTG"); } }
private List<string> avMsgs = new List<string>();
[field: NonSerialized]
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string name)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(name));
}
}
/// <summary>
/// Master GPS Constructor
/// </summary>
public GPS_Sentence_Master()
{
avMsgs.Clear();
_gprmc = new GPS_Sentence_GPRMC();
_gpgga = new GPS_Sentence_GPGGA();
_gpgsa = new GPS_Sentence_GPGSA();
_gpgsv = new GPS_Sentence_GPGSV();
_gpvtg = new GPS_Sentence_GPVTG();
}
/// <summary>
/// Main event to have master GPS sentence begin parsing
/// </summary>
/// <param name="split"></param>
/// <returns></returns>
public bool Parse(string[] split)
{
// Check for any new sentences that are not already known
foreach (string s in split)
{
if (s.Length > 0 && s[0] == '$' && !avMsgs.Contains(s))
{
avMsgs.Add(s);
}
}
int error = 0;
//Individual Sentence Parsing Calls
if(_gprmc.Parse(split)) error++;
if(_gpgga.Parse(split)) error++;
if(_gpgsa.Parse(split)) error++;
if(_gpgsv.Parse(split)) error++;
if(_gpvtg.Parse(split)) error++;
//TODO: Can check here if error > 0, and throw a better error than a FAIL.
// Return success
return (error == 0);
}
/// <summary>
/// Returns a collection of available GPS messages from this sensor
/// </summary>
/// <returns></returns>
public List<string> getAvailableMessages()
{
return avMsgs;
}
}
/// <summary>
/// Base class for GPS sentences.
/// </summary>
public abstract class GPS_Sentence_Base : INotifyPropertyChanged
{
private string _type;
public string Type { get { return _type; } set { _type = value; OnPropertyChanged("Type"); } }
[field: NonSerialized]
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string name)
{
PropertyChangedEventHandler handler = PropertyChanged;
if(handler != null)
{
handler(this, new PropertyChangedEventArgs(name));
}
}
/// <summary>
/// Holds parsing code for individual sentence types
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public abstract bool Parse(string[] s);
/// <summary>
/// Converts string to double, with error checking for null strings
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public double String_to_Double(string s)
{
if (s.CompareTo("") != 0)
{
return Convert.ToDouble(s);
}
return -0;
}
/// <summary>
/// Converts string to int, with error checking for null strings
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public int String_to_Int(string s)
{
if (s.CompareTo("") != 0)
{
return Convert.ToInt32(s);
}
return -0;
}
/// <summary>
/// Converts string to char, with error checking for null strings
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public char String_to_Char(string s)
{
if (s.CompareTo("") != 0)
{
return Convert.ToChar(s);
}
return ' ';
}
}
/// <summary>
/// GPRMC Sentence Structure
/// </summary>
public class GPS_Sentence_GPRMC : GPS_Sentence_Base
{
// UTC Time of position fix
private string _time;
public string Time { get { return _time; } set { _time = value; OnPropertyChanged("Time"); } }
// Data Status/Validity (A = ok, V = invalid)
private char _status;
public char Status { get { return _status; } set { _status = value; OnPropertyChanged("Status"); } }
// Latitude of fix (Decimal Degrees)
private double _latitude;
public double Latitude { get { return _latitude; } set { _latitude = value; OnPropertyChanged("Latitude"); } }
// Longitude of fix (Decimal Degrees)
private double _longitude;
public double Longitude { get { return _longitude; } set { _longitude = value; OnPropertyChanged("Longitude"); } }
// Speed (Knots)
private double _speed;
public double Speed { get { return _speed; } set { _speed = value; OnPropertyChanged("Speed"); } }
// Course (Degrees)
private double _course;
public double Course { get { return _course; } set { _course = value; OnPropertyChanged("Course"); } }
// Date (UT)
private int _date;
public int Date { get { return _date; } set { _date = value; OnPropertyChanged("Date"); } }
// Magnetic Variation (Degrees)
//TODO: GPRMC:Magnetic - Not currently populated
private double _magnetic;
public double Magnetic { get { return _magnetic; } set { _magnetic = value; OnPropertyChanged("Magnetic"); } }
// Fix (A = Autonomous, D = Differential, E = Estimated, N = Not Valid, S = Simulator)
private char _fix;
public char Fix { get { return _fix; } set { _fix = value; OnPropertyChanged("Fix"); } }
// Checksum
private string _checksum;
public string Checksum { get { return _checksum; } set { _checksum = value; OnPropertyChanged("Checksum"); } }
/// <summary>
/// Parsing Function
/// </summary>
/// <param name="buffer"></param>
/// <returns></returns>
public override bool Parse(string[] buffer)
{
bool valid_data = false;
double buf, degrees, minutes;
// TODO: Use Master's precalculated indicides to know where to parse. No search will be neceessary anymore.
for (int i = 0; i < buffer.Length - 14; i++)
{
if(String.Compare(buffer[i],"$GPRMC") == 0)
{
Type = "$GPRMC";
Time = buffer[i + 1];
Status = buffer[i + 2][0];
buf = String_to_Double(buffer[i + 3]);
degrees = Math.Floor(buf / 100.0);
minutes = (buf - (degrees * 100)) / 60.0;
Latitude = degrees + minutes;
if (String_to_Char(buffer[i + 4]) == 'S')
Latitude *= -1;
buf = String_to_Double(buffer[i + 5]);
degrees = Math.Floor(buf / 100.0);
minutes = (buf - (degrees * 100)) / 60.0;
Longitude = degrees + minutes;
if (String_to_Char(buffer[i + 6]) == 'W')
Longitude *= -1;
Speed = String_to_Double(buffer[i + 7]);
Course = String_to_Double(buffer[i + 8]);
Date = String_to_Int(buffer[i + 9]);
Magnetic = 0.0; //TODO: Magnetic
Fix = buffer[i + 12][0];
Checksum = "*" + buffer[i + 13];
valid_data = true;
}
}
return valid_data;
}
}
/// <summary>
/// GPGGA Sentence Structure
/// </summary>
public class GPS_Sentence_GPGGA : GPS_Sentence_Base
{
//UTC of Position
private string _time;
public string Time { get { return _time; } set { _time = value; OnPropertyChanged("Time"); } }
// Latitude of Position
private double _latitude;
public double Latitude { get { return _latitude; } set { _latitude = value; OnPropertyChanged("Latitude"); } }
// Longitude of Position
private double _longitude;
public double Longitude { get { return _longitude; } set { _longitude = value; OnPropertyChanged("Longitude"); } }
// GPS Quality indicator (0=no fix, 1=GPS fix, 2=Dif. GPS fix)
private int _quality;
public int Quality { get { return _quality; } set { _quality = value; OnPropertyChanged("Quality"); } }
// Number of Satellites in Use
private int _satellite_count;
public int Satellite_Count { get { return _satellite_count; } set { _satellite_count = value; OnPropertyChanged("Satellite_Count"); } }
// Horizontal Dilution of Precision
private double _horizontal_dilution;
public double Horizontal_Dilution { get { return _horizontal_dilution; } set { _horizontal_dilution = value; OnPropertyChanged("Horizontal_Dilution"); } }
// Altitude above sea level
private double _altitude;
public double Altitude { get { return _altitude; } set { _altitude = value; OnPropertyChanged("Altitude"); } }
// Altitude unit of measure (M = Meters)
private char _altitude_unit;
public char Altitude_Unit { get { return _altitude_unit; } set { _altitude_unit = value; OnPropertyChanged("Altitude_unit"); } }
// Geoidal Separation
private double _geoidal_separation;
public double Geoidal_Separation { get { return _geoidal_separation; } set { _geoidal_separation = value; OnPropertyChanged("Geoidal_Separation"); } }
// Geoidal Separation unit of measure (M = Meters)
private char _geoidal_separation_unit;
public char Geoidal_Separation_Unit { get { return _geoidal_separation_unit; } set { _geoidal_separation_unit = value; OnPropertyChanged("Geoidal_Separation_Unit"); } }
// Age of Differential GPS data (seconds)
private double _age_from_last_update_s;
public double Age_From_Last_Update_s { get { return _age_from_last_update_s; } set { _age_from_last_update_s = value; OnPropertyChanged("Age_From_Last_Update_s"); } }
// Differential Reference Station ID
private int _diff_reference_station_ID;
public int Diff_Reference_Station_ID { get { return _diff_reference_station_ID; } set { _diff_reference_station_ID = value; OnPropertyChanged("Diff_Reference_Station_ID"); } }
// Checksum
private string _checksum;
public string Checksum { get { return _checksum; } set { _checksum = value; OnPropertyChanged("Checksum"); } }
/// <summary>
/// Parsing Function
/// </summary>
/// <param name="buffer"></param>
/// <returns></returns>
public override bool Parse(string[] buffer)
{
bool valid_data = false;
double buf, degrees, minutes;
// TODO: Use Master's precalculated indicides to know where to parse. No search will be neceessary anymore.
for (int i = 0; i < buffer.Length - 16; i++)
{
if (String.Compare(buffer[i], "$GPGGA") == 0)
{
Type = "$GPGGA";
Time = buffer[i + 1];
buf = String_to_Double(buffer[i + 2]);
degrees = Math.Floor(buf / 100.0);
minutes = (buf - (degrees * 100)) / 60.0;
Latitude = degrees + minutes;
if (String_to_Char(buffer[i + 3]) == 'S')
Latitude *= -1;
buf = String_to_Double(buffer[i + 4]);
degrees = Math.Floor(buf / 100.0);
minutes = (buf - (degrees * 100)) / 60.0;
Longitude = degrees + minutes;
if (String_to_Char(buffer[i + 5]) == 'W')
Longitude *= -1;
Quality = String_to_Int(buffer[i + 6]);
Satellite_Count = String_to_Int(buffer[i + 7]);
Horizontal_Dilution = String_to_Double(buffer[i + 8]);
Altitude = String_to_Double(buffer[i + 9]);
Altitude_Unit = String_to_Char(buffer[i + 10]);
Geoidal_Separation = String_to_Double(buffer[i + 11]);
Geoidal_Separation_Unit = String_to_Char(buffer[i + 12]);
Age_From_Last_Update_s = String_to_Double(buffer[i + 13]);
Diff_Reference_Station_ID = String_to_Int(buffer[i + 14]);
Checksum = "*" + buffer[i + 15];
valid_data = true;
}
}
return valid_data;
}
}
/// <summary>
/// GPGSA Sentence Structure
/// </summary>
public class GPS_Sentence_GPGSA : GPS_Sentence_Base
{
// Mode1 (M = Manual, A = Automatic)
private char _mode1;
public char Mode1 { get { return _mode1; } set { _mode1 = value; OnPropertyChanged("Mode1"); } }
// Mode2 (1 = Fix unavailable, 2 = 2D, 3 = 3D)
private int _mode2;
public int Mode2 { get { return _mode2; } set { _mode2 = value; OnPropertyChanged("Mode2"); } }
private int[] _svIDs = new int[12];
// PRN of Satellite 0 used for fix
public int SVID0 { get { return _svIDs[0]; } set { _svIDs[0] = value; OnPropertyChanged("SVID0"); } }
// PRN of Satellite 1 used for fix
public int SVID1 { get { return _svIDs[1]; } set { _svIDs[1] = value; OnPropertyChanged("SVID1"); } }
// PRN of Satellite 2 used for fix
public int SVID2 { get { return _svIDs[2]; } set { _svIDs[2] = value; OnPropertyChanged("SVID2"); } }
// PRN of Satellite 3 used for fix
public int SVID3 { get { return _svIDs[3]; } set { _svIDs[3] = value; OnPropertyChanged("SVID3"); } }
// PRN of Satellite 4 used for fix
public int SVID4 { get { return _svIDs[4]; } set { _svIDs[4] = value; OnPropertyChanged("SVID4"); } }
// PRN of Satellite 5 used for fix
public int SVID5 { get { return _svIDs[5]; } set { _svIDs[5] = value; OnPropertyChanged("SVID5"); } }
// PRN of Satellite 6 used for fix
public int SVID6 { get { return _svIDs[6]; } set { _svIDs[6] = value; OnPropertyChanged("SVID6"); } }
// PRN of Satellite 7 used for fix
public int SVID7 { get { return _svIDs[7]; } set { _svIDs[7] = value; OnPropertyChanged("SVID7"); } }
// PRN of Satellite 8 used for fix
public int SVID8 { get { return _svIDs[8]; } set { _svIDs[8] = value; OnPropertyChanged("SVID8"); } }
// PRN of Satellite 9 used for fix
public int SVID9 { get { return _svIDs[9]; } set { _svIDs[9] = value; OnPropertyChanged("SVID9"); } }
// PRN of Satellite 10 used for fix
public int SVID10 { get { return _svIDs[10]; } set { _svIDs[10] = value; OnPropertyChanged("SVID10"); } }
// PRN of Satellite 11 used for fix
public int SVID11 { get { return _svIDs[11]; } set { _svIDs[11] = value; OnPropertyChanged("SVID11"); } }
// Dilution of Precision
private double _pDOP;
public double PDOP { get { return _pDOP; } set { _pDOP = value; OnPropertyChanged("PDOP"); } }
// Horizontal Dilution of Precision
private double _hDOP;
public double HDOP { get { return _hDOP; } set { _hDOP = value; OnPropertyChanged("HDOP"); } }
// Vertical Dilution of Prevision
private double _vDOP;
public double VDOP { get { return _vDOP; } set { _vDOP = value; OnPropertyChanged("VDOP"); } }
/// <summary>
/// Parsing Function
/// </summary>
/// <param name="buffer"></param>
/// <returns></returns>
public override bool Parse(string[] buffer)
{
bool valid_data = false;
// TODO: Use Master's precalculated indicides to know where to parse. No search will be neceessary anymore.
for (int i = 0; i < buffer.Length - 16; i++)
{
if (String.Compare(buffer[i], "$GPGSA") == 0)
{
Type = "$GPGSA";
Mode1 = String_to_Char(buffer[i + 1]);
Mode2 = String_to_Int(buffer[i + 2]);
SVID0 = String_to_Int(buffer[i + 3]);
SVID1 = String_to_Int(buffer[i + 4]);
SVID2 = String_to_Int(buffer[i + 5]);
SVID3 = String_to_Int(buffer[i + 6]);
SVID4 = String_to_Int(buffer[i + 7]);
SVID5 = String_to_Int(buffer[i + 8]);
SVID6 = String_to_Int(buffer[i + 9]);
SVID7 = String_to_Int(buffer[i + 10]);
SVID8 = String_to_Int(buffer[i + 11]);
SVID9 = String_to_Int(buffer[i + 12]);
SVID10 = String_to_Int(buffer[i + 13]);
SVID11 = String_to_Int(buffer[i + 14]);
PDOP = String_to_Double(buffer[i + 15]);
HDOP = String_to_Double(buffer[i + 16]);
VDOP = String_to_Double(buffer[i + 17]);
valid_data = true;
}
}
return valid_data;
}
}
/// <summary>
/// GPGSV Sentence Structure
/// </summary>
public class GPS_Sentence_GPGSV : GPS_Sentence_Base
{
// NOTE: Message Sub-ID (ex: 1/3) is ignored in this implementation because the multiple sentences are fused into this one message on parse
// Total number of messages in this block
private int _total_Messages;
public int Total_Messages { get { return _total_Messages; } set { _total_Messages = value; OnPropertyChanged("Total_Messages"); } }
// Total number of satellites in view
private int _total_SV;
public int Total_SV { get { return _total_SV; } set { _total_SV = value; OnPropertyChanged("Total_SV"); } }
//TODO: Make the SVS array bindable to the Demo UI
public SV[] _svs = new SV[12];
public SV[] SVS { get { return _svs; } set { _svs = value; OnPropertyChanged("SVS"); } }
public struct SV
{
// SV PRN Number
public int PRN { get; set; }
// Elevation (degrees, 9 max)
public int Elevation { get; set; }
// Azimuth (degrees from true N, -359)
public int Azimuth { get; set; }
// SNR (dB, -99, null with no tracking)
public int SNR { get; set; }
}
// Checksum
private string _checksum;
public string Checksum { get { return _checksum; } set { _checksum = value; OnPropertyChanged("Checksum"); } }
/// <summary>
/// Parsing Function
/// </summary>
/// <param name="buffer"></param>
/// <returns></returns>
public override bool Parse(string[] buffer)
{
bool valid_data = false;
// TODO: Use Master's precalculated indicides to know where to parse. No search will be neceessary anymore.
for (int i = 0; i < buffer.Length - 20; i++)
{
if (String.Compare(buffer[i], "$GPGSV") == 0)
{
Type = "$GPGSV";
Total_Messages = String_to_Int(buffer[i + 1]);
int Current_Message = String_to_Int(buffer[i + 2]);
Total_SV = String_to_Int(buffer[i + 3]);
int arr_size = Current_Message * 4;
if (SVS.Length < arr_size)
Array.Resize(ref _svs, arr_size);
int local_offset = 0;
for (int locind = 0; locind < 4; locind++)
{
int current_index = ((Current_Message - 1) * 4) + locind;
if (current_index >= Total_SV)
break;
local_offset = (locind + 1) * 4;
SVS[current_index].PRN = String_to_Int(buffer[i + local_offset]);
SVS[current_index].Elevation = String_to_Int(buffer[i + local_offset + 1]);
SVS[current_index].Azimuth = String_to_Int(buffer[i + local_offset + 2]);
SVS[current_index].SNR = String_to_Int(buffer[i + local_offset + 3]);
}
Checksum = "*" + buffer[i + local_offset + 4];
valid_data = true;
}
}
return valid_data;
}
}
/// <summary>
/// GPVTG Sentence Structure
/// </summary>
public class GPS_Sentence_GPVTG : GPS_Sentence_Base
{
// Track Made Good (Degrees)
private double _trackMadeGood;
public double TrackMadeGood { get { return _trackMadeGood; } set { _trackMadeGood = value; OnPropertyChanged("TrackMadeGood"); } }
// Track made good, relative to true north (Always T)
private char _fixedText_TrueNorth;
public char FixedText_TrueNorth { get { return _fixedText_TrueNorth; } set { _fixedText_TrueNorth = value; OnPropertyChanged("RelativetoTrueNorth"); } }
// Magnetic Track (Degrees)
private double _magneticTrack;
public double MagneticTrack { get { return _magneticTrack; } set { _magneticTrack = value; OnPropertyChanged("MagneticTrack"); } }
// Track made good, relative to true north (Always T)
private char _fixedText_Magnetic;
public char FixedText_Magnetic { get { return _fixedText_Magnetic; } set { _fixedText_Magnetic = value; OnPropertyChanged("FixedText_Magnetic"); } }
// Track Speed in Knots
private double _trackSpeed_Knots;
public double TrackSpeed_Knots { get { return _trackSpeed_Knots; } set { _trackSpeed_Knots = value; OnPropertyChanged("TrackSpeed_Knots"); } }
// Track made good, relative to true north (Always T)
private char _fixedText_Knots;
public char FixedText_Knots { get { return _fixedText_Knots; } set { _fixedText_Knots = value; OnPropertyChanged("FixedText_Knots"); } }
// Track Speed in Km per Hour
private double _trackSpeed_KmH;
public double TrackSpeed_KmH { get { return _trackSpeed_KmH; } set { _trackSpeed_KmH = value; OnPropertyChanged("TrackSpeed_KmH"); } }
// Track made good, relative to true north (Always T)
private char _fixedText_KmH;
public char FixedText_KmH { get { return _fixedText_KmH; } set { _fixedText_KmH = value; OnPropertyChanged("FixedText_KmH"); } }
// Fix
private char _fix;
public char Fix { get { return _fix; } set { _fix = value; OnPropertyChanged("Fix"); } }
// Checksum
private string _checksum;
public string Checksum { get { return _checksum; } set { _checksum = value; OnPropertyChanged("Checksum"); } }
/// <summary>
/// Parsing Function
/// </summary>
/// <param name="buffer"></param>
/// <returns></returns>
public override bool Parse(string[] buffer)
{
bool valid_data = false;
// TODO: Use Master's precalculated indicides to know where to parse. No search will be neceessary anymore.
for (int i = 0; i < buffer.Length - 16; i++)
{
if (String.Compare(buffer[i], "$GPVTG") == 0)
{
Type = "$GPVTG";
TrackMadeGood = String_to_Double(buffer[i + 1]);
FixedText_TrueNorth = String_to_Char(buffer[i + 2]);
TrackMadeGood = String_to_Double(buffer[i + 3]);
FixedText_Magnetic = String_to_Char(buffer[i + 4]);
TrackMadeGood = String_to_Double(buffer[i + 5]);
FixedText_Knots = String_to_Char(buffer[i + 6]);
TrackMadeGood = String_to_Double(buffer[i + 7]);
FixedText_KmH = String_to_Char(buffer[i + 8]);
Fix = String_to_Char(buffer[i + 9]);
Checksum = "*" + buffer[i + 10];
valid_data = true;
}
}
return valid_data;
}
}
}
| 40.829421 | 183 | 0.550057 | [
"MIT"
] | Kaarmaa/ConstellationGPS | ConstellationGPS/GPS_Sentences.cs | 26,092 | 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.Organizations")]
#if BCL35
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (3.5) - AWS Organizations. AWS Organizations is a web service that enables you to consolidate your multiple AWS accounts into an organization and centrally manage your accounts and their resources.")]
#elif BCL45
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (4.5) - AWS Organizations. AWS Organizations is a web service that enables you to consolidate your multiple AWS accounts into an organization and centrally manage your accounts and their resources.")]
#elif PCL
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (PCL) - AWS Organizations. AWS Organizations is a web service that enables you to consolidate your multiple AWS accounts into an organization and centrally manage your accounts and their resources.")]
#elif UNITY
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (Unity) - AWS Organizations. AWS Organizations is a web service that enables you to consolidate your multiple AWS accounts into an organization and centrally manage your accounts and their resources.")]
#elif CORECLR
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (CoreCLR)- AWS Organizations. AWS Organizations is a web service that enables you to consolidate your multiple AWS accounts into an organization and centrally manage your accounts and their resources.")]
#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 2009-2019 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.9.35")]
#if WINDOWS_PHONE || UNITY
[assembly: System.CLSCompliant(false)]
# else
[assembly: System.CLSCompliant(true)]
#endif
#if BCL
[assembly: System.Security.AllowPartiallyTrustedCallers]
#endif | 53.087719 | 272 | 0.780568 | [
"Apache-2.0"
] | Bio2hazard/aws-sdk-net | sdk/src/Services/Organizations/Properties/AssemblyInfo.cs | 3,026 | C# |
using ConfigurationExampleInterface;
using System;
using System.Collections.Generic;
using System.Text;
namespace ConfigurationExample
{
/// <summary>
/// Implementation of the plugin interface that will be loaded from a default assembly. This will be registered
/// via configuration rather than code.
/// </summary>
public class InternalPlugin : IPlugin
{
/// <summary>
/// Gets the name of the plugin.
/// </summary>
/// <value>
/// Always returns <c>InternalPlugin</c>.
/// </value>
public string Name
{
get
{
return "InternalPlugin";
}
}
}
}
| 24.172414 | 115 | 0.56776 | [
"MIT"
] | ChuckFork/AutofacExamples | src/ConfigurationExample/InternalPlugin.cs | 703 | C# |
// Copyright (c) Xenko contributors (https://xenko.com) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
using System;
using Xunit;
using Xenko.Core;
using Xenko.Core.Mathematics;
using Xenko.Input;
using Xenko.Games.Testing;
namespace Xenko.Samples.Tests
{
public class PhysicsSampleTest : IClassFixture<PhysicsSampleTest.Fixture>
{
private const string Path = "..\\..\\..\\..\\samplesGenerated\\PhysicsSample";
public class Fixture : SampleTestFixture
{
public Fixture() : base(Path, new Guid("d20d150b-d3cb-454e-8c11-620b4c9d393f"))
{
}
}
[Fact]
public void TestLaunch()
{
using (var game = new GameTestingClient(Path, SampleTestsData.TestPlatform))
{
game.Wait(TimeSpan.FromMilliseconds(2000));
}
}
[Fact]
public void TestInputs()
{
using (var game = new GameTestingClient(Path, SampleTestsData.TestPlatform))
{
game.Wait(TimeSpan.FromMilliseconds(2000));
// X:0.8367187 Y:0.9375
// Constraints
game.TakeScreenshot();
game.Tap(new Vector2(0.83f, 0.93f), TimeSpan.FromMilliseconds(200));
game.Wait(TimeSpan.FromMilliseconds(1000));
game.TakeScreenshot();
game.Tap(new Vector2(0.83f, 0.93f), TimeSpan.FromMilliseconds(200));
game.Wait(TimeSpan.FromMilliseconds(1000));
game.TakeScreenshot();
game.Tap(new Vector2(0.83f, 0.93f), TimeSpan.FromMilliseconds(200));
game.Wait(TimeSpan.FromMilliseconds(1000));
game.TakeScreenshot();
game.Tap(new Vector2(0.83f, 0.93f), TimeSpan.FromMilliseconds(200));
game.Wait(TimeSpan.FromMilliseconds(1000));
game.TakeScreenshot();
game.Tap(new Vector2(0.83f, 0.93f), TimeSpan.FromMilliseconds(200));
game.Wait(TimeSpan.FromMilliseconds(1000));
game.TakeScreenshot();
// VolumeTrigger
game.Tap(new Vector2(0.95f, 0.5f), TimeSpan.FromMilliseconds(200)); // Transition to the next scene
game.Wait(TimeSpan.FromMilliseconds(1000));
game.TakeScreenshot();
// Raycasting
game.Tap(new Vector2(0.95f, 0.5f), TimeSpan.FromMilliseconds(200)); // Transition to the next scene
game.Wait(TimeSpan.FromMilliseconds(1000));
game.TakeScreenshot();
game.Tap(new Vector2(0.3304687f, 0.6055555f), TimeSpan.FromMilliseconds(200));
game.TakeScreenshot();
game.Tap(new Vector2(0.496875f, 0.4125f), TimeSpan.FromMilliseconds(200));
game.TakeScreenshot();
game.Tap(new Vector2(0.659375f, 0.5319445f), TimeSpan.FromMilliseconds(200));
game.TakeScreenshot();
game.KeyPress(Keys.Right, TimeSpan.FromMilliseconds(500));
game.Wait(TimeSpan.FromMilliseconds(500));
}
}
}
}
| 37.247191 | 115 | 0.579186 | [
"MIT"
] | abbaye/xenko | samples/Tests/Physics/PhysicsSampleTest.cs | 3,315 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace LogExpert
{
///<summary>
///This is a callback interface. Some of the ILogLineColumnizer functions
///are called with this interface as an argument. You don't have to implement this interface. It's implemented
///by LogExpert. You can use it in your own columnizers, if you need it.
///</summary>
///<remarks>
///Implementors of ILogLineColumnizer can use the provided functions to get some more informations
///about the log file. In the most cases you don't need this interface. It's provided here for special cases.<br></br>
///<br></br>
///An example would be when the log lines contains only the time of day but the date is coded in the file name. In this situation
///you can use the GetFileName() function to retrieve the name of the current file to build a complete timestamp.
///</remarks>
public interface ILogLineColumnizerCallback
{
/// <summary>
/// This function returns the current line number. That is the line number of the log line
/// a ILogLineColumnizer function is called for (e.g. the line that has to be painted).
/// </summary>
/// <returns>The current line number</returns>
int GetLineNum();
/// <summary>
/// Returns the full file name (path + name) of the current log file.
/// </summary>
/// <returns>File name of current log file</returns>
string GetFileName();
/// <summary>
/// Returns the log line with the given index (zero-based).
/// </summary>
/// <param name="lineNum">Number of the line to be retrieved</param>
/// <returns>A string with line content or null if line number is out of range</returns>
string GetLogLine(int lineNum);
/// <summary>
/// Returns the number of lines of the logfile.
/// </summary>
/// <returns>Number of lines.</returns>
int GetLineCount();
}
}
| 39.040816 | 131 | 0.683743 | [
"MIT"
] | ankobi/logexpert | ColumnizerLib/ILogLineColumnizerCallback.cs | 1,915 | C# |
using System;
namespace Quartz
{
internal class TriggerConfigurator : ITriggerConfigurator
{
private readonly TriggerBuilder triggerBuilder = new TriggerBuilder();
public ITriggerConfigurator WithIdentity(string name)
{
triggerBuilder.WithIdentity(name);
return this;
}
public ITriggerConfigurator WithIdentity(string name, string @group)
{
triggerBuilder.WithIdentity(name, @group);
return this;
}
public ITriggerConfigurator WithIdentity(TriggerKey key)
{
triggerBuilder.WithIdentity(key);
return this;
}
public ITriggerConfigurator WithDescription(string? description)
{
triggerBuilder.WithDescription(description);
return this;
}
public ITriggerConfigurator WithPriority(int priority)
{
triggerBuilder.WithPriority(priority);
return this;
}
public ITriggerConfigurator ModifiedByCalendar(string? calendarName)
{
triggerBuilder.ModifiedByCalendar(calendarName);
return this;
}
public ITriggerConfigurator StartAt(DateTimeOffset startTimeUtc)
{
triggerBuilder.StartAt(startTimeUtc);
return this;
}
public ITriggerConfigurator StartNow()
{
triggerBuilder.StartNow();
return this;
}
public ITriggerConfigurator EndAt(DateTimeOffset? endTimeUtc)
{
triggerBuilder.EndAt(endTimeUtc);
return this;
}
public ITriggerConfigurator WithSchedule(IScheduleBuilder scheduleBuilder)
{
triggerBuilder.WithSchedule(scheduleBuilder);
return this;
}
public ITriggerConfigurator ForJob(JobKey jobKey)
{
triggerBuilder.ForJob(jobKey);
return this;
}
public ITriggerConfigurator ForJob(string jobName)
{
triggerBuilder.ForJob(jobName);
return this;
}
public ITriggerConfigurator ForJob(string jobName, string jobGroup)
{
triggerBuilder.ForJob(jobName, jobGroup);
return this;
}
public ITriggerConfigurator ForJob(IJobDetail jobDetail)
{
triggerBuilder.ForJob(jobDetail);
return this;
}
public ITriggerConfigurator UsingJobData(JobDataMap newJobDataMap)
{
triggerBuilder.UsingJobData(newJobDataMap);
return this;
}
public ITriggerConfigurator UsingJobData(string key, string value)
{
triggerBuilder.UsingJobData(key, value);
return this;
}
public ITriggerConfigurator UsingJobData(string key, int value)
{
triggerBuilder.UsingJobData(key, value);
return this;
}
public ITriggerConfigurator UsingJobData(string key, long value)
{
triggerBuilder.UsingJobData(key, value);
return this;
}
public ITriggerConfigurator UsingJobData(string key, float value)
{
triggerBuilder.UsingJobData(key, value);
return this;
}
public ITriggerConfigurator UsingJobData(string key, double value)
{
triggerBuilder.UsingJobData(key, value);
return this;
}
public ITriggerConfigurator UsingJobData(string key, decimal value)
{
triggerBuilder.UsingJobData(key, value);
return this;
}
public ITriggerConfigurator UsingJobData(string key, bool value)
{
triggerBuilder.UsingJobData(key, value);
return this;
}
public ITriggerConfigurator UsingJobData(string key, Guid value)
{
triggerBuilder.UsingJobData(key, value);
return this;
}
public ITriggerConfigurator UsingJobData(string key, char value)
{
triggerBuilder.UsingJobData(key, value);
return this;
}
internal ITrigger Build() => triggerBuilder.Build();
}
} | 27.554839 | 82 | 0.592835 | [
"Apache-2.0"
] | ArturDorochowicz/quartznet | src/Quartz.Extensions.DependencyInjection/TriggerConfigurator.cs | 4,271 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Microsoft.MixedReality.Toolkit.Core.Definitions.InputSystem;
using Microsoft.MixedReality.Toolkit.Core.Definitions.Utilities;
using Microsoft.MixedReality.Toolkit.Core.EventDatum.Input;
using Microsoft.MixedReality.Toolkit.Core.Interfaces.InputSystem;
using Microsoft.MixedReality.Toolkit.Core.Interfaces.InputSystem.Handlers;
using Microsoft.MixedReality.Toolkit.Core.Services;
using Microsoft.MixedReality.Toolkit.SDK.UX.Interactable.Events;
using Microsoft.MixedReality.Toolkit.SDK.UX.Interactable.Profile;
using Microsoft.MixedReality.Toolkit.SDK.UX.Interactable.States;
using Microsoft.MixedReality.Toolkit.SDK.UX.Interactable.Themes;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
#if UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
using UnityEngine.Windows.Speech;
#endif // UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
namespace Microsoft.MixedReality.Toolkit.SDK.UX.Interactable
{
/// <summary>
/// Uses input and action data to declare a set of states
/// Maintains a collection of themes that react to state changes and provide sensory feedback
/// Passes state information and input data on to receivers that detect patterns and does stuff.
/// </summary>
// TODO: How to handle cycle buttons
// TODO: plumb for gestures
// TODO: Add way to protect the defaultTheme from being edited and encourage users to create a new theme, maybe include a create/duplicate button
// TODO: Make sure all shader values are batched by theme
[System.Serializable]
public class Interactable : MonoBehaviour, IMixedRealityFocusHandler, IMixedRealityInputHandler, IMixedRealityPointerHandler, IMixedRealitySpeechHandler // TEMP , IInputClickHandler, IFocusable, IInputHandler
{
/// <summary>
/// Setup the input system
/// </summary>
private static IMixedRealityInputSystem inputSystem = null;
protected static IMixedRealityInputSystem InputSystem => inputSystem ?? (inputSystem = MixedRealityToolkit.Instance.GetService<IMixedRealityInputSystem>());
// list of pointers
protected List<IMixedRealityPointer> pointers = new List<IMixedRealityPointer>();
public List<IMixedRealityPointer> Focusers => pointers;
// is the interactable enabled?
public bool Enabled = true;
// a collection of states and basic state logic
public States.States States;
// the state logic for comparing state
public InteractableStates StateManager;
// which action is this interactable listening for
public MixedRealityInputAction InputAction;
// the id of the selected inputAction, for serialization
[HideInInspector]
public int InputActionId;
// is the interactable listening to global events
public bool IsGlobal = false;
// a way of adding more layers of states for toggles
public int Dimensions = 1;
// is the interactive selectable
public bool CanSelect = true;
// can deselect a toggle, a radial button or tab would set this to false
public bool CanDeselect = true;
// a voice command to fire a click event
public string VoiceCommand = "";
// does the voice command require this to have focus?
public bool RequiresFocus = true;
/// <summary>
/// Does this interactable require focus
/// </summary>
public bool FocusEnabled { get { return !IsGlobal; } set { IsGlobal = !value; } }
// list of profiles can match themes with GameObjects
public List<InteractableProfileItem> Profiles = new List<InteractableProfileItem>();
// Base onclick event
public UnityEvent OnClick;
// list of events added to this interactable
public List<InteractableEvent> Events = new List<InteractableEvent>();
// the list of running theme instances to receive state changes
public List<InteractableThemeBase> runningThemesList = new List<InteractableThemeBase>();
// the list of profile settings, so theme values are not directly effected
protected List<ProfileSettings> runningProfileSettings = new List<ProfileSettings>();
// directly manipulate a theme value, skip blending
protected bool forceUpdate = false;
#if UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
protected KeywordRecognizer keywordRecognizer;
protected RecognitionConfidenceLevel recognitionConfidenceLevel { get; set; }
#endif // UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
// basic button states
public bool HasFocus { get; private set; }
public bool HasPress { get; private set; }
public bool IsDisabled { get; private set; }
// advanced button states from InteractableStates.InteractableStateEnum
public bool IsTargeted { get; private set; }
public bool IsInteractive { get; private set; }
public bool HasObservationTargeted { get; private set; }
public bool HasObservation { get; private set; }
public bool IsVisited { get; private set; }
public bool IsToggled { get; private set; }
public bool HasGesture { get; private set; }
public bool HasGestureMax { get; private set; }
public bool HasCollision { get; private set; }
public bool HasVoiceCommand { get; private set; }
public bool HasCustom { get; private set; }
// internal cached states
protected State lastState;
protected bool wasDisabled = false;
// cache of current dimension
protected int dimensionIndex = 0;
// allows for switching colliders without firing a lose focus immediately
// for advanced controls like drop-downs
protected float rollOffTime = 0.25f;
protected float rollOffTimer = 0.25f;
// cache voice commands
protected string[] voiceCommands;
// IInteractableEvents
protected List<IInteractableHandler> handlers = new List<IInteractableHandler>();
protected Coroutine globalTimer;
protected float clickTime = 0.3f;
protected Coroutine inputTimer;
protected MixedRealityInputAction pointerInputAction;
// order = pointer , input
protected int[] GlobalClickOrder = new int[] { 0, 0 };
public void AddHandler(IInteractableHandler handler)
{
if (!handlers.Contains(handler))
{
handlers.Add(handler);
}
}
public void RemoveHandler(IInteractableHandler handler)
{
if (handlers.Contains(handler))
{
handlers.Remove(handler);
}
}
#region InspectorHelpers
/// <summary>
/// Gets a list of input actions, used by the inspector
/// </summary>
/// <returns></returns>
public static string[] GetInputActions()
{
MixedRealityInputAction[] actions = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions;
List<string> list = new List<string>();
for (int i = 0; i < actions.Length; i++)
{
list.Add(actions[i].Description);
}
return list.ToArray();
}
/// <summary>
/// Returns a list of states assigned to the Interactable
/// </summary>
/// <returns></returns>
public State[] GetStates()
{
if (States != null)
{
return States.GetStates();
}
return new State[0];
}
#endregion InspectorHelpers
#region MonoBehaviorImplimentation
protected virtual void Awake()
{
//State = new InteractableStates(InteractableStates.Default);
InputAction = ResolveInputAction(InputActionId);
SetupEvents();
SetupThemes();
SetupStates();
}
private void OnEnable()
{
if (IsGlobal)
{
InputSystem.Register(gameObject);
}
SetupVoiceCommand();
}
private void OnDisable()
{
if (IsGlobal)
{
InputSystem.Unregister(gameObject);
}
StopVoiceCommand();
}
protected virtual void Update()
{
if (rollOffTimer < rollOffTime && HasPress)
{
rollOffTimer += Time.deltaTime;
if (rollOffTimer >= rollOffTime)
{
SetPress(false);
}
}
for (int i = 0; i < Events.Count; i++)
{
if (Events[i].Receiver != null)
{
Events[i].Receiver.OnUpdate(StateManager, this);
}
}
for (int i = 0; i < runningThemesList.Count; i++)
{
if (runningThemesList[i].Loaded)
{
runningThemesList[i].OnUpdate(StateManager.CurrentState().ActiveIndex, forceUpdate);
}
}
if (lastState != StateManager.CurrentState())
{
for (int i = 0; i < handlers.Count; i++)
{
if (handlers[i] != null)
{
handlers[i].OnStateChange(StateManager, this);
}
}
}
if (forceUpdate)
{
forceUpdate = false;
}
if (IsDisabled == Enabled)
{
SetDisabled(!Enabled);
}
lastState = StateManager.CurrentState();
}
#endregion MonoBehaviorImplimentation
#region InteractableInitiation
/// <summary>
/// starts the StateManager
/// </summary>
protected virtual void SetupStates()
{
StateManager = States.SetupLogic();
}
/// <summary>
/// Creates the event receiver instances from the Events list
/// </summary>
protected virtual void SetupEvents()
{
InteractableEvent.EventLists lists = InteractableEvent.GetEventTypes();
for (int i = 0; i < Events.Count; i++)
{
Events[i].Receiver = InteractableEvent.GetReceiver(Events[i], lists);
Events[i].Receiver.Host = this;
//Events[i].Settings = InteractableEvent.GetSettings(Events[i].Receiver);
// apply settings
}
}
/// <summary>
/// Creates the list of theme instances based on all the theme settings
/// </summary>
protected virtual void SetupThemes()
{
InteractableProfileItem.ThemeLists lists = InteractableProfileItem.GetThemeTypes();
runningThemesList = new List<InteractableThemeBase>();
runningProfileSettings = new List<ProfileSettings>();
for (int i = 0; i < Profiles.Count; i++)
{
ProfileSettings profileSettings = new ProfileSettings();
List<ThemeSettings> themeSettingsList = new List<ThemeSettings>();
for (int j = 0; j < Profiles[i].Themes.Count; j++)
{
Theme theme = Profiles[i].Themes[j];
ThemeSettings themeSettings = new ThemeSettings();
if (Profiles[i].Target != null && theme != null)
{
List<InteractableThemePropertySettings> tempSettings = new List<InteractableThemePropertySettings>();
for (int n = 0; n < theme.Settings.Count; n++)
{
InteractableThemePropertySettings settings = theme.Settings[n];
settings.Theme = InteractableProfileItem.GetTheme(settings, Profiles[i].Target, lists);
// add themes to theme list based on dimension
if (j == dimensionIndex)
{
runningThemesList.Add(settings.Theme);
}
tempSettings.Add(settings);
}
themeSettings.Settings = tempSettings;
themeSettingsList.Add(themeSettings);
}
}
profileSettings.ThemeSettings = themeSettingsList;
runningProfileSettings.Add(profileSettings);
}
}
#endregion InteractableInitiation
#region SetButtonStates
/// <summary>
/// Grabs the state value index
/// </summary>
/// <param name="state"></param>
/// <returns></returns>
public int GetStateValue(InteractableStates.InteractableStateEnum state)
{
return StateManager.GetStateValue((int)state);
}
/// <summary>
/// Handle focus state changes
/// </summary>
/// <param name="focus"></param>
public virtual void SetFocus(bool focus)
{
HasFocus = focus;
if(!focus && HasPress)
{
rollOffTimer = 0;
}
else
{
rollOffTimer = rollOffTime;
}
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Focus, focus ? 1 : 0);
UpdateState();
}
public virtual void SetPress(bool press)
{
HasPress = press;
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Pressed, press ? 1 : 0);
UpdateState();
}
public virtual void SetDisabled(bool disabled)
{
IsDisabled = disabled;
Enabled = !disabled;
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Disabled, disabled ? 1 : 0);
UpdateState();
}
public virtual void SetTargeted(bool targeted)
{
IsTargeted = targeted;
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Targeted, targeted ? 1 : 0);
UpdateState();
}
public virtual void SetInteractive(bool interactive)
{
IsInteractive = interactive;
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Interactive, interactive ? 1 : 0);
UpdateState();
}
public virtual void SetObservationTargeted(bool targeted)
{
HasObservationTargeted = targeted;
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.ObservationTargeted, targeted ? 1 : 0);
UpdateState();
}
public virtual void SetObservation(bool observation)
{
HasObservation = observation;
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Observation, observation ? 1 : 0);
UpdateState();
}
public virtual void SetVisited(bool visited)
{
IsVisited = visited;
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Visited, visited ? 1 : 0);
UpdateState();
}
public virtual void SetToggled(bool toggled)
{
IsToggled = toggled;
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Toggled, toggled ? 1 : 0);
UpdateState();
}
public virtual void SetGesture(bool gesture)
{
HasGesture = gesture;
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Gesture, gesture ? 1 : 0);
UpdateState();
}
public virtual void SetGestureMax(bool gesture)
{
HasGestureMax = gesture;
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.GestureMax, gesture ? 1 : 0);
UpdateState();
}
public virtual void SetCollision(bool collision)
{
HasCollision = collision;
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Collision, collision ? 1 : 0);
UpdateState();
}
public virtual void SetCustom(bool custom)
{
HasCustom = custom;
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Custom, custom ? 1 : 0);
UpdateState();
}
public virtual void SetVoiceCommand(bool voice)
{
HasVoiceCommand = voice;
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Custom, voice ? 1 : 0);
UpdateState();
}
/// <summary>
/// a public way to set state directly
/// </summary>
/// <param name="state"></param>
/// <param name="value"></param>
public void SetState(InteractableStates.InteractableStateEnum state, bool value)
{
if (StateManager != null)
{
StateManager.SetStateValue(state, value ? 1 : 0);
}
UpdateState();
}
/// <summary>
/// runs the state logic and sets state based on the current state values
/// </summary>
protected virtual void UpdateState()
{
StateManager.CompareStates();
}
#endregion SetButtonStates
#region PointerManagement
/// <summary>
/// Adds a pointer to pointers, means a pointer is giving focus
/// </summary>
/// <param name="pointer"></param>
private void AddPointer(IMixedRealityPointer pointer)
{
if (!pointers.Contains(pointer))
{
pointers.Add(pointer);
}
}
/// <summary>
/// Removes a pointer, lost focus
/// </summary>
/// <param name="pointer"></param>
private void RemovePointer(IMixedRealityPointer pointer)
{
pointers.Remove(pointer);
}
#endregion PointerManagement
#region MixedRealityFocusHandlers
public void OnFocusEnter(FocusEventData eventData)
{
if (!CanInteract())
{
return;
}
AddPointer(eventData.Pointer);
SetFocus(pointers.Count > 0);
}
public void OnFocusExit(FocusEventData eventData)
{
if (!CanInteract() && !HasFocus)
{
return;
}
RemovePointer(eventData.Pointer);
SetFocus(pointers.Count > 0);
}
public void OnBeforeFocusChange(FocusEventData eventData)
{
//do nothing
}
public void OnFocusChanged(FocusEventData eventData)
{
//do nothing
}
#endregion MixedRealityFocusHandlers
#region MixedRealityPointerHandlers
/// <summary>
/// pointer up event has fired
/// </summary>
/// <param name="eventData"></param>
public void OnPointerUp(MixedRealityPointerEventData eventData)
{
pointerInputAction = eventData.MixedRealityInputAction;
if ((!CanInteract() && !HasPress))
{
return;
}
if (ShouldListen(eventData.MixedRealityInputAction))
{
SetPress(false);
}
}
/// <summary>
/// Pointer down event has fired
/// </summary>
/// <param name="eventData"></param>
public void OnPointerDown(MixedRealityPointerEventData eventData)
{
pointerInputAction = eventData.MixedRealityInputAction;
if (!CanInteract())
{
return;
}
if (ShouldListen(eventData.MixedRealityInputAction))
{
SetPress(true);
}
}
public void OnPointerClicked(MixedRealityPointerEventData eventData)
{
// let the Input Handlers know what the pointer action is
if (eventData != null)
{
pointerInputAction = eventData.MixedRealityInputAction;
}
// check to see if is global or focus - or - if is global, pointer event does not fire twice - or - input event is not taking these actions already
if (!CanInteract() || (IsGlobal && (inputTimer != null || GlobalClickOrder[1] == 1)))
{
return;
}
if (StateManager != null)
{
if (eventData != null && ShouldListen(eventData.MixedRealityInputAction))
{
if (GlobalClickOrder[1] == 0)
{
GlobalClickOrder[0] = 1;
}
IncreaseDimensionIndex();
SendOnClick(eventData.Pointer);
SetVisited(true);
StartInputTimer(false);
}
else if (eventData == null && (HasFocus || IsGlobal)) // handle brute force
{
if (GlobalClickOrder[1] == 0)
{
GlobalClickOrder[0] = 1;
}
IncreaseDimensionIndex();
StartGlobalVisual(false);
SendOnClick(null);
SetVisited(true);
StartInputTimer(false);
}
}
}
/// <summary>
/// Starts a timer to check if input is in progress
/// - Make sure global pointer events are not double firing
/// - Make sure Global Input events are not double firing
/// - Make sure pointer events are not duplicating an input event
/// </summary>
/// <param name="isInput"></param>
protected void StartInputTimer(bool isInput = false)
{
if (IsGlobal || isInput)
{
if (inputTimer != null)
{
StopCoroutine(inputTimer);
inputTimer = null;
}
inputTimer = StartCoroutine(InputDownTimer(clickTime));
}
}
#endregion MixedRealityPointerHandlers
#region MixedRealityInputHandlers
/// <summary>
/// Used for click events for actions not processed by pointer events
/// </summary>
/// <param name="eventData"></param>
public void OnInputUp(InputEventData eventData)
{
// check global and focus
if (!CanInteract())
{
return;
}
if (StateManager != null)
{
// check if the InputAction matches - and - if the pointer event did not fire first or is handling these actions,
if (eventData != null && ShouldListen(eventData.MixedRealityInputAction) && inputTimer != null && (eventData.MixedRealityInputAction != pointerInputAction || pointerInputAction == MixedRealityInputAction.None))
{
if (GlobalClickOrder[0] == 0)
{
GlobalClickOrder[1] = 1;
}
StopCoroutine(inputTimer);
inputTimer = null;
SetPress(false);
IncreaseDimensionIndex();
SendOnClick(null);
SetVisited(true);
}
}
}
/// <summary>
/// Used to handle global events really, using pointer events for most things
/// </summary>
/// <param name="eventData"></param>
public void OnInputDown(InputEventData eventData)
{
if (!CanInteract())
{
return;
}
if (StateManager != null)
{
if (eventData != null && ShouldListen(eventData.MixedRealityInputAction) && (eventData.MixedRealityInputAction != pointerInputAction || pointerInputAction == MixedRealityInputAction.None))
{
StartInputTimer(true);
SetPress(true);
}
}
}
public void OnInputPressed(InputEventData<float> eventData)
{
// ignore
}
public void OnPositionInputChanged(InputEventData<Vector2> eventData)
{
// ignore
}
#endregion MixedRealityInputHandlers
#region DimensionsUtilities
/// <summary>
/// A public way to access the current dimension
/// </summary>
/// <returns></returns>
public int GetDimensionIndex()
{
return dimensionIndex;
}
/// <summary>
/// a public way to increase a dimension, for cycle button
/// </summary>
public void IncreaseDimension()
{
IncreaseDimensionIndex();
}
/// <summary>
/// a public way to decrease the dimension
/// </summary>
public void DecreaseDimension()
{
int index = dimensionIndex;
if (index > 0)
{
index--;
}
else
{
index = Dimensions - 1;
}
SetDimensionIndex(index);
}
/// <summary>
/// a public way to set the dimension index
/// </summary>
/// <param name="index"></param>
public void SetDimensionIndex(int index)
{
int currentIndex = dimensionIndex;
if (index < Dimensions)
{
dimensionIndex = index;
if (currentIndex != dimensionIndex)
{
FilterThemesByDimensions();
forceUpdate = true;
}
}
}
/// <summary>
/// internal dimension cycling
/// </summary>
protected void IncreaseDimensionIndex()
{
int currentIndex = dimensionIndex;
if (dimensionIndex < Dimensions - 1)
{
dimensionIndex++;
}
else
{
dimensionIndex = 0;
}
if(currentIndex != dimensionIndex)
{
FilterThemesByDimensions();
forceUpdate = true;
}
}
#endregion DimensionsUtilities
#region InteractableUtilities
/// <summary>
/// Assigns the InputAction based on the InputActionId
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public static MixedRealityInputAction ResolveInputAction(int index)
{
MixedRealityInputAction[] actions = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions;
index = Mathf.Clamp(index, 0, actions.Length - 1);
return actions[index];
}
/// <summary>
/// Get the themes based on the current dimesionIndex
/// </summary>
protected void FilterThemesByDimensions()
{
runningThemesList = new List<InteractableThemeBase>();
for (int i = 0; i < runningProfileSettings.Count; i++)
{
ProfileSettings settings = runningProfileSettings[i];
ThemeSettings themeSettings = settings.ThemeSettings[dimensionIndex];
for (int j = 0; j < themeSettings.Settings.Count; j++)
{
runningThemesList.Add(themeSettings.Settings[j].Theme);
}
}
}
/// <summary>
/// Based on inputAction and state, should this interaction listen to this input?
/// </summary>
/// <param name="action"></param>
/// <returns></returns>
protected virtual bool ShouldListen(MixedRealityInputAction action)
{
bool isListening = HasFocus || IsGlobal;
return action == InputAction && isListening;
}
/// <summary>
/// Based on button settings and state, should this button listen to input?
/// </summary>
/// <returns></returns>
protected virtual bool CanInteract()
{
if (!Enabled)
{
return false;
}
if (Dimensions > 1 && ((dimensionIndex != Dimensions -1 & !CanSelect) || (dimensionIndex == Dimensions - 1 & !CanDeselect)) )
{
return false;
}
return true;
}
/// <summary>
/// call onClick methods on receivers or IInteractableHandlers
/// </summary>
protected void SendOnClick(IMixedRealityPointer pointer)
{
OnClick.Invoke();
for (int i = 0; i < Events.Count; i++)
{
if (Events[i].Receiver != null)
{
Events[i].Receiver.OnClick(StateManager, this, pointer);
}
}
for (int i = 0; i < handlers.Count; i++)
{
if (handlers[i] != null)
{
handlers[i].OnClick(StateManager, this, pointer);
}
}
}
/// <summary>
/// sets some visual states for automating button events like clicks from a keyword
/// </summary>
/// <param name="voiceCommand"></param>
protected void StartGlobalVisual(bool voiceCommand = false)
{
if (voiceCommand)
{
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.VoiceCommand, 1);
}
SetVisited(true);
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Focus, 1);
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Pressed, 1);
UpdateState();
if (globalTimer != null)
{
StopCoroutine(globalTimer);
}
globalTimer = StartCoroutine(GlobalVisualReset(clickTime));
}
/// <summary>
/// Clears up any automated visual states
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
protected IEnumerator GlobalVisualReset(float time)
{
yield return new WaitForSeconds(time);
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.VoiceCommand, 0);
if (!HasFocus) {
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Focus, 0);
}
if (!HasPress)
{
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Pressed, 0);
}
UpdateState();
globalTimer = null;
}
/// <summary>
/// A timer for the MixedRealityInputHandlers, clicks should occur within a certain time.
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
protected IEnumerator InputDownTimer(float time)
{
yield return new WaitForSeconds(time);
inputTimer = null;
}
#endregion InteractableUtilities
#region VoiceCommands
/// <summary>
/// Voice commands from MixedRealitySpeechCommandProfile, keyword recognized
/// requires isGlobal
/// </summary>
/// <param name="eventData"></param>
public void OnSpeechKeywordRecognized(SpeechEventData eventData)
{
if (Enabled && ShouldListen(eventData.MixedRealityInputAction))
{
StartGlobalVisual(true);
IncreaseDimensionIndex();
SendVoiceCommands(eventData.RecognizedText, 0, 1);
SendOnClick(null);
}
}
/// <summary>
/// Setup voice commands from component VoiceCommand input field
/// Supports toggles using a comma to separate keywords, no spaces please
/// </summary>
protected void SetupVoiceCommand()
{
#if UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
if (!string.IsNullOrEmpty(VoiceCommand) && VoiceCommand.Length > 2)
{
voiceCommands = new string[] { VoiceCommand };
if (VoiceCommand.IndexOf(",") > -1)
{
voiceCommands = VoiceCommand.Split(',');
}
recognitionConfidenceLevel = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.SpeechCommandsProfile.SpeechRecognitionConfidenceLevel;
if(keywordRecognizer == null)
{
keywordRecognizer = new KeywordRecognizer(voiceCommands, (ConfidenceLevel)recognitionConfidenceLevel);
keywordRecognizer.OnPhraseRecognized += KeywordRecognizer_OnPhraseRecognized;
keywordRecognizer.Start();
}
}
#endif // UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
}
protected void StopVoiceCommand()
{
#if UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
if (keywordRecognizer != null)
{
if (keywordRecognizer.IsRunning)
{
keywordRecognizer.Stop();
}
keywordRecognizer.OnPhraseRecognized -= KeywordRecognizer_OnPhraseRecognized;
keywordRecognizer.Dispose();
keywordRecognizer = null;
}
#endif // UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
}
#if UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
/// <summary>
/// Local voice commands registered on the interactable Voice Command Field
/// </summary>
/// <param name="args"></param>
protected void KeywordRecognizer_OnPhraseRecognized(PhraseRecognizedEventArgs args)
{
if (args.text == VoiceCommand && (!RequiresFocus || HasFocus) && CanInteract())
{
if (CanInteract())
{
StartGlobalVisual(true);
int index = GetVoiceCommandIndex(args.text);
if (voiceCommands.Length < 2 || Dimensions < 2)
{
IncreaseDimensionIndex();
}
else
{
SetDimensionIndex(index);
}
SendVoiceCommands(args.text, index, voiceCommands.Length);
SendOnClick(null);
}
}
}
#endif // UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
/// <summary>
/// call OnVoinceCommand methods on receivers or IInteractableHandlers
/// </summary>
protected void SendVoiceCommands(string command, int index, int length)
{
for (int i = 0; i < Events.Count; i++)
{
if (Events[i].Receiver != null)
{
Events[i].Receiver.OnVoiceCommand(StateManager, this, command, index, length);
}
}
for (int i = 0; i < handlers.Count; i++)
{
if (handlers[i] != null)
{
handlers[i].OnVoiceCommand(StateManager, this, command, index, length);
}
}
}
/// <summary>
/// checks the voiceCommand array for a keyword and returns it's index
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
protected int GetVoiceCommandIndex(string command)
{
if(voiceCommands.Length > 1)
{
for (int i = 0; i < voiceCommands.Length; i++)
{
if(command == voiceCommands[i])
{
return i;
}
}
}
return 0;
}
#endregion VoiceCommands
}
}
| 33.919781 | 226 | 0.54359 | [
"MIT"
] | aaabor/MixedRealityToolkit-Unity | Assets/MixedRealityToolkit.SDK/Features/UX/Interactable/Scripts/Interactable.cs | 37,212 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OfficeOpenXml;
using XgbFeatureInteractions.Properties;
namespace XgbFeatureInteractions
{
public class FeatureInteractions : Dictionary<string,FeatureInteraction>
{
public int MaxDepth
{
get
{
return this.Max(x => x.Value.Depth);
}
}
public double TotalGain
{
get
{
return this.Sum(x => x.Value.Gain);
}
}
public double TotalCover
{
get
{
return this.Sum(x => x.Value.Cover);
}
}
public double TotalFScore
{
get
{
return this.Sum(x => x.Value.FScore);
}
}
public FeatureInteractions() : base()
{
}
public void Merge(FeatureInteractions interactions)
{
foreach(KeyValuePair<string, FeatureInteraction> fi in interactions)
{
if (!ContainsKey(fi.Key))
{
Add(fi.Key, fi.Value);
}
else
{
this[fi.Key].Gain += fi.Value.Gain;
this[fi.Key].Cover += fi.Value.Cover;
this[fi.Key].FScore += fi.Value.FScore;
this[fi.Key].FScoreWeighted += fi.Value.FScoreWeighted;
this[fi.Key].AverageFScoreWeighted = this[fi.Key].FScoreWeighted / this[fi.Key].FScore;
this[fi.Key].AverageGain = this[fi.Key].Gain / this[fi.Key].FScore;
this[fi.Key].ExpectedGain += fi.Value.ExpectedGain;
this[fi.Key].SumLeafCoversLeft += fi.Value.SumLeafCoversLeft;
this[fi.Key].SumLeafCoversRight += fi.Value.SumLeafCoversRight;
this[fi.Key].SumLeafValuesLeft += fi.Value.SumLeafValuesLeft;
this[fi.Key].SumLeafValuesRight += fi.Value.SumLeafValuesRight;
this[fi.Key].TreeIndex += fi.Value.TreeIndex;
this[fi.Key].AverageTreeIndex = this[fi.Key].TreeIndex / this[fi.Key].FScore;
this[fi.Key].TreeDepth += fi.Value.TreeDepth;
this[fi.Key].AverageTreeDepth = this[fi.Key].TreeDepth / this[fi.Key].FScore;
//if (fi.Value.Depth == 0)
//{
// this[fi.Key].SplitValueHistogram.Merge(fi.Value.SplitValueHistogram);
//}
this[fi.Key].SplitValueHistogram.Merge(fi.Value.SplitValueHistogram);
}
}
}
public FeatureInteractions(IEnumerable<KeyValuePair<string, FeatureInteraction>> featureInteractions) : base()
{
foreach (var fi in featureInteractions)
{
Add(fi.Key, fi.Value);
}
}
public FeatureInteractions GetFeatureInteractionsOfDepth(int depth)
{
return new FeatureInteractions(new FeatureInteractions(this.Where(x => x.Value.Depth == depth)));
}
public FeatureInteractions GetFeatureInteractionsWithLeafStatistics()
{
return new FeatureInteractions(new FeatureInteractions(this.Where(x => x.Value.HasLeafStatistics == true)));
}
public bool WriteToXlsx(string fileName, int topK)
{
try
{
if (File.Exists(fileName))
{
File.Delete(fileName);
}
FileInfo newFile = new FileInfo(fileName);
ExcelPackage pck = new ExcelPackage(newFile);
Console.ResetColor();
Console.WriteLine("Writing {0}", fileName);
List<FeatureInteraction> interactions = null;
for (int depth=0; depth <= MaxDepth; depth++)
{
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.WriteLine(String.Format("Writing feature interactions with depth {0} ", depth));
Console.ResetColor();
interactions = GetFeatureInteractionsOfDepth(depth).Values.ToList();
interactions.Sort();
double KTotalGain = interactions.Sum(x => x.Gain);
double TotalCover = interactions.Sum(x => x.Cover);
double TotalFScore = interactions.Sum(x => x.FScore);
double TotalFScoreWeighted = interactions.Sum(x => x.FScoreWeighted);
double TotalFScoreWeightedAverage = interactions.Sum(x => x.AverageFScoreWeighted);
if (topK > 0)
{
interactions = interactions.Take(topK).ToList();
}
if (interactions.Count == 0)
{
break;
}
var ws = pck.Workbook.Worksheets.Add(String.Format("Interaction Depth {0}",depth));
ws.Row(1).Height = 20;
ws.Row(1).Style.Font.Bold = true;
ws.Row(1).Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
ws.Row(1).Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
ws.Column(1).Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
ws.Column(1).Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
ws.Column(1).Width = interactions.Max(x => x.Name.Length) + 10;
ws.Column(2).Width = 17;
ws.Column(3).Width = 17;
ws.Column(4).Width = 17;
ws.Column(5).Width = 17;
ws.Column(6).Width = 17;
ws.Column(7).Width = 17;
ws.Column(8).Width = 17;
ws.Column(9).Width = 17;
ws.Column(10).Width = 17;
ws.Column(11).Width = 18;
ws.Column(12).Width = 18;
ws.Column(13).Width = 19;
ws.Column(14).Width = 17;
ws.Column(15).Width = 19;
ws.Column(16).Width = 19;
ws.Cells[1, 1].Value = "Interaction";
ws.Cells[1, 2].Value = "Gain";
ws.Cells[1, 3].Value = "FScore";
ws.Cells[1, 4].Value = "wFScore";
ws.Cells[1, 5].Value = "Average wFScore";
ws.Cells[1, 6].Value = "Average Gain";
ws.Cells[1, 7].Value = "Expected Gain";
ws.Cells[1, 8].Value = "Gain Rank";
ws.Cells[1, 9].Value = "FScore Rank";
ws.Cells[1, 10].Value = "wFScore Rank";
ws.Cells[1, 11].Value = "Avg wFScore Rank";
ws.Cells[1, 12].Value = "Avg Gain Rank";
ws.Cells[1, 13].Value = "Expected Gain Rank";
ws.Cells[1, 14].Value = "Average Rank";
ws.Cells[1, 15].Value = "Average Tree Index";
ws.Cells[1, 16].Value = "Average Tree Depth";
var gainSorted = interactions.OrderBy(x => -x.Gain).ToList();
var fScoreSorted = interactions.OrderBy(x => -x.FScore).ToList();
var fScoreWeightedSorted = interactions.OrderBy(x => -x.FScoreWeighted).ToList();
var averagefScoreWeightedSorted = interactions.OrderBy(x => -x.AverageFScoreWeighted).ToList();
var averageGainSorted = interactions.OrderBy(x => -x.AverageGain).ToList();
var expectedGainSorted = interactions.OrderBy(x => -x.ExpectedGain).ToList();
List<object[]> excelData = new List<object[]>();
Func<double, double> _formatNumber = (x) =>
{
return Double.Parse(String.Format("{0:0.00}", x));
};
foreach (FeatureInteraction fi in interactions)
{
List<object> rowValues = new List<object>();
rowValues.Add(fi.Name); //1
rowValues.Add(fi.Gain); //2
rowValues.Add(fi.FScore); //3
rowValues.Add(fi.FScoreWeighted); //4
rowValues.Add(fi.AverageFScoreWeighted); //5
rowValues.Add(fi.AverageGain); //6
rowValues.Add(fi.ExpectedGain); //7
rowValues.Add(gainSorted.FindIndex(x => x.Name == fi.Name) + 1); //8
rowValues.Add(fScoreSorted.FindIndex(x => x.Name == fi.Name) + 1); //9
rowValues.Add(fScoreWeightedSorted.FindIndex(x => x.Name == fi.Name) + 1); //10
rowValues.Add(averagefScoreWeightedSorted.FindIndex(x => x.Name == fi.Name) + 1); //11
rowValues.Add(averageGainSorted.FindIndex(x => x.Name == fi.Name) + 1); //12
rowValues.Add(expectedGainSorted.FindIndex(x => x.Name == fi.Name) + 1); //13
rowValues.Add(_formatNumber(rowValues.Skip(7).Average(x => Double.Parse(x.ToString())))); //14
rowValues.Add(_formatNumber(fi.AverageTreeIndex)); //15
rowValues.Add(_formatNumber(fi.AverageTreeDepth)); //16
excelData.Add(rowValues.ToArray());
}
ws.Cells["A2"].LoadFromArrays(excelData);
}
interactions = GetFeatureInteractionsWithLeafStatistics().Values.ToList();
if(interactions.Count > 0)
{
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.WriteLine(String.Format("Writing leaf statistics"));
Console.ResetColor();
interactions.Sort();
var ws = pck.Workbook.Worksheets.Add(String.Format("Leaf Statistics"));
ws.Row(1).Height = 20;
ws.Row(1).Style.Font.Bold = true;
ws.Row(1).Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
ws.Row(1).Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
ws.Column(1).Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
ws.Column(1).Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
ws.Column(1).Width = interactions.Max(x => x.Name.Length) + 10;
ws.Column(2).Width = 20;
ws.Column(3).Width = 20;
ws.Column(4).Width = 20;
ws.Column(5).Width = 20;
ws.Cells[1, 1].Value = "Interaction";
ws.Cells[1, 2].Value = "Sum Leaf Values Left";
ws.Cells[1, 3].Value = "Sum Leaf Values Right";
ws.Cells[1, 4].Value = "Sum Leaf Covers Left";
ws.Cells[1, 5].Value = "Sum Leaf Covers Right";
List<object[]> excelData = new List<object[]>();
foreach (FeatureInteraction fi in interactions)
{
List<object> rowValues = new List<object>();
rowValues.Add(fi.Name); //1
rowValues.Add(fi.SumLeafValuesLeft); //2
rowValues.Add(fi.SumLeafValuesRight); //3
rowValues.Add(fi.SumLeafCoversLeft); //4
rowValues.Add(fi.SumLeafCoversRight); //5
excelData.Add(rowValues.ToArray());
}
ws.Cells["A2"].LoadFromArrays(excelData);
}
interactions = GetFeatureInteractionsOfDepth(0).Values.ToList();
if (interactions.Count > 0)
{
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.WriteLine(String.Format("Writing split value histograms"));
Console.ResetColor();
interactions.Sort();
var ws = pck.Workbook.Worksheets.Add(String.Format("Split Value Histograms"));
ws.Row(1).Height = 20;
ws.Row(1).Style.Font.Bold = true;
ws.Row(1).Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
ws.Row(1).Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
for(int i = 0; i < interactions.Count; i++)
{
if(i == GlobalSettings.MaxHistograms)
{
break;
}
var fi = interactions[i];
int c1 = i * 2 + 1;
int c2 = c1 + 1;
ws.Cells[1, c1, 1, c2].Merge = true;
ws.Cells[1, c1 , 1, c2].Value = fi.Name;
ws.Column(c1).Width = Math.Max(10, (fi.Name.Length + 4) / 2);
ws.Column(c2).Width = Math.Max(10, (fi.Name.Length + 4) / 2);
int row = 2;
foreach(KeyValuePair<double,double> kvp in fi.SplitValueHistogram)
{
ws.Cells[row, c1].Value = kvp.Key;
ws.Cells[row, c2].Value = kvp.Value;
row++;
}
}
}
pck.Save();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("{0} has been written.", fileName);
Console.ResetColor();
return true;
}
catch (Exception e)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("ERROR: {0}", e.Message);
Console.ResetColor();
return false;
}
}
}
}
| 43.599407 | 120 | 0.488736 | [
"MIT"
] | Far0n/xgbfi | XgbFeatureInteractions/FeatureInteractions.cs | 14,695 | C# |
using System;
namespace NknSdk.Common.Exceptions
{
public class InvalidWalletFormatException : ApplicationException
{
private const string DefaultMessage = "invalid wallet format";
public InvalidWalletFormatException(string message = DefaultMessage)
: base(message)
{
}
}
}
| 22.2 | 76 | 0.672673 | [
"MIT"
] | rule110-io/nTipBot | nkn-sdk-net/NknSdk/Common/Exceptions/InvalidWalletFormatException.cs | 335 | C# |
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using EC_Website.Core.Entities.Base;
namespace EC_Website.Core.Entities.BlogModel
{
public class Blog : ArticleBase
{
public Blog()
{
CoverPhotoPath = "/img/ec_background.jpg";
}
[Required(ErrorMessage = "Please enter the summary of article")]
[StringLength(250, ErrorMessage = "Characters must be less than 250")]
[Display(Name = "Summary")]
public string Summary { get; set; }
[StringLength(64)]
[Display(Name = "Cover Photo Path")]
public string CoverPhotoPath { get; set; }
[Display(Name = "View Count")]
public int ViewCount { get; set; }
public virtual ICollection<BlogTag> BlogTags { get; set; } = new List<BlogTag>();
public virtual ICollection<BlogLike> LikedUsers { get; set; } = new List<BlogLike>();
public virtual ICollection<Comment> Comments { get; set; } = new List<Comment>();
}
}
| 34.466667 | 93 | 0.630561 | [
"MIT"
] | suxrobGM/EC_WebSite | src/EC_Website.Core/Entities/BlogModel/Blog.cs | 1,036 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BDSA2018.Lecture07.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace BDSA2018.Lecture07.Web.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class CharactersController : ControllerBase
{
private ICharacterRepository _repository;
public CharactersController(ICharacterRepository repository)
{
_repository = repository;
}
// GET api/characters
[HttpGet]
public async Task<ActionResult<IEnumerable<CharacterDTO>>> Get()
{
return await _repository.Read().ToListAsync();
}
// GET api/characters/5
[HttpGet("{id}")]
public async Task<ActionResult<CharacterDTO>> Get(int id)
{
var character = await _repository.FindAsync(id);
if (character == null)
{
return NotFound();
}
return character;
}
// POST api/characters
[HttpPost]
public async Task<ActionResult<CharacterDTO>> Post([FromBody] CharacterCreateUpdateDTO character)
{
//if (!ModelState.IsValid)
//{
// return BadRequest(ModelState);
//}
var dto = await _repository.CreateAsync(character);
return CreatedAtAction(nameof(Get), new { id = dto.Id }, dto);
}
// PUT api/characters/5
[HttpPut("{id}")]
public async Task<IActionResult> Put(int id, [FromBody] CharacterCreateUpdateDTO character)
{
var updated = await _repository.UpdateAsync(character);
if (updated)
{
return NoContent();
}
return NotFound();
}
// DELETE api/characters/5
[HttpDelete("{id}")]
public async Task<IActionResult> Delete(int id)
{
var deleted = await _repository.DeleteAsync(id);
if (deleted)
{
return NoContent();
}
return NotFound();
}
}
}
| 25.755814 | 105 | 0.560722 | [
"MIT"
] | ondfisk/BDSA2018 | BDSA2018.Lecture07.Web/Controllers/CharactersController.cs | 2,217 | C# |
namespace ResurrectionRP_Server.Society.Societies.WildCustom
{
public partial class WildCustom : Garage
{
private static GarageData.EsthetiqueData[] _esthetiqueModList = new GarageData.EsthetiqueData[]
{
new GarageData.EsthetiqueData(0, "Spoiler", 2000),
new GarageData.EsthetiqueData(1, "Pare-choc Avant", 2000),
new GarageData.EsthetiqueData(2, "Pare-choc Arrière", 2000),
new GarageData.EsthetiqueData(3, "Jupe latérale", 2000),
new GarageData.EsthetiqueData(4, "Échappement", 2000),
new GarageData.EsthetiqueData(5, "Cadre", 2000),
new GarageData.EsthetiqueData(6, "Grille", 2000),
new GarageData.EsthetiqueData(7, "Capot", 2000),
new GarageData.EsthetiqueData(8, "Aile", 2000),
new GarageData.EsthetiqueData(9, "Aile Droite", 2000),
new GarageData.EsthetiqueData(10, "Toit", 2000),
new GarageData.EsthetiqueData(14, "Klaxon", 2000),
new GarageData.EsthetiqueData(22, "Xenon", 2000),
new GarageData.EsthetiqueData(23, "Roues", 2000),
new GarageData.EsthetiqueData(25, "Supports de plaque", 2000),
new GarageData.EsthetiqueData(27, "Design intérieur", 2000),
new GarageData.EsthetiqueData(28, "Ornements", 2000),
new GarageData.EsthetiqueData(30, "Compteur", 2000),
new GarageData.EsthetiqueData(33, "Volant", 2000),
new GarageData.EsthetiqueData(34, "Levier de vitesses", 2000),
new GarageData.EsthetiqueData(35, "Plaques", 2000),
new GarageData.EsthetiqueData(38, "Hydraulics", 2000),
new GarageData.EsthetiqueData(46, "Teinte des vitres", 2000),
new GarageData.EsthetiqueData(48, "Skin", 2000),
new GarageData.EsthetiqueData(62, "Assiette", 2000),
new GarageData.EsthetiqueData(69, "Teinte des vitres", 2000),
new GarageData.EsthetiqueData(74, "Couleur du tableau de bord", 2000),
new GarageData.EsthetiqueData(75, "Couleur de garniture", 2000)
};
private static GarageData.PerformanceData[] _performanceModList = new GarageData.PerformanceData[]
{
new GarageData.PerformanceData(11, "Moteur", new double[] { 0, 7000, 14000, 21000, 35000, 50000}),
new GarageData.PerformanceData(12, "Frein", new double[] { 0, 3500, 7000, 10500}),
new GarageData.PerformanceData(13, "Transmission", new double[] { 0, 5250, 10500, 15750}),
new GarageData.PerformanceData(15, "Suspensions", new double[] { 0, 1750, 2625, 3500, 5250})
// new GarageData.PerformanceData(18, "Turbo", new double[] { 0, 78250 })
};
}
}
| 58.723404 | 110 | 0.637319 | [
"MIT"
] | PourrezJ/ResurrectionRP-Framework | ResurrectionRP_Server/Society/Societies/WildCustom/WildCustom.data.cs | 2,766 | C# |
// *** WARNING: this file was generated by crd2pulumi. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.Kubernetes.Types.Inputs.Keycloak.V1Alpha1
{
public class KeycloakRealmSpecRealmUsersArgs : Pulumi.ResourceArgs
{
[Input("attributes")]
private InputMap<ImmutableArray<string>>? _attributes;
/// <summary>
/// A set of Attributes.
/// </summary>
public InputMap<ImmutableArray<string>> Attributes
{
get => _attributes ?? (_attributes = new InputMap<ImmutableArray<string>>());
set => _attributes = value;
}
[Input("clientRoles")]
private InputMap<ImmutableArray<string>>? _clientRoles;
/// <summary>
/// A set of Client Roles.
/// </summary>
public InputMap<ImmutableArray<string>> ClientRoles
{
get => _clientRoles ?? (_clientRoles = new InputMap<ImmutableArray<string>>());
set => _clientRoles = value;
}
[Input("credentials")]
private InputList<Pulumi.Kubernetes.Types.Inputs.Keycloak.V1Alpha1.KeycloakRealmSpecRealmUsersCredentialsArgs>? _credentials;
/// <summary>
/// A set of Credentials.
/// </summary>
public InputList<Pulumi.Kubernetes.Types.Inputs.Keycloak.V1Alpha1.KeycloakRealmSpecRealmUsersCredentialsArgs> Credentials
{
get => _credentials ?? (_credentials = new InputList<Pulumi.Kubernetes.Types.Inputs.Keycloak.V1Alpha1.KeycloakRealmSpecRealmUsersCredentialsArgs>());
set => _credentials = value;
}
/// <summary>
/// Email.
/// </summary>
[Input("email")]
public Input<string>? Email { get; set; }
/// <summary>
/// True if email has already been verified.
/// </summary>
[Input("emailVerified")]
public Input<bool>? EmailVerified { get; set; }
/// <summary>
/// User enabled flag.
/// </summary>
[Input("enabled")]
public Input<bool>? Enabled { get; set; }
[Input("federatedIdentities")]
private InputList<Pulumi.Kubernetes.Types.Inputs.Keycloak.V1Alpha1.KeycloakRealmSpecRealmUsersFederatedIdentitiesArgs>? _federatedIdentities;
/// <summary>
/// A set of Federated Identities.
/// </summary>
public InputList<Pulumi.Kubernetes.Types.Inputs.Keycloak.V1Alpha1.KeycloakRealmSpecRealmUsersFederatedIdentitiesArgs> FederatedIdentities
{
get => _federatedIdentities ?? (_federatedIdentities = new InputList<Pulumi.Kubernetes.Types.Inputs.Keycloak.V1Alpha1.KeycloakRealmSpecRealmUsersFederatedIdentitiesArgs>());
set => _federatedIdentities = value;
}
/// <summary>
/// First Name.
/// </summary>
[Input("firstName")]
public Input<string>? FirstName { get; set; }
[Input("groups")]
private InputList<string>? _groups;
/// <summary>
/// A set of Groups.
/// </summary>
public InputList<string> Groups
{
get => _groups ?? (_groups = new InputList<string>());
set => _groups = value;
}
/// <summary>
/// User ID.
/// </summary>
[Input("id")]
public Input<string>? Id { get; set; }
/// <summary>
/// Last Name.
/// </summary>
[Input("lastName")]
public Input<string>? LastName { get; set; }
[Input("realmRoles")]
private InputList<string>? _realmRoles;
/// <summary>
/// A set of Realm Roles.
/// </summary>
public InputList<string> RealmRoles
{
get => _realmRoles ?? (_realmRoles = new InputList<string>());
set => _realmRoles = value;
}
[Input("requiredActions")]
private InputList<string>? _requiredActions;
/// <summary>
/// A set of Required Actions.
/// </summary>
public InputList<string> RequiredActions
{
get => _requiredActions ?? (_requiredActions = new InputList<string>());
set => _requiredActions = value;
}
/// <summary>
/// User Name.
/// </summary>
[Input("username")]
public Input<string>? Username { get; set; }
public KeycloakRealmSpecRealmUsersArgs()
{
}
}
}
| 31.80137 | 185 | 0.58109 | [
"Apache-2.0"
] | pulumi/pulumi-kubernetes-crds | operators/keycloak-operator/dotnet/Kubernetes/Crds/Operators/KeycloakOperator/Keycloak/V1Alpha1/Inputs/KeycloakRealmSpecRealmUsersArgs.cs | 4,643 | 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.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
namespace Microsoft.DotNet.XHarness.iOS.Shared.Utilities
{
public static class ProjectFileExtensions
{
const string MSBuild_Namespace = "http://schemas.microsoft.com/developer/msbuild/2003";
public static void SetProjectTypeGuids(this XmlDocument csproj, string value)
{
SetNode(csproj, "ProjectTypeGuids", value);
}
public static string GetProjectGuid(this XmlDocument csproj)
{
return csproj.SelectSingleNode("/*/*/*[local-name() = 'ProjectGuid']").InnerText;
}
public static void SetProjectGuid(this XmlDocument csproj, string value)
{
csproj.SelectSingleNode("/*/*/*[local-name() = 'ProjectGuid']").InnerText = value;
}
public static string GetOutputType(this XmlDocument csproj)
{
return csproj.SelectSingleNode("/*/*/*[local-name() = 'OutputType']").InnerText;
}
public static void SetOutputType(this XmlDocument csproj, string value)
{
csproj.SelectSingleNode("/*/*/*[local-name() = 'OutputType']").InnerText = value;
}
static string[] eqsplitter = new string[] { "==" };
static string[] orsplitter = new string[] { " Or " };
static char[] pipesplitter = new char[] { '|' };
static char[] trimchars = new char[] { '\'', ' ' };
static void ParseConditions(this XmlNode node, out string platform, out string configuration)
{
// This parses the platform/configuration out of conditions like this:
//
// Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' "
//
platform = "Any CPU";
configuration = "Debug";
while (node != null)
{
if (node.Attributes != null)
{
var conditionAttribute = node.Attributes["Condition"];
if (conditionAttribute != null)
{
var condition = conditionAttribute.Value;
var eqsplit = condition.Split(eqsplitter, StringSplitOptions.None);
if (eqsplit.Length == 2)
{
var left = eqsplit[0].Trim(trimchars).Split(pipesplitter);
var right = eqsplit[1].Trim(trimchars).Split(pipesplitter);
if (left.Length == right.Length)
{
for (int i = 0; i < left.Length; i++)
{
switch (left[i])
{
case "$(Configuration)":
configuration = right[i];
break;
case "$(Platform)":
platform = right[i];
break;
default:
throw new Exception(string.Format("Unknown condition logic: {0}", left[i]));
}
}
}
}
if (string.IsNullOrEmpty(platform) || string.IsNullOrEmpty(configuration))
throw new Exception(string.Format("Could not parse the condition: {0}", conditionAttribute.Value));
}
}
node = node.ParentNode;
}
if (string.IsNullOrEmpty(platform) || string.IsNullOrEmpty(configuration))
throw new Exception("Could not find a condition attribute.");
}
public static void SetOutputPath(this XmlDocument csproj, string value, bool expand = true)
{
var nodes = csproj.SelectNodes("/*/*/*[local-name() = 'OutputPath']");
if (nodes.Count == 0)
throw new Exception("Could not find node OutputPath");
foreach (XmlNode n in nodes)
{
if (expand)
{
// OutputPath needs to be expanded, otherwise Xamarin Studio isn't able to launch the project.
string platform, configuration;
ParseConditions(n, out platform, out configuration);
n.InnerText = value.Replace("$(Platform)", platform).Replace("$(Configuration)", configuration);
}
else
{
n.InnerText = value;
}
}
}
static bool IsNodeApplicable(XmlNode node, string platform, string configuration)
{
while (node != null)
{
if (!EvaluateCondition(node, platform, configuration))
return false;
node = node.ParentNode;
}
return true;
}
static bool EvaluateCondition(XmlNode node, string platform, string configuration)
{
if (node.Attributes == null)
return true;
var condition = node.Attributes["Condition"];
if (condition == null)
return true;
var conditionValue = condition.Value;
if (configuration != null)
conditionValue = conditionValue.Replace("$(Configuration)", configuration);
if (platform != null)
conditionValue = conditionValue.Replace("$(Platform)", platform);
var orsplits = conditionValue.Split(orsplitter, StringSplitOptions.None);
foreach (var orsplit in orsplits)
{
var eqsplit = orsplit.Split(eqsplitter, StringSplitOptions.None);
if (eqsplit.Length != 2)
{
Console.WriteLine("Could not parse condition; {0}", conditionValue);
return false;
}
var left = eqsplit[0].Trim(trimchars);
var right = eqsplit[1].Trim(trimchars);
if (left == right)
return true;
}
return false;
}
public static string GetOutputPath(this XmlDocument csproj, string platform, string configuration)
{
return GetElementValue(csproj, platform, configuration, "OutputPath");
}
public static string GetMtouchArch(this XmlDocument csproj, string platform, string configuration)
{
return GetElementValue(csproj, platform, configuration, "MtouchArch");
}
static string GetElementValue(this XmlDocument csproj, string platform, string configuration, string elementName)
{
var nodes = csproj.SelectNodes($"/*/*/*[local-name() = '{elementName}']");
if (nodes.Count == 0)
throw new Exception($"Could not find node {elementName}");
foreach (XmlNode n in nodes)
{
if (IsNodeApplicable(n, platform, configuration))
return n.InnerText.Replace("$(Platform)", platform).Replace("$(Configuration)", configuration);
}
throw new Exception($"Could not find {elementName}");
}
public static string GetOutputAssemblyPath(this XmlDocument csproj, string platform, string configuration)
{
var outputPath = GetOutputPath(csproj, platform, configuration);
var assemblyName = GetElementValue(csproj, platform, configuration, "AssemblyName");
var outputType = GetElementValue(csproj, platform, configuration, "OutputType");
string extension;
switch (outputType.ToLowerInvariant())
{
case "library":
extension = "dll";
break;
case "exe":
extension = "exe";
break;
default:
throw new NotImplementedException(outputType);
}
return outputPath + "\\" + assemblyName + "." + extension; // MSBuild-style paths.
}
public static void SetIntermediateOutputPath(this XmlDocument csproj, string value)
{
// Set any existing IntermediateOutputPath
var nodes = csproj.SelectNodes("/*/*/*[local-name() = 'IntermediateOutputPath']");
var hasToplevel = false;
if (nodes.Count != 0)
{
foreach (XmlNode n in nodes)
{
n.InnerText = value;
hasToplevel |= n.Attributes["Condition"] == null;
}
}
if (hasToplevel)
return;
// Make sure there's a top-level version too.
var property_group = csproj.SelectSingleNode("/*/*[local-name() = 'PropertyGroup' and not(@Condition)]");
var intermediateOutputPath = csproj.CreateElement("IntermediateOutputPath", MSBuild_Namespace);
intermediateOutputPath.InnerText = value;
property_group.AppendChild(intermediateOutputPath);
}
public static void SetTargetFrameworkIdentifier(this XmlDocument csproj, string value)
{
SetTopLevelPropertyGroupValue(csproj, "TargetFrameworkIdentifier", value);
}
public static void SetTopLevelPropertyGroupValue(this XmlDocument csproj, string key, string value)
{
var firstPropertyGroups = csproj.SelectNodes("//*[local-name() = 'PropertyGroup']")[0];
var targetFrameworkIdentifierNode = firstPropertyGroups.SelectSingleNode(string.Format("//*[local-name() = '{0}']", key));
if (targetFrameworkIdentifierNode != null)
{
SetNode(csproj, key, value);
}
else
{
var mea = csproj.CreateElement(key, MSBuild_Namespace);
mea.InnerText = value;
firstPropertyGroups.AppendChild(mea);
}
}
public static void RemoveTargetFrameworkIdentifier(this XmlDocument csproj)
{
try
{
RemoveNode(csproj, "TargetFrameworkIdentifier");
}
catch
{
// ignore exceptions, if not present, we are not worried
}
}
public static void SetAssemblyName(this XmlDocument csproj, string value)
{
SetNode(csproj, "AssemblyName", value);
}
public static string GetAssemblyName(this XmlDocument csproj)
{
return csproj.SelectSingleNode("/*/*/*[local-name() = 'AssemblyName']").InnerText;
}
public static void SetPlatformAssembly(this XmlDocument csproj, string value)
{
SetAssemblyReference(csproj, "Xamarin.iOS", value);
}
public static void SetAssemblyReference(this XmlDocument csproj, string current, string value)
{
var project = csproj.ChildNodes[1];
var reference = csproj.SelectSingleNode("/*/*/*[local-name() = 'Reference' and @Include = '" + current + "']");
if (reference != null)
reference.Attributes["Include"].Value = value;
}
public static void RemoveReferences(this XmlDocument csproj, string projectName)
{
var reference = csproj.SelectSingleNode("/*/*/*[local-name() = 'Reference' and @Include = '" + projectName + "']");
if (reference != null)
reference.ParentNode.RemoveChild(reference);
}
public static void AddCompileInclude(this XmlDocument csproj, string link, string include, bool prepend = false)
{
var compile_node = csproj.SelectSingleNode("//*[local-name() = 'Compile']");
var item_group = compile_node.ParentNode;
var node = csproj.CreateElement("Compile", MSBuild_Namespace);
var include_attribute = csproj.CreateAttribute("Include");
include_attribute.Value = include;
node.Attributes.Append(include_attribute);
var linkElement = csproj.CreateElement("Link", MSBuild_Namespace);
linkElement.InnerText = link;
node.AppendChild(linkElement);
if (prepend)
item_group.PrependChild(node);
else
item_group.AppendChild(node);
}
public static void FixCompileInclude(this XmlDocument csproj, string include, string newInclude)
{
csproj.SelectSingleNode($"//*[local-name() = 'Compile' and @Include = '{include}']").Attributes["Include"].Value = newInclude;
}
public static void AddInterfaceDefinition(this XmlDocument csproj, string include)
{
var itemGroup = csproj.CreateItemGroup();
var id = csproj.CreateElement("InterfaceDefinition", MSBuild_Namespace);
var attrib = csproj.CreateAttribute("Include");
attrib.Value = include;
id.Attributes.Append(attrib);
itemGroup.AppendChild(id);
}
public static void SetImport(this XmlDocument csproj, string value)
{
var imports = csproj.SelectNodes("/*/*[local-name() = 'Import'][not(@Condition)]");
if (imports.Count != 1)
throw new Exception("More than one import");
imports[0].Attributes["Project"].Value = value;
}
public static void SetExtraLinkerDefs(this XmlDocument csproj, string value)
{
var mtouchExtraArgs = csproj.SelectNodes("//*[local-name() = 'MtouchExtraArgs']");
foreach (XmlNode mea in mtouchExtraArgs)
mea.InnerText = mea.InnerText.Replace("extra-linker-defs.xml", value);
var nones = csproj.SelectNodes("//*[local-name() = 'None' and @Include = 'extra-linker-defs.xml']");
foreach (XmlNode none in nones)
none.Attributes["Include"].Value = value;
}
public static void AddExtraMtouchArgs(this XmlDocument csproj, string value, string platform, string configuration)
{
AddToNode(csproj, "MtouchExtraArgs", value, platform, configuration);
}
public static void AddMonoBundlingExtraArgs(this XmlDocument csproj, string value, string platform, string configuration)
{
AddToNode(csproj, "MonoBundlingExtraArgs", value, platform, configuration);
}
public static void AddToNode(this XmlDocument csproj, string node, string value, string platform, string configuration)
{
var nodes = csproj.SelectNodes($"//*[local-name() = '{node}']");
var found = false;
foreach (XmlNode mea in nodes)
{
if (!IsNodeApplicable(mea, platform, configuration))
continue;
if (mea.InnerText.Length > 0 && mea.InnerText[mea.InnerText.Length - 1] != ' ')
mea.InnerText += " ";
mea.InnerText += value;
found = true;
}
if (found)
return;
// The project might not have this node, so create one of none was found.
var propertyGroups = csproj.SelectNodes("//*[local-name() = 'PropertyGroup' and @Condition]");
foreach (XmlNode pg in propertyGroups)
{
if (!EvaluateCondition(pg, platform, configuration))
continue;
var mea = csproj.CreateElement(node, MSBuild_Namespace);
mea.InnerText = value;
pg.AppendChild(mea);
}
}
public static string GetMtouchLink(this XmlDocument csproj, string platform, string configuration)
{
return GetNode(csproj, "MtouchLink", platform, configuration);
}
public static void SetMtouchUseLlvm(this XmlDocument csproj, bool value, string platform, string configuration)
{
SetNode(csproj, "MtouchUseLlvm", true ? "true" : "false", platform, configuration);
}
public static void SetMtouchUseBitcode(this XmlDocument csproj, bool value, string platform, string configuration)
{
SetNode(csproj, "MtouchEnableBitcode", true ? "true" : "false", platform, configuration);
}
public static IEnumerable<XmlNode> GetPropertyGroups(this XmlDocument csproj, string platform, string configuration)
{
var propertyGroups = csproj.SelectNodes("//*[local-name() = 'PropertyGroup' and @Condition]");
foreach (XmlNode node in propertyGroups)
{
if (!EvaluateCondition(node, platform, configuration))
continue;
yield return node;
}
}
public static void SetNode(this XmlDocument csproj, string node, string value, string platform, string configuration)
{
var projnode = csproj.SelectElementNodes(node);
var found = false;
foreach (XmlNode xmlnode in projnode)
{
if (!IsNodeApplicable(xmlnode, platform, configuration))
continue;
xmlnode.InnerText = value;
found = true;
}
if (found)
return;
// Not all projects have a MtouchExtraArgs node, so create one of none was found.
var propertyGroups = csproj.SelectNodes("//*[local-name() = 'PropertyGroup' and @Condition]");
foreach (XmlNode pg in propertyGroups)
{
if (!EvaluateCondition(pg, platform, configuration))
continue;
var mea = csproj.CreateElement(node, MSBuild_Namespace);
mea.InnerText = value;
pg.AppendChild(mea);
}
}
static string GetNode(this XmlDocument csproj, string name, string platform, string configuration)
{
foreach (var pg in GetPropertyGroups(csproj, platform, configuration))
{
foreach (XmlNode node in pg.ChildNodes)
if (node.Name == name)
return node.InnerText;
}
return null;
}
public static string GetImport(this XmlDocument csproj)
{
var imports = csproj.SelectNodes("/*/*[local-name() = 'Import'][not(@Condition)]");
if (imports.Count != 1)
throw new Exception("More than one import");
return imports[0].Attributes["Project"].Value;
}
public delegate bool FixReferenceDelegate(string reference, out string fixed_reference);
public static void FixProjectReferences(this XmlDocument csproj, string suffix, FixReferenceDelegate fixCallback = null)
{
var nodes = csproj.SelectNodes("/*/*/*[local-name() = 'ProjectReference']");
if (nodes.Count == 0)
return;
foreach (XmlNode n in nodes)
{
var name = n["Name"].InnerText;
string fixed_name = null;
if (fixCallback != null && !fixCallback(name, out fixed_name))
continue;
var include = n.Attributes["Include"];
string fixed_include;
if (fixed_name == null)
{
fixed_include = include.Value;
fixed_include = fixed_include.Replace(".csproj", suffix + ".csproj");
fixed_include = fixed_include.Replace(".fsproj", suffix + ".fsproj");
}
else
{
var unix_path = include.Value.Replace('\\', '/');
var unix_dir = System.IO.Path.GetDirectoryName(unix_path);
fixed_include = System.IO.Path.Combine(unix_dir, fixed_name + System.IO.Path.GetExtension(unix_path));
fixed_include = fixed_include.Replace('/', '\\');
}
n.Attributes["Include"].Value = fixed_include;
var nameElement = n["Name"];
name = System.IO.Path.GetFileNameWithoutExtension(fixed_include.Replace('\\', '/'));
nameElement.InnerText = name;
}
}
public static void FixTestLibrariesReferences(this XmlDocument csproj, string platform)
{
var nodes = csproj.SelectNodes("//*[local-name() = 'ObjcBindingNativeLibrary' or local-name() = 'ObjcBindingNativeFramework']");
var test_libraries = new string[] {
"libtest.a",
"libtest2.a",
"XTest.framework",
"XStaticArTest.framework",
"XStaticObjectTest.framework"
};
foreach (XmlNode node in nodes)
{
var includeAttribute = node.Attributes["Include"];
if (includeAttribute != null)
{
foreach (var tl in test_libraries)
includeAttribute.Value = includeAttribute.Value.Replace($"test-libraries\\.libs\\ios-fat\\{tl}", $"test-libraries\\.libs\\{platform}-fat\\{tl}");
}
}
nodes = csproj.SelectNodes("//*[local-name() = 'Target' and @Name = 'BeforeBuild']");
foreach (XmlNode node in nodes)
{
var outputsAttribute = node.Attributes["Outputs"];
if (outputsAttribute != null)
{
foreach (var tl in test_libraries)
outputsAttribute.Value = outputsAttribute.Value.Replace($"test-libraries\\.libs\\ios-fat\\${tl}", $"test-libraries\\.libs\\{platform}-fat\\${tl}");
}
}
}
public static void FixArchitectures(this XmlDocument csproj, string simulator_arch, string device_arch, string platform = null, string configuration = null)
{
var nodes = csproj.SelectNodes("/*/*/*[local-name() = 'MtouchArch']");
if (nodes.Count == 0)
throw new Exception(string.Format("Could not find MtouchArch at all"));
foreach (XmlNode n in nodes)
{
if (platform != null && configuration != null && !IsNodeApplicable(n, platform, configuration))
continue;
switch (n.InnerText.ToLower())
{
case "i386":
case "x86_64":
case "i386, x86_64":
n.InnerText = simulator_arch;
break;
case "armv7":
case "armv7s":
case "arm64":
case "arm64_32":
case "armv7k":
case "armv7, arm64":
case "armv7k, arm64_32":
n.InnerText = device_arch;
break;
default:
throw new NotImplementedException(string.Format("Unhandled architecture: {0}", n.InnerText));
}
}
}
public static void FindAndReplace(this XmlDocument csproj, string find, string replace)
{
FindAndReplace(csproj.ChildNodes, find, replace);
}
static void FindAndReplace(XmlNode node, string find, string replace)
{
if (node.HasChildNodes)
{
FindAndReplace(node.ChildNodes, find, replace);
}
else
{
if (node.NodeType == XmlNodeType.Text)
node.InnerText = node.InnerText.Replace(find, replace);
}
if (node.Attributes != null)
{
foreach (XmlAttribute attrib in node.Attributes)
attrib.Value = attrib.Value.Replace(find, replace);
}
}
static void FindAndReplace(XmlNodeList nodes, string find, string replace)
{
foreach (XmlNode node in nodes)
FindAndReplace(node, find, replace);
}
public static void FixInfoPListInclude(this XmlDocument csproj, string suffix, string fullPath = null, string newName = null)
{
var import = GetInfoPListNode(csproj, false);
if (import != null)
{
var value = import.Attributes["Include"].Value;
var unixValue = value.Replace('\\', '/');
var fname = Path.GetFileName(unixValue);
if (newName == null)
{
if (string.IsNullOrEmpty(fullPath))
newName = value.Replace(fname, $"Info{suffix}.plist");
else
newName = value.Replace(fname, $"{fullPath}\\Info{suffix}.plist");
}
import.Attributes["Include"].Value = (!Path.IsPathRooted(unixValue)) ? value.Replace(fname, newName) : newName;
var logicalName = import.SelectSingleNode("./*[local-name() = 'LogicalName']");
if (logicalName == null)
{
logicalName = csproj.CreateElement("LogicalName", MSBuild_Namespace);
import.AppendChild(logicalName);
}
logicalName.InnerText = "Info.plist";
}
}
static XmlNode GetInfoPListNode(this XmlDocument csproj, bool throw_if_not_found = false)
{
var logicalNames = csproj.SelectNodes("//*[local-name() = 'LogicalName']");
foreach (XmlNode ln in logicalNames)
{
if (!ln.InnerText.Contains("Info.plist"))
continue;
return ln.ParentNode;
}
var nodes = csproj.SelectNodes("//*[local-name() = 'None' and contains(@Include ,'Info.plist')]");
if (nodes.Count > 0)
{
return nodes[0]; // return the value, which could be Info.plist or a full path (linked).
}
nodes = csproj.SelectNodes("//*[local-name() = 'None' and contains(@Include ,'Info-tv.plist')]");
if (nodes.Count > 0)
{
return nodes[0]; // return the value, which could be Info.plist or a full path (linked).
}
if (throw_if_not_found)
throw new Exception($"Could not find Info.plist include.");
return null;
}
public static string GetInfoPListInclude(this XmlDocument csproj)
{
return GetInfoPListNode(csproj).Attributes["Include"].Value;
}
public static IEnumerable<string> GetProjectReferences(this XmlDocument csproj)
{
var nodes = csproj.SelectNodes("//*[local-name() = 'ProjectReference']");
foreach (XmlNode node in nodes)
yield return node.Attributes["Include"].Value;
}
public static IEnumerable<string> GetExtensionProjectReferences(this XmlDocument csproj)
{
var nodes = csproj.SelectNodes("//*[local-name() = 'ProjectReference']");
foreach (XmlNode node in nodes)
{
if (node.SelectSingleNode("./*[local-name () = 'IsAppExtension']") != null)
yield return node.Attributes["Include"].Value;
}
}
public static IEnumerable<string> GetNunitAndXunitTestReferences(this XmlDocument csproj)
{
var nodes = csproj.SelectNodes("//*[local-name() = 'Reference']");
foreach (XmlNode node in nodes)
{
var includeValue = node.Attributes["Include"].Value;
if (includeValue.EndsWith("_test.dll", StringComparison.Ordinal) || includeValue.EndsWith("_xunit-test.dll", StringComparison.Ordinal))
yield return includeValue;
}
}
public static void SetProjectReferenceValue(this XmlDocument csproj, string projectInclude, string node, string value)
{
var nameNode = csproj.SelectSingleNode("//*[local-name() = 'ProjectReference' and @Include = '" + projectInclude + "']/*[local-name() = '" + node + "']");
nameNode.InnerText = value;
}
public static void SetProjectReferenceInclude(this XmlDocument csproj, string projectInclude, string value)
{
var elements = csproj.SelectElementNodes("ProjectReference");
elements
.Where((v) =>
{
var attrib = v.Attributes["Include"];
if (attrib == null)
return false;
return attrib.Value == projectInclude;
})
.Single()
.Attributes["Include"].Value = value;
}
public static void CreateProjectReferenceValue(this XmlDocument csproj, string existingInclude, string path, string guid, string name)
{
var referenceNode = csproj.SelectSingleNode("//*[local-name() = 'Reference' and @Include = '" + existingInclude + "']");
var projectReferenceNode = csproj.CreateElement("ProjectReference", MSBuild_Namespace);
var includeAttribute = csproj.CreateAttribute("Include");
includeAttribute.Value = path.Replace('/', '\\');
projectReferenceNode.Attributes.Append(includeAttribute);
var projectNode = csproj.CreateElement("Project", MSBuild_Namespace);
projectNode.InnerText = guid;
projectReferenceNode.AppendChild(projectNode);
var nameNode = csproj.CreateElement("Name", MSBuild_Namespace);
nameNode.InnerText = name;
projectReferenceNode.AppendChild(nameNode);
XmlNode itemGroup;
if (referenceNode != null)
{
itemGroup = referenceNode.ParentNode;
referenceNode.ParentNode.RemoveChild(referenceNode);
}
else
{
itemGroup = csproj.CreateElement("ItemGroup", MSBuild_Namespace);
csproj.SelectSingleNode("//*[local-name() = 'Project']").AppendChild(itemGroup);
}
itemGroup.AppendChild(projectReferenceNode);
}
static XmlNode CreateItemGroup(this XmlDocument csproj)
{
var lastItemGroup = csproj.SelectSingleNode("//*[local-name() = 'ItemGroup'][last()]");
var newItemGroup = csproj.CreateElement("ItemGroup", MSBuild_Namespace);
lastItemGroup.ParentNode.InsertAfter(newItemGroup, lastItemGroup);
return newItemGroup;
}
public static void AddAdditionalDefines(this XmlDocument csproj, string value)
{
var mainPropertyGroup = csproj.SelectSingleNode("//*[local-name() = 'PropertyGroup' and not(@Condition)]");
var mainDefine = mainPropertyGroup.SelectSingleNode("*[local-name() = 'DefineConstants']");
if (mainDefine == null)
{
mainDefine = csproj.CreateElement("DefineConstants", MSBuild_Namespace);
mainDefine.InnerText = value;
mainPropertyGroup.AppendChild(mainDefine);
}
else
{
mainDefine.InnerText = mainDefine.InnerText + ";" + value;
}
// make sure all other DefineConstants include the main one
var otherDefines = csproj.SelectNodes("//*[local-name() = 'PropertyGroup' and @Condition]/*[local-name() = 'DefineConstants']");
foreach (XmlNode def in otherDefines)
{
if (!def.InnerText.Contains("$(DefineConstants"))
def.InnerText = def.InnerText + ";$(DefineConstants)";
}
}
public static void RemoveDefines(this XmlDocument csproj, string defines, string platform = null, string configuration = null)
{
var separator = new char[] { ';' };
var defs = defines.Split(separator, StringSplitOptions.RemoveEmptyEntries);
var projnode = csproj.SelectNodes("//*[local-name() = 'PropertyGroup']/*[local-name() = 'DefineConstants']");
foreach (XmlNode xmlnode in projnode)
{
if (string.IsNullOrEmpty(xmlnode.InnerText))
continue;
var parent = xmlnode.ParentNode;
if (!IsNodeApplicable(parent, platform, configuration))
continue;
var existing = xmlnode.InnerText.Split(separator, StringSplitOptions.RemoveEmptyEntries);
var any = false;
foreach (var def in defs)
{
for (var i = 0; i < existing.Length; i++)
{
if (existing[i] == def)
{
existing[i] = null;
any = true;
}
}
}
if (!any)
continue;
xmlnode.InnerText = string.Join(separator[0].ToString(), existing.Where((v) => !string.IsNullOrEmpty(v)));
}
}
public static void AddAdditionalDefines(this XmlDocument csproj, string value, string platform, string configuration)
{
var projnode = csproj.SelectNodes("//*[local-name() = 'PropertyGroup' and @Condition]/*[local-name() = 'DefineConstants']");
foreach (XmlNode xmlnode in projnode)
{
var parent = xmlnode.ParentNode;
if (parent.Attributes["Condition"] == null)
continue;
if (!IsNodeApplicable(parent, platform, configuration))
continue;
if (string.IsNullOrEmpty(xmlnode.InnerText))
{
xmlnode.InnerText = value;
}
else
{
xmlnode.InnerText += ";" + value;
}
return;
}
projnode = csproj.SelectNodes("//*[local-name() = 'PropertyGroup' and @Condition]");
foreach (XmlNode xmlnode in projnode)
{
if (xmlnode.Attributes["Condition"] == null)
continue;
if (!IsNodeApplicable(xmlnode, platform, configuration))
continue;
var defines = csproj.CreateElement("DefineConstants", MSBuild_Namespace);
defines.InnerText = "$(DefineConstants);" + value;
xmlnode.AppendChild(defines);
return;
}
throw new Exception("Could not find where to add a new DefineConstants node");
}
public static void SetNode(this XmlDocument csproj, string node, string value)
{
var nodes = csproj.SelectNodes("/*/*/*[local-name() = '" + node + "']");
if (nodes.Count == 0)
throw new Exception(string.Format("Could not find node {0}", node));
foreach (XmlNode n in nodes)
{
n.InnerText = value;
}
}
public static void RemoveNode(this XmlDocument csproj, string node, bool throwOnInexistentNode = true)
{
var nodes = csproj.SelectNodes("/*/*/*[local-name() = '" + node + "']");
if (throwOnInexistentNode && nodes.Count == 0)
throw new Exception(string.Format("Could not find node {0}", node));
foreach (XmlNode n in nodes)
{
n.ParentNode.RemoveChild(n);
}
}
public static void CloneConfiguration(this XmlDocument csproj, string platform, string configuration, string new_configuration)
{
var projnode = csproj.GetPropertyGroups(platform, configuration);
foreach (XmlNode xmlnode in projnode)
{
var clone = xmlnode.Clone();
var condition = clone.Attributes["Condition"];
condition.InnerText = condition.InnerText.Replace(configuration, new_configuration);
xmlnode.ParentNode.InsertAfter(clone, xmlnode);
return;
}
throw new Exception($"Configuration {platform}|{configuration} not found.");
}
public static void DeleteConfiguration(this XmlDocument csproj, string platform, string configuration)
{
var projnode = csproj.GetPropertyGroups(platform, configuration);
foreach (XmlNode xmlnode in projnode)
xmlnode.ParentNode.RemoveChild(xmlnode);
}
static IEnumerable<XmlNode> SelectElementNodes(this XmlNode node, string name)
{
foreach (XmlNode child in node.ChildNodes)
{
if (child.NodeType == XmlNodeType.Element && child.Name == name)
yield return child;
if (!child.HasChildNodes)
continue;
foreach (XmlNode descendent in child.SelectElementNodes(name))
yield return descendent;
}
}
public static void ResolveAllPaths(this XmlDocument csproj, string project_path)
{
var dir = System.IO.Path.GetDirectoryName(project_path);
var nodes_with_paths = new string[]
{
"AssemblyOriginatorKeyFile",
"CodesignEntitlements",
"TestLibrariesDirectory",
"HintPath",
};
var attributes_with_paths = new string[][]
{
new string [] { "None", "Include" },
new string [] { "Compile", "Include" },
new string [] { "Compile", "Exclude" },
new string [] { "ProjectReference", "Include" },
new string [] { "InterfaceDefinition", "Include" },
new string [] { "BundleResource", "Include" },
new string [] { "EmbeddedResource", "Include" },
new string [] { "ImageAsset", "Include" },
new string [] { "GeneratedTestInput", "Include" },
new string [] { "GeneratedTestOutput", "Include" },
new string [] { "TestLibrariesInput", "Include" },
new string [] { "TestLibrariesOutput", "Include" },
new string [] { "Content", "Include" },
new string [] { "ObjcBindingApiDefinition", "Include" },
new string [] { "ObjcBindingCoreSource", "Include" },
new string [] { "ObjcBindingNativeLibrary", "Include" },
new string [] { "ObjcBindingNativeFramework", "Include" },
new string [] { "Import", "Project", "CustomBuildActions.targets" },
new string [] { "FilesToCopy", "Include" },
new string [] { "FilesToCopyFoo", "Include" },
new string [] { "FilesToCopyFooBar", "Include" },
new string [] { "FilesToCopyEncryptedXml", "Include" },
new string [] { "FilesToCopyCryptographyPkcs", "Include" },
new string [] { "FilesToCopyResources", "Include" },
new string [] { "FilesToCopyXMLFiles", "Include" },
new string [] { "FilesToCopyChannels", "Include" },
new string [] { "CustomMetalSmeltingInput", "Include" },
new string [] { "Metal", "Include" },
};
var nodes_with_variables = new string[]
{
"MtouchExtraArgs",
};
Func<string, string> convert = (input) =>
{
if (input[0] == '/')
return input; // This is already a full path.
if (input.StartsWith("$(MSBuildExtensionsPath)", StringComparison.Ordinal))
return input; // This is already a full path.
if (input.StartsWith("$(MSBuildBinPath)", StringComparison.Ordinal))
return input; // This is already a full path.
input = input.Replace('\\', '/'); // make unix-style
input = System.IO.Path.GetFullPath(System.IO.Path.Combine(dir, input));
input = input.Replace('/', '\\'); // make windows-style again
return input;
};
foreach (var key in nodes_with_paths)
{
var nodes = csproj.SelectElementNodes(key);
foreach (var node in nodes)
node.InnerText = convert(node.InnerText);
}
foreach (var key in nodes_with_variables)
{
var nodes = csproj.SelectElementNodes(key);
foreach (var node in nodes)
{
node.InnerText = node.InnerText.Replace("${ProjectDir}", StringUtils.Quote(System.IO.Path.GetDirectoryName(project_path)));
}
}
foreach (var kvp in attributes_with_paths)
{
var element = kvp[0];
var attrib = kvp[1];
var nodes = csproj.SelectElementNodes(element);
foreach (XmlNode node in nodes)
{
var a = node.Attributes[attrib];
if (a == null)
continue;
// entries after index 2 is a list of values to filter the attribute value against.
var found = kvp.Length == 2;
var skipLogicalName = kvp.Length > 2;
for (var i = 2; i < kvp.Length; i++)
found |= a.Value == kvp[i];
if (!found)
continue;
// Fix any default LogicalName values (but don't change existing ones).
var ln = node.SelectElementNodes("LogicalName")?.SingleOrDefault();
var links = node.SelectElementNodes("Link");
if (!skipLogicalName && ln == null && !links.Any())
{
ln = csproj.CreateElement("LogicalName", MSBuild_Namespace);
node.AppendChild(ln);
string logicalName = a.Value;
switch (element)
{
case "BundleResource":
if (logicalName.StartsWith("Resources\\", StringComparison.Ordinal))
logicalName = logicalName.Substring("Resources\\".Length);
break;
default:
break;
}
ln.InnerText = logicalName;
}
a.Value = convert(a.Value);
}
}
}
}
}
| 43.444334 | 171 | 0.531953 | [
"MIT"
] | MaximLipnin/xharness | src/Microsoft.DotNet.XHarness.iOS.Shared/Utilities/ProjectFileExtensions.cs | 43,705 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyDescription("A console sample for the Nyan data service stack")]
[assembly: AssemblyCompany("Nyan Development Team")]
[assembly: AssemblyCopyright("Copyright © 2015 Nyan Development Team")]
[assembly: AssemblyTitle("Nyan.Samples.Console")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Nyan.Samples.Console")]
[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("2d2feaf5-588f-4914-a767-1886633efdcd")]
// 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("0.1.*")]
| 39.432432 | 84 | 0.75257 | [
"MIT"
] | bucknellu/Nyan | samples/Console/Properties/AssemblyInfo.cs | 1,462 | C# |
// 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.Data;
using System.Threading.Tasks;
using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
// ReSharper disable InconsistentNaming
namespace Microsoft.EntityFrameworkCore
{
public class ExistingConnectionTest
{
// See aspnet/Data#135
[ConditionalFact]
public Task Can_use_an_existing_closed_connection()
{
return Can_use_an_existing_closed_connection_test(openConnection: false);
}
[ConditionalFact]
public Task Can_use_an_existing_open_connection()
{
return Can_use_an_existing_closed_connection_test(openConnection: true);
}
private static async Task Can_use_an_existing_closed_connection_test(bool openConnection)
{
var serviceProvider = new ServiceCollection()
.AddEntityFrameworkSqlServer()
.BuildServiceProvider();
using (var store = SqlServerTestStore.GetNorthwindStore())
{
store.CloseConnection();
var openCount = 0;
var closeCount = 0;
var disposeCount = 0;
using (var connection = new SqlConnection(store.ConnectionString))
{
if (openConnection)
{
await connection.OpenAsync();
}
connection.StateChange += (_, a) =>
{
switch (a.CurrentState)
{
case ConnectionState.Open:
openCount++;
break;
case ConnectionState.Closed:
closeCount++;
break;
}
};
connection.Disposed += (_, __) => disposeCount++;
using (var context = new NorthwindContext(serviceProvider, connection))
{
Assert.Equal(91, await context.Customers.CountAsync());
}
if (openConnection)
{
Assert.Equal(ConnectionState.Open, connection.State);
Assert.Equal(0, openCount);
Assert.Equal(0, closeCount);
}
else
{
Assert.Equal(ConnectionState.Closed, connection.State);
Assert.Equal(1, openCount);
Assert.Equal(1, closeCount);
}
Assert.Equal(0, disposeCount);
}
}
}
private class NorthwindContext : DbContext
{
private readonly IServiceProvider _serviceProvider;
private readonly SqlConnection _connection;
public NorthwindContext(IServiceProvider serviceProvider, SqlConnection connection)
{
_serviceProvider = serviceProvider;
_connection = connection;
}
// ReSharper disable once UnusedAutoPropertyAccessor.Local
public DbSet<Customer> Customers { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder
.UseSqlServer(_connection, b => b.ApplyConfiguration())
.UseInternalServiceProvider(_serviceProvider);
protected override void OnModelCreating(ModelBuilder modelBuilder)
=> modelBuilder.Entity<Customer>(
b =>
{
b.HasKey(c => c.CustomerID);
b.ToTable("Customers");
});
}
// ReSharper disable once ClassNeverInstantiated.Local
private class Customer
{
// ReSharper disable once UnusedAutoPropertyAccessor.Local
public string CustomerID { get; set; }
// ReSharper disable UnusedMember.Local
public string CompanyName { get; set; }
public string Fax { get; set; }
}
}
}
| 35.209302 | 111 | 0.52576 | [
"Apache-2.0"
] | CharlieRoseMarie/EntityFrameworkCore | test/EFCore.SqlServer.FunctionalTests/ExistingConnectionTest.cs | 4,542 | C# |
using System.Web;
using System.Web.Optimization;
namespace FSL.eBook.RWP.DesignPatterns
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
}
}
| 39.28125 | 112 | 0.57677 | [
"MIT"
] | fabiosilvalima/FSL.EbookRealWorldProgramming | FSL.eBook.RWP.DesignPatterns/App_Start/BundleConfig.cs | 1,259 | C# |
using MySql.Data.MySqlClient;
using Newtonsoft.Json;
using Panuon.UI.Silver;
using Panuon.UI.Silver.Core;
using PartialViewInterface;
using PartialViewInterface.Commands;
using PartialViewInterface.Utils;
using PartialViewMySqlBackUp.BackUp;
using PartialViewMySqlBackUp.Models;
using Quartz;
using Quartz.Impl;
using Quartz.Impl.Matchers;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace PartialViewMySqlBackUp.ViewModels
{
public class MySqlBackUpViewModel : DependencyObject
{
private static MySqlBackUpViewModel instance;
private static readonly object locker = new object();
public static MySqlBackUpViewModel Instance()
{
if (instance == null)
{
lock (locker)
{
if (instance == null)
{
instance = new MySqlBackUpViewModel();
}
}
}
return instance;
}
public DelegateCommand TaskStartCommand { get; set; }
public DelegateCommand TaskStopCommand { get; set; }
public DelegateCommand ManualExecuteCommand { get; set; }
public DelegateCommand RemovePolicyCommand { get; set; }
public DelegateCommand AddPolicyCommand { get; set; }
public DelegateCommand ChooseAllCommand { get; set; }
public DelegateCommand RecoverDefaultCommand { get; set; }
public DelegateCommand EditPolicyCommand { get; set; }
private MySqlBackUpViewModel()
{
TaskStartCommand = new DelegateCommand();
TaskStopCommand = new DelegateCommand();
ManualExecuteCommand = new DelegateCommand();
RemovePolicyCommand = new DelegateCommand();
AddPolicyCommand = new DelegateCommand();
ChooseAllCommand = new DelegateCommand();
RecoverDefaultCommand = new DelegateCommand();
EditPolicyCommand = new DelegateCommand();
TaskStartCommand.ExecuteAction = Start;
TaskStopCommand.ExecuteAction = Stop;
ManualExecuteCommand.ExecuteAction = ManualExecute;
RemovePolicyCommand.ExecuteAction = RemovePolicy;
AddPolicyCommand.ExecuteAction = AddPolicy;
ChooseAllCommand.ExecuteAction = ChooseAll;
RecoverDefaultCommand.ExecuteAction = RecoverDefault;
EditPolicyCommand.ExecuteAction = EditPolicy;
Policys = new ObservableCollection<BackUpPolicy>();
Tables = new ObservableCollection<BackUpTable>();
Databases = new ObservableCollection<BackUpDatabase>();
CurrentPolicy = new BackUpPolicy();
CurrentPolicy.SelectedDatabase = EnvironmentInfo.SelectedDatabase;
CurrentPolicyBak = DeepCopy(CurrentPolicy);
ReadPolicyConfig();
GetTables();
ProcessHelper.ShowOutputMessage += ProcessHelper_ShowOutputMessage;
Message = "说明:\r\n1)全库备份,是完整备份。基础业务备份,是只备份核心业务数据。\r\n2)哪些表数据属于核心业务,系统已经默认配置了,也可以自行勾选,但是建议只多不少。\r\n3)如果要全部勾选,建议就不要配置为基础业务备份,直接使用全库备份即可。\r\n4)基础业务的备份频率一定要高于全库备份,因为全库备份包含了一些历史表,会很大。\r\n5)配置策略之后,重新启动不需要再去点执行任务,系统会自动执行。\r\n";
}
private void ProcessHelper_ShowOutputMessage(string message)
{
ShowMessage(message);
}
IScheduler scheduler = EnvironmentInfo.scheduler;
private void Start(object parameter)
{
if (string.IsNullOrEmpty(TaskBackUpPath))
{
MessageBoxHelper.MessageBoxShowWarning("请配置保存文件的路径!");
return;
}
if (TaskBackUpPath.ToLower().StartsWith("c:"))
{
if (MessageBoxHelper.MessageBoxShowQuestion("请确认是否将备份文件保存的C盘?") == MessageBoxResult.No)
{
return;
}
}
foreach (var policy in Policys)
{
string cron = ConvertToCron(policy);
string cronNoDB = ConvertToCronNoDbName(policy);
if (policy.BackUpType == BackUpType.DataBase)
{
var jobIdentity = $"DataBaseBackUpJob-{cron}";
var triggerKey = scheduler.GetTriggerKeys(GroupMatcher<TriggerKey>.GroupEquals("scheduler")).Where(x => x.Name == jobIdentity).FirstOrDefault();
if (triggerKey != null)
{
scheduler.UnscheduleJob(triggerKey);
}
var job = JobBuilder.Create(typeof(DataBaseBackUpJob))
.WithIdentity(jobIdentity, "scheduler")
.UsingJobData("DatabaseName", policy.SelectedDatabase)
.Build();
var trigger = TriggerBuilder.Create()
.StartNow()
.WithIdentity(jobIdentity, "scheduler")
.WithCronSchedule(cronNoDB)
.Build();
scheduler.ScheduleJob(job, trigger);
}
else
{
var jobIdentity = $"TablesBackUpJob-{cron}";
var triggerKey = scheduler.GetTriggerKeys(GroupMatcher<TriggerKey>.GroupEquals("scheduler")).Where(x => x.Name == jobIdentity).FirstOrDefault();
if (triggerKey != null)
{
scheduler.UnscheduleJob(triggerKey);
}
var job = JobBuilder.Create(typeof(TablesBackUpJob))
.WithIdentity(jobIdentity, "scheduler")
.UsingJobData("DatabaseName", policy.SelectedDatabase)
.Build();
var trigger = TriggerBuilder.Create()
.StartNow()
.WithIdentity(jobIdentity, "scheduler")
.WithCronSchedule(cronNoDB)
.Build();
scheduler.ScheduleJob(job, trigger);
}
}
Notice.Show("定时任务已经启动....", "通知", 3, MessageBoxIcon.Success);
}
private void Stop(object parameter)
{
scheduler.PauseJobs(Quartz.Impl.Matchers.GroupMatcher<JobKey>.GroupEquals("BackUp"));
Notice.Show("定时任务已经停止....", "通知", 3, MessageBoxIcon.Success);
}
private void ManualExecute(object parameter)
{
if (string.IsNullOrEmpty(TaskBackUpPath))
{
MessageBoxHelper.MessageBoxShowWarning("请配置文件的路径!");
return;
}
if (!(CurrentPolicy.IsTaskBackUpDataBase || CurrentPolicy.IsTaskBackUpTables))
{
MessageBoxHelper.MessageBoxShowWarning("请选择备份类型!");
return;
}
if (TaskBackUpPath.ToLower().StartsWith("c:"))
{
if (MessageBoxHelper.MessageBoxShowQuestion("请确认是否将备份文件保存的C盘?") == MessageBoxResult.No)
{
return;
}
}
if (CurrentPolicy.IsTaskBackUpDataBase)
{
var policies = Policys.Where(x => x.BackUpType == BackUpType.DataBase);
if (policies.Any())
{
foreach (var policy in Policys)
{
var databaseName = policy.SelectedDatabase;
ExecuteBackUp executeBackUp = new ExecuteBackUp();
Task.Factory.StartNew(() =>
{
executeBackUp.BackUpDataBase(databaseName);
});
}
}
else
{
MessageBoxHelper.MessageBoxShowWarning("未配置全库备份类型的策略,请确认!");
return;
}
}
if (CurrentPolicy.IsTaskBackUpTables)
{
var policies = Policys.Where(x => x.BackUpType == BackUpType.Tables);
if (policies.Any())
{
foreach (var policy in policies)
{
var databaseName = policy.SelectedDatabase;
ExecuteBackUp executeBackUp = new ExecuteBackUp();
Task.Factory.StartNew(() =>
{
executeBackUp.BackUpTables(databaseName);
});
}
}
else
{
MessageBoxHelper.MessageBoxShowWarning("未配置基础业务备份类型的策略,请确认!");
return;
}
}
}
#region 数据转换
private BackUpPolicy ConvertToPolicy(string cron)
{
BackUpPolicy policy = new BackUpPolicy();
string[] cronArry = cron.Split(' ');
int second = int.Parse(cronArry[0]);
int minute = int.Parse(cronArry[1]);
int hour = int.Parse(cronArry[2]);
policy.SelectedTime = DateTime.Now.Date.AddHours(hour).AddMinutes(minute).AddSeconds(second);
string dayOfWeek = cronArry[5];
string[] week = dayOfWeek.Split(',');
foreach (var day in week)
{
switch (day)
{
case "1":
policy.Sunday = true;
break;
case "2":
policy.Monday = true;
break;
case "3":
policy.Tuesday = true;
break;
case "4":
policy.Wednesday = true;
break;
case "5":
policy.Thursday = true;
break;
case "6":
policy.Friday = true;
break;
case "7":
policy.Saturday = true;
break;
}
}
var databaseName = cronArry[6];
policy.SelectedDatabase = databaseName;
return policy;
}
private string ConvertToCronNoDbName(BackUpPolicy policy)
{
//周日 1 周一 2...
//0 15 10 ? * 1,5 每周日,周四 上午10:15分执行
string second = policy.SelectedTime.ToString("ss");//秒
string minute = policy.SelectedTime.ToString("mm");
string hour = policy.SelectedTime.ToString("HH");
string dayOfWeek = "";
if (policy.Sunday)
{
dayOfWeek += "1,";
}
if (policy.Monday)
{
dayOfWeek += "2,";
}
if (policy.Tuesday)
{
dayOfWeek += "3,";
}
if (policy.Wednesday)
{
dayOfWeek += "4,";
}
if (policy.Thursday)
{
dayOfWeek += "5,";
}
if (policy.Friday)
{
dayOfWeek += "6,";
}
if (policy.Saturday)
{
dayOfWeek += "7";
}
return $"{second} {minute} {hour} ? * {dayOfWeek.Trim(',')}";
}
private string ConvertToCron(BackUpPolicy policy)
{
var cron = ConvertToCronNoDbName(policy);
return $"{cron} {policy.SelectedDatabase}";
}
#endregion
private void RemovePolicy(object parameter)
{
BackUpPolicy policy = Policys.FirstOrDefault(x => x.PolicyToString == CurrentPolicyBak.PolicyToString);
if (policy != null)
{
Policys.Remove(policy);
WritePolicyConfig();
Clear();
Notice.Show("策略已移除成功", "通知", 3, MessageBoxIcon.Success);
}
else
{
MessageBoxHelper.MessageBoxShowWarning("请选择你需要移除的策略");
}
}
private void AddPolicy(object parameter)
{
if (CheckDayOfWeek())
{
return;
}
if (CurrentPolicy.BackUpType == BackUpType.Tables && !Tables.Any(x => x.IsChecked))
{
MessageBoxHelper.MessageBoxShowWarning("当前备份类型为按业务表备份,但是未选择需要备份的表,请确认!");
return;
}
CurrentPolicy.SelectedTime = (DateTime)parameter;//通过绑定无法获取到值 原因不明
BackUpPolicy policy = Policys.FirstOrDefault(x => x.BackUpType == CurrentPolicy.BackUpType //备份类型
&& x.SelectedDatabase == CurrentPolicy.SelectedDatabase); //选中的数据库
if (policy == null)
{
Policys.Add(new BackUpPolicy()
{
Sunday = CurrentPolicy.Sunday,
Monday = CurrentPolicy.Monday,
Tuesday = CurrentPolicy.Tuesday,
Wednesday = CurrentPolicy.Wednesday,
Thursday = CurrentPolicy.Thursday,
Friday = CurrentPolicy.Friday,
Saturday = CurrentPolicy.Saturday,
SelectedTime = CurrentPolicy.SelectedTime,
IsTaskBackUpDataBase = CurrentPolicy.IsTaskBackUpDataBase,
IsTaskBackUpTables = CurrentPolicy.IsTaskBackUpTables,
ItemString = CurrentPolicy.PolicyToString,
SelectedDatabase = CurrentPolicy.SelectedDatabase
});
Notice.Show("策略已添加成功", "通知", 3);
}
else
{
policy.Sunday = CurrentPolicy.Sunday;
policy.Monday = CurrentPolicy.Monday;
policy.Tuesday = CurrentPolicy.Tuesday;
policy.Wednesday = CurrentPolicy.Wednesday;
policy.Thursday = CurrentPolicy.Thursday;
policy.Friday = CurrentPolicy.Friday;
policy.Saturday = CurrentPolicy.Saturday;
policy.SelectedTime = CurrentPolicy.SelectedTime;
policy.IsTaskBackUpDataBase = CurrentPolicy.IsTaskBackUpDataBase;
policy.IsTaskBackUpTables = CurrentPolicy.IsTaskBackUpTables;
policy.ItemString = CurrentPolicy.PolicyToString;
policy.SelectedDatabase = CurrentPolicy.SelectedDatabase;
Notice.Show("策略已更新成功", "通知", 3, MessageBoxIcon.Success);
}
WritePolicyConfig();
WriteTablesConfig(CurrentPolicy.SelectedDatabase);
}
/// <summary>
/// 深拷贝
/// </summary>
/// <param name="currentPolicy"></param>
/// <returns></returns>
public BackUpPolicy DeepCopy(BackUpPolicy currentPolicy)
{
var model = new BackUpPolicy()
{
Sunday = currentPolicy.Sunday,
Monday = currentPolicy.Monday,
Tuesday = currentPolicy.Tuesday,
Wednesday = currentPolicy.Wednesday,
Thursday = currentPolicy.Thursday,
Friday = currentPolicy.Friday,
Saturday = currentPolicy.Saturday,
SelectedTime = currentPolicy.SelectedTime,
IsTaskBackUpDataBase = currentPolicy.IsTaskBackUpDataBase,
IsTaskBackUpTables = currentPolicy.IsTaskBackUpTables,
ItemString = currentPolicy.PolicyToString,
SelectedDatabase = currentPolicy.SelectedDatabase
};
return model;
}
/// <summary>
/// 编辑策略
/// </summary>
/// <param name="parameter"></param>
private void EditPolicy(object parameter)
{
if (CurrentPolicy.BackUpType != CurrentPolicyBak.BackUpType)
{
MessageBoxHelper.MessageBoxShowWarning("不允许修改备份类型,如需要该类型的策略可选择新增。");
return;
}
AddPolicy(parameter);
}
/// <summary>
/// 从配置文件读取策略
/// </summary>
/// <returns></returns>
public void ReadPolicyConfig()
{
Policys.Clear();
string config = ConfigHelper.ReadAppConfig("TablesBackUpJob");
if (!string.IsNullOrEmpty(config))
{
var policyStrs = config.Split('|');
foreach (var policyStr in policyStrs)
{
BackUpPolicy policy = ConvertToPolicy(policyStr);
policy.IsTaskBackUpTables = true;
policy.ItemString = policy.PolicyToString;
Policys.Add(policy);
}
}
config = ConfigHelper.ReadAppConfig("DataBaseBackUpJob");
if (!string.IsNullOrEmpty(config))
{
var policyStrs = config.Split('|');
foreach (var policyStr in policyStrs)
{
BackUpPolicy policy = ConvertToPolicy(policyStr);
policy.IsTaskBackUpDataBase = true;
policy.ItemString = policy.PolicyToString;
Policys.Add(policy);
}
}
}
/// <summary>
/// 更新策略到配置文件
/// </summary>
/// <returns></returns>
public void WritePolicyConfig()
{
if (Policys == null)
return;
string dataBaseBackUpJobConfig = string.Empty;
string tablesBackUpJobConfig = string.Empty;
foreach (var policy in Policys)
{
var currentPolicyConfig = ConvertToCron(policy);
if (policy.BackUpType == BackUpType.DataBase)
{
dataBaseBackUpJobConfig = $"{dataBaseBackUpJobConfig}|{currentPolicyConfig}";
}
else if (policy.BackUpType == BackUpType.Tables)
{
tablesBackUpJobConfig = $"{tablesBackUpJobConfig}|{currentPolicyConfig}";
}
}
dataBaseBackUpJobConfig = dataBaseBackUpJobConfig.TrimStart('|');
tablesBackUpJobConfig = tablesBackUpJobConfig.TrimStart('|');
ConfigHelper.WriterAppConfig("DataBaseBackUpJob", dataBaseBackUpJobConfig);
ConfigHelper.WriterAppConfig("TablesBackUpJob", tablesBackUpJobConfig);
}
/// <summary>
/// 根据选择的表更新“业务表”配置
/// </summary>
/// <param name="dbName"></param>
public void WriteTablesConfig(string dbName)
{
string BaseDirectoryPath = AppDomain.CurrentDomain.BaseDirectory;
string path = BaseDirectoryPath + "plugs\\BackUpTables.json";
BackUpConfig.SavePath = TaskBackUpPath;
var tablesConfig = BackUpConfig.TablesConfig.FirstOrDefault(x => x.DbName == dbName);
if (tablesConfig == null) //避免数据库名称不是配置文件中的默认数据库名称
{
tablesConfig = new TablesConfig { DbName = dbName, Tables = new List<Table>() };
}
tablesConfig.Tables.Clear();
Tables.ToList().ForEach((x) =>
{
if (x.IsChecked)
{
tablesConfig.Tables.Add(new Table() { TableName = x.TableName });
}
});
File.WriteAllText(path, JsonConvert.SerializeObject(BackUpConfig), Encoding.UTF8);
}
/// <summary>
/// 全选
/// </summary>
/// <param name="parameter"></param>
private void ChooseAll(object parameter)
{
Tables.ToList().ForEach(x => x.IsChecked = IsSelectedAll);
}
/// <summary>
/// 恢复默认
/// </summary>
/// <param name="parameter"></param>
private void RecoverDefault(object parameter)
{
var tablesConfig = BackUpConfig.TablesConfig.FirstOrDefault(x => x.DbName == CurrentPolicy.SelectedDatabase);
if (tablesConfig != null)
{
Tables.ToList().ForEach((x) =>
{
x.IsChecked = tablesConfig.IgnoreTables.FindIndex(t => t.TableName == x.TableName) < 0;
});
}
}
#region 获取配置
public BackUpConfig BackUpConfig { get; set; }
public void GetTables()
{
try
{
string BaseDirectoryPath = AppDomain.CurrentDomain.BaseDirectory;
string path = BaseDirectoryPath + "plugs\\BackUpTables.json";
string jsonData = File.ReadAllText(path);
BackUpConfig = JsonConvert.DeserializeObject<BackUpConfig>(jsonData);
if (BackUpConfig.TablesConfig == null)
{
BackUpConfig.TablesConfig = new List<TablesConfig>() { };
}
TaskBackUpPath = BackUpConfig.SavePath;//文件保存路径
EnvironmentInfo.TaskBackUpPath = BackUpConfig.SavePath;
if (!Directory.Exists(TaskBackUpPath))
{
Directory.CreateDirectory(TaskBackUpPath);
}
//string cmd = "select @@basedir as mysqlpath from dual";
//DataTable dt = MySqlHelper.ExecuteDataset(EnvironmentInfo.ConnectionString, cmd).Tables[0];
//MySqlBinPath = dt.Rows[0][0].ToString() + "\\bin";//获取mysql的bin路径
MySqlBinPath = BaseDirectoryPath;//如果不是在服务器上,那么可能无法获取到mysqldump文件
#region 获取当前数据库服务器下的所有非系统数据库
string sql = $"SHOW DATABASES WHERE `Database` NOT IN ('mysql', 'performance_schema', 'information_schema', 'sys');";
DataTable dt = MySqlHelper.ExecuteDataset(EnvironmentInfo.ConnectionString, sql).Tables[0];
foreach (DataRow dr in dt.Rows)
{
BackUpDatabase database = new BackUpDatabase() { DatabaseName = dr["DATABASE"].ToString() };
Databases.Add(database);
if (dr["DATABASE"].ToString() == EnvironmentInfo.DatabaseName2x) //默认选中2.x数据库,触发选中事件,展示左侧数据库表
{
EnvironmentInfo.SelectedDatabase = EnvironmentInfo.DatabaseName2x;
SetTables(EnvironmentInfo.DatabaseName2x);
}
}
#endregion
}
catch (Exception ex)
{
ShowMessage(ex.ToString());
}
}
#endregion
/// <summary>
/// 获取指定库中的表,设置左侧表集合
/// </summary>
/// <param name="dbName">数据库名</param>
public void SetTables(string dbName)
{
if (dbName.IsNullOrEmpty())
{
Notice.Show("未配置备份数据库,请确认!", "通知", 3, MessageBoxIcon.Warning);
return;
}
var tablesConfig = BackUpConfig.TablesConfig.FirstOrDefault(x => x.DbName == dbName);
if (tablesConfig == null)
{
tablesConfig = new TablesConfig
{
DbName = dbName,
Tables = new List<Table>()
};
}
Tables.Clear();
var sql = $"select table_name from information_schema.`TABLES` where TABLE_SCHEMA='{dbName}';";
var dt = MySqlHelper.ExecuteDataset(EnvironmentInfo.ConnectionString, sql).Tables[0];//获取所有的表
foreach (DataRow dr in dt.Rows)
{
BackUpTable backUpTable = new BackUpTable() { TableName = dr["table_name"].ToString(), IsChecked = false };
tablesConfig.Tables.ForEach((x) =>
{
if (x.TableName == dr["table_name"].ToString())
{
backUpTable.IsChecked = true;
}
});
Tables.Add(backUpTable);
}
}
#region 校验数据
private void Clear()
{
CurrentPolicy.Sunday = false;
CurrentPolicy.Monday = false;
CurrentPolicy.Tuesday = false;
CurrentPolicy.Wednesday = false;
CurrentPolicy.Thursday = false;
CurrentPolicy.Friday = false;
CurrentPolicy.Saturday = false;
CurrentPolicy.IsTaskBackUpDataBase = false;
CurrentPolicy.IsTaskBackUpTables = false;
}
/// <summary>
/// 校验周期中的星期几是否被占用
/// 原则:避免同一天(只校验星期几,不校验时分秒)有多个策略,减少数据库压力。
/// 修改前:由于最多只有两个策略(全库/业务表),所以只需判断周期中的某天是否存在两个一个类型的策略即可
/// 修改后:由于可能存在多个库的多个策略,所以如果周期中的某天存在其他策略,即为占用。否则为未占用。
/// </summary>
/// <returns></returns>
private bool CheckDayOfWeek()
{
if (!CurrentPolicy.Sunday
&& !CurrentPolicy.Monday
&& !CurrentPolicy.Monday
&& !CurrentPolicy.Tuesday
&& !CurrentPolicy.Wednesday
&& !CurrentPolicy.Thursday
&& !CurrentPolicy.Friday
&& !CurrentPolicy.Saturday)
{
MessageBoxHelper.MessageBoxShowWarning("请至少选择一个周期!");
return true;
}
if (!CurrentPolicy.IsTaskBackUpDataBase && !CurrentPolicy.IsTaskBackUpTables)
{
MessageBoxHelper.MessageBoxShowWarning("请选择备份类型!");
return true;
}
BackUpPolicy policy;
if (CurrentPolicy.Sunday)
{
policy = Policys.FirstOrDefault(x => x.Sunday && x.SelectedDatabase != CurrentPolicy.SelectedDatabase);
if (policy != null)
{
CurrentPolicy.Sunday = false;
}
}
if (CurrentPolicy.Monday)
{
policy = Policys.FirstOrDefault(x => x.Monday && x.SelectedDatabase != CurrentPolicy.SelectedDatabase);
if (policy != null)
{
CurrentPolicy.Monday = false;
}
}
if (CurrentPolicy.Tuesday)
{
policy = Policys.FirstOrDefault(x => x.Tuesday && x.SelectedDatabase != CurrentPolicy.SelectedDatabase);
if (policy != null)
{
CurrentPolicy.Tuesday = false;
}
}
if (CurrentPolicy.Wednesday)
{
policy = Policys.FirstOrDefault(x => x.Wednesday && x.SelectedDatabase != CurrentPolicy.SelectedDatabase);
if (policy != null)
{
CurrentPolicy.Wednesday = false;
}
}
if (CurrentPolicy.Thursday)
{
policy = Policys.FirstOrDefault(x => x.Thursday && x.SelectedDatabase != CurrentPolicy.SelectedDatabase);
if (policy != null)
{
CurrentPolicy.Thursday = false;
}
}
if (CurrentPolicy.Friday)
{
policy = Policys.FirstOrDefault(x => x.Friday && x.SelectedDatabase != CurrentPolicy.SelectedDatabase);
if (policy != null)
{
CurrentPolicy.Friday = false;
}
}
if (CurrentPolicy.Saturday)
{
policy = Policys.FirstOrDefault(x => x.Saturday && x.SelectedDatabase != CurrentPolicy.SelectedDatabase);
if (policy != null)
{
CurrentPolicy.Saturday = false;
}
}
if (!CurrentPolicy.Sunday
&& !CurrentPolicy.Monday
&& !CurrentPolicy.Monday
&& !CurrentPolicy.Tuesday
&& !CurrentPolicy.Wednesday
&& !CurrentPolicy.Thursday
&& !CurrentPolicy.Friday
&& !CurrentPolicy.Saturday)
{
MessageBoxHelper.MessageBoxShowWarning("已有策略占用了选定周期,请至少选择一个有效的周期!");
return true;
}
return false;
}
#endregion
public void ShowMessage(string message)
{
this.Dispatcher.Invoke(new Action(() =>
{
if (Message != null && Message.Length > 5000)
{
Message = string.Empty;
}
if (message.Length > 0)
{
Message += $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} {message}{Environment.NewLine}";
}
}));
}
#region 属性
public string MySqlBinPath { get; set; }
public ObservableCollection<BackUpTable> Tables { get; set; }
/// <summary>
/// 需备份的数据库的集合
/// </summary>
public ObservableCollection<BackUpDatabase> Databases { get; set; }
public ObservableCollection<BackUpPolicy> Policys { get; set; }
/// <summary>
/// 当前选中的策略
/// </summary>
public BackUpPolicy CurrentPolicy { get; set; }
/// <summary>
/// 当前选中的策略的备份,用于记录修改前的值
/// </summary>
public BackUpPolicy CurrentPolicyBak { get; set; }
/// <summary>
/// 全选
/// </summary>
public bool IsSelectedAll
{
get { return (bool)GetValue(IsSelectedAllProperty); }
set { SetValue(IsSelectedAllProperty, value); }
}
// Using a DependencyProperty as the backing store for IsSelectedAll. This enables animation, styling, binding, etc...
public static readonly DependencyProperty IsSelectedAllProperty =
DependencyProperty.Register("IsSelectedAll", typeof(bool), typeof(MySqlBackUpViewModel));
/// <summary>
/// 文件保存路径-任务
/// </summary>
public string TaskBackUpPath
{
get { return (string)GetValue(TaskBackUpPathProperty); }
set { SetValue(TaskBackUpPathProperty, value); }
}
// Using a DependencyProperty as the backing store for AutoBackUpPath. This enables animation, styling, binding, etc...
public static readonly DependencyProperty TaskBackUpPathProperty =
DependencyProperty.Register("TaskBackUpPath", typeof(string), typeof(MySqlBackUpViewModel));
/// <summary>
/// 是否备份全库-手动
/// </summary>
public bool IsManualBackUpDataBase
{
get { return (bool)GetValue(IsManualBackUpDataBaseProperty); }
set { SetValue(IsManualBackUpDataBaseProperty, value); }
}
// Using a DependencyProperty as the backing store for IsManualBackUpDataBase. This enables animation, styling, binding, etc...
public static readonly DependencyProperty IsManualBackUpDataBaseProperty =
DependencyProperty.Register("IsManualBackUpDataBase", typeof(bool), typeof(MySqlBackUpViewModel));
public string Message
{
get { return (string)GetValue(MessageProperty); }
set { SetValue(MessageProperty, value); }
}
// Using a DependencyProperty as the backing store for Message. This enables animation, styling, binding, etc...
public static readonly DependencyProperty MessageProperty =
DependencyProperty.Register("Message", typeof(string), typeof(MySqlBackUpViewModel));
#endregion
}
}
| 36.897936 | 232 | 0.516923 | [
"Apache-2.0"
] | HalfAmazing/JieLink.DevOps | JieLinkDevOpsApp/PartialView/PartialViewMySqlBackUp/ViewModels/MySqlBackUpViewModel.cs | 33,905 | C# |
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;
namespace Scifinity.Core.Models
{
public record Command
{
[JsonPropertyName("position")]
public int Position { get; init; }
[JsonPropertyName("command_text")]
public string CommandText { get; init; }
}
}
| 22.1875 | 48 | 0.676056 | [
"MIT"
] | KiptoonKipkurui/scifinity | src/Scifinity.Core/Models/Command.cs | 357 | C# |
/**
* Copyright 2015 Canada Health Infoway, Inc.
*
* 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.
*
* Author: $LastChangedBy: tmcgrady $
* Last modified: $LastChangedDate: 2011-05-04 15:47:15 -0400 (Wed, 04 May 2011) $
* Revision: $LastChangedRevision: 2623 $
*/
/* This class was auto-generated by the message builder generator tools. */
namespace Ca.Infoway.Messagebuilder.Model.Ab_r02_04_03_imm.Immunization.Poiz_mt061150ab {
using Ca.Infoway.Messagebuilder.Annotation;
using Ca.Infoway.Messagebuilder.Datatype;
using Ca.Infoway.Messagebuilder.Datatype.Impl;
using Ca.Infoway.Messagebuilder.Domainvalue;
using Ca.Infoway.Messagebuilder.Model;
using Ca.Infoway.Messagebuilder.Model.Ab_r02_04_03_imm.Merged;
using System;
using System.Collections.Generic;
/**
* <summary>Business Name: Vaccine</summary>
*
* <p>Allows vaccines to be clearly described and referenced.
* Also allows searching for and examining information about
* vaccines that have been administered to a patient.</p> <p>A
* pharmaceutical product to be supplied and/or administered to
* a patient. Encompasses manufactured vaccines and generic
* classifications.</p>
*/
[Hl7PartTypeMappingAttribute(new string[] {"POIZ_MT061150AB.Vaccine"})]
public class Vaccine : MessagePartBean {
private CV code;
private ST lotNumberText;
private Ca.Infoway.Messagebuilder.Model.Ab_r02_04_03_imm.Merged.Manufacturer asManufacturedProductManufacturer;
private IList<Ca.Infoway.Messagebuilder.Model.Ab_r02_04_03_imm.Immunization.Poiz_mt061150ab.Antigen> ingredientsIngredientAntigen;
public Vaccine() {
this.code = new CVImpl();
this.lotNumberText = new STImpl();
this.ingredientsIngredientAntigen = new List<Ca.Infoway.Messagebuilder.Model.Ab_r02_04_03_imm.Immunization.Poiz_mt061150ab.Antigen>();
}
/**
* <summary>Business Name: Vaccine Code</summary>
*
* <remarks>Relationship: POIZ_MT061150AB.Vaccine.code
* Conformance/Cardinality: MANDATORY (1) <p>Used to ensure
* clear communication by uniquely identifying a particular
* drug product when prescribing or dispensing. This attribute
* is mandatory because it is expected that vaccine codes will
* always be specified.</p> <p>An identifier for a type of
* drug. Depending on where the drug is being referenced, the
* drug may be identified at different levels of abstraction.
* E.g. Manufactured drug (including vaccine).</p></remarks>
*/
[Hl7XmlMappingAttribute(new string[] {"code"})]
public ClinicalDrug Code {
get { return (ClinicalDrug) this.code.Value; }
set { this.code.Value = value; }
}
/**
* <summary>Business Name: Vaccine Lot Number</summary>
*
* <remarks>Relationship: POIZ_MT061150AB.Vaccine.lotNumberText
* Conformance/Cardinality: REQUIRED (0-1) <p>Useful in
* tracking for recalls but may not always be known (e.g.
* historical immunization records).</p> <p>Identification of a
* batch in which a specific manufactured drug belongs.</p></remarks>
*/
[Hl7XmlMappingAttribute(new string[] {"lotNumberText"})]
public String LotNumberText {
get { return this.lotNumberText.Value; }
set { this.lotNumberText.Value = value; }
}
/**
* <summary>Relationship:
* POIZ_MT061150AB.ManufacturedProduct.manufacturer</summary>
*
* <remarks>Conformance/Cardinality: MANDATORY (1)</remarks>
*/
[Hl7XmlMappingAttribute(new string[] {"asManufacturedProduct/manufacturer"})]
public Ca.Infoway.Messagebuilder.Model.Ab_r02_04_03_imm.Merged.Manufacturer AsManufacturedProductManufacturer {
get { return this.asManufacturedProductManufacturer; }
set { this.asManufacturedProductManufacturer = value; }
}
/**
* <summary>Relationship:
* POIZ_MT061150AB.Ingredients.ingredientAntigen</summary>
*
* <remarks>Conformance/Cardinality: MANDATORY (1)</remarks>
*/
[Hl7XmlMappingAttribute(new string[] {"ingredients/ingredientAntigen"})]
public IList<Ca.Infoway.Messagebuilder.Model.Ab_r02_04_03_imm.Immunization.Poiz_mt061150ab.Antigen> IngredientsIngredientAntigen {
get { return this.ingredientsIngredientAntigen; }
}
}
} | 46.070175 | 147 | 0.662795 | [
"ECL-2.0",
"Apache-2.0"
] | CanadaHealthInfoway/message-builder-dotnet | message-builder-release-ab-r02_04_03_imm/Main/Ca/Infoway/Messagebuilder/Model/Ab_r02_04_03_imm/Immunization/Poiz_mt061150ab/Vaccine.cs | 5,252 | C# |
namespace mltest
{
using Microsoft.ML.Runtime.Api;
using Microsoft.ML.Runtime.Data;
public class JokeModelPrediction
{
[ColumnName(DefaultColumnNames.PredictedLabel)]
public string Category { get; set; }
}
}
| 20.5 | 55 | 0.674797 | [
"MIT"
] | MilenaPetkanova/FunNotFunApp | ml/JokeModelPrediction.cs | 248 | C# |
/*****************************************************************************
Copyright 2018 The TensorFlow.NET Authors. 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.
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.Protobuf.Collections;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Tensorflow.Util;
namespace Tensorflow
{
/// <summary>
/// Represents a graph node that performs computation on tensors.
///
/// An `Operation` is a node in a TensorFlow `Graph` that takes zero or
/// more `Tensor` objects as input, and produces zero or more `Tensor`
/// objects as output. Objects of type `Operation` are created by
/// calling an op constructor(such as `tf.matmul`)
/// or `tf.Graph.create_op`.
///
/// For example `c = tf.matmul(a, b)` creates an `Operation` of type
/// "MatMul" that takes tensors `a` and `b` as input, and produces `c`
/// as output.
///
/// After the graph has been launched in a session, an `Operation` can
/// be executed by passing it to
/// `tf.Session.run`.
/// `op.run()` is a shortcut for calling `tf.get_default_session().run(op)`.
/// </summary>
public partial class Operation : ITensorOrOperation
{
private readonly IntPtr _handle; // _c_op in python
private readonly Graph _graph;
private NodeDef _node_def;
public string type => OpType;
public Graph graph => _graph;
public int _id => _id_value;
public int _id_value { get; set; }
public Operation op => this;
public TF_DataType dtype => TF_DataType.DtInvalid;
public string name => _handle == IntPtr.Zero ? null : c_api.StringPiece(c_api.TF_OperationName(_handle));
public string OpType => _handle == IntPtr.Zero ? null : c_api.StringPiece(c_api.TF_OperationOpType(_handle));
public string Device => _handle == IntPtr.Zero ? null : c_api.StringPiece(c_api.TF_OperationDevice(_handle));
bool _is_stateful;
public NodeDef node_def
{
get
{
if (_node_def == null)
_node_def = GetNodeDef();
return _node_def;
}
}
public Operation(IntPtr handle, Graph g = null)
{
if (handle == IntPtr.Zero)
return;
_handle = handle;
_graph = g ?? ops.get_default_graph();
_outputs = new Tensor[NumOutputs];
for (int i = 0; i < NumOutputs; i++)
_outputs[i] = new Tensor(this, i, OutputType(i));
// Dict mapping op name to file and line information for op colocation
// context managers.
_control_flow_context = _graph._get_control_flow_context();
// Note: _control_flow_post_processing() must not be called here, the caller is responsible for calling it when using this constructor.
}
/*public Operation(Graph g, string opType, string oper_name)
{
_graph = g;
var _operDesc = c_api.TF_NewOperation(g, opType, oper_name);
c_api.TF_SetAttrType(_operDesc, "dtype", TF_DataType.TF_INT32);
lock (Locks.ProcessWide)
using (var status = new Status())
{
_handle = c_api.TF_FinishOperation(_operDesc, status);
status.Check(true);
}
// Dict mapping op name to file and line information for op colocation
// context managers.
_control_flow_context = graph._get_control_flow_context();
}*/
/// <summary>
/// Creates an `Operation`.
/// </summary>
/// <param name="node_def">`node_def_pb2.NodeDef`. `NodeDef` for the `Operation`.</param>
/// <param name="g">`Graph`. The parent graph.</param>
/// <param name="inputs">list of `Tensor` objects. The inputs to this `Operation`.</param>
/// <param name="output_types">list of `DType` objects.</param>
/// <param name="control_inputs">
/// list of operations or tensors from which to have a
/// control dependency.
/// </param>
/// <param name="input_types">
/// List of `DType` objects representing the
/// types of the tensors accepted by the `Operation`. By default
/// uses `[x.dtype.base_dtype for x in inputs]`. Operations that expect
/// reference-typed inputs must specify these explicitly.
/// </param>
/// <param name="original_op"></param>
/// <param name="op_def"></param>
public Operation(NodeDef node_def, Graph g, Tensor[] inputs = null, TF_DataType[] output_types = null, ITensorOrOperation[] control_inputs = null, TF_DataType[] input_types = null, string original_op = "", OpDef op_def = null)
{
_graph = g;
// Build the list of control inputs.
var control_input_ops = new List<Operation>();
if (control_inputs != null)
{
foreach (var c in control_inputs)
{
switch (c)
{
case Operation c1:
control_input_ops.Add(c1);
break;
case Tensor tensor:
control_input_ops.Add(tensor.op);
break;
// TODO: IndexedSlices don't yet exist, but once they do, this needs to be uncommented
//case IndexedSlices islices:
// control_input_ops.Add(islices.op);
// break;
default:
throw new NotImplementedException($"Control input must be an Operation, a Tensor, or IndexedSlices: {c}");
}
}
}
_id_value = _graph._next_id();
// Dict mapping op name to file and line information for op colocation
// context managers.
_control_flow_context = graph._get_control_flow_context();
// This will be set by self.inputs.
if (op_def == null)
op_def = g.GetOpDef(node_def.Op);
var grouped_inputs = _reconstruct_sequence_inputs(op_def, inputs, node_def.Attr);
_handle = ops._create_c_op(g, node_def, grouped_inputs, control_input_ops.ToArray());
_is_stateful = op_def.IsStateful;
// Initialize self._outputs.
output_types = new TF_DataType[NumOutputs];
for (int i = 0; i < NumOutputs; i++)
output_types[i] = OutputType(i);
_outputs = new Tensor[NumOutputs];
for (int i = 0; i < NumOutputs; i++)
_outputs[i] = new Tensor(this, i, output_types[i]);
graph._add_op(this);
if (_handle != IntPtr.Zero)
_control_flow_post_processing();
}
public void run(FeedItem[] feed_dict = null, Session session = null)
{
ops._run_using_default_session(this, feed_dict, graph, session);
}
private object[] _reconstruct_sequence_inputs(OpDef op_def, Tensor[] inputs, MapField<string, AttrValue> attrs)
{
var grouped_inputs = new List<object>();
int i = 0;
int input_len = 0;
bool is_sequence = false;
foreach (var input_arg in op_def.InputArg)
{
if (!string.IsNullOrEmpty(input_arg.NumberAttr))
{
input_len = (int) attrs[input_arg.NumberAttr].I;
is_sequence = true;
} else if (!string.IsNullOrEmpty(input_arg.TypeListAttr))
{
input_len = attrs[input_arg.TypeListAttr].List.Type.Count;
is_sequence = true;
} else
{
input_len = 1;
is_sequence = false;
}
if (is_sequence)
grouped_inputs.Add(inputs.Skip(i).Take(input_len).ToArray());
else
grouped_inputs.Add(inputs[i]);
i += input_len;
}
return grouped_inputs.ToArray();
}
public T get_attr<T>(string name)
=> (T)get_attr(name);
public object get_attr(string name)
{
AttrValue x = null;
lock (Locks.ProcessWide)
using (var status = new Status())
using (var buf = new Buffer())
{
c_api.TF_OperationGetAttrValueProto(_handle, name, buf, status);
status.Check(true);
x = AttrValue.Parser.ParseFrom(buf.MemoryBlock.Stream());
}
string oneof_value = x.ValueCase.ToString();
if (string.IsNullOrEmpty(oneof_value))
return null;
if (oneof_value == "list")
throw new NotImplementedException($"Unsupported field type in {x.ToString()}");
if (oneof_value == "type")
return x.Type;
object result = x.GetType().GetProperty(oneof_value).GetValue(x);
if (result is Google.Protobuf.ByteString byteString)
return byteString.ToStringUtf8();
return result;
}
public TF_AttrMetadata GetAttributeMetadata(string attr_name, Status s)
{
return c_api.TF_OperationGetAttrMetadata(_handle, attr_name, s);
}
private NodeDef GetNodeDef()
{
lock (Locks.ProcessWide)
using (var s = new Status())
using (var buffer = new Buffer())
{
c_api.TF_OperationToNodeDef(_handle, buffer, s);
s.Check();
return NodeDef.Parser.ParseFrom(buffer.MemoryBlock.Stream());
}
}
/// <summary>
/// Update the input to this operation at the given index.
///
/// NOTE: This is for TF internal use only.Please don't use it.
/// </summary>
/// <param name="index">the index of the input to update.</param>
/// <param name="tensor"> the Tensor to be used as the input at the given index.</param>
public void _update_input(int index, Tensor tensor)
{
_assert_same_graph(tensor);
var input = _tf_input(index);
var output = tensor._as_tf_output();
// Reset cached inputs.
_inputs_val = null;
// after the c_api call next time _inputs is accessed
// the updated inputs are reloaded from the c_api
lock (Locks.ProcessWide)
using (var status = new Status())
{
c_api.UpdateEdge(_graph, output, input, status);
//var updated_inputs = inputs;
status.Check();
}
}
private void _assert_same_graph(Tensor tensor)
{
//TODO: implement
}
/// <summary>
/// Create and return a new TF_Output for output_idx'th output of this op.
/// </summary>
public TF_Output _tf_output(int output_idx)
{
return new TF_Output(op, output_idx);
}
/// <summary>
/// Create and return a new TF_Input for input_idx'th input of this op.
/// </summary>
public TF_Input _tf_input(int input_idx)
{
return new TF_Input(op, input_idx);
}
}
} | 37.953988 | 234 | 0.5453 | [
"Apache-2.0"
] | dcmartin/TensorFlow.NET | src/TensorFlowNET.Core/Operations/Operation.cs | 12,375 | C# |
using UnityEngine;
using Oculus.Avatar;
using System;
using System.Collections.Generic;
public delegate void specificationCallback(IntPtr specification);
public delegate void assetLoadedCallback(OvrAvatarAsset asset);
public delegate void combinedMeshLoadedCallback(IntPtr asset);
public class OvrAvatarSDKManager : MonoBehaviour
{
private static OvrAvatarSDKManager _instance;
private bool initialized = false;
private Dictionary<ulong, HashSet<specificationCallback>> specificationCallbacks;
private Dictionary<ulong, HashSet<assetLoadedCallback>> assetLoadedCallbacks;
private Dictionary<IntPtr, combinedMeshLoadedCallback> combinedMeshLoadedCallbacks;
private Dictionary<UInt64, OvrAvatarAsset> assetCache;
private OvrAvatarTextureCopyManager textureCopyManager;
public ovrAvatarLogLevel LoggingLevel = ovrAvatarLogLevel.Info;
private Queue<AvatarSpecRequestParams> avatarSpecificationQueue;
private List<int> loadingAvatars;
private bool avatarSpecRequestAvailable = true;
private float lastDispatchedAvatarSpecRequestTime = 0f;
private const float AVATAR_SPEC_REQUEST_TIMEOUT = 5f;
private ovrAvatarDebugContext debugContext = ovrAvatarDebugContext.None;
public struct AvatarSpecRequestParams
{
public UInt64 _userId;
public specificationCallback _callback;
public bool _useCombinedMesh;
public ovrAvatarAssetLevelOfDetail _lod;
public bool _forceMobileTextureFormat;
public ovrAvatarLookAndFeelVersion _lookVersion;
public ovrAvatarLookAndFeelVersion _fallbackVersion;
public bool _enableExpressive;
public AvatarSpecRequestParams(
UInt64 userId,
specificationCallback callback,
bool useCombinedMesh,
ovrAvatarAssetLevelOfDetail lod,
bool forceMobileTextureFormat,
ovrAvatarLookAndFeelVersion lookVersion,
ovrAvatarLookAndFeelVersion fallbackVersion,
bool enableExpressive)
{
_userId = userId;
_callback = callback;
_useCombinedMesh = useCombinedMesh;
_lod = lod;
_forceMobileTextureFormat = forceMobileTextureFormat;
_lookVersion = lookVersion;
_fallbackVersion = fallbackVersion;
_enableExpressive = enableExpressive;
}
}
public static OvrAvatarSDKManager Instance
{
get
{
if (_instance == null)
{
_instance = GameObject.FindObjectOfType<OvrAvatarSDKManager>();
if (_instance == null)
{
GameObject manager = new GameObject("OvrAvatarSDKManager");
_instance = manager.AddComponent<OvrAvatarSDKManager>();
_instance.textureCopyManager = manager.AddComponent<OvrAvatarTextureCopyManager>();
_instance.initialized = _instance.Initialize();
}
}
return _instance.initialized ? _instance : null;
}
}
private bool Initialize()
{
CAPI.Initialize();
string appId = GetAppId();
if (appId == "")
{
AvatarLogger.LogError("No Oculus App ID has been provided for target platform. " +
"Go to Oculus Avatar > Edit Configuration to supply one", OvrAvatarSettings.Instance);
appId = "0";
return false;
}
#if UNITY_ANDROID && !UNITY_EDITOR
#if AVATAR_XPLAT
CAPI.ovrAvatar_Initialize(appId);
#else
CAPI.ovrAvatar_InitializeAndroidUnity(appId);
#endif
#else
CAPI.ovrAvatar_Initialize(appId);
CAPI.SendEvent("initialize", appId);
#endif
specificationCallbacks = new Dictionary<UInt64, HashSet<specificationCallback>>();
assetLoadedCallbacks = new Dictionary<UInt64, HashSet<assetLoadedCallback>>();
combinedMeshLoadedCallbacks = new Dictionary<IntPtr, combinedMeshLoadedCallback>();
assetCache = new Dictionary<ulong, OvrAvatarAsset>();
avatarSpecificationQueue = new Queue<AvatarSpecRequestParams>();
loadingAvatars = new List<int>();
CAPI.ovrAvatar_SetLoggingLevel(LoggingLevel);
CAPI.ovrAvatar_RegisterLoggingCallback(CAPI.LoggingCallback);
#if AVATAR_DEBUG
CAPI.ovrAvatar_SetDebugDrawContext((uint)debugContext);
#endif
return true;
}
void OnDestroy()
{
CAPI.Shutdown();
CAPI.ovrAvatar_RegisterLoggingCallback(null);
CAPI.ovrAvatar_Shutdown();
}
void Update()
{
if (Instance == null)
{
return;
}
#if AVATAR_DEBUG
// Call before ovrAvatarMessage_Pop which flushes the state
CAPI.ovrAvatar_DrawDebugLines();
#endif
// Dispatch waiting avatar spec request
if (avatarSpecificationQueue.Count > 0 &&
(avatarSpecRequestAvailable ||
Time.time - lastDispatchedAvatarSpecRequestTime >= AVATAR_SPEC_REQUEST_TIMEOUT))
{
avatarSpecRequestAvailable = false;
AvatarSpecRequestParams avatarSpec = avatarSpecificationQueue.Dequeue();
DispatchAvatarSpecificationRequest(avatarSpec);
lastDispatchedAvatarSpecRequestTime = Time.time;
AvatarLogger.Log("Avatar spec request dispatched: " + avatarSpec._userId);
}
IntPtr message = CAPI.ovrAvatarMessage_Pop();
if (message == IntPtr.Zero)
{
return;
}
ovrAvatarMessageType messageType = CAPI.ovrAvatarMessage_GetType(message);
switch (messageType)
{
case ovrAvatarMessageType.AssetLoaded:
{
ovrAvatarMessage_AssetLoaded assetMessage = CAPI.ovrAvatarMessage_GetAssetLoaded(message);
IntPtr asset = assetMessage.asset;
UInt64 assetID = assetMessage.assetID;
ovrAvatarAssetType assetType = CAPI.ovrAvatarAsset_GetType(asset);
OvrAvatarAsset assetData;
IntPtr avatarOwner = IntPtr.Zero;
switch (assetType)
{
case ovrAvatarAssetType.Mesh:
assetData = new OvrAvatarAssetMesh(assetID, asset, ovrAvatarAssetType.Mesh);
break;
case ovrAvatarAssetType.Texture:
assetData = new OvrAvatarAssetTexture(assetID, asset);
break;
case ovrAvatarAssetType.Material:
assetData = new OvrAvatarAssetMaterial(assetID, asset);
break;
case ovrAvatarAssetType.CombinedMesh:
avatarOwner = CAPI.ovrAvatarAsset_GetAvatar(asset);
assetData = new OvrAvatarAssetMesh(assetID, asset, ovrAvatarAssetType.CombinedMesh);
break;
default:
throw new NotImplementedException(string.Format("Unsupported asset type format {0}", assetType.ToString()));
}
HashSet<assetLoadedCallback> callbackSet;
if (assetType == ovrAvatarAssetType.CombinedMesh)
{
if (!assetCache.ContainsKey(assetID))
{
assetCache.Add(assetID, assetData);
}
combinedMeshLoadedCallback callback;
if (combinedMeshLoadedCallbacks.TryGetValue(avatarOwner, out callback))
{
callback(asset);
combinedMeshLoadedCallbacks.Remove(avatarOwner);
}
else
{
AvatarLogger.LogWarning("Loaded a combined mesh with no owner: " + assetMessage.assetID);
}
}
else
{
if (assetLoadedCallbacks.TryGetValue(assetMessage.assetID, out callbackSet))
{
assetCache.Add(assetID, assetData);
foreach (var callback in callbackSet)
{
callback(assetData);
}
assetLoadedCallbacks.Remove(assetMessage.assetID);
}
}
break;
}
case ovrAvatarMessageType.AvatarSpecification:
{
avatarSpecRequestAvailable = true;
ovrAvatarMessage_AvatarSpecification spec = CAPI.ovrAvatarMessage_GetAvatarSpecification(message);
HashSet<specificationCallback> callbackSet;
if (specificationCallbacks.TryGetValue(spec.oculusUserID, out callbackSet))
{
foreach (var callback in callbackSet)
{
callback(spec.avatarSpec);
}
specificationCallbacks.Remove(spec.oculusUserID);
}
else
{
AvatarLogger.LogWarning("Error, got an avatar specification callback from a user id we don't have a record for: " + spec.oculusUserID);
}
break;
}
default:
throw new NotImplementedException("Unhandled ovrAvatarMessageType: " + messageType);
}
CAPI.ovrAvatarMessage_Free(message);
}
public bool IsAvatarSpecWaiting()
{
return avatarSpecificationQueue.Count > 0;
}
public bool IsAvatarLoading()
{
return loadingAvatars.Count > 0;
}
// Add avatar gameobject ID to loading list to keep track of loading avatars
public void AddLoadingAvatar(int gameobjectID)
{
loadingAvatars.Add(gameobjectID);
}
// Remove avatar gameobject ID from loading list
public void RemoveLoadingAvatar(int gameobjectID)
{
loadingAvatars.Remove(gameobjectID);
}
// Request an avatar specification to be loaded by adding to the queue.
// Requests are dispatched in Update().
public void RequestAvatarSpecification(AvatarSpecRequestParams avatarSpecRequest)
{
avatarSpecificationQueue.Enqueue(avatarSpecRequest);
AvatarLogger.Log("Avatar spec request queued: " + avatarSpecRequest._userId.ToString());
}
private void DispatchAvatarSpecificationRequest(AvatarSpecRequestParams avatarSpecRequest)
{
textureCopyManager.CheckFallbackTextureSet(avatarSpecRequest._lod);
CAPI.ovrAvatar_SetForceASTCTextures(avatarSpecRequest._forceMobileTextureFormat);
HashSet<specificationCallback> callbackSet;
if (!specificationCallbacks.TryGetValue(avatarSpecRequest._userId, out callbackSet))
{
callbackSet = new HashSet<specificationCallback>();
specificationCallbacks.Add(avatarSpecRequest._userId, callbackSet);
IntPtr specRequest = CAPI.ovrAvatarSpecificationRequest_Create(avatarSpecRequest._userId);
CAPI.ovrAvatarSpecificationRequest_SetLookAndFeelVersion(specRequest, avatarSpecRequest._lookVersion);
CAPI.ovrAvatarSpecificationRequest_SetFallbackLookAndFeelVersion(specRequest, avatarSpecRequest._fallbackVersion);
CAPI.ovrAvatarSpecificationRequest_SetLevelOfDetail(specRequest, avatarSpecRequest._lod);
CAPI.ovrAvatarSpecificationRequest_SetCombineMeshes(specRequest, avatarSpecRequest._useCombinedMesh);
CAPI.ovrAvatarSpecificationRequest_SetExpressiveFlag(specRequest, avatarSpecRequest._enableExpressive);
CAPI.ovrAvatar_RequestAvatarSpecificationFromSpecRequest(specRequest);
CAPI.ovrAvatarSpecificationRequest_Destroy(specRequest);
}
callbackSet.Add(avatarSpecRequest._callback);
}
public void BeginLoadingAsset(
UInt64 assetId,
ovrAvatarAssetLevelOfDetail lod,
assetLoadedCallback callback)
{
HashSet<assetLoadedCallback> callbackSet;
if (!assetLoadedCallbacks.TryGetValue(assetId, out callbackSet))
{
callbackSet = new HashSet<assetLoadedCallback>();
assetLoadedCallbacks.Add(assetId, callbackSet);
}
AvatarLogger.Log("Loading Asset ID: " + assetId);
CAPI.ovrAvatarAsset_BeginLoadingLOD(assetId, lod);
callbackSet.Add(callback);
}
public void RegisterCombinedMeshCallback(
IntPtr sdkAvatar,
combinedMeshLoadedCallback callback)
{
combinedMeshLoadedCallback currentCallback;
if (!combinedMeshLoadedCallbacks.TryGetValue(sdkAvatar, out currentCallback))
{
combinedMeshLoadedCallbacks.Add(sdkAvatar, callback);
}
else
{
throw new Exception("Adding second combind mesh callback for same avatar");
}
}
public OvrAvatarAsset GetAsset(UInt64 assetId)
{
OvrAvatarAsset asset;
if (assetCache.TryGetValue(assetId, out asset))
{
return asset;
}
else
{
return null;
}
}
public void DeleteAssetFromCache(UInt64 assetId)
{
if (assetCache.ContainsKey(assetId))
{
assetCache.Remove(assetId);
}
}
public string GetAppId()
{
return UnityEngine.Application.platform == RuntimePlatform.Android ?
OvrAvatarSettings.MobileAppID : OvrAvatarSettings.AppID;
}
public OvrAvatarTextureCopyManager GetTextureCopyManager()
{
if (textureCopyManager != null)
{
return textureCopyManager;
}
else
{
return null;
}
}
}
| 38.040431 | 159 | 0.615957 | [
"MIT"
] | Anna-Henson/SonderMITRealityHack | Sonder/Assets/Oculus/Avatar/Scripts/OvrAvatarSDKManager.cs | 14,113 | C# |
// ========================================
// Project Name : WodiLib
// File Name : TransferDestination.cs
//
// MIT License Copyright(c) 2019 kameske
// see LICENSE file
// ========================================
using System;
using System.ComponentModel;
using WodiLib.Cmn;
using WodiLib.Project;
using WodiLib.Sys;
namespace WodiLib.Event.EventCommand
{
/// <inheritdoc />
/// <summary>
/// イベントコマンド・場所移動(移動先指定)
/// </summary>
[Serializable]
public class TransferDestination : TransferBase
{
// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// Private Constant
// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
private const string EventCommandSentenceFormat = "{0}X:{1} Y:{2} {3}";
private const string EventCommandSentenceThisMap = "▲現在のマップ";
private const string EventCommandSentenceFormatNormal = "▲マップID{0}[{1}]";
private const string EventCommandSentenceFormatVariable = "▲マップIDXX<{0}>";
private const string EventCommandSentencePreciseCoordinates = "[精密]";
private const string EventCommandSentenceNotPreciseCoordinates = "";
private const int TargetHero = -1;
// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// OverrideMethod
// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
/// <inheritdoc />
public override EventCommandCode EventCommandCode => EventCommandCode.Transfer;
/// <inheritdoc />
[EditorBrowsable(EditorBrowsableState.Never)]
protected override string MakeEventCommandMoveParamSentence(
EventCommandSentenceResolver resolver, EventCommandSentenceType type,
EventCommandSentenceResolveDesc desc)
{
var moveMapStr = Target == TargetHero
? MakeEventCommandMoveMapSentence(resolver, type, desc) + " "
: "";
var xStr = resolver.GetNumericVariableAddressStringIfVariableAddress(PositionX, type, desc);
var yStr = resolver.GetNumericVariableAddressStringIfVariableAddress(PositionY, type, desc);
var preciseCoordinatesStr = IsPreciseCoordinates
? EventCommandSentencePreciseCoordinates
: EventCommandSentenceNotPreciseCoordinates;
return string.Format(EventCommandSentenceFormat,
moveMapStr, xStr, yStr, preciseCoordinatesStr);
}
private string MakeEventCommandMoveMapSentence(
EventCommandSentenceResolver resolver, EventCommandSentenceType type,
EventCommandSentenceResolveDesc desc)
{
if (IsSameMap) return EventCommandSentenceThisMap;
if (DestinationMapId.IsVariableAddressSimpleCheck())
{
var varStr = resolver.GetNumericVariableAddressStringIfVariableAddress(
DestinationMapId, type, desc);
return string.Format(EventCommandSentenceFormatVariable, varStr);
}
var eventName = resolver.GetMapName(DestinationMapId).Item2;
return string.Format(EventCommandSentenceFormatNormal,
DestinationMapId, eventName);
}
// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// Property
// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
/// <summary>対象</summary>
public int Target
{
get => _Target;
set => _Target = value;
}
/// <summary>移動先マップ</summary>
public int DestinationMapId
{
get => _DestinationMapId;
set => _DestinationMapId = value;
}
/// <summary>同じマップ</summary>
public bool IsSameMap
{
get => _IsSameMap;
set => _IsSameMap = value;
}
/// <summary>移動先座標X</summary>
public int PositionX
{
get => _PositionX;
set => _PositionX = value;
}
/// <summary>移動先座標Y</summary>
public int PositionY
{
get => _PositionY;
set => _PositionY = value;
}
/// <summary>精密座標</summary>
public bool IsPreciseCoordinates
{
get => _IsPreciseCoordinates;
set => _IsPreciseCoordinates = value;
}
/// <summary>[NotNull] 場所移動時トランジションオプション</summary>
/// <exception cref="PropertyNullException">nullをセットした場合</exception>
public TransferOption TransferOption
{
get => _TransferOption;
set
{
if (value == null)
throw new PropertyNullException(
ErrorMessage.NotNull(nameof(TransferOption)));
_TransferOption = value;
}
}
}
} | 35.272727 | 105 | 0.558485 | [
"MIT"
] | sono8stream/WodiLib | WodiLib/WodiLib/Event/EventCommand/Implement/TransferDestination.cs | 5,222 | C# |
using System.Web;
using System.Web.Optimization;
namespace custom_social_buttons
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/font-awesome.css",
"~/Content/site.css"));
}
}
}
| 39.454545 | 112 | 0.569892 | [
"MIT"
] | stewartm83/customize-oauth2-buttons | src/custom-social-buttons/App_Start/BundleConfig.cs | 1,304 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace wxwinter.wf.WFLib
{
[System.Workflow.Activities.ExternalDataExchange()]
public interface IExternalEvent
{
event System.EventHandler<SubmitEventArgs> submitEvent;
}
public class ExternalEvent : IExternalEvent
{
//事件
public event EventHandler<SubmitEventArgs> submitEvent;
//触发事件的方法
public void submitResult(Guid guid, Guid 状态实例编号, string 提交结果, string 提交人员, string 提交部门, string 提交职能, string 提交方式, string 提交说明, string 触发器类型, string 下一状态办理人员, string 数据表单)
{
SubmitEventArgs e = new SubmitEventArgs(guid);
e.状态实例编号 = 状态实例编号;
e.提交结果 = 提交结果;
e.提交人员 = 提交人员;
e.提交部门 = 提交部门;
e.提交职能 = 提交职能;
e.提交方式 = 提交方式;
e.提交说明 = 提交说明;
e.触发器类型 = 触发器类型;
e.提交说明 = 提交说明;
e.提交日期 = System.DateTime.Now;
e.下一状态办理人员 = 下一状态办理人员;
e.数据表单 = 数据表单;
submitEvent(null, e);
}
}
}
| 22.8125 | 181 | 0.580822 | [
"BSD-3-Clause"
] | wanghuifeng/wxwinterwfWFDesigner | wxwinter.wf.WFLib/IExternalEvent.cs | 1,421 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace OpenPager.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class SettingsPage : ContentPage
{
public SettingsPage ()
{
InitializeComponent ();
}
}
} | 18.05 | 50 | 0.770083 | [
"Apache-2.0"
] | ForrestFalcon/OpenPagerXamarin | OpenPager/OpenPager/Views/SettingsPage.xaml.cs | 363 | C# |
using System;
/*
* AvaTax API Client Library
*
* (c) 2004-2019 Avalara, Inc.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Genevieve Conty
* @author Greg Hester
* Swagger name: AvaTaxClient
*/
namespace Avalara.AvaTax.RestClient
{
/// <summary>
///
/// </summary>
public enum PointOfSalePartnerId
{
/// <summary>
///
/// </summary>
DMA = 1,
/// <summary>
///
/// </summary>
AX7 = 2,
}
}
| 17.057143 | 74 | 0.541039 | [
"Apache-2.0"
] | avasachinbaijal/AvaTax-REST-V2-DotNet-SDK | src/enums/PointOfSalePartnerId.cs | 597 | C# |
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;
namespace CodeElements.NetworkCall.Test
{
public class CallTransmissionBasicTests : NetworkCallTestBase<IBasicTestInterface>
{
public CallTransmissionBasicTests() : base(new BasicTestInterfaceImpl())
{
}
protected override async Task SendData(BufferSegment data, DataTransmitter target)
{
await Task.Delay(20);
await base.SendData(data, target);
}
[Theory, InlineData(12, 31, 43), InlineData(1, 1, 2), InlineData(234321, 34223, 268544)]
public async Task TestSumValues(int x, int y, int result)
{
Assert.Equal(result, await Client.Interface.SumValues(x, y));
}
[Fact]
public async Task TestMultipleCallsSameTime()
{
var tasks = new List<Task>();
for (int i = 0; i < 5; i++)
tasks.Add(TestSumValues(12, 11, 23));
await Task.WhenAll(tasks);
}
[Theory]
[InlineData("this is a test", "is", StringComparison.Ordinal, 2)]
[InlineData("this is a test", "IS", StringComparison.Ordinal, -1)]
[InlineData("this is a test", "IS", StringComparison.OrdinalIgnoreCase, 2)]
public async Task TestIndexOf(string value, string needle, StringComparison comparison, int result)
{
Assert.Equal(result, await Client.Interface.IndexOf(value, needle, comparison));
}
[Fact]
public async Task TestCustomObject()
{
var result = await Client.Interface.GetEnvironmentInfo();
Assert.Equal("asd", result.Test1);
Assert.False(result.Test2);
Assert.Equal(3.141, result.Test3);
}
}
public interface IBasicTestInterface
{
Task<int> SumValues(int x, int y);
Task<int> IndexOf(string value, string needle, StringComparison stringComparison);
Task<EnvironmentInfo> GetEnvironmentInfo();
}
public class BasicTestInterfaceImpl : IBasicTestInterface
{
public Task<int> SumValues(int x, int y)
{
return Task.FromResult(x + y);
}
public async Task<int> IndexOf(string value, string needle, StringComparison stringComparison)
{
await Task.Delay(50);
return value.IndexOf(needle, stringComparison);
}
public async Task<EnvironmentInfo> GetEnvironmentInfo()
{
await Task.Delay(20);
return new EnvironmentInfo {Test1 = "asd", Test2 = false, Test3 = 3.141};
}
}
public class EnvironmentInfo
{
public string Test1 { get; set; }
public bool Test2 { get; set; }
public double Test3 { get; set; }
}
} | 32.204545 | 107 | 0.604093 | [
"MIT"
] | Alkalinee/CodeElements.NetworkCallTransmissionProtocol | CodeElements.NetworkCall.Test/CallTransmissionBasicTests.cs | 2,836 | C# |
using System;
using System.IO;
class Program
{
static void Main(string[] args)
{
Console.Write("Ввидите число> ");
Int64 inp = Convert.ToInt64(Console.ReadLine());
string output = Math.Pow(inp,Convert.ToString(inp).Length).ToString();
Console.WriteLine(output);
Console.ReadKey();
}
} | 25.357143 | 79 | 0.594366 | [
"Apache-2.0"
] | TiM-SyStEm/TimNotepad | TIMnotepad/TIMnotepad/bin/Debug/files/run-app-file.cs | 367 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AzureNextGen.Devices.V20180401
{
public static class ListIotHubResourceKeysForKeyName
{
public static Task<ListIotHubResourceKeysForKeyNameResult> InvokeAsync(ListIotHubResourceKeysForKeyNameArgs args, InvokeOptions? options = null)
=> Pulumi.Deployment.Instance.InvokeAsync<ListIotHubResourceKeysForKeyNameResult>("azure-nextgen:devices/v20180401:listIotHubResourceKeysForKeyName", args ?? new ListIotHubResourceKeysForKeyNameArgs(), options.WithVersion());
}
public sealed class ListIotHubResourceKeysForKeyNameArgs : Pulumi.InvokeArgs
{
/// <summary>
/// The name of the shared access policy.
/// </summary>
[Input("keyName", required: true)]
public string KeyName { get; set; } = null!;
/// <summary>
/// The name of the resource group that contains the IoT hub.
/// </summary>
[Input("resourceGroupName", required: true)]
public string ResourceGroupName { get; set; } = null!;
/// <summary>
/// The name of the IoT hub.
/// </summary>
[Input("resourceName", required: true)]
public string ResourceName { get; set; } = null!;
public ListIotHubResourceKeysForKeyNameArgs()
{
}
}
[OutputType]
public sealed class ListIotHubResourceKeysForKeyNameResult
{
/// <summary>
/// The name of the shared access policy.
/// </summary>
public readonly string KeyName;
/// <summary>
/// The primary key.
/// </summary>
public readonly string? PrimaryKey;
/// <summary>
/// The permissions assigned to the shared access policy.
/// </summary>
public readonly string Rights;
/// <summary>
/// The secondary key.
/// </summary>
public readonly string? SecondaryKey;
[OutputConstructor]
private ListIotHubResourceKeysForKeyNameResult(
string keyName,
string? primaryKey,
string rights,
string? secondaryKey)
{
KeyName = keyName;
PrimaryKey = primaryKey;
Rights = rights;
SecondaryKey = secondaryKey;
}
}
}
| 31.45122 | 237 | 0.622722 | [
"Apache-2.0"
] | test-wiz-sec/pulumi-azure-nextgen | sdk/dotnet/Devices/V20180401/ListIotHubResourceKeysForKeyName.cs | 2,579 | 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 swf-2012-01-25.normal.json service model.
*/
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Amazon.Runtime;
using Amazon.SimpleWorkflow.Model;
namespace Amazon.SimpleWorkflow
{
/// <summary>
/// Interface for accessing SimpleWorkflow
///
/// Amazon Simple Workflow Service
/// <para>
/// The Amazon Simple Workflow Service (Amazon SWF) makes it easy to build applications
/// that use Amazon's cloud to coordinate work across distributed components. In Amazon
/// SWF, a <i>task</i> represents a logical unit of work that is performed by a component
/// of your workflow. Coordinating tasks in a workflow involves managing intertask dependencies,
/// scheduling, and concurrency in accordance with the logical flow of the application.
/// </para>
///
/// <para>
/// Amazon SWF gives you full control over implementing tasks and coordinating them without
/// worrying about underlying complexities such as tracking their progress and maintaining
/// their state.
/// </para>
///
/// <para>
/// This documentation serves as reference only. For a broader overview of the Amazon
/// SWF programming model, see the <i> <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/">Amazon
/// SWF Developer Guide</a> </i>.
/// </para>
/// </summary>
#if NETSTANDARD13
[Obsolete("Support for .NET Standard 1.3 is in maintenance mode and will only receive critical bug fixes and security patches. Visit https://docs.aws.amazon.com/sdk-for-net/v3/developer-guide/migration-from-net-standard-1-3.html for further details.")]
#endif
public partial interface IAmazonSimpleWorkflow : IAmazonService, IDisposable
{
#if AWS_ASYNC_ENUMERABLES_API
/// <summary>
/// Paginators for the service
/// </summary>
ISimpleWorkflowPaginatorFactory Paginators { get; }
#endif
#region CountClosedWorkflowExecutions
/// <summary>
/// Returns the number of closed workflow executions within the given domain that meet
/// the specified filtering criteria.
///
/// <note>
/// <para>
/// This operation is eventually consistent. The results are best effort and may not exactly
/// reflect recent updates and changes.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the following parameters by using a <code>Condition</code> element with
/// the appropriate keys.
/// </para>
/// <ul> <li>
/// <para>
/// <code>tagFilter.tag</code>: String constraint. The key is <code>swf:tagFilter.tag</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>typeFilter.name</code>: String constraint. The key is <code>swf:typeFilter.name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>typeFilter.version</code>: String constraint. The key is <code>swf:typeFilter.version</code>.
/// </para>
/// </li> </ul> </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CountClosedWorkflowExecutions service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CountClosedWorkflowExecutions service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/CountClosedWorkflowExecutions">REST API Reference for CountClosedWorkflowExecutions Operation</seealso>
Task<CountClosedWorkflowExecutionsResponse> CountClosedWorkflowExecutionsAsync(CountClosedWorkflowExecutionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region CountOpenWorkflowExecutions
/// <summary>
/// Returns the number of open workflow executions within the given domain that meet the
/// specified filtering criteria.
///
/// <note>
/// <para>
/// This operation is eventually consistent. The results are best effort and may not exactly
/// reflect recent updates and changes.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the following parameters by using a <code>Condition</code> element with
/// the appropriate keys.
/// </para>
/// <ul> <li>
/// <para>
/// <code>tagFilter.tag</code>: String constraint. The key is <code>swf:tagFilter.tag</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>typeFilter.name</code>: String constraint. The key is <code>swf:typeFilter.name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>typeFilter.version</code>: String constraint. The key is <code>swf:typeFilter.version</code>.
/// </para>
/// </li> </ul> </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CountOpenWorkflowExecutions service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CountOpenWorkflowExecutions service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/CountOpenWorkflowExecutions">REST API Reference for CountOpenWorkflowExecutions Operation</seealso>
Task<CountOpenWorkflowExecutionsResponse> CountOpenWorkflowExecutionsAsync(CountOpenWorkflowExecutionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region CountPendingActivityTasks
/// <summary>
/// Returns the estimated number of activity tasks in the specified task list. The count
/// returned is an approximation and isn't guaranteed to be exact. If you specify a task
/// list that no activity task was ever scheduled in then <code>0</code> is returned.
///
///
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the <code>taskList.name</code> parameter by using a <code>Condition</code>
/// element with the <code>swf:taskList.name</code> key to allow the action to access
/// only certain task lists.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CountPendingActivityTasks service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CountPendingActivityTasks service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/CountPendingActivityTasks">REST API Reference for CountPendingActivityTasks Operation</seealso>
Task<CountPendingActivityTasksResponse> CountPendingActivityTasksAsync(CountPendingActivityTasksRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region CountPendingDecisionTasks
/// <summary>
/// Returns the estimated number of decision tasks in the specified task list. The count
/// returned is an approximation and isn't guaranteed to be exact. If you specify a task
/// list that no decision task was ever scheduled in then <code>0</code> is returned.
///
///
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the <code>taskList.name</code> parameter by using a <code>Condition</code>
/// element with the <code>swf:taskList.name</code> key to allow the action to access
/// only certain task lists.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CountPendingDecisionTasks service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CountPendingDecisionTasks service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/CountPendingDecisionTasks">REST API Reference for CountPendingDecisionTasks Operation</seealso>
Task<CountPendingDecisionTasksResponse> CountPendingDecisionTasksAsync(CountPendingDecisionTasksRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region DeprecateActivityType
/// <summary>
/// Deprecates the specified <i>activity type</i>. After an activity type has been deprecated,
/// you cannot create new tasks of that activity type. Tasks of this type that were scheduled
/// before the type was deprecated continue to run.
///
/// <note>
/// <para>
/// This operation is eventually consistent. The results are best effort and may not exactly
/// reflect recent updates and changes.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the following parameters by using a <code>Condition</code> element with
/// the appropriate keys.
/// </para>
/// <ul> <li>
/// <para>
/// <code>activityType.name</code>: String constraint. The key is <code>swf:activityType.name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>activityType.version</code>: String constraint. The key is <code>swf:activityType.version</code>.
/// </para>
/// </li> </ul> </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeprecateActivityType service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeprecateActivityType service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.TypeDeprecatedException">
/// Returned when the specified activity or workflow type was already deprecated.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/DeprecateActivityType">REST API Reference for DeprecateActivityType Operation</seealso>
Task<DeprecateActivityTypeResponse> DeprecateActivityTypeAsync(DeprecateActivityTypeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region DeprecateDomain
/// <summary>
/// Deprecates the specified domain. After a domain has been deprecated it cannot be used
/// to create new workflow executions or register new types. However, you can still use
/// visibility actions on this domain. Deprecating a domain also deprecates all activity
/// and workflow types registered in the domain. Executions that were started before the
/// domain was deprecated continues to run.
///
/// <note>
/// <para>
/// This operation is eventually consistent. The results are best effort and may not exactly
/// reflect recent updates and changes.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeprecateDomain service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeprecateDomain service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.DomainDeprecatedException">
/// Returned when the specified domain has been deprecated.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/DeprecateDomain">REST API Reference for DeprecateDomain Operation</seealso>
Task<DeprecateDomainResponse> DeprecateDomainAsync(DeprecateDomainRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region DeprecateWorkflowType
/// <summary>
/// Deprecates the specified <i>workflow type</i>. After a workflow type has been deprecated,
/// you cannot create new executions of that type. Executions that were started before
/// the type was deprecated continues to run. A deprecated workflow type may still be
/// used when calling visibility actions.
///
/// <note>
/// <para>
/// This operation is eventually consistent. The results are best effort and may not exactly
/// reflect recent updates and changes.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the following parameters by using a <code>Condition</code> element with
/// the appropriate keys.
/// </para>
/// <ul> <li>
/// <para>
/// <code>workflowType.name</code>: String constraint. The key is <code>swf:workflowType.name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>workflowType.version</code>: String constraint. The key is <code>swf:workflowType.version</code>.
/// </para>
/// </li> </ul> </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeprecateWorkflowType service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeprecateWorkflowType service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.TypeDeprecatedException">
/// Returned when the specified activity or workflow type was already deprecated.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/DeprecateWorkflowType">REST API Reference for DeprecateWorkflowType Operation</seealso>
Task<DeprecateWorkflowTypeResponse> DeprecateWorkflowTypeAsync(DeprecateWorkflowTypeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region DescribeActivityType
/// <summary>
/// Returns information about the specified activity type. This includes configuration
/// settings provided when the type was registered and other general information about
/// the type.
///
///
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the following parameters by using a <code>Condition</code> element with
/// the appropriate keys.
/// </para>
/// <ul> <li>
/// <para>
/// <code>activityType.name</code>: String constraint. The key is <code>swf:activityType.name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>activityType.version</code>: String constraint. The key is <code>swf:activityType.version</code>.
/// </para>
/// </li> </ul> </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeActivityType service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeActivityType service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/DescribeActivityType">REST API Reference for DescribeActivityType Operation</seealso>
Task<DescribeActivityTypeResponse> DescribeActivityTypeAsync(DescribeActivityTypeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region DescribeDomain
/// <summary>
/// Returns information about the specified domain, including description and status.
///
///
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeDomain service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeDomain service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/DescribeDomain">REST API Reference for DescribeDomain Operation</seealso>
Task<DescribeDomainResponse> DescribeDomainAsync(DescribeDomainRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region DescribeWorkflowExecution
/// <summary>
/// Returns information about the specified workflow execution including its type and
/// some statistics.
///
/// <note>
/// <para>
/// This operation is eventually consistent. The results are best effort and may not exactly
/// reflect recent updates and changes.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeWorkflowExecution service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeWorkflowExecution service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/DescribeWorkflowExecution">REST API Reference for DescribeWorkflowExecution Operation</seealso>
Task<DescribeWorkflowExecutionResponse> DescribeWorkflowExecutionAsync(DescribeWorkflowExecutionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region DescribeWorkflowType
/// <summary>
/// Returns information about the specified <i>workflow type</i>. This includes configuration
/// settings specified when the type was registered and other information such as creation
/// date, current status, etc.
///
///
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the following parameters by using a <code>Condition</code> element with
/// the appropriate keys.
/// </para>
/// <ul> <li>
/// <para>
/// <code>workflowType.name</code>: String constraint. The key is <code>swf:workflowType.name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>workflowType.version</code>: String constraint. The key is <code>swf:workflowType.version</code>.
/// </para>
/// </li> </ul> </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeWorkflowType service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeWorkflowType service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/DescribeWorkflowType">REST API Reference for DescribeWorkflowType Operation</seealso>
Task<DescribeWorkflowTypeResponse> DescribeWorkflowTypeAsync(DescribeWorkflowTypeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region GetWorkflowExecutionHistory
/// <summary>
/// Returns the history of the specified workflow execution. The results may be split
/// into multiple pages. To retrieve subsequent pages, make the call again using the <code>nextPageToken</code>
/// returned by the initial call.
///
/// <note>
/// <para>
/// This operation is eventually consistent. The results are best effort and may not exactly
/// reflect recent updates and changes.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetWorkflowExecutionHistory service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the GetWorkflowExecutionHistory service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/GetWorkflowExecutionHistory">REST API Reference for GetWorkflowExecutionHistory Operation</seealso>
Task<GetWorkflowExecutionHistoryResponse> GetWorkflowExecutionHistoryAsync(GetWorkflowExecutionHistoryRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region ListActivityTypes
/// <summary>
/// Returns information about all activities registered in the specified domain that match
/// the specified name and registration status. The result includes information like creation
/// date, current status of the activity, etc. The results may be split into multiple
/// pages. To retrieve subsequent pages, make the call again using the <code>nextPageToken</code>
/// returned by the initial call.
///
///
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListActivityTypes service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ListActivityTypes service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/ListActivityTypes">REST API Reference for ListActivityTypes Operation</seealso>
Task<ListActivityTypesResponse> ListActivityTypesAsync(ListActivityTypesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region ListClosedWorkflowExecutions
/// <summary>
/// Returns a list of closed workflow executions in the specified domain that meet the
/// filtering criteria. The results may be split into multiple pages. To retrieve subsequent
/// pages, make the call again using the nextPageToken returned by the initial call.
///
/// <note>
/// <para>
/// This operation is eventually consistent. The results are best effort and may not exactly
/// reflect recent updates and changes.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the following parameters by using a <code>Condition</code> element with
/// the appropriate keys.
/// </para>
/// <ul> <li>
/// <para>
/// <code>tagFilter.tag</code>: String constraint. The key is <code>swf:tagFilter.tag</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>typeFilter.name</code>: String constraint. The key is <code>swf:typeFilter.name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>typeFilter.version</code>: String constraint. The key is <code>swf:typeFilter.version</code>.
/// </para>
/// </li> </ul> </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListClosedWorkflowExecutions service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ListClosedWorkflowExecutions service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/ListClosedWorkflowExecutions">REST API Reference for ListClosedWorkflowExecutions Operation</seealso>
Task<ListClosedWorkflowExecutionsResponse> ListClosedWorkflowExecutionsAsync(ListClosedWorkflowExecutionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region ListDomains
/// <summary>
/// Returns the list of domains registered in the account. The results may be split into
/// multiple pages. To retrieve subsequent pages, make the call again using the nextPageToken
/// returned by the initial call.
///
/// <note>
/// <para>
/// This operation is eventually consistent. The results are best effort and may not exactly
/// reflect recent updates and changes.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains. The element must be set to <code>arn:aws:swf::AccountID:domain/*</code>,
/// where <i>AccountID</i> is the account ID, with no dashes.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListDomains service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ListDomains service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/ListDomains">REST API Reference for ListDomains Operation</seealso>
Task<ListDomainsResponse> ListDomainsAsync(ListDomainsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region ListOpenWorkflowExecutions
/// <summary>
/// Returns a list of open workflow executions in the specified domain that meet the filtering
/// criteria. The results may be split into multiple pages. To retrieve subsequent pages,
/// make the call again using the nextPageToken returned by the initial call.
///
/// <note>
/// <para>
/// This operation is eventually consistent. The results are best effort and may not exactly
/// reflect recent updates and changes.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the following parameters by using a <code>Condition</code> element with
/// the appropriate keys.
/// </para>
/// <ul> <li>
/// <para>
/// <code>tagFilter.tag</code>: String constraint. The key is <code>swf:tagFilter.tag</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>typeFilter.name</code>: String constraint. The key is <code>swf:typeFilter.name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>typeFilter.version</code>: String constraint. The key is <code>swf:typeFilter.version</code>.
/// </para>
/// </li> </ul> </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListOpenWorkflowExecutions service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ListOpenWorkflowExecutions service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/ListOpenWorkflowExecutions">REST API Reference for ListOpenWorkflowExecutions Operation</seealso>
Task<ListOpenWorkflowExecutionsResponse> ListOpenWorkflowExecutionsAsync(ListOpenWorkflowExecutionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region ListTagsForResource
/// <summary>
/// List tags for a given domain.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListTagsForResource service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ListTagsForResource service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.LimitExceededException">
/// Returned by any operation if a system imposed limitation has been reached. To address
/// this fault you should either clean up unused resources or increase the limit by contacting
/// AWS.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
Task<ListTagsForResourceResponse> ListTagsForResourceAsync(ListTagsForResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region ListWorkflowTypes
/// <summary>
/// Returns information about workflow types in the specified domain. The results may
/// be split into multiple pages that can be retrieved by making the call repeatedly.
///
///
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListWorkflowTypes service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ListWorkflowTypes service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/ListWorkflowTypes">REST API Reference for ListWorkflowTypes Operation</seealso>
Task<ListWorkflowTypesResponse> ListWorkflowTypesAsync(ListWorkflowTypesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region PollForActivityTask
/// <summary>
/// Used by workers to get an <a>ActivityTask</a> from the specified activity <code>taskList</code>.
/// This initiates a long poll, where the service holds the HTTP connection open and responds
/// as soon as a task becomes available. The maximum time the service holds on to the
/// request before responding is 60 seconds. If no task is available within 60 seconds,
/// the poll returns an empty result. An empty result, in this context, means that an
/// ActivityTask is returned, but that the value of taskToken is an empty string. If a
/// task is returned, the worker should use its type to identify and process it correctly.
///
/// <important>
/// <para>
/// Workers should set their client side socket timeout to at least 70 seconds (10 seconds
/// higher than the maximum time service may hold the poll request).
/// </para>
/// </important>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the <code>taskList.name</code> parameter by using a <code>Condition</code>
/// element with the <code>swf:taskList.name</code> key to allow the action to access
/// only certain task lists.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PollForActivityTask service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the PollForActivityTask service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.LimitExceededException">
/// Returned by any operation if a system imposed limitation has been reached. To address
/// this fault you should either clean up unused resources or increase the limit by contacting
/// AWS.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/PollForActivityTask">REST API Reference for PollForActivityTask Operation</seealso>
Task<PollForActivityTaskResponse> PollForActivityTaskAsync(PollForActivityTaskRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region PollForDecisionTask
/// <summary>
/// Used by deciders to get a <a>DecisionTask</a> from the specified decision <code>taskList</code>.
/// A decision task may be returned for any open workflow execution that is using the
/// specified task list. The task includes a paginated view of the history of the workflow
/// execution. The decider should use the workflow type and the history to determine how
/// to properly handle the task.
///
///
/// <para>
/// This action initiates a long poll, where the service holds the HTTP connection open
/// and responds as soon a task becomes available. If no decision task is available in
/// the specified task list before the timeout of 60 seconds expires, an empty result
/// is returned. An empty result, in this context, means that a DecisionTask is returned,
/// but that the value of taskToken is an empty string.
/// </para>
/// <important>
/// <para>
/// Deciders should set their client side socket timeout to at least 70 seconds (10 seconds
/// higher than the timeout).
/// </para>
/// </important> <important>
/// <para>
/// Because the number of workflow history events for a single workflow execution might
/// be very large, the result returned might be split up across a number of pages. To
/// retrieve subsequent pages, make additional calls to <code>PollForDecisionTask</code>
/// using the <code>nextPageToken</code> returned by the initial call. Note that you do
/// <i>not</i> call <code>GetWorkflowExecutionHistory</code> with this <code>nextPageToken</code>.
/// Instead, call <code>PollForDecisionTask</code> again.
/// </para>
/// </important>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the <code>taskList.name</code> parameter by using a <code>Condition</code>
/// element with the <code>swf:taskList.name</code> key to allow the action to access
/// only certain task lists.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PollForDecisionTask service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the PollForDecisionTask service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.LimitExceededException">
/// Returned by any operation if a system imposed limitation has been reached. To address
/// this fault you should either clean up unused resources or increase the limit by contacting
/// AWS.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/PollForDecisionTask">REST API Reference for PollForDecisionTask Operation</seealso>
Task<PollForDecisionTaskResponse> PollForDecisionTaskAsync(PollForDecisionTaskRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region RecordActivityTaskHeartbeat
/// <summary>
/// Used by activity workers to report to the service that the <a>ActivityTask</a> represented
/// by the specified <code>taskToken</code> is still making progress. The worker can also
/// specify details of the progress, for example percent complete, using the <code>details</code>
/// parameter. This action can also be used by the worker as a mechanism to check if cancellation
/// is being requested for the activity task. If a cancellation is being attempted for
/// the specified task, then the boolean <code>cancelRequested</code> flag returned by
/// the service is set to <code>true</code>.
///
///
/// <para>
/// This action resets the <code>taskHeartbeatTimeout</code> clock. The <code>taskHeartbeatTimeout</code>
/// is specified in <a>RegisterActivityType</a>.
/// </para>
///
/// <para>
/// This action doesn't in itself create an event in the workflow execution history. However,
/// if the task times out, the workflow execution history contains a <code>ActivityTaskTimedOut</code>
/// event that contains the information from the last heartbeat generated by the activity
/// worker.
/// </para>
/// <note>
/// <para>
/// The <code>taskStartToCloseTimeout</code> of an activity type is the maximum duration
/// of an activity task, regardless of the number of <a>RecordActivityTaskHeartbeat</a>
/// requests received. The <code>taskStartToCloseTimeout</code> is also specified in <a>RegisterActivityType</a>.
/// </para>
/// </note> <note>
/// <para>
/// This operation is only useful for long-lived activities to report liveliness of the
/// task and to determine if a cancellation is being attempted.
/// </para>
/// </note> <important>
/// <para>
/// If the <code>cancelRequested</code> flag returns <code>true</code>, a cancellation
/// is being attempted. If the worker can cancel the activity, it should respond with
/// <a>RespondActivityTaskCanceled</a>. Otherwise, it should ignore the cancellation request.
/// </para>
/// </important>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RecordActivityTaskHeartbeat service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RecordActivityTaskHeartbeat service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/RecordActivityTaskHeartbeat">REST API Reference for RecordActivityTaskHeartbeat Operation</seealso>
Task<RecordActivityTaskHeartbeatResponse> RecordActivityTaskHeartbeatAsync(RecordActivityTaskHeartbeatRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region RegisterActivityType
/// <summary>
/// Registers a new <i>activity type</i> along with its configuration settings in the
/// specified domain.
///
/// <important>
/// <para>
/// A <code>TypeAlreadyExists</code> fault is returned if the type already exists in the
/// domain. You cannot change any configuration settings of the type after its registration,
/// and it must be registered as a new version.
/// </para>
/// </important>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the following parameters by using a <code>Condition</code> element with
/// the appropriate keys.
/// </para>
/// <ul> <li>
/// <para>
/// <code>defaultTaskList.name</code>: String constraint. The key is <code>swf:defaultTaskList.name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>name</code>: String constraint. The key is <code>swf:name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>version</code>: String constraint. The key is <code>swf:version</code>.
/// </para>
/// </li> </ul> </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RegisterActivityType service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RegisterActivityType service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.LimitExceededException">
/// Returned by any operation if a system imposed limitation has been reached. To address
/// this fault you should either clean up unused resources or increase the limit by contacting
/// AWS.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.TypeAlreadyExistsException">
/// Returned if the type already exists in the specified domain. You may get this fault
/// if you are registering a type that is either already registered or deprecated, or
/// if you undeprecate a type that is currently registered.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/RegisterActivityType">REST API Reference for RegisterActivityType Operation</seealso>
Task<RegisterActivityTypeResponse> RegisterActivityTypeAsync(RegisterActivityTypeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region RegisterDomain
/// <summary>
/// Registers a new domain.
///
///
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// You cannot use an IAM policy to control domain access for this action. The name of
/// the domain being registered is available as the resource of this action.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RegisterDomain service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RegisterDomain service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.DomainAlreadyExistsException">
/// Returned if the domain already exists. You may get this fault if you are registering
/// a domain that is either already registered or deprecated, or if you undeprecate a
/// domain that is currently registered.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.LimitExceededException">
/// Returned by any operation if a system imposed limitation has been reached. To address
/// this fault you should either clean up unused resources or increase the limit by contacting
/// AWS.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.TooManyTagsException">
/// You've exceeded the number of tags allowed for a domain.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/RegisterDomain">REST API Reference for RegisterDomain Operation</seealso>
Task<RegisterDomainResponse> RegisterDomainAsync(RegisterDomainRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region RegisterWorkflowType
/// <summary>
/// Registers a new <i>workflow type</i> and its configuration settings in the specified
/// domain.
///
///
/// <para>
/// The retention period for the workflow history is set by the <a>RegisterDomain</a>
/// action.
/// </para>
/// <important>
/// <para>
/// If the type already exists, then a <code>TypeAlreadyExists</code> fault is returned.
/// You cannot change the configuration settings of a workflow type once it is registered
/// and it must be registered as a new version.
/// </para>
/// </important>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the following parameters by using a <code>Condition</code> element with
/// the appropriate keys.
/// </para>
/// <ul> <li>
/// <para>
/// <code>defaultTaskList.name</code>: String constraint. The key is <code>swf:defaultTaskList.name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>name</code>: String constraint. The key is <code>swf:name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>version</code>: String constraint. The key is <code>swf:version</code>.
/// </para>
/// </li> </ul> </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RegisterWorkflowType service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RegisterWorkflowType service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.LimitExceededException">
/// Returned by any operation if a system imposed limitation has been reached. To address
/// this fault you should either clean up unused resources or increase the limit by contacting
/// AWS.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.TypeAlreadyExistsException">
/// Returned if the type already exists in the specified domain. You may get this fault
/// if you are registering a type that is either already registered or deprecated, or
/// if you undeprecate a type that is currently registered.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/RegisterWorkflowType">REST API Reference for RegisterWorkflowType Operation</seealso>
Task<RegisterWorkflowTypeResponse> RegisterWorkflowTypeAsync(RegisterWorkflowTypeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region RequestCancelWorkflowExecution
/// <summary>
/// Records a <code>WorkflowExecutionCancelRequested</code> event in the currently running
/// workflow execution identified by the given domain, workflowId, and runId. This logically
/// requests the cancellation of the workflow execution as a whole. It is up to the decider
/// to take appropriate actions when it receives an execution history with this event.
///
/// <note>
/// <para>
/// If the runId isn't specified, the <code>WorkflowExecutionCancelRequested</code> event
/// is recorded in the history of the current open workflow execution with the specified
/// workflowId in the domain.
/// </para>
/// </note> <note>
/// <para>
/// Because this action allows the workflow to properly clean up and gracefully close,
/// it should be used instead of <a>TerminateWorkflowExecution</a> when possible.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RequestCancelWorkflowExecution service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RequestCancelWorkflowExecution service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/RequestCancelWorkflowExecution">REST API Reference for RequestCancelWorkflowExecution Operation</seealso>
Task<RequestCancelWorkflowExecutionResponse> RequestCancelWorkflowExecutionAsync(RequestCancelWorkflowExecutionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region RespondActivityTaskCanceled
/// <summary>
/// Used by workers to tell the service that the <a>ActivityTask</a> identified by the
/// <code>taskToken</code> was successfully canceled. Additional <code>details</code>
/// can be provided using the <code>details</code> argument.
///
///
/// <para>
/// These <code>details</code> (if provided) appear in the <code>ActivityTaskCanceled</code>
/// event added to the workflow history.
/// </para>
/// <important>
/// <para>
/// Only use this operation if the <code>canceled</code> flag of a <a>RecordActivityTaskHeartbeat</a>
/// request returns <code>true</code> and if the activity can be safely undone or abandoned.
/// </para>
/// </important>
/// <para>
/// A task is considered open from the time that it is scheduled until it is closed. Therefore
/// a task is reported as open while a worker is processing it. A task is closed after
/// it has been specified in a call to <a>RespondActivityTaskCompleted</a>, RespondActivityTaskCanceled,
/// <a>RespondActivityTaskFailed</a>, or the task has <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dg-basic.html#swf-dev-timeout-types">timed
/// out</a>.
/// </para>
///
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RespondActivityTaskCanceled service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RespondActivityTaskCanceled service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/RespondActivityTaskCanceled">REST API Reference for RespondActivityTaskCanceled Operation</seealso>
Task<RespondActivityTaskCanceledResponse> RespondActivityTaskCanceledAsync(RespondActivityTaskCanceledRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region RespondActivityTaskCompleted
/// <summary>
/// Used by workers to tell the service that the <a>ActivityTask</a> identified by the
/// <code>taskToken</code> completed successfully with a <code>result</code> (if provided).
/// The <code>result</code> appears in the <code>ActivityTaskCompleted</code> event in
/// the workflow history.
///
/// <important>
/// <para>
/// If the requested task doesn't complete successfully, use <a>RespondActivityTaskFailed</a>
/// instead. If the worker finds that the task is canceled through the <code>canceled</code>
/// flag returned by <a>RecordActivityTaskHeartbeat</a>, it should cancel the task, clean
/// up and then call <a>RespondActivityTaskCanceled</a>.
/// </para>
/// </important>
/// <para>
/// A task is considered open from the time that it is scheduled until it is closed. Therefore
/// a task is reported as open while a worker is processing it. A task is closed after
/// it has been specified in a call to RespondActivityTaskCompleted, <a>RespondActivityTaskCanceled</a>,
/// <a>RespondActivityTaskFailed</a>, or the task has <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dg-basic.html#swf-dev-timeout-types">timed
/// out</a>.
/// </para>
///
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RespondActivityTaskCompleted service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RespondActivityTaskCompleted service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/RespondActivityTaskCompleted">REST API Reference for RespondActivityTaskCompleted Operation</seealso>
Task<RespondActivityTaskCompletedResponse> RespondActivityTaskCompletedAsync(RespondActivityTaskCompletedRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region RespondActivityTaskFailed
/// <summary>
/// Used by workers to tell the service that the <a>ActivityTask</a> identified by the
/// <code>taskToken</code> has failed with <code>reason</code> (if specified). The <code>reason</code>
/// and <code>details</code> appear in the <code>ActivityTaskFailed</code> event added
/// to the workflow history.
///
///
/// <para>
/// A task is considered open from the time that it is scheduled until it is closed. Therefore
/// a task is reported as open while a worker is processing it. A task is closed after
/// it has been specified in a call to <a>RespondActivityTaskCompleted</a>, <a>RespondActivityTaskCanceled</a>,
/// RespondActivityTaskFailed, or the task has <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dg-basic.html#swf-dev-timeout-types">timed
/// out</a>.
/// </para>
///
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RespondActivityTaskFailed service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RespondActivityTaskFailed service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/RespondActivityTaskFailed">REST API Reference for RespondActivityTaskFailed Operation</seealso>
Task<RespondActivityTaskFailedResponse> RespondActivityTaskFailedAsync(RespondActivityTaskFailedRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region RespondDecisionTaskCompleted
/// <summary>
/// Used by deciders to tell the service that the <a>DecisionTask</a> identified by the
/// <code>taskToken</code> has successfully completed. The <code>decisions</code> argument
/// specifies the list of decisions made while processing the task.
///
///
/// <para>
/// A <code>DecisionTaskCompleted</code> event is added to the workflow history. The <code>executionContext</code>
/// specified is attached to the event in the workflow execution history.
/// </para>
///
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// If an IAM policy grants permission to use <code>RespondDecisionTaskCompleted</code>,
/// it can express permissions for the list of decisions in the <code>decisions</code>
/// parameter. Each of the decisions has one or more parameters, much like a regular API
/// call. To allow for policies to be as readable as possible, you can express permissions
/// on decisions as if they were actual API calls, including applying conditions to some
/// parameters. For more information, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RespondDecisionTaskCompleted service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RespondDecisionTaskCompleted service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/RespondDecisionTaskCompleted">REST API Reference for RespondDecisionTaskCompleted Operation</seealso>
Task<RespondDecisionTaskCompletedResponse> RespondDecisionTaskCompletedAsync(RespondDecisionTaskCompletedRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region SignalWorkflowExecution
/// <summary>
/// Records a <code>WorkflowExecutionSignaled</code> event in the workflow execution history
/// and creates a decision task for the workflow execution identified by the given domain,
/// workflowId and runId. The event is recorded with the specified user defined signalName
/// and input (if provided).
///
/// <note>
/// <para>
/// If a runId isn't specified, then the <code>WorkflowExecutionSignaled</code> event
/// is recorded in the history of the current open workflow with the matching workflowId
/// in the domain.
/// </para>
/// </note> <note>
/// <para>
/// If the specified workflow execution isn't open, this method fails with <code>UnknownResource</code>.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the SignalWorkflowExecution service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the SignalWorkflowExecution service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/SignalWorkflowExecution">REST API Reference for SignalWorkflowExecution Operation</seealso>
Task<SignalWorkflowExecutionResponse> SignalWorkflowExecutionAsync(SignalWorkflowExecutionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region StartWorkflowExecution
/// <summary>
/// Starts an execution of the workflow type in the specified domain using the provided
/// <code>workflowId</code> and input data.
///
///
/// <para>
/// This action returns the newly started workflow execution.
/// </para>
///
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the following parameters by using a <code>Condition</code> element with
/// the appropriate keys.
/// </para>
/// <ul> <li>
/// <para>
/// <code>tagList.member.0</code>: The key is <code>swf:tagList.member.0</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>tagList.member.1</code>: The key is <code>swf:tagList.member.1</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>tagList.member.2</code>: The key is <code>swf:tagList.member.2</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>tagList.member.3</code>: The key is <code>swf:tagList.member.3</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>tagList.member.4</code>: The key is <code>swf:tagList.member.4</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>taskList</code>: String constraint. The key is <code>swf:taskList.name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>workflowType.name</code>: String constraint. The key is <code>swf:workflowType.name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>workflowType.version</code>: String constraint. The key is <code>swf:workflowType.version</code>.
/// </para>
/// </li> </ul> </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the StartWorkflowExecution service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the StartWorkflowExecution service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.DefaultUndefinedException">
/// The <code>StartWorkflowExecution</code> API action was called without the required
/// parameters set.
///
///
/// <para>
/// Some workflow execution parameters, such as the decision <code>taskList</code>, must
/// be set to start the execution. However, these parameters might have been set as defaults
/// when the workflow type was registered. In this case, you can omit these parameters
/// from the <code>StartWorkflowExecution</code> call and Amazon SWF uses the values defined
/// in the workflow type.
/// </para>
/// <note>
/// <para>
/// If these parameters aren't set and no default parameters were defined in the workflow
/// type, this error is displayed.
/// </para>
/// </note>
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.LimitExceededException">
/// Returned by any operation if a system imposed limitation has been reached. To address
/// this fault you should either clean up unused resources or increase the limit by contacting
/// AWS.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.TypeDeprecatedException">
/// Returned when the specified activity or workflow type was already deprecated.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.WorkflowExecutionAlreadyStartedException">
/// Returned by <a>StartWorkflowExecution</a> when an open execution with the same workflowId
/// is already running in the specified domain.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/StartWorkflowExecution">REST API Reference for StartWorkflowExecution Operation</seealso>
Task<StartWorkflowExecutionResponse> StartWorkflowExecutionAsync(StartWorkflowExecutionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region TagResource
/// <summary>
/// Add a tag to a Amazon SWF domain.
///
/// <note>
/// <para>
/// Amazon SWF supports a maximum of 50 tags per resource.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the TagResource service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the TagResource service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.LimitExceededException">
/// Returned by any operation if a system imposed limitation has been reached. To address
/// this fault you should either clean up unused resources or increase the limit by contacting
/// AWS.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.TooManyTagsException">
/// You've exceeded the number of tags allowed for a domain.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/TagResource">REST API Reference for TagResource Operation</seealso>
Task<TagResourceResponse> TagResourceAsync(TagResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region TerminateWorkflowExecution
/// <summary>
/// Records a <code>WorkflowExecutionTerminated</code> event and forces closure of the
/// workflow execution identified by the given domain, runId, and workflowId. The child
/// policy, registered with the workflow type or specified when starting this execution,
/// is applied to any open child workflow executions of this workflow execution.
///
/// <important>
/// <para>
/// If the identified workflow execution was in progress, it is terminated immediately.
/// </para>
/// </important> <note>
/// <para>
/// If a runId isn't specified, then the <code>WorkflowExecutionTerminated</code> event
/// is recorded in the history of the current open workflow with the matching workflowId
/// in the domain.
/// </para>
/// </note> <note>
/// <para>
/// You should consider using <a>RequestCancelWorkflowExecution</a> action instead because
/// it allows the workflow to gracefully close while <a>TerminateWorkflowExecution</a>
/// doesn't.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the TerminateWorkflowExecution service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the TerminateWorkflowExecution service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/TerminateWorkflowExecution">REST API Reference for TerminateWorkflowExecution Operation</seealso>
Task<TerminateWorkflowExecutionResponse> TerminateWorkflowExecutionAsync(TerminateWorkflowExecutionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region UndeprecateActivityType
/// <summary>
/// Undeprecates a previously deprecated <i>activity type</i>. After an activity type
/// has been undeprecated, you can create new tasks of that activity type.
///
/// <note>
/// <para>
/// This operation is eventually consistent. The results are best effort and may not exactly
/// reflect recent updates and changes.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the following parameters by using a <code>Condition</code> element with
/// the appropriate keys.
/// </para>
/// <ul> <li>
/// <para>
/// <code>activityType.name</code>: String constraint. The key is <code>swf:activityType.name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>activityType.version</code>: String constraint. The key is <code>swf:activityType.version</code>.
/// </para>
/// </li> </ul> </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UndeprecateActivityType service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the UndeprecateActivityType service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.TypeAlreadyExistsException">
/// Returned if the type already exists in the specified domain. You may get this fault
/// if you are registering a type that is either already registered or deprecated, or
/// if you undeprecate a type that is currently registered.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/UndeprecateActivityType">REST API Reference for UndeprecateActivityType Operation</seealso>
Task<UndeprecateActivityTypeResponse> UndeprecateActivityTypeAsync(UndeprecateActivityTypeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region UndeprecateDomain
/// <summary>
/// Undeprecates a previously deprecated domain. After a domain has been undeprecated
/// it can be used to create new workflow executions or register new types.
///
/// <note>
/// <para>
/// This operation is eventually consistent. The results are best effort and may not exactly
/// reflect recent updates and changes.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// You cannot use an IAM policy to constrain this action's parameters.
/// </para>
/// </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UndeprecateDomain service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the UndeprecateDomain service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.DomainAlreadyExistsException">
/// Returned if the domain already exists. You may get this fault if you are registering
/// a domain that is either already registered or deprecated, or if you undeprecate a
/// domain that is currently registered.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/UndeprecateDomain">REST API Reference for UndeprecateDomain Operation</seealso>
Task<UndeprecateDomainResponse> UndeprecateDomainAsync(UndeprecateDomainRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region UndeprecateWorkflowType
/// <summary>
/// Undeprecates a previously deprecated <i>workflow type</i>. After a workflow type has
/// been undeprecated, you can create new executions of that type.
///
/// <note>
/// <para>
/// This operation is eventually consistent. The results are best effort and may not exactly
/// reflect recent updates and changes.
/// </para>
/// </note>
/// <para>
/// <b>Access Control</b>
/// </para>
///
/// <para>
/// You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:
/// </para>
/// <ul> <li>
/// <para>
/// Use a <code>Resource</code> element with the domain name to limit the action to only
/// specified domains.
/// </para>
/// </li> <li>
/// <para>
/// Use an <code>Action</code> element to allow or deny permission to call this action.
/// </para>
/// </li> <li>
/// <para>
/// Constrain the following parameters by using a <code>Condition</code> element with
/// the appropriate keys.
/// </para>
/// <ul> <li>
/// <para>
/// <code>workflowType.name</code>: String constraint. The key is <code>swf:workflowType.name</code>.
/// </para>
/// </li> <li>
/// <para>
/// <code>workflowType.version</code>: String constraint. The key is <code>swf:workflowType.version</code>.
/// </para>
/// </li> </ul> </li> </ul>
/// <para>
/// If the caller doesn't have sufficient permissions to invoke the action, or the parameter
/// values fall outside the specified constraints, the action fails. The associated event
/// attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
/// For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using
/// IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UndeprecateWorkflowType service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the UndeprecateWorkflowType service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.TypeAlreadyExistsException">
/// Returned if the type already exists in the specified domain. You may get this fault
/// if you are registering a type that is either already registered or deprecated, or
/// if you undeprecate a type that is currently registered.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/UndeprecateWorkflowType">REST API Reference for UndeprecateWorkflowType Operation</seealso>
Task<UndeprecateWorkflowTypeResponse> UndeprecateWorkflowTypeAsync(UndeprecateWorkflowTypeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
#region UntagResource
/// <summary>
/// Remove a tag from a Amazon SWF domain.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UntagResource service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the UntagResource service method, as returned by SimpleWorkflow.</returns>
/// <exception cref="Amazon.SimpleWorkflow.Model.LimitExceededException">
/// Returned by any operation if a system imposed limitation has been reached. To address
/// this fault you should either clean up unused resources or increase the limit by contacting
/// AWS.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.OperationNotPermittedException">
/// Returned when the caller doesn't have sufficient permissions to invoke the action.
/// </exception>
/// <exception cref="Amazon.SimpleWorkflow.Model.UnknownResourceException">
/// Returned when the named resource cannot be found with in the scope of this operation
/// (region or domain). This could happen if the named resource was never created or is
/// no longer available for this operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/swf-2012-01-25/UntagResource">REST API Reference for UntagResource Operation</seealso>
Task<UntagResourceResponse> UntagResourceAsync(UntagResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken));
#endregion
}
} | 53.10441 | 256 | 0.623171 | [
"Apache-2.0"
] | PureKrome/aws-sdk-net | sdk/src/Services/SimpleWorkflow/Generated/_netstandard/IAmazonSimpleWorkflow.cs | 140,886 | C# |
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using DSharpPlus;
using DSharpPlus.CommandsNext;
using Microsoft.EntityFrameworkCore;
using CypherBot.Core.Models;
using CypherBot.Core.DataAccess.Repos;
namespace CypherBot.Core.Services
{
public static class CharacterHelper
{
//public static async Task<Character> GetCurrentPlayersCharacterAsync(CommandContext ctx)
//{
// var chr = new Character();// Data.CharacterList.Characters.FirstOrDefault(x => x.Player == ctx.Member.Username + ctx.Member.Discriminator);
// if (chr == null)
// {
// await ctx.RespondAsync("Hey! you don't have any characters!");
// }
// return chr;
//}
public static async Task<List<Character>> GetCurrentPlayersCharactersAsync(CommandContext ctx)
{
using (var db = new CypherContext())
{
var chars = await db.Characters
.Include(x => x.Cyphers)
.Include(x => x.Inventory)
.Include(x => x.RecoveryRolls)
.Include(x => x.Pools)
.Where(x => x.Player == ctx.Member.Username + ctx.Member.Discriminator)
.ToListAsync();
return chars;
}
}
public static async Task SaveCurrentCharacterAsync(string playerId, Character charToSave)
{
using (var db = new CypherContext())
{
var chr = db.Characters
.Include(x => x.Cyphers)
.Include(x => x.Inventory)
.Include(x => x.RecoveryRolls)
.FirstOrDefault(x => x.CharacterId == charToSave.CharacterId);
if (chr == null)
{
db.Characters.Add(charToSave);
}
else
{
db.Entry(chr).CurrentValues.SetValues(charToSave);
foreach (var cy in chr.Cyphers)
{
if (!charToSave.Cyphers.Any(x => x.CypherId == cy.CypherId))
{
db.Remove(cy);
}
}
foreach (var inv in chr.Inventory)
{
if (!charToSave.Inventory.Any(x => x.InventoryId == inv.InventoryId))
{
db.Remove(inv);
}
}
foreach (var roll in chr.RecoveryRolls)
{
if (!charToSave.RecoveryRolls.Any(x => x.RecoveryRollId == roll.RecoveryRollId))
{
db.Remove(roll);
}
}
}
try
{
await db.SaveChangesAsync();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
throw;
}
}
}
}
}
| 31.852941 | 153 | 0.451216 | [
"MIT"
] | AncientAlbatross/Cypher-Bot | src/CypherBot.Core/Services/CharacterHelper.cs | 3,251 | C# |
using System;
using System.IO;
namespace FluentMigrator.NHibernate.Templates.CSharp
{
internal class AlterDefaultConstraint : ExpressionTemplate<FluentMigrator.Expressions.AlterDefaultConstraintExpression>
{
public override void WriteTo(TextWriter tw)
{
throw new NotImplementedException("FluentMigrator.Expressions.AlterDefaultConstraintExpression");
}
}
} | 29.928571 | 123 | 0.732697 | [
"MIT"
] | jeffreyabecker/FluentMigrator.NHibernate | FluentMigrator.NHibernate/Templates/CSharp/AlterDefaultConstraint.cs | 419 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MLAgents;
public class CarAgent : Agent {
[Header("Specific to Car")]
public GameObject target;
public Rigidbody m_rigidbody;
public CarArea area;
public float forwardForce = 40f;
public float turnForce = 1f;
public float turnRate = 20f;
// public float limitSpeed = 15f;
public float detectRange = 5f;
float[] detectAngle = { 0f, 45f, 90f, 135f, 180f, 225f, 270f, 315f };//, 70f , 110f , 250f , 290f };
// [HideInInspector]public float forwardDis;
// [HideInInspector]public float leftDis;
// [HideInInspector]public float rightDis;
public override void InitializeAgent ()
{
base.InitializeAgent ();
ResetReward ();
}
/// <summary>
/// Converts polar coordinate to cartesian coordinate.
/// </summary>
public static Vector3 PolarToCartesian(float radius, float angle)
{
float x = radius * Mathf.Cos(DegreeToRadian(angle));
float z = radius * Mathf.Sin(DegreeToRadian(angle));
return new Vector3(x, 0f, z);
}
/// <summary>
/// Converts degrees to radians.
/// </summary>
public static float DegreeToRadian(float degree)
{
return degree * Mathf.PI / 180f;
}
public override void CollectObservations ()
{
List<float> state = new List<float> ();
// state.Add (target.transform.position.x - transform.position.x);
// state.Add (target.transform.position.z - transform.position.z);
// state.Add (m_rigidbody.velocity.x);
// state.Add (m_rigidbody.velocity.z);
AddVectorObs (target.transform.position.x - transform.position.x);
AddVectorObs (target.transform.position.z - transform.position.z);
AddVectorObs (m_rigidbody.velocity.x);
AddVectorObs (m_rigidbody.velocity.z);
for (int i = 0; i < detectAngle.Length; ++i) {
float distance = 0;
float angle = detectAngle [i];
Vector3 direction = transform.TransformDirection (PolarToCartesian (1f, angle));
direction.y = 0;
RaycastHit hitInfo;
if (Physics.Raycast (transform.position, direction, out hitInfo, detectRange)) {
distance = hitInfo.distance;
}
AddVectorObs (distance);
}
// forwardDis = 999f;
// leftDis = 999f;
// rightDis = 999f;
// /// Collect obstacle info
// Vector3 forward = m_rigidbody.transform.forward;
// Vector3 leftSide = Vector3.Cross (forward, Vector3.down * 0.5f);
// leftSide = Vector3.Lerp (forward, leftSide, 0.7f).normalized;
// Vector3 rightSide = Vector3.Cross (forward, Vector3.up * 0.5f);
// rightSide = Vector3.Lerp (forward, rightSide, 0.7f).normalized;
//
// RaycastHit hitInfo;
// if (Physics.Raycast (transform.position, forward, out hitInfo, detectRange )) {
// forwardDis = hitInfo.distance;
// }
// if (Physics.Raycast (transform.position, leftSide, out hitInfo, detectRange )) {
// leftDis = hitInfo.distance;
// }
// if (Physics.Raycast (transform.position, rightSide, out hitInfo, detectRange )) {
// rightDis = hitInfo.distance;
// }
//
//// state.Add (forwardDis);
//// state.Add (leftDis);
//// state.Add (rightDis);
//
// AddVectorObs (forwardDis);
// AddVectorObs (leftDis);
// AddVectorObs (rightDis);
// return state;
}
// public override List<float> CollectState ()
// {
// List<float> state = new List<float> ();
// state.Add (target.transform.position.x - transform.position.x);
// state.Add (target.transform.position.z - transform.position.z);
// state.Add (m_rigidbody.velocity.x);
// state.Add (m_rigidbody.velocity.z);
//
//
// forwardDis = 999f;
// leftDis = 999f;
// rightDis = 999f;
// /// Collect obstacle info
// Vector3 forward = m_rigidbody.transform.forward;
// Vector3 leftSide = Vector3.Cross (forward, Vector3.down * 0.5f);
// leftSide = Vector3.Lerp (forward, leftSide, 0.7f).normalized;
// Vector3 rightSide = Vector3.Cross (forward, Vector3.up * 0.5f);
// rightSide = Vector3.Lerp (forward, rightSide, 0.7f).normalized;
//
// RaycastHit hitInfo;
// if (Physics.Raycast (transform.position, forward, out hitInfo, detectRange )) {
// forwardDis = hitInfo.distance;
// }
// if (Physics.Raycast (transform.position, leftSide, out hitInfo, detectRange )) {
// leftDis = hitInfo.distance;
// }
// if (Physics.Raycast (transform.position, rightSide, out hitInfo, detectRange )) {
// rightDis = hitInfo.distance;
// }
//
// state.Add (forwardDis);
// state.Add (leftDis);
// state.Add (rightDis);
//
//
// return state;
// }
public override void AgentAction (float[] action , string textAction)
{
// Recieve the input from the action list
float inputForward = 0;
float inputLeft = 0;
inputForward = Mathf.Clamp (action [0], -1f, 1f);
inputLeft = Mathf.Clamp (action [1], -1f, 1f);
// if (brain.brainParameters.actionSpaceType == StateType.continuous) {
// inputForward = Mathf.Clamp (action [0], -1f, 1f);
// inputLeft = Mathf.Clamp (action [1], -1f, 1f);
// } else {
// int movement = Mathf.FloorToInt (action [0]);
// if (movement == 1) { directX = -1; }
// if (movement == 2) { directX = 1; }
// if (movement == 3) { directZ = -1; }
// if (movement == 4) { directZ = 1; }
// }
// calculate the direction vector
Vector3 forward = transform.forward;
Vector3 right = Vector3.Cross (forward , Vector3.up);
Vector3 rotateDir = Vector3.down;
// transform.Rotate (rotateDir * directZ, Time.fixedDeltaTime * 200f * turnForce );
// m_rigidbody.AddForce (forward * directX * forwardForce + directionZ * directZ * turnForce * m_rigidbody.velocity.magnitude);
// the force is:
// forward force => the force to push the object to move forward
// side force => the force to rotate the object
// the side force is calculate by :
// f_s = mv^2/r = m*omiga*v = mass * angleSpeed * velocity
Vector3 force = forward * inputForward * forwardForce + // force in forward direction
right * turnRate * m_rigidbody.velocity.magnitude * m_rigidbody.mass * inputLeft ; // force in side
// add force to rigidbody
// notice that this will not rotate the object
m_rigidbody.AddForce( force );
// manually rotate the object
transform.Rotate (rotateDir * inputLeft, Time.deltaTime * turnRate * Mathf.Rad2Deg );
// if (Mathf.Abs (directZ) > 0) {
// m_rigidbody.AddTorque(rotateDir * directZ * turnForce * m_rigidbody.velocity.sqrMagnitude);
// } else {
// m_rigidbody.angularVelocity = Vector3.zero;
// }
// Vector3 pushForce = ( direction * directX * forwardForce + directionZ * directZ * turnForce * m_rigidbody.velocity.magnitude );
// m_rigidbody.AddForce ( pushForce );
// if (m_rigidbody.velocity.sqrMagnitude > limitSpeed)
// m_rigidbody.velocity *= 0.95f;
// if (m_rigidbody.velocity.magnitude > Mathf.Epsilon && m_rigidbody.velocity.magnitude > 0.001f) {
// transform.forward = m_rigidbody.velocity.normalized;
// }
// calculate the reward of each frame
// the vector of the object to target
Vector3 disToDes = (target.transform.position - transform.position);
// reward = -0.005f;
// the reward is reduced every frame (punishment)
// because we want the car to approach the destination as fast as possible
// the larger distance toward the target, the greater the punishment
// the low velocity will also brings the punishment
AddReward( -0.001f * Mathf.Pow( disToDes.magnitude , 2f ) *
( m_rigidbody.velocity.magnitude < 0.1f ? 5f : 1f ) );
// float squareRange = 5f;
// if (gameObject.transform.position.y < 0f ||
// Mathf.Abs (transform.localPosition.x) > squareRange ||
// Mathf.Abs (transform.localPosition.z) > squareRange) {
// Done ();
// AddReward (-100f);
// }
// Debug.Log ("Force " + pushForce);
}
public override void AgentReset ()
{
transform.localPosition = area.ResetArea ();
transform.LookAt (area.transform.position);
m_rigidbody.velocity = Vector3.zero;
m_rigidbody.angularVelocity = Vector3.zero;
// float squareRange = 2f;
// transform.localPosition = new Vector3 (Random.Range (-squareRange, squareRange), 0, Random.Range (-squareRange, squareRange));
}
public void GetToGoal()
{
Done ();
AddReward (100f);
}
public void OnDrawGizmosSelected()
{
Gizmos.color = Color.cyan;
for (int i = 0; i < detectAngle.Length; ++i) {
float distance = 0;
float angle = detectAngle [i];
Vector3 direction = transform.TransformDirection (PolarToCartesian (1f, angle));
direction.y = 0;
RaycastHit hitInfo;
if (Physics.Raycast (transform.position, direction, out hitInfo, detectRange)) {
distance = hitInfo.distance;
}
Gizmos.DrawLine (transform.position, transform.position + direction * distance);
}
// Vector3 forward = m_rigidbody.transform.forward;
// Vector3 leftSide = Vector3.Cross (forward, Vector3.down * 0.5f);
// leftSide = Vector3.Lerp (forward, leftSide, 0.7f).normalized;
// Vector3 rightSide = Vector3.Cross (forward, Vector3.up * 0.5f);
// rightSide = Vector3.Lerp (forward, rightSide, 0.7f).normalized;
//
// Gizmos.color = Color.red;
//
// Gizmos.DrawLine (transform.position, transform.position + forward.normalized * forwardDis);
// Gizmos.DrawLine (transform.position, transform.position + leftSide.normalized * leftDis);
// Gizmos.DrawLine (transform.position, transform.position + rightSide.normalized * rightDis);
}
}
| 31.240678 | 132 | 0.688694 | [
"Apache-2.0"
] | AtwoodDeng/UnityML | unity-environment/Assets/ML-Agents/Examples/Car/Script/CarAgent.cs | 9,218 | C# |
// Instance generated by TankLibHelper.InstanceBuilder
// ReSharper disable All
namespace TankLib.STU.Types {
[STUAttribute(0x1E2AF12C, "STUConfigVarUXDisplayText")]
public class STUConfigVarUXDisplayText : STU_E4324757 {
[STUFieldAttribute(0xAA76FAD1, "m_displayText")]
public teStructuredDataAssetRef<ulong> m_displayText;
}
}
| 32.545455 | 61 | 0.76257 | [
"MIT"
] | Mike111177/OWLib | TankLib/STU/Types/STUConfigVarUXDisplayText.cs | 358 | 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.
using System.Text;
using Cake.Common.Tests.Fixtures;
using Cake.Testing;
using NSubstitute;
using Xunit;
namespace Cake.Common.Tests.Unit.Text
{
public sealed class TextTransformationTests
{
public sealed class TheConstructor
{
[Fact]
public void Should_Throw_If_Template_Is_Null()
{
// Given
var fixture = new TextTransformationFixture();
fixture.TransformationTemplate = null;
// When
var result = Record.Exception(() => fixture.CreateTextTransformation());
// Then
AssertEx.IsArgumentNullException(result, "template");
}
}
public sealed class TheSaveMethod
{
[Fact]
public void Should_Throw_If_File_Path_Is_Null()
{
// Given
var fixture = new TextTransformationFixture();
var transformation = fixture.CreateTextTransformation();
// When
var result = Record.Exception(() => transformation.Save(null));
// Then
AssertEx.IsArgumentNullException(result, "path");
}
[Fact]
public void Should_Render_Content_To_File_With_Default_Encoding()
{
// Given
var expectedContent = "Hello World";
var fixture = new TextTransformationFixture();
fixture.TransformationTemplate.Render().Returns(expectedContent);
var transformation = fixture.CreateTextTransformation();
// When
transformation.Save("./output.txt");
// Then
var outputFile = fixture.FileSystem.GetFile("/Working/output.txt");
Assert.False(outputFile.HasUTF8BOM());
Assert.Equal(expectedContent, outputFile.GetTextContent());
}
[Fact]
public void Should_Render_Content_To_File_With_Specified_Encoding()
{
// Given
var expectedContent = "Hello World";
var fixture = new TextTransformationFixture();
fixture.TransformationTemplate.Render().Returns(expectedContent);
var transformation = fixture.CreateTextTransformation();
// When
transformation.Save("./output.txt", Encoding.UTF8);
// Then
var outputFile = fixture.FileSystem.GetFile("/Working/output.txt");
Assert.True(outputFile.HasUTF8BOM());
Assert.Equal(expectedContent, outputFile.GetTextContent(Encoding.UTF8));
}
}
public sealed class TheToStringMethod
{
[Fact]
public void Should_Render_The_Provided_Template()
{
// Given
var fixture = new TextTransformationFixture();
fixture.TransformationTemplate.Render().Returns("Hello World");
var transformation = fixture.CreateTextTransformation();
// When
var result = transformation.ToString();
// Then
Assert.Equal("Hello World", result);
}
}
}
} | 34.417476 | 88 | 0.556841 | [
"MIT"
] | Acidburn0zzz/cake | src/Cake.Common.Tests/Unit/Text/TextTransformationTests.cs | 3,547 | C# |
using System.Linq;
using FuzzyRanks.Matching.FuzzyCompare.Base;
using FuzzyRanks.Matching.StringTokenize;
using FuzzyRanks.Matching.StringTokenize.Base;
namespace FuzzyRanks.Matching.FuzzyCompare.Common
{
/// <summary>
/// Build the token based Jaccard coefficient, which is defined as the
/// intersection divided by the size of the union of the tokens.
/// Tokens can be build by NGrams
///
/// ( |X & Y| ) / ( | X or Y | )
/// intersection / union
/// </summary>
public class Jaccard : FuzzyComparer
{
// ***********************Fields***********************
private int nGramLength = 2;
private StringTokenizer tokenizer = new GramTokenizer();
// ***********************Functions***********************
public override float Compare(string str1, string str2)
{
if (str1 == null || str2 == null)
{
return 0;
}
if (!this.CaseSensitiv)
{
str1 = str1.ToLower();
str2 = str2.ToLower();
}
if (str1.Equals(str2))
{
return 1.0f;
}
// building NGram of length=2
this.tokenizer.MaxLength = this.nGramLength;
// tokenize into NGrams e.g "Müller" -> #M Mü ül ll le er r#
string[] nGrams1 = this.tokenizer.Tokenize(str1);
// tokenize into NGrams e.g "Meier" -> #M Me ei ie er r#
string[] nGrams2 = this.tokenizer.Tokenize(str2);
float score = this.BuildJaccard(nGrams1, nGrams2);
return this.NormalizeScore(str1, str2, score);
}
private float BuildJaccard(string[] nGrams1, string[] nGrams2)
{
// all distinct tokens together -> #M Mü ül ll le er r# Me ei ie
float unionNGrams = nGrams1.Union(nGrams2).Count();
// inner set of tokens -> #M r#
float matchingNGrams = nGrams1.Where(x => nGrams2.Contains(x)).Count();
if (matchingNGrams == 0)
{
return 0.0f;
}
// ( |X & Y| ) / ( | X or Y | )
// innerer Schnitt / Vereinigungsmenge
return matchingNGrams / unionNGrams;
}
private float NormalizeScore(string str1, string str2, float score)
{
// no normalization is needed it has already the range 0-1
return score;
}
}
} | 31.5 | 84 | 0.501742 | [
"MIT"
] | Vladimir-Novick/FuzzyRanks | Matching/FuzzyCompare/Common/Jaccard.cs | 2,590 | C# |
using System.Text;
namespace Microsoft.Build.Logging.StructuredLogger
{
public class StringWriter
{
public static string GetString(object rootNode)
{
var sb = new StringBuilder();
WriteNode(rootNode, sb, 0);
return sb.ToString();
}
private static void WriteNode(object rootNode, StringBuilder sb, int indent = 0)
{
if (rootNode == null)
{
return;
}
Indent(sb, indent);
var text = rootNode.ToString() ?? "";
// when we injest strings we normalize on \n to save space.
// when the strings leave our app via clipboard, bring \r\n back so that notepad works
text = text.Replace("\n", "\r\n");
sb.AppendLine(text);
var treeNode = rootNode as TreeNode;
if (treeNode != null && treeNode.HasChildren)
{
foreach (var child in treeNode.Children)
{
WriteNode(child, sb, indent + 1);
}
}
}
private static void Indent(StringBuilder sb, int indent)
{
for (int i = 0; i < indent * 4; i++)
{
sb.Append(' ');
}
}
}
}
| 26.901961 | 99 | 0.465015 | [
"MIT"
] | OdeToCode/MSBuildStructuredLog | src/StructuredLogger/Serialization/StringWriter.cs | 1,374 | C# |
// <auto-generated />
using System;
using hello_aspnet.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace hello_aspnet.Data.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.0.0");
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasColumnType("TEXT")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasColumnType("TEXT")
.HasMaxLength(128);
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasMaxLength(128);
b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(128);
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
| 35.434944 | 95 | 0.446601 | [
"MIT"
] | afzaal-ahmad-zeeshan/hello-aspnetcore | Data/Migrations/ApplicationDbContextModelSnapshot.cs | 9,532 | C# |
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Immutable;
namespace System.Reflection.Metadata
{
public struct ArrayShape
{
private readonly int _rank;
private readonly ImmutableArray<int> _sizes;
private readonly ImmutableArray<int> _lowerBounds;
public ArrayShape(int rank, ImmutableArray<int> sizes, ImmutableArray<int> lowerBounds)
{
_rank = rank;
_sizes = sizes;
_lowerBounds = lowerBounds;
}
public int Rank
{
get { return _rank; }
}
public ImmutableArray<int> Sizes
{
get { return _sizes; }
}
public ImmutableArray<int> LowerBounds
{
get { return _lowerBounds; }
}
}
}
| 24.756757 | 101 | 0.599345 | [
"MIT"
] | controlflow/srm-extensions | src/System.Reflection.Metadata.Extensions/Decoding/ArrayShape.cs | 918 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TwainDirect.Scanner.TwainLocalManager
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
using (WindowsIdentity windowsidentity = WindowsIdentity.GetCurrent())
{
WindowsPrincipal windowsprincipal = new WindowsPrincipal(windowsidentity);
if (!windowsprincipal.IsInRole(WindowsBuiltInRole.Administrator))
{
MessageBox.Show("Please right-click on this program, and select 'Run as administrator'.", "TWAIN Local Manager");
}
Application.Exit();
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormMain());
}
}
}
| 31.264706 | 133 | 0.613358 | [
"MIT"
] | adamglowacki/twain-direct | source/TwainDirect.Scanner.TwainLocalManager/Program.cs | 1,065 | C# |
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ReportingService.Repo;
namespace ReportingService.Repo.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20211004082308_CreateSP_Monitoring_SP_JoinOncePerUserPerGroupPerDayEmails")]
partial class CreateSP_Monitoring_SP_JoinOncePerUserPerGroupPerDayEmails
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.9")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Scaffolding.Models.ActivityCredentialSet", b =>
{
b.Property<int>("GroupId")
.HasColumnName("GroupID")
.HasColumnType("int");
b.Property<int>("ActivityId")
.HasColumnName("ActivityID")
.HasColumnType("int");
b.Property<int>("CredentialSetId")
.HasColumnName("CredentialSetID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<int?>("DisplayOrder")
.HasColumnType("int");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("GroupId", "ActivityId", "CredentialSetId", "SysChangeVersion");
b.ToTable("ActivityCredentialSet","Group");
});
modelBuilder.Entity("Scaffolding.Models.ActivityQuestions", b =>
{
b.Property<int>("RequestFormVariantId")
.HasColumnName("RequestFormVariantID")
.HasColumnType("int");
b.Property<int>("ActivityId")
.HasColumnName("ActivityID")
.HasColumnType("int");
b.Property<int>("QuestionId")
.HasColumnName("QuestionID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<int?>("Order")
.HasColumnType("int");
b.Property<int?>("Required")
.HasColumnType("int");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("RequestFormVariantId", "ActivityId", "QuestionId", "SysChangeVersion");
b.ToTable("ActivityQuestions","QuestionSet");
});
modelBuilder.Entity("Scaffolding.Models.AddressDetail", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<string>("AddressLine1")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<string>("AddressLine2")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<string>("AddressLine3")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<DateTime?>("LastUpdated")
.HasColumnType("datetime2(0)");
b.Property<string>("Locality")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<int?>("PostcodeId")
.HasColumnType("int");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("AddressDetail","Address");
});
modelBuilder.Entity("Scaffolding.Models.ChampionPostcode", b =>
{
b.Property<int>("UserId")
.HasColumnName("UserID")
.HasColumnType("int");
b.Property<string>("PostalCode")
.HasColumnType("varchar(10)")
.HasMaxLength(10)
.IsUnicode(false);
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("UserId", "PostalCode", "SysChangeVersion");
b.ToTable("ChampionPostcode","User");
});
modelBuilder.Entity("Scaffolding.Models.CommunicationMessage", b =>
{
b.Property<string>("MessageId")
.HasColumnName("MessageID")
.HasColumnType("varchar(50)")
.HasMaxLength(50)
.IsUnicode(false);
b.Property<string>("Comments")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.Property<bool?>("MatchedToExpectedEmail")
.HasColumnType("bit");
b.HasKey("MessageId")
.HasName("PK_CommMess");
b.ToTable("CommunicationMessage","Monitoring");
});
modelBuilder.Entity("Scaffolding.Models.Credential", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("varchar(50)")
.HasMaxLength(50)
.IsUnicode(false);
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("Credential","Group");
});
modelBuilder.Entity("Scaffolding.Models.CredentialSet", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("GroupId")
.HasColumnName("GroupID")
.HasColumnType("int");
b.Property<int>("CredentialId")
.HasColumnName("CredentialID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "GroupId", "CredentialId", "SysChangeVersion");
b.ToTable("CredentialSet","Group");
});
modelBuilder.Entity("Scaffolding.Models.CredentialTypes", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("CredentialTypes","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.DueDateType", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("DueDateType","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.EmailTemplates", b =>
{
b.Property<string>("TemplateName")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<DateTime?>("DateLastModified")
.HasColumnType("datetime");
b.Property<string>("GroupName")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.HasKey("TemplateName")
.HasName("PK__EmailTem__A6C2DA676F71E846");
b.ToTable("EmailTemplates","Analysis");
});
modelBuilder.Entity("Scaffolding.Models.EmailUnsubscribes", b =>
{
b.Property<DateTime?>("DateFrom")
.HasColumnType("datetime");
b.Property<string>("Event")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<DateTime?>("EventDate")
.HasColumnType("datetime");
b.Property<int?>("GroupId")
.HasColumnType("int");
b.Property<int?>("JobId")
.HasColumnType("int");
b.Property<string>("MessageId")
.HasColumnType("varchar(50)")
.HasMaxLength(50)
.IsUnicode(false);
b.Property<int?>("RecipientUserId")
.HasColumnName("RecipientUserID")
.HasColumnType("int");
b.Property<int?>("RequestId")
.HasColumnType("int");
b.Property<string>("TemplateName")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.ToTable("EmailUnsubscribes","Monitoring");
});
modelBuilder.Entity("Scaffolding.Models.Event", b =>
{
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Event1")
.HasColumnName("Event")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<string>("EventDate")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<string>("GroupId")
.HasColumnType("varchar(10)")
.HasMaxLength(10)
.IsUnicode(false);
b.Property<string>("JobId")
.HasColumnType("varchar(10)")
.HasMaxLength(10)
.IsUnicode(false);
b.Property<string>("MessageId")
.HasColumnType("varchar(50)")
.HasMaxLength(50)
.IsUnicode(false);
b.Property<int?>("RecipientUserId")
.HasColumnName("RecipientUserID")
.HasColumnType("int");
b.Property<string>("RequestId")
.HasColumnType("varchar(10)")
.HasMaxLength(10)
.IsUnicode(false);
b.Property<string>("TemplateName")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.ToTable("Event","Communication");
});
modelBuilder.Entity("Scaffolding.Models.EventHistory", b =>
{
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Event")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<string>("EventDate")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<string>("GroupId")
.HasColumnType("varchar(10)")
.HasMaxLength(10)
.IsUnicode(false);
b.Property<string>("JobId")
.HasColumnType("varchar(10)")
.HasMaxLength(10)
.IsUnicode(false);
b.Property<string>("MessageId")
.HasColumnType("varchar(50)")
.HasMaxLength(50)
.IsUnicode(false);
b.Property<int?>("RecipientUserId")
.HasColumnName("RecipientUserID")
.HasColumnType("int");
b.Property<string>("RequestId")
.HasColumnType("varchar(10)")
.HasMaxLength(10)
.IsUnicode(false);
b.Property<string>("TemplateName")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.ToTable("EventHistory","Communication");
});
modelBuilder.Entity("Scaffolding.Models.ExpectedEmails", b =>
{
b.Property<string>("Details")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<int?>("DistinctMessageIds")
.HasColumnName("DistinctMessageIDs")
.HasColumnType("int");
b.Property<int?>("EmailsExpected")
.HasColumnType("int");
b.Property<int?>("GroupId")
.HasColumnName("GroupID")
.HasColumnType("int");
b.Property<bool?>("Issue")
.HasColumnType("bit");
b.Property<string>("IssueDescription")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.Property<int?>("JobId")
.HasColumnName("JobID")
.HasColumnType("int");
b.Property<bool?>("JoinUpdated")
.HasColumnType("bit");
b.Property<DateTime?>("MinTimestampDelivered")
.HasColumnType("datetime");
b.Property<DateTime?>("MinTimestampDropped")
.HasColumnType("datetime");
b.Property<DateTime?>("MinTimestampInteraction")
.HasColumnType("datetime");
b.Property<DateTime?>("MinTimestampProcessed")
.HasColumnType("datetime");
b.Property<byte[]>("RecipientEmailAddress")
.HasColumnType("binary(1)")
.IsFixedLength(true)
.HasMaxLength(1);
b.Property<int?>("RecipientOrder")
.HasColumnType("int");
b.Property<int?>("RecipientUserId")
.HasColumnName("RecipientUserID")
.HasColumnType("int");
b.Property<int?>("RequestId")
.HasColumnName("RequestID")
.HasColumnType("int");
b.Property<string>("SingleMessageId")
.HasColumnName("SingleMessageID")
.HasColumnType("varchar(50)")
.HasMaxLength(50)
.IsUnicode(false);
b.Property<string>("TemplateName")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<DateTime?>("TimestampExpected")
.HasColumnType("datetime");
b.Property<bool?>("Unsubscribed")
.HasColumnType("bit");
b.ToTable("ExpectedEmails","Monitoring");
});
modelBuilder.Entity("Scaffolding.Models.Feedback1", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("ID")
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime?>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<DateTime?>("FeedbackDate")
.HasColumnType("datetime");
b.Property<byte?>("FeedbackRatingTypeId")
.HasColumnName("FeedbackRatingTypeID")
.HasColumnType("tinyint");
b.Property<int?>("JobId")
.HasColumnType("int");
b.Property<byte?>("RequestRoleTypeId")
.HasColumnName("RequestRoleTypeID")
.HasColumnType("tinyint");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.Property<int?>("UserId")
.HasColumnType("int");
b.HasKey("Id", "SysChangeVersion");
b.ToTable("Feedback","Feedback");
});
modelBuilder.Entity("Scaffolding.Models.FeedbackRating", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("FeedbackRating","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.Group", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("FriendlyName")
.HasColumnType("nvarchar(max)");
b.Property<string>("GeographicName")
.HasColumnType("nvarchar(max)");
b.Property<string>("GroupKey")
.HasColumnType("nvarchar(450)")
.HasMaxLength(450);
b.Property<string>("GroupName")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<byte?>("GroupType")
.HasColumnType("tinyint");
b.Property<bool?>("HomepageEnabled")
.HasColumnType("bit");
b.Property<string>("JoinGroupPopUpDetail")
.HasColumnType("nvarchar(max)");
b.Property<string>("LinkUrl")
.HasColumnName("LinkURL")
.HasColumnType("nvarchar(max)");
b.Property<int?>("ParentGroupId")
.HasColumnType("int");
b.Property<bool?>("ShiftsEnabled")
.HasColumnType("bit");
b.Property<string>("ShortName")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.Property<bool?>("TasksEnabled")
.HasColumnType("bit");
b.HasKey("Id", "SysChangeVersion");
b.ToTable("Group","Group");
});
modelBuilder.Entity("Scaffolding.Models.GroupCredential", b =>
{
b.Property<int>("GroupId")
.HasColumnName("GroupID")
.HasColumnType("int");
b.Property<int>("CredentialId")
.HasColumnName("CredentialID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<byte?>("CredentialTypeId")
.HasColumnName("CredentialTypeID")
.HasColumnType("tinyint");
b.Property<byte?>("CredentialVerifiedById")
.HasColumnType("tinyint");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<int?>("DisplayOrder")
.HasColumnType("int");
b.Property<string>("HowToAchieve")
.HasColumnType("varchar(400)")
.HasMaxLength(400)
.IsUnicode(false);
b.Property<string>("HowToAchieveCtaDestination")
.HasColumnName("HowToAchieve_CTA_Destination")
.HasColumnType("varchar(50)")
.HasMaxLength(50)
.IsUnicode(false);
b.Property<string>("Name")
.HasColumnType("varchar(50)")
.HasMaxLength(50)
.IsUnicode(false);
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.Property<string>("WhatIsThis")
.HasColumnType("varchar(400)")
.HasMaxLength(400)
.IsUnicode(false);
b.HasKey("GroupId", "CredentialId", "SysChangeVersion")
.HasName("PK_GROUP_CREDENTIAL");
b.ToTable("GroupCredential","Group");
});
modelBuilder.Entity("Scaffolding.Models.GroupEmailConfiguration", b =>
{
b.Property<int>("GroupId")
.ValueGeneratedOnAdd()
.HasColumnName("GroupID")
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<byte>("CommunicationJobTypeId")
.HasColumnName("CommunicationJobTypeID")
.HasColumnType("tinyint");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<string>("Configuration")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("GroupId", "CommunicationJobTypeId", "SysChangeVersion");
b.ToTable("GroupEmailConfiguration","Group");
});
modelBuilder.Entity("Scaffolding.Models.GroupLocation", b =>
{
b.Property<int>("GroupId")
.HasColumnName("GroupID")
.HasColumnType("int");
b.Property<int>("LocationId")
.HasColumnName("LocationID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("GroupId", "LocationId", "SysChangeVersion")
.HasName("PK_GROUP_LOCATION");
b.ToTable("GroupLocation","Group");
});
modelBuilder.Entity("Scaffolding.Models.GroupMapDetails", b =>
{
b.Property<int>("GroupId")
.HasColumnName("GroupID")
.HasColumnType("int");
b.Property<byte>("MapLocationId")
.HasColumnName("MapLocationID")
.HasColumnType("tinyint");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<decimal?>("Latitude")
.HasColumnType("decimal(9, 6)");
b.Property<decimal?>("Longitude")
.HasColumnType("decimal(9, 6)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.Property<decimal?>("ZoomLevel")
.HasColumnType("decimal(9, 6)");
b.HasKey("GroupId", "MapLocationId", "SysChangeVersion")
.HasName("PK_GROUP_GROUP_MAP_DETAILS");
b.ToTable("GroupMapDetails","Group");
});
modelBuilder.Entity("Scaffolding.Models.GroupSupportActivityConfiguration", b =>
{
b.Property<int>("GroupId")
.ValueGeneratedOnAdd()
.HasColumnName("GroupID")
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("SupportActivityId")
.HasColumnName("SupportActivityID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<double?>("Radius")
.HasColumnType("float");
b.Property<short?>("SupportActivityInstructionsId")
.HasColumnName("SupportActivityInstructionsID")
.HasColumnType("smallint");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("GroupId", "SupportActivityId", "SysChangeVersion")
.HasName("PK_GroupSupportActivityInstructions");
b.ToTable("GroupSupportActivityConfiguration","Group");
});
modelBuilder.Entity("Scaffolding.Models.GroupType", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("GroupType","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.Job", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Details")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.Property<DateTime>("DueDate")
.HasColumnType("datetime");
b.Property<byte?>("DueDateTypeId")
.HasColumnType("tinyint");
b.Property<bool?>("IsHealthCritical")
.HasColumnType("bit");
b.Property<byte?>("JobStatusId")
.HasColumnName("JobStatusID")
.HasColumnType("tinyint");
b.Property<DateTime?>("NotBeforeDate")
.HasColumnType("datetime");
b.Property<string>("Reference")
.HasColumnType("nvarchar(max)");
b.Property<int?>("RequestId")
.HasColumnType("int");
b.Property<byte?>("SupportActivityId")
.HasColumnName("SupportActivityID")
.HasColumnType("tinyint");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.Property<int?>("VolunteerUserId")
.HasColumnName("VolunteerUserID")
.HasColumnType("int");
b.HasKey("Id", "SysChangeVersion");
b.ToTable("Job","Request");
});
modelBuilder.Entity("Scaffolding.Models.JobAvailableToGroup", b =>
{
b.Property<int>("JobId")
.HasColumnName("JobID")
.HasColumnType("int");
b.Property<int>("GroupId")
.HasColumnName("GroupID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("JobId", "GroupId", "SysChangeVersion");
b.ToTable("JobAvailableToGroup","Request");
});
modelBuilder.Entity("Scaffolding.Models.JobQuestions", b =>
{
b.Property<int>("JobId")
.HasColumnName("JobID")
.HasColumnType("int");
b.Property<int>("QuestionId")
.HasColumnName("QuestionID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<string>("Answer")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("JobId", "QuestionId", "SysChangeVersion");
b.ToTable("JobQuestions","Request");
});
modelBuilder.Entity("Scaffolding.Models.JobStatus", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("JobStatus","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.Location", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<string>("AddressLine1")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<string>("AddressLine2")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<string>("AddressLine3")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Instructions")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.Property<decimal?>("Latitude")
.HasColumnType("decimal(9, 6)");
b.Property<string>("Locality")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<decimal?>("Longitude")
.HasColumnType("decimal(9, 6)");
b.Property<string>("Name")
.HasColumnType("varchar(200)")
.HasMaxLength(200)
.IsUnicode(false);
b.Property<string>("PostCode")
.HasColumnType("varchar(10)")
.HasMaxLength(10)
.IsUnicode(false);
b.Property<string>("ShortName")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("Location","Address");
});
modelBuilder.Entity("Scaffolding.Models.Location2", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("Location","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.LocationPostcodes", b =>
{
b.Property<string>("Location")
.HasColumnType("varchar(30)")
.HasMaxLength(30)
.IsUnicode(false);
b.Property<string>("Postcode")
.HasColumnType("varchar(10)")
.HasMaxLength(10)
.IsUnicode(false);
b.Property<string>("Area")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.Property<int?>("GroupId")
.HasColumnName("GroupID")
.HasColumnType("int");
b.HasKey("Location", "Postcode")
.HasName("PK__Location__512B029FCCC038BB");
b.ToTable("LocationPostcodes","Analysis");
});
modelBuilder.Entity("Scaffolding.Models.LogRequestEvent", b =>
{
b.Property<int>("RequestId")
.HasColumnType("int");
b.Property<byte>("RequestEventId")
.HasColumnType("tinyint");
b.Property<DateTime>("DateRequested")
.HasColumnType("datetime");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<int?>("JobId")
.HasColumnType("int");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.Property<int?>("UserId")
.HasColumnType("int");
b.HasKey("RequestId", "RequestEventId", "DateRequested", "SysChangeVersion");
b.ToTable("LogRequestEvent","Request");
});
modelBuilder.Entity("Scaffolding.Models.MonitoringTimestamps", b =>
{
b.Property<string>("Activity")
.HasColumnType("varchar(50)")
.HasMaxLength(50)
.IsUnicode(false);
b.Property<int>("RunId")
.HasColumnName("RunID")
.HasColumnType("int");
b.Property<string>("Trigger")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<bool>("Start")
.HasColumnType("bit");
b.Property<DateTime?>("ProcessedTo")
.HasColumnType("datetime");
b.Property<int?>("RowsAffected")
.HasColumnType("int");
b.Property<DateTime?>("Timestamp")
.HasColumnType("datetime");
b.HasKey("Activity", "RunId", "Trigger", "Start")
.HasName("PK__Monitori__EA1CFA03357523B9");
b.ToTable("MonitoringTimestamps","Monitoring");
});
modelBuilder.Entity("Scaffolding.Models.MonthlyStats", b =>
{
b.Property<int>("GroupId")
.HasColumnName("GroupID")
.HasColumnType("int");
b.Property<DateTime>("Timestamp")
.HasColumnType("datetime");
b.Property<int?>("ActiveVols")
.HasColumnType("int");
b.Property<int?>("Admins")
.HasColumnType("int");
b.Property<string>("GroupName")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<int?>("Jobs")
.HasColumnType("int");
b.Property<string>("JobsCancelled")
.HasColumnName("Jobs_Cancelled")
.HasColumnType("varchar(6)")
.HasMaxLength(6)
.IsUnicode(false);
b.Property<string>("JobsCompleted")
.HasColumnName("Jobs_Completed")
.HasColumnType("varchar(6)")
.HasMaxLength(6)
.IsUnicode(false);
b.Property<string>("JobsOverdue")
.HasColumnName("Jobs_Overdue")
.HasColumnType("varchar(6)")
.HasMaxLength(6)
.IsUnicode(false);
b.Property<int?>("Members")
.HasColumnType("int");
b.Property<int?>("NonMemberVols")
.HasColumnType("int");
b.Property<int?>("OtherCredentials")
.HasColumnType("int");
b.Property<int?>("Requests")
.HasColumnType("int");
b.Property<string>("Subgroup")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<string>("TimePeriod")
.HasColumnType("varchar(30)")
.HasMaxLength(30)
.IsUnicode(false);
b.Property<string>("TopActivities")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.Property<int?>("YotiIds")
.HasColumnName("YotiIDs")
.HasColumnType("int");
b.HasKey("GroupId", "Timestamp")
.HasName("PK__MonthlyS__EC10CAA9CA65B25F");
b.ToTable("MonthlyStats","Monitoring");
});
modelBuilder.Entity("Scaffolding.Models.NewRequestNotificationStrategy", b =>
{
b.Property<int>("GroupId")
.HasColumnName("GroupID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<int?>("MaxVolunteer")
.HasColumnType("int");
b.Property<byte?>("NewRequestNotificationStrategyId")
.HasColumnType("tinyint");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("GroupId", "SysChangeVersion");
b.ToTable("NewRequestNotificationStrategy","Group");
});
modelBuilder.Entity("Scaffolding.Models.NewRequestNotificationStrategy2", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("NewRequestNotificationStrategy","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.Postcode", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("FriendlyName")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<bool?>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValueSql("((1))");
b.Property<DateTime?>("LastUpdated")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(0)")
.HasDefaultValueSql("(getutcdate())");
b.Property<decimal?>("Latitude")
.HasColumnType("decimal(9, 6)");
b.Property<decimal?>("Longitude")
.HasColumnType("decimal(9, 6)");
b.Property<string>("Postcode1")
.HasColumnName("Postcode")
.HasColumnType("varchar(10)")
.HasMaxLength(10)
.IsUnicode(false);
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("Postcode","Address");
});
modelBuilder.Entity("Scaffolding.Models.PostcodeLookup", b =>
{
b.Property<string>("PostcodeDistrict")
.HasColumnType("varchar(4)")
.HasMaxLength(4)
.IsUnicode(false);
b.Property<int?>("ActivePostcodes")
.HasColumnType("int");
b.Property<string>("Country")
.HasColumnType("varchar(30)")
.HasMaxLength(30)
.IsUnicode(false);
b.Property<string>("Locality")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.Property<string>("Region")
.HasColumnType("varchar(30)")
.HasMaxLength(30)
.IsUnicode(false);
b.Property<string>("Town")
.HasColumnType("varchar(30)")
.HasMaxLength(30)
.IsUnicode(false);
b.HasKey("PostcodeDistrict")
.HasName("PK__Postcode__6235C9C1310092D5");
b.ToTable("PostcodeLookup","Analysis");
});
modelBuilder.Entity("Scaffolding.Models.PreComputedNearestPostcodes", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<byte[]>("CompressedNearestPostcodes")
.HasColumnType("varbinary(max)");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Postcode")
.HasColumnType("varchar(10)")
.HasMaxLength(10)
.IsUnicode(false);
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("PreComputedNearestPostcodes","Address");
});
modelBuilder.Entity("Scaffolding.Models.Question", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("Question","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.Question2", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<string>("AdditionalData")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("varchar(500)")
.HasMaxLength(500)
.IsUnicode(false);
b.Property<byte?>("QuestionType")
.HasColumnType("tinyint");
b.Property<bool?>("Required")
.HasColumnType("bit");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("Question","QuestionSet");
});
modelBuilder.Entity("Scaffolding.Models.QuestionType", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("QuestionType","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.RegistrationFormVariant", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("RegistrationFormVariant","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.RegistrationHistory", b =>
{
b.Property<int>("UserId")
.HasColumnName("UserID")
.HasColumnType("int");
b.Property<byte>("RegistrationStep")
.HasColumnType("tinyint");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime?>("DateCompleted")
.HasColumnType("datetime");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("UserId", "RegistrationStep", "SysChangeVersion");
b.ToTable("RegistrationHistory","User");
});
modelBuilder.Entity("Scaffolding.Models.RegistrationJourney", b =>
{
b.Property<int>("GroupId")
.HasColumnType("int");
b.Property<string>("Source")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<byte?>("RegistrationFormVariant")
.HasColumnType("tinyint");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("GroupId", "Source", "SysChangeVersion");
b.ToTable("RegistrationJourney","Website");
});
modelBuilder.Entity("Scaffolding.Models.Request", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<bool?>("AcceptedTerms")
.HasColumnType("bit");
b.Property<bool?>("Archive")
.HasColumnType("bit");
b.Property<bool?>("CommunicationSent")
.HasColumnType("bit");
b.Property<int?>("CreatedByUserId")
.HasColumnName("CreatedByUserID")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<DateTime?>("DateRequested")
.HasColumnType("datetime");
b.Property<bool?>("ForRequestor")
.HasColumnType("bit");
b.Property<byte?>("FulfillableStatus")
.HasColumnType("tinyint");
b.Property<Guid?>("Guid")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsFulfillable")
.HasColumnType("bit");
b.Property<bool?>("MultiVolunteer")
.HasColumnType("bit");
b.Property<string>("OrganisationName")
.HasColumnType("varchar(255)")
.HasMaxLength(255)
.IsUnicode(false);
b.Property<string>("OtherDetails")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.Property<Guid?>("ParentGuid")
.HasColumnType("uniqueidentifier");
b.Property<int?>("PersonIdRecipient")
.HasColumnName("PersonID_Recipient")
.HasColumnType("int");
b.Property<int?>("PersonIdRequester")
.HasColumnName("PersonID_Requester")
.HasColumnType("int");
b.Property<string>("PostCode")
.HasColumnType("varchar(10)")
.HasMaxLength(10)
.IsUnicode(false);
b.Property<bool?>("ReadPrivacyNotice")
.HasColumnType("bit");
b.Property<int?>("ReferringGroupId")
.HasColumnType("int");
b.Property<bool?>("Repeat")
.HasColumnType("bit");
b.Property<byte?>("RequestType")
.HasColumnType("tinyint");
b.Property<bool?>("RequestorDefinedByGroup")
.HasColumnType("bit");
b.Property<byte?>("RequestorType")
.HasColumnType("tinyint");
b.Property<string>("Source")
.HasColumnType("nvarchar(max)");
b.Property<string>("SpecialCommunicationNeeds")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.Property<bool?>("SuppressRecipientPersonalDetail")
.HasColumnType("bit");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("Request","Request");
});
modelBuilder.Entity("Scaffolding.Models.RequestEvent", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("RequestEvent","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.RequestFormStage", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("RequestFormStage","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.RequestFormVariant", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("RequestFormVariant","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.RequestHelpFormVariant", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("RequestHelpFormVariant","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.RequestHelpJourney", b =>
{
b.Property<int>("GroupId")
.HasColumnType("int");
b.Property<string>("Source")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<bool?>("AccessRestrictedByRole")
.HasColumnType("bit");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<byte?>("RequestHelpFormVariant")
.HasColumnType("tinyint");
b.Property<bool?>("RequestorDefinedByGroup")
.HasColumnType("bit");
b.Property<bool?>("RequestsRequireApproval")
.HasColumnType("bit");
b.Property<bool?>("SuppressRecipientPersonalDetails")
.HasColumnType("bit");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.Property<int?>("TargetGroups")
.HasColumnType("int");
b.HasKey("GroupId", "Source", "SysChangeVersion");
b.ToTable("RequestHelpJourney","Website");
});
modelBuilder.Entity("Scaffolding.Models.RequestJobStatus", b =>
{
b.Property<int>("JobId")
.HasColumnName("JobID")
.HasColumnType("int");
b.Property<DateTime>("DateCreated")
.HasColumnType("datetime");
b.Property<byte>("JobStatusId")
.HasColumnName("JobStatusID")
.HasColumnType("tinyint");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<int?>("CreatedByUserId")
.HasColumnName("CreatedByUserID")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.Property<int?>("VolunteerUserId")
.HasColumnName("VolunteerUserID")
.HasColumnType("int");
b.HasKey("JobId", "DateCreated", "JobStatusId", "SysChangeVersion");
b.ToTable("RequestJobStatus","Request");
});
modelBuilder.Entity("Scaffolding.Models.RequestRoles", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("RequestRoles","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.RequestSubmission", b =>
{
b.Property<int>("RequestId")
.HasColumnName("RequestID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<byte?>("FreqencyId")
.HasColumnName("FreqencyID")
.HasColumnType("tinyint");
b.Property<int?>("NumberOfRepeats")
.HasColumnType("int");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("RequestId", "SysChangeVersion");
b.ToTable("RequestSubmission","Request");
});
modelBuilder.Entity("Scaffolding.Models.RequestType", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("RequestType","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.RequestorType", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("RequestorType","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.Role", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<bool?>("IsAdmin")
.HasColumnType("bit");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("Role","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.SecurityConfiguration", b =>
{
b.Property<int>("GroupId")
.HasColumnName("GroupID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<bool?>("AllowAutonomousJoinersAndLeavers")
.HasColumnType("bit");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("GroupId", "SysChangeVersion");
b.ToTable("SecurityConfiguration","Group");
});
modelBuilder.Entity("Scaffolding.Models.Shift", b =>
{
b.Property<int>("RequestId")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<int?>("LocationId")
.HasColumnType("int");
b.Property<int?>("ShiftLength")
.HasColumnType("int");
b.Property<DateTime?>("StartDate")
.HasColumnType("datetime");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("RequestId", "SysChangeVersion");
b.ToTable("Shift","Request");
});
modelBuilder.Entity("Scaffolding.Models.SupportActivities", b =>
{
b.Property<int>("RequestId")
.HasColumnName("RequestID")
.HasColumnType("int");
b.Property<int>("ActivityId")
.HasColumnName("ActivityID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("RequestId", "ActivityId", "SysChangeVersion");
b.ToTable("SupportActivities","Request");
});
modelBuilder.Entity("Scaffolding.Models.SupportActivity", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("SupportActivity","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.SupportActivity2", b =>
{
b.Property<int>("UserId")
.HasColumnName("UserID")
.HasColumnType("int");
b.Property<byte>("ActivityId")
.HasColumnName("ActivityID")
.HasColumnType("tinyint");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("UserId", "ActivityId", "SysChangeVersion");
b.ToTable("SupportActivity","User");
});
modelBuilder.Entity("Scaffolding.Models.SupportActivityInstructions", b =>
{
b.Property<short>("SupportActivityInstructionsId")
.ValueGeneratedOnAdd()
.HasColumnName("SupportActivityInstructionsID")
.HasColumnType("smallint")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Instructions")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("SupportActivityInstructionsId", "SysChangeVersion");
b.ToTable("SupportActivityInstructions","Group");
});
modelBuilder.Entity("Scaffolding.Models.SupportActivityInstructions2", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("SupportActivityInstructions","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.TargetGroup", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("TargetGroup","Lookup");
});
modelBuilder.Entity("Scaffolding.Models.TestRequests", b =>
{
b.Property<int>("RequestId")
.HasColumnName("RequestID")
.HasColumnType("int");
b.Property<string>("Details")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.HasKey("RequestId")
.HasName("PK__TestRequ__33A8519AEEE3E890");
b.ToTable("TestRequests","Maintenance");
});
modelBuilder.Entity("Scaffolding.Models.UpdateHistory", b =>
{
b.Property<int>("RequestId")
.HasColumnType("int");
b.Property<int>("JobId")
.HasColumnType("int");
b.Property<DateTime>("DateCreated")
.HasColumnType("datetime");
b.Property<string>("FieldChanged")
.HasColumnType("varchar(900)")
.IsUnicode(false);
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<int?>("CreatedByUserId")
.HasColumnName("CreatedByUserID")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("NewValue")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.Property<string>("OldValue")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.Property<int?>("QuestionId")
.HasColumnType("int");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("RequestId", "JobId", "DateCreated", "FieldChanged", "SysChangeVersion")
.HasName("PK_UpddateHistory");
b.ToTable("UpdateHistory","Request");
});
modelBuilder.Entity("Scaffolding.Models.User", b =>
{
b.Property<int>("Id")
.HasColumnName("ID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime?>("DateCreated")
.HasColumnType("datetime");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<bool?>("EmailSharingConsent")
.HasColumnType("bit");
b.Property<string>("FirebaseUid")
.HasColumnName("FirebaseUID")
.HasColumnType("varchar(50)")
.HasMaxLength(50)
.IsUnicode(false);
b.Property<bool?>("HmscontactConsent")
.HasColumnName("HMSContactConsent")
.HasColumnType("bit");
b.Property<bool?>("IsVerified")
.HasColumnType("bit");
b.Property<bool?>("IsVolunteer")
.HasColumnType("bit");
b.Property<bool?>("MobileSharingConsent")
.HasColumnType("bit");
b.Property<bool?>("OtherPhoneSharingConsent")
.HasColumnType("bit");
b.Property<string>("PostalCode")
.HasColumnType("varchar(10)")
.HasMaxLength(10)
.IsUnicode(false);
b.Property<int?>("ReferringGroupId")
.HasColumnType("int");
b.Property<string>("Source")
.HasColumnType("nvarchar(max)");
b.Property<bool?>("StreetChampionRoleUnderstood")
.HasColumnType("bit");
b.Property<double?>("SupportRadiusMiles")
.HasColumnType("float");
b.Property<bool?>("SupportVolunteersByPhone")
.HasColumnType("bit");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("Id", "SysChangeVersion");
b.ToTable("User","User");
});
modelBuilder.Entity("Scaffolding.Models.UserCredential", b =>
{
b.Property<int>("GroupId")
.HasColumnName("GroupID")
.HasColumnType("int");
b.Property<int>("UserId")
.HasColumnName("UserID")
.HasColumnType("int");
b.Property<int>("CredentialId")
.HasColumnName("CredentialID")
.HasColumnType("int");
b.Property<DateTime>("DateAdded")
.HasColumnType("datetime");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<int?>("AuthorisedByUserId")
.HasColumnName("AuthorisedByUserID")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("Notes")
.HasColumnType("varchar(max)")
.IsUnicode(false);
b.Property<string>("Reference")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.Property<DateTime?>("ValidUntil")
.HasColumnType("datetime");
b.HasKey("GroupId", "UserId", "CredentialId", "DateAdded", "SysChangeVersion");
b.ToTable("UserCredential","Group");
});
modelBuilder.Entity("Scaffolding.Models.UserRole", b =>
{
b.Property<int>("UserId")
.HasColumnName("UserID")
.HasColumnType("int");
b.Property<int>("RoleId")
.HasColumnName("RoleID")
.HasColumnType("int");
b.Property<int>("GroupId")
.HasColumnName("GroupID")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.HasKey("UserId", "RoleId", "GroupId", "SysChangeVersion");
b.ToTable("UserRole","Group");
});
modelBuilder.Entity("Scaffolding.Models.UserRoleAudit", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("SysChangeVersion")
.HasColumnName("SYS_CHANGE_VERSION")
.HasColumnType("int");
b.Property<byte?>("ActionId")
.HasColumnName("ActionID")
.HasColumnType("tinyint");
b.Property<int?>("AuthorisedByUserId")
.HasColumnName("AuthorisedByUserID")
.HasColumnType("int");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<DateTime?>("DateRequested")
.HasColumnType("datetime");
b.Property<int?>("GroupId")
.HasColumnName("GroupID")
.HasColumnType("int");
b.Property<int?>("RoleId")
.HasColumnName("RoleID")
.HasColumnType("int");
b.Property<bool?>("Success")
.HasColumnType("bit");
b.Property<string>("SysChangeOperation")
.IsRequired()
.HasColumnName("SYS_CHANGE_OPERATION")
.HasColumnType("char(1)")
.IsFixedLength(true)
.HasMaxLength(1)
.IsUnicode(false);
b.Property<int?>("UserId")
.HasColumnName("UserID")
.HasColumnType("int");
b.HasKey("Id", "SysChangeVersion");
b.ToTable("UserRoleAudit","Group");
});
modelBuilder.Entity("Scaffolding.Models.VerificationAttempt", b =>
{
b.Property<bool?>("AgeMatch")
.HasColumnType("bit");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("DateOfAttempt")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<bool?>("DobMatch")
.HasColumnType("bit");
b.Property<bool?>("NotPreviouslyVerified")
.HasColumnType("bit");
b.Property<int?>("UserId")
.HasColumnType("int");
b.Property<bool?>("UserServiceUpdated")
.HasColumnType("bit");
b.Property<bool?>("Verified")
.HasColumnType("bit");
b.Property<string>("YotiRememberMeId")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.ToTable("VerificationAttempt","Verification");
});
modelBuilder.Entity("Scaffolding.Models.VerificationAttempt2", b =>
{
b.Property<bool?>("AgeMatch")
.HasColumnType("bit");
b.Property<DateTime>("DateFrom")
.ValueGeneratedOnAdd()
.HasColumnType("datetime")
.HasDefaultValueSql("(getdate())");
b.Property<string>("DateOfAttempt")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.Property<bool?>("DobMatch")
.HasColumnType("bit");
b.Property<bool?>("NotPreviouslyVerified")
.HasColumnType("bit");
b.Property<int?>("UserId")
.HasColumnType("int");
b.Property<bool?>("UserServiceUpdated")
.HasColumnType("bit");
b.Property<bool?>("Verified")
.HasColumnType("bit");
b.Property<string>("YotiRememberMeId")
.HasColumnType("varchar(100)")
.HasMaxLength(100)
.IsUnicode(false);
b.ToTable("VerificationAttempt2","Verification");
});
#pragma warning restore 612, 618
}
}
}
| 38.656645 | 125 | 0.425805 | [
"MIT"
] | HelpMyStreet/report-service | ReportingService/ReportingService.Repo/Migrations/20211004082308_CreateSP_Monitoring_SP_JoinOncePerUserPerGroupPerDayEmails.Designer.cs | 113,150 | C# |
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/bigquery/datatransfer/v1/datatransfer.proto
// Original file comments:
// Copyright 2017 Google Inc.
//
// 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.
//
#pragma warning disable 1591
#region Designer generated code
using System;
using System.Threading;
using System.Threading.Tasks;
using grpc = global::Grpc.Core;
namespace Google.Cloud.BigQuery.DataTransfer.V1 {
/// <summary>
/// The Google BigQuery Data Transfer Service API enables BigQuery users to
/// configure the transfer of their data from other Google Products into BigQuery.
/// This service contains methods that are end user exposed. It backs up the
/// frontend.
/// </summary>
public static partial class DataTransferService
{
static readonly string __ServiceName = "google.cloud.bigquery.datatransfer.v1.DataTransferService";
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.GetDataSourceRequest> __Marshaller_GetDataSourceRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.GetDataSourceRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.DataSource> __Marshaller_DataSource = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.DataSource.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesRequest> __Marshaller_ListDataSourcesRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesResponse> __Marshaller_ListDataSourcesResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.CreateTransferConfigRequest> __Marshaller_CreateTransferConfigRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.CreateTransferConfigRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig> __Marshaller_TransferConfig = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.UpdateTransferConfigRequest> __Marshaller_UpdateTransferConfigRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.UpdateTransferConfigRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferConfigRequest> __Marshaller_DeleteTransferConfigRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferConfigRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Protobuf.WellKnownTypes.Empty> __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferConfigRequest> __Marshaller_GetTransferConfigRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferConfigRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsRequest> __Marshaller_ListTransferConfigsRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsResponse> __Marshaller_ListTransferConfigsResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsRequest> __Marshaller_ScheduleTransferRunsRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsResponse> __Marshaller_ScheduleTransferRunsResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferRunRequest> __Marshaller_GetTransferRunRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferRunRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.TransferRun> __Marshaller_TransferRun = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.TransferRun.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferRunRequest> __Marshaller_DeleteTransferRunRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferRunRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsRequest> __Marshaller_ListTransferRunsRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsResponse> __Marshaller_ListTransferRunsResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsRequest> __Marshaller_ListTransferLogsRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsResponse> __Marshaller_ListTransferLogsResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsRequest> __Marshaller_CheckValidCredsRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsResponse> __Marshaller_CheckValidCredsResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsResponse.Parser.ParseFrom);
static readonly grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.GetDataSourceRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.DataSource> __Method_GetDataSource = new grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.GetDataSourceRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.DataSource>(
grpc::MethodType.Unary,
__ServiceName,
"GetDataSource",
__Marshaller_GetDataSourceRequest,
__Marshaller_DataSource);
static readonly grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesResponse> __Method_ListDataSources = new grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesResponse>(
grpc::MethodType.Unary,
__ServiceName,
"ListDataSources",
__Marshaller_ListDataSourcesRequest,
__Marshaller_ListDataSourcesResponse);
static readonly grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.CreateTransferConfigRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig> __Method_CreateTransferConfig = new grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.CreateTransferConfigRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig>(
grpc::MethodType.Unary,
__ServiceName,
"CreateTransferConfig",
__Marshaller_CreateTransferConfigRequest,
__Marshaller_TransferConfig);
static readonly grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.UpdateTransferConfigRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig> __Method_UpdateTransferConfig = new grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.UpdateTransferConfigRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig>(
grpc::MethodType.Unary,
__ServiceName,
"UpdateTransferConfig",
__Marshaller_UpdateTransferConfigRequest,
__Marshaller_TransferConfig);
static readonly grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferConfigRequest, global::Google.Protobuf.WellKnownTypes.Empty> __Method_DeleteTransferConfig = new grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferConfigRequest, global::Google.Protobuf.WellKnownTypes.Empty>(
grpc::MethodType.Unary,
__ServiceName,
"DeleteTransferConfig",
__Marshaller_DeleteTransferConfigRequest,
__Marshaller_Empty);
static readonly grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferConfigRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig> __Method_GetTransferConfig = new grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferConfigRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig>(
grpc::MethodType.Unary,
__ServiceName,
"GetTransferConfig",
__Marshaller_GetTransferConfigRequest,
__Marshaller_TransferConfig);
static readonly grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsResponse> __Method_ListTransferConfigs = new grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsResponse>(
grpc::MethodType.Unary,
__ServiceName,
"ListTransferConfigs",
__Marshaller_ListTransferConfigsRequest,
__Marshaller_ListTransferConfigsResponse);
static readonly grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsResponse> __Method_ScheduleTransferRuns = new grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsResponse>(
grpc::MethodType.Unary,
__ServiceName,
"ScheduleTransferRuns",
__Marshaller_ScheduleTransferRunsRequest,
__Marshaller_ScheduleTransferRunsResponse);
static readonly grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferRunRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.TransferRun> __Method_GetTransferRun = new grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferRunRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.TransferRun>(
grpc::MethodType.Unary,
__ServiceName,
"GetTransferRun",
__Marshaller_GetTransferRunRequest,
__Marshaller_TransferRun);
static readonly grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferRunRequest, global::Google.Protobuf.WellKnownTypes.Empty> __Method_DeleteTransferRun = new grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferRunRequest, global::Google.Protobuf.WellKnownTypes.Empty>(
grpc::MethodType.Unary,
__ServiceName,
"DeleteTransferRun",
__Marshaller_DeleteTransferRunRequest,
__Marshaller_Empty);
static readonly grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsResponse> __Method_ListTransferRuns = new grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsResponse>(
grpc::MethodType.Unary,
__ServiceName,
"ListTransferRuns",
__Marshaller_ListTransferRunsRequest,
__Marshaller_ListTransferRunsResponse);
static readonly grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsResponse> __Method_ListTransferLogs = new grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsResponse>(
grpc::MethodType.Unary,
__ServiceName,
"ListTransferLogs",
__Marshaller_ListTransferLogsRequest,
__Marshaller_ListTransferLogsResponse);
static readonly grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsResponse> __Method_CheckValidCreds = new grpc::Method<global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsRequest, global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsResponse>(
grpc::MethodType.Unary,
__ServiceName,
"CheckValidCreds",
__Marshaller_CheckValidCredsRequest,
__Marshaller_CheckValidCredsResponse);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Google.Cloud.BigQuery.DataTransfer.V1.DatatransferReflection.Descriptor.Services[0]; }
}
/// <summary>Base class for server-side implementations of DataTransferService</summary>
public abstract partial class DataTransferServiceBase
{
/// <summary>
/// Retrieves a supported data source and returns its settings,
/// which can be used for UI rendering.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.BigQuery.DataTransfer.V1.DataSource> GetDataSource(global::Google.Cloud.BigQuery.DataTransfer.V1.GetDataSourceRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Lists supported data sources and returns their settings,
/// which can be used for UI rendering.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesResponse> ListDataSources(global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Creates a new data transfer configuration.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig> CreateTransferConfig(global::Google.Cloud.BigQuery.DataTransfer.V1.CreateTransferConfigRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Updates a data transfer configuration.
/// All fields must be set, even if they are not updated.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig> UpdateTransferConfig(global::Google.Cloud.BigQuery.DataTransfer.V1.UpdateTransferConfigRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Deletes a data transfer configuration,
/// including any associated transfer runs and logs.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Protobuf.WellKnownTypes.Empty> DeleteTransferConfig(global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferConfigRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Returns information about a data transfer config.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig> GetTransferConfig(global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferConfigRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Returns information about all data transfers in the project.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsResponse> ListTransferConfigs(global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Creates transfer runs for a time range [range_start_time, range_end_time].
/// For each date - or whatever granularity the data source supports - in the
/// range, one transfer run is created.
/// Note that runs are created per UTC time in the time range.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsResponse> ScheduleTransferRuns(global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Returns information about the particular transfer run.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.BigQuery.DataTransfer.V1.TransferRun> GetTransferRun(global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferRunRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Deletes the specified transfer run.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Protobuf.WellKnownTypes.Empty> DeleteTransferRun(global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferRunRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Returns information about running and completed jobs.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsResponse> ListTransferRuns(global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Returns user facing log messages for the data transfer run.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsResponse> ListTransferLogs(global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Returns true if valid credentials exist for the given data source and
/// requesting user.
/// Some data sources doesn't support service account, so we need to talk to
/// them on behalf of the end user. This API just checks whether we have OAuth
/// token for the particular user, which is a pre-requisite before user can
/// create a transfer config.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsResponse> CheckValidCreds(global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for DataTransferService</summary>
public partial class DataTransferServiceClient : grpc::ClientBase<DataTransferServiceClient>
{
/// <summary>Creates a new client for DataTransferService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public DataTransferServiceClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for DataTransferService that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public DataTransferServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected DataTransferServiceClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected DataTransferServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
/// <summary>
/// Retrieves a supported data source and returns its settings,
/// which can be used for UI rendering.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.DataSource GetDataSource(global::Google.Cloud.BigQuery.DataTransfer.V1.GetDataSourceRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return GetDataSource(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Retrieves a supported data source and returns its settings,
/// which can be used for UI rendering.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.DataSource GetDataSource(global::Google.Cloud.BigQuery.DataTransfer.V1.GetDataSourceRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetDataSource, null, options, request);
}
/// <summary>
/// Retrieves a supported data source and returns its settings,
/// which can be used for UI rendering.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.DataSource> GetDataSourceAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.GetDataSourceRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return GetDataSourceAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Retrieves a supported data source and returns its settings,
/// which can be used for UI rendering.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.DataSource> GetDataSourceAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.GetDataSourceRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetDataSource, null, options, request);
}
/// <summary>
/// Lists supported data sources and returns their settings,
/// which can be used for UI rendering.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesResponse ListDataSources(global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return ListDataSources(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Lists supported data sources and returns their settings,
/// which can be used for UI rendering.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesResponse ListDataSources(global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_ListDataSources, null, options, request);
}
/// <summary>
/// Lists supported data sources and returns their settings,
/// which can be used for UI rendering.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesResponse> ListDataSourcesAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return ListDataSourcesAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Lists supported data sources and returns their settings,
/// which can be used for UI rendering.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesResponse> ListDataSourcesAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.ListDataSourcesRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_ListDataSources, null, options, request);
}
/// <summary>
/// Creates a new data transfer configuration.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig CreateTransferConfig(global::Google.Cloud.BigQuery.DataTransfer.V1.CreateTransferConfigRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return CreateTransferConfig(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Creates a new data transfer configuration.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig CreateTransferConfig(global::Google.Cloud.BigQuery.DataTransfer.V1.CreateTransferConfigRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_CreateTransferConfig, null, options, request);
}
/// <summary>
/// Creates a new data transfer configuration.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig> CreateTransferConfigAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.CreateTransferConfigRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return CreateTransferConfigAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Creates a new data transfer configuration.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig> CreateTransferConfigAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.CreateTransferConfigRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_CreateTransferConfig, null, options, request);
}
/// <summary>
/// Updates a data transfer configuration.
/// All fields must be set, even if they are not updated.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig UpdateTransferConfig(global::Google.Cloud.BigQuery.DataTransfer.V1.UpdateTransferConfigRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return UpdateTransferConfig(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Updates a data transfer configuration.
/// All fields must be set, even if they are not updated.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig UpdateTransferConfig(global::Google.Cloud.BigQuery.DataTransfer.V1.UpdateTransferConfigRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_UpdateTransferConfig, null, options, request);
}
/// <summary>
/// Updates a data transfer configuration.
/// All fields must be set, even if they are not updated.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig> UpdateTransferConfigAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.UpdateTransferConfigRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return UpdateTransferConfigAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Updates a data transfer configuration.
/// All fields must be set, even if they are not updated.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig> UpdateTransferConfigAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.UpdateTransferConfigRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_UpdateTransferConfig, null, options, request);
}
/// <summary>
/// Deletes a data transfer configuration,
/// including any associated transfer runs and logs.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Protobuf.WellKnownTypes.Empty DeleteTransferConfig(global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferConfigRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return DeleteTransferConfig(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Deletes a data transfer configuration,
/// including any associated transfer runs and logs.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Protobuf.WellKnownTypes.Empty DeleteTransferConfig(global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferConfigRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_DeleteTransferConfig, null, options, request);
}
/// <summary>
/// Deletes a data transfer configuration,
/// including any associated transfer runs and logs.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> DeleteTransferConfigAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferConfigRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return DeleteTransferConfigAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Deletes a data transfer configuration,
/// including any associated transfer runs and logs.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> DeleteTransferConfigAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferConfigRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_DeleteTransferConfig, null, options, request);
}
/// <summary>
/// Returns information about a data transfer config.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig GetTransferConfig(global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferConfigRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return GetTransferConfig(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Returns information about a data transfer config.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig GetTransferConfig(global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferConfigRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetTransferConfig, null, options, request);
}
/// <summary>
/// Returns information about a data transfer config.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig> GetTransferConfigAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferConfigRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return GetTransferConfigAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Returns information about a data transfer config.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.TransferConfig> GetTransferConfigAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferConfigRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetTransferConfig, null, options, request);
}
/// <summary>
/// Returns information about all data transfers in the project.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsResponse ListTransferConfigs(global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return ListTransferConfigs(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Returns information about all data transfers in the project.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsResponse ListTransferConfigs(global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_ListTransferConfigs, null, options, request);
}
/// <summary>
/// Returns information about all data transfers in the project.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsResponse> ListTransferConfigsAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return ListTransferConfigsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Returns information about all data transfers in the project.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsResponse> ListTransferConfigsAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferConfigsRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_ListTransferConfigs, null, options, request);
}
/// <summary>
/// Creates transfer runs for a time range [range_start_time, range_end_time].
/// For each date - or whatever granularity the data source supports - in the
/// range, one transfer run is created.
/// Note that runs are created per UTC time in the time range.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsResponse ScheduleTransferRuns(global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return ScheduleTransferRuns(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Creates transfer runs for a time range [range_start_time, range_end_time].
/// For each date - or whatever granularity the data source supports - in the
/// range, one transfer run is created.
/// Note that runs are created per UTC time in the time range.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsResponse ScheduleTransferRuns(global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_ScheduleTransferRuns, null, options, request);
}
/// <summary>
/// Creates transfer runs for a time range [range_start_time, range_end_time].
/// For each date - or whatever granularity the data source supports - in the
/// range, one transfer run is created.
/// Note that runs are created per UTC time in the time range.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsResponse> ScheduleTransferRunsAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return ScheduleTransferRunsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Creates transfer runs for a time range [range_start_time, range_end_time].
/// For each date - or whatever granularity the data source supports - in the
/// range, one transfer run is created.
/// Note that runs are created per UTC time in the time range.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsResponse> ScheduleTransferRunsAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.ScheduleTransferRunsRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_ScheduleTransferRuns, null, options, request);
}
/// <summary>
/// Returns information about the particular transfer run.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.TransferRun GetTransferRun(global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferRunRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return GetTransferRun(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Returns information about the particular transfer run.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.TransferRun GetTransferRun(global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferRunRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetTransferRun, null, options, request);
}
/// <summary>
/// Returns information about the particular transfer run.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.TransferRun> GetTransferRunAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferRunRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return GetTransferRunAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Returns information about the particular transfer run.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.TransferRun> GetTransferRunAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.GetTransferRunRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetTransferRun, null, options, request);
}
/// <summary>
/// Deletes the specified transfer run.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Protobuf.WellKnownTypes.Empty DeleteTransferRun(global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferRunRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return DeleteTransferRun(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Deletes the specified transfer run.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Protobuf.WellKnownTypes.Empty DeleteTransferRun(global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferRunRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_DeleteTransferRun, null, options, request);
}
/// <summary>
/// Deletes the specified transfer run.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> DeleteTransferRunAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferRunRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return DeleteTransferRunAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Deletes the specified transfer run.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> DeleteTransferRunAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.DeleteTransferRunRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_DeleteTransferRun, null, options, request);
}
/// <summary>
/// Returns information about running and completed jobs.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsResponse ListTransferRuns(global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return ListTransferRuns(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Returns information about running and completed jobs.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsResponse ListTransferRuns(global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_ListTransferRuns, null, options, request);
}
/// <summary>
/// Returns information about running and completed jobs.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsResponse> ListTransferRunsAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return ListTransferRunsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Returns information about running and completed jobs.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsResponse> ListTransferRunsAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferRunsRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_ListTransferRuns, null, options, request);
}
/// <summary>
/// Returns user facing log messages for the data transfer run.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsResponse ListTransferLogs(global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return ListTransferLogs(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Returns user facing log messages for the data transfer run.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsResponse ListTransferLogs(global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_ListTransferLogs, null, options, request);
}
/// <summary>
/// Returns user facing log messages for the data transfer run.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsResponse> ListTransferLogsAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return ListTransferLogsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Returns user facing log messages for the data transfer run.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsResponse> ListTransferLogsAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.ListTransferLogsRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_ListTransferLogs, null, options, request);
}
/// <summary>
/// Returns true if valid credentials exist for the given data source and
/// requesting user.
/// Some data sources doesn't support service account, so we need to talk to
/// them on behalf of the end user. This API just checks whether we have OAuth
/// token for the particular user, which is a pre-requisite before user can
/// create a transfer config.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsResponse CheckValidCreds(global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return CheckValidCreds(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Returns true if valid credentials exist for the given data source and
/// requesting user.
/// Some data sources doesn't support service account, so we need to talk to
/// them on behalf of the end user. This API just checks whether we have OAuth
/// token for the particular user, which is a pre-requisite before user can
/// create a transfer config.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsResponse CheckValidCreds(global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_CheckValidCreds, null, options, request);
}
/// <summary>
/// Returns true if valid credentials exist for the given data source and
/// requesting user.
/// Some data sources doesn't support service account, so we need to talk to
/// them on behalf of the end user. This API just checks whether we have OAuth
/// token for the particular user, which is a pre-requisite before user can
/// create a transfer config.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsResponse> CheckValidCredsAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return CheckValidCredsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Returns true if valid credentials exist for the given data source and
/// requesting user.
/// Some data sources doesn't support service account, so we need to talk to
/// them on behalf of the end user. This API just checks whether we have OAuth
/// token for the particular user, which is a pre-requisite before user can
/// create a transfer config.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsResponse> CheckValidCredsAsync(global::Google.Cloud.BigQuery.DataTransfer.V1.CheckValidCredsRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_CheckValidCreds, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override DataTransferServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new DataTransferServiceClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(DataTransferServiceBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_GetDataSource, serviceImpl.GetDataSource)
.AddMethod(__Method_ListDataSources, serviceImpl.ListDataSources)
.AddMethod(__Method_CreateTransferConfig, serviceImpl.CreateTransferConfig)
.AddMethod(__Method_UpdateTransferConfig, serviceImpl.UpdateTransferConfig)
.AddMethod(__Method_DeleteTransferConfig, serviceImpl.DeleteTransferConfig)
.AddMethod(__Method_GetTransferConfig, serviceImpl.GetTransferConfig)
.AddMethod(__Method_ListTransferConfigs, serviceImpl.ListTransferConfigs)
.AddMethod(__Method_ScheduleTransferRuns, serviceImpl.ScheduleTransferRuns)
.AddMethod(__Method_GetTransferRun, serviceImpl.GetTransferRun)
.AddMethod(__Method_DeleteTransferRun, serviceImpl.DeleteTransferRun)
.AddMethod(__Method_ListTransferRuns, serviceImpl.ListTransferRuns)
.AddMethod(__Method_ListTransferLogs, serviceImpl.ListTransferLogs)
.AddMethod(__Method_CheckValidCreds, serviceImpl.CheckValidCreds).Build();
}
}
}
#endregion
| 75.629667 | 384 | 0.732551 | [
"Apache-2.0"
] | chrisdunelm/gcloud-dotnet | apis/Google.Cloud.BigQuery.DataTransfer.V1/Google.Cloud.BigQuery.DataTransfer.V1/DatatransferGrpc.cs | 74,949 | C# |
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class HighScoreScreen : MonoBehaviour
{
// Start is called before the first frame update
public Text highScoreText;
private void Start()
{
highScoreText.text = PlayerPrefs.GetInt("HighScore", 0).ToString();
}
public void Continue()
{
SceneManager.LoadScene("Level 1");
}
}
| 19.666667 | 75 | 0.673123 | [
"MIT"
] | josephnglynn/Santa-Sleigh-Game | Assets/Scripts/HighScoreScreen.cs | 415 | C# |
using System;
using UntestableLibrary;
namespace Generics
{
public static class LifeInfo
{
public static bool IsTodayHoliday()
{
var dayOfWeek = DateTime.Today.DayOfWeek;
var holiday = ULConfigurationManager.GetProperty<DayOfWeek>("Holiday", DayOfWeek.Sunday);
switch (holiday)
{
case DayOfWeek.Sunday:
return dayOfWeek == DayOfWeek.Saturday || dayOfWeek == DayOfWeek.Sunday;
case DayOfWeek.Monday:
return dayOfWeek == DayOfWeek.Sunday || dayOfWeek == DayOfWeek.Monday;
case DayOfWeek.Tuesday:
return dayOfWeek == DayOfWeek.Monday || dayOfWeek == DayOfWeek.Tuesday;
case DayOfWeek.Wednesday:
return dayOfWeek == DayOfWeek.Tuesday || dayOfWeek == DayOfWeek.Wednesday;
case DayOfWeek.Thursday:
return dayOfWeek == DayOfWeek.Wednesday || dayOfWeek == DayOfWeek.Thursday;
case DayOfWeek.Friday:
return dayOfWeek == DayOfWeek.Thursday || dayOfWeek == DayOfWeek.Friday;
case DayOfWeek.Saturday:
return dayOfWeek == DayOfWeek.Friday || dayOfWeek == DayOfWeek.Saturday;
default:
return dayOfWeek == DayOfWeek.Saturday || dayOfWeek == DayOfWeek.Sunday;
}
}
}
}
| 42.294118 | 101 | 0.573018 | [
"MIT"
] | urasandesu/Prig.Samples | 04.Generics/Generics/LifeInfo.cs | 1,440 | C# |
using m3uParser.Model;
using Sprache;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace m3uParser
{
/// <summary>
/// https://en.wikipedia.org/wiki/M3U
/// https://github.com/sprache/Sprache
/// https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.2
/// http://ss-iptv.com/en/users/documents/m3u
/// https://developer.apple.com/library/content/technotes/tn2288/_index.html
/// https://developer.apple.com/documentation/http_live_streaming/example_playlists_for_http_live_streaming/event_playlist_construction
/// https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#page-12
/// https://wiki.tvip.ru/en/m3u
/// https://pastebin.com/KNYEZNun
/// https://github.com/AlexanderSofronov/iptv.example
/// </summary>
public static class M3U
{
public static Extm3u Parse(string content)
{
return new Extm3u(content);
}
public static Extm3u ParseBytes(byte[] byteArr)
{
return Parse(Encoding.Default.GetString(byteArr));
}
public static Extm3u ParseFromFile(string file)
{
return Parse(System.IO.File.ReadAllText(file));
}
public static async Task<Extm3u> ParseFromUrlAsync(string requestUri)
{
return await ParseFromUrlAsync(requestUri, new HttpClient());
}
public static async Task<Extm3u> ParseFromUrlAsync(string requestUri, HttpClient client)
{
var get = await client.GetAsync(requestUri);
var content = await get.Content.ReadAsStringAsync();
return Parse(content);
}
}
} | 33.425926 | 139 | 0.665374 | [
"MIT"
] | jefersonsv/m3uParser | src/m3uParser/M3U.cs | 1,807 | C# |
// <copyright file="LoadableComponent{T}.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>
namespace OpenQA.Selenium.Support.UI
{
/// <summary>
/// Represents any abstraction of something that can be loaded. This may be an entire web page, or
/// simply a component within that page (such as a login box or menu) or even a service.
/// </summary>
/// <typeparam name="T">The type to be returned (normally the subclass' type)</typeparam>
/// <example>
/// The expected usage is:
/// <para>
/// <code>
/// new HypotheticalComponent().Load();
/// </code>
/// </para>
/// </example>
/// <remarks>
/// After the <see cref="LoadableComponent{T}.Load()"/> method is called, the component will be loaded and
/// ready for use. Overload the protected Load and IsLoaded members to both load a component and determine
/// if the component is already loaded.
/// </remarks>
public abstract class LoadableComponent<T> : ILoadableComponent
where T : LoadableComponent<T>
{
/// <summary>
/// Gets or sets the message for the exception thrown when a component cannot be loaded
/// </summary>
public virtual string UnableToLoadMessage
{
get;
set;
}
/// <summary>
/// Gets a value indicating whether the component is fully loaded.
/// </summary>
/// <remarks>
/// When the component is loaded, this property will return true or false depending on
/// the execution of <see cref="EvaluateLoadedStatus"/> to indicate the not loaded state.
/// </remarks>
protected bool IsLoaded
{
get
{
bool isLoaded = false;
try
{
isLoaded = this.EvaluateLoadedStatus();
}
catch (WebDriverException)
{
return false;
}
return isLoaded;
}
}
/// <summary>
/// Ensure that the component is currently loaded.
/// </summary>
/// <returns>The loaded component.</returns>
/// <remarks>This is equivalent to the Get() method in Java version.</remarks>
public virtual T Load()
{
if (this.IsLoaded)
{
return (T)this;
}
else
{
this.TryLoad();
}
if (!this.IsLoaded)
{
throw new LoadableComponentException(this.UnableToLoadMessage);
}
return (T)this;
}
/// <summary>
/// Ensure that the component is currently loaded.
/// </summary>
/// <returns>The loaded <see cref="ILoadableComponent"/> instance.</returns>
ILoadableComponent ILoadableComponent.Load()
{
return (ILoadableComponent)this.Load();
}
/// <summary>
/// HandleLoadError gives a subclass the opportunity to handle a <see cref="WebDriverException"/> that occurred
/// during the execution of <see cref="ExecuteLoad"/>.
/// </summary>
/// <param name="ex">The exception which occurs on load.</param>
protected virtual void HandleLoadError(WebDriverException ex)
{
}
/// <summary>
/// When this method returns, the component modeled by the subclass should be fully loaded. This
/// subclass is expected to navigate to an appropriate page or trigger loading the correct HTML
/// should this be necessary.
/// </summary>
protected abstract void ExecuteLoad();
/// <summary>
/// Determine whether or not the component is loaded. Subclasses are expected to provide the details
/// to determine if the page or component is loaded.
/// </summary>
/// <returns>A boolean value indicating if the component is loaded.</returns>
protected abstract bool EvaluateLoadedStatus();
/// <summary>
/// Attempts to load this component, providing an opportunity for the user to handle any errors encountered
/// during the load process.
/// </summary>
/// <returns>A self-reference to this <see cref="LoadableComponent{T}"/></returns>
protected T TryLoad()
{
try
{
this.ExecuteLoad();
}
catch (WebDriverException e)
{
this.HandleLoadError(e);
}
return (T)this;
}
}
}
| 35.907895 | 119 | 0.583547 | [
"Apache-2.0"
] | 10088/selenium | dotnet/src/support/UI/LoadableComponent{T}.cs | 5,460 | C# |
using Discord;
using GrammarNazi.Core.BotCommands.Discord;
using GrammarNazi.Domain.Constants;
using GrammarNazi.Domain.Entities;
using GrammarNazi.Domain.Services;
using Moq;
using System.Threading.Tasks;
using Xunit;
namespace GrammarNazi.Tests.BotCommands.Discord
{
public class RemoveWhiteListCommandTests
{
[Fact]
public async Task NoParameter_Should_ReplyMessage()
{
// Arrange
var channelConfigurationServiceMock = new Mock<IDiscordChannelConfigService>();
var command = new RemoveWhiteListCommand(channelConfigurationServiceMock.Object);
const string replyMessage = "Parameter not received";
var chatConfig = new DiscordChannelConfig
{
WhiteListWords = new() { "Word" }
};
var channelMock = new Mock<IMessageChannel>();
var user = new Mock<IGuildUser>();
user.Setup(v => v.GuildPermissions).Returns(GuildPermissions.All);
var message = new Mock<IMessage>();
message.Setup(v => v.Content).Returns(DiscordBotCommands.AddWhiteList);
message.Setup(v => v.Author).Returns(user.Object);
message.Setup(v => v.Channel).Returns(channelMock.Object);
channelConfigurationServiceMock.Setup(v => v.GetConfigurationByChannelId(message.Object.Channel.Id))
.ReturnsAsync(chatConfig);
// Act
await command.Handle(message.Object);
// Assert
// Verify SendMessageAsync was called with the reply message "Parameter not received"
channelMock.Verify(v => v.SendMessageAsync(null, false, It.Is<Embed>(e => e.Description.Contains(replyMessage)), null, null, null));
}
[Fact]
public async Task NoWordExist_Should_ReplyMessage()
{
// Arrange
var channelConfigurationServiceMock = new Mock<IDiscordChannelConfigService>();
var command = new RemoveWhiteListCommand(channelConfigurationServiceMock.Object);
const string replyMessage = "is not in the WhiteList";
var chatConfig = new DiscordChannelConfig
{
WhiteListWords = new() { "Word" }
};
var channelMock = new Mock<IMessageChannel>();
var user = new Mock<IGuildUser>();
user.Setup(v => v.GuildPermissions).Returns(GuildPermissions.All);
var message = new Mock<IMessage>();
message.Setup(v => v.Content).Returns($"{DiscordBotCommands.AddWhiteList} Word2");
message.Setup(v => v.Author).Returns(user.Object);
message.Setup(v => v.Channel).Returns(channelMock.Object);
channelConfigurationServiceMock.Setup(v => v.GetConfigurationByChannelId(message.Object.Channel.Id))
.ReturnsAsync(chatConfig);
// Act
await command.Handle(message.Object);
// Assert
// Verify SendMessageAsync was called with the reply message "is not in the WhiteList"
channelMock.Verify(v => v.SendMessageAsync(null, false, It.Is<Embed>(e => e.Description.Contains(replyMessage)), null, null, null));
}
[Fact]
public async Task UserNotAdmin_Should_ReplyNotAdminMessage()
{
await TestUtilities.TestDiscordNotAdminUser(new RemoveWhiteListCommand(null));
}
[Theory]
[InlineData("Word", "Word")]
[InlineData("Word", "word")]
[InlineData("Word", "WORD")]
[InlineData("Word", "WoRd")]
public async Task WordExist_Should_RemoveWordFromWhiteList_And_ReplyMessage(string existingWord, string wordToRemove)
{
// Arrange
var channelConfigurationServiceMock = new Mock<IDiscordChannelConfigService>();
var command = new RemoveWhiteListCommand(channelConfigurationServiceMock.Object);
const string replyMessage = "removed from the WhiteList";
var chatConfig = new DiscordChannelConfig
{
WhiteListWords = new() { existingWord }
};
var channelMock = new Mock<IMessageChannel>();
var user = new Mock<IGuildUser>();
user.Setup(v => v.GuildPermissions).Returns(GuildPermissions.All);
var message = new Mock<IMessage>();
message.Setup(v => v.Content).Returns($"{DiscordBotCommands.RemoveWhiteList} {wordToRemove}");
message.Setup(v => v.Author).Returns(user.Object);
message.Setup(v => v.Channel).Returns(channelMock.Object);
channelConfigurationServiceMock.Setup(v => v.GetConfigurationByChannelId(message.Object.Channel.Id))
.ReturnsAsync(chatConfig);
// Act
await command.Handle(message.Object);
// Assert
// Verify SendMessageAsync was called with the reply message "added to the WhiteList"
channelMock.Verify(v => v.SendMessageAsync(null, false, It.Is<Embed>(e => e.Description.Contains(replyMessage)), null, null, null));
Assert.Empty(chatConfig.WhiteListWords);
}
}
}
| 41.870968 | 144 | 0.6302 | [
"MIT"
] | Peter-Kang/Smart-Alek | GrammarNazi.Tests/BotCommands/Discord/RemoveWhiteListCommandTests.cs | 5,194 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Core.Pipeline;
using Azure.ResourceManager;
using Azure.ResourceManager.Compute.Models;
using Azure.ResourceManager.Core;
namespace Azure.ResourceManager.Compute
{
/// <summary> A class representing collection of GalleryApplication and their operations over its parent. </summary>
public partial class GalleryApplicationCollection : ArmCollection, IEnumerable<GalleryApplication>, IAsyncEnumerable<GalleryApplication>
{
private readonly ClientDiagnostics _clientDiagnostics;
private readonly GalleryApplicationsRestOperations _galleryApplicationsRestClient;
/// <summary> Initializes a new instance of the <see cref="GalleryApplicationCollection"/> class for mocking. </summary>
protected GalleryApplicationCollection()
{
}
/// <summary> Initializes a new instance of GalleryApplicationCollection class. </summary>
/// <param name="parent"> The resource representing the parent resource. </param>
internal GalleryApplicationCollection(ArmResource parent) : base(parent)
{
_clientDiagnostics = new ClientDiagnostics(ClientOptions);
_galleryApplicationsRestClient = new GalleryApplicationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri);
}
/// <summary> Gets the valid resource type for this object. </summary>
protected override ResourceType ValidResourceType => Gallery.ResourceType;
// Collection level operations.
/// <summary> Create or update a gallery Application Definition. </summary>
/// <param name="galleryApplicationName"> The name of the gallery Application Definition to be created or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 characters. </param>
/// <param name="galleryApplication"> Parameters supplied to the create or update gallery Application operation. </param>
/// <param name="waitForCompletion"> Waits for the completion of the long running operations. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="galleryApplicationName"/> or <paramref name="galleryApplication"/> is null. </exception>
public virtual GalleryApplicationCreateOrUpdateOperation CreateOrUpdate(string galleryApplicationName, GalleryApplicationData galleryApplication, bool waitForCompletion = true, CancellationToken cancellationToken = default)
{
if (galleryApplicationName == null)
{
throw new ArgumentNullException(nameof(galleryApplicationName));
}
if (galleryApplication == null)
{
throw new ArgumentNullException(nameof(galleryApplication));
}
using var scope = _clientDiagnostics.CreateScope("GalleryApplicationCollection.CreateOrUpdate");
scope.Start();
try
{
var response = _galleryApplicationsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, galleryApplicationName, galleryApplication, cancellationToken);
var operation = new GalleryApplicationCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _galleryApplicationsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, galleryApplicationName, galleryApplication).Request, response);
if (waitForCompletion)
operation.WaitForCompletion(cancellationToken);
return operation;
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Create or update a gallery Application Definition. </summary>
/// <param name="galleryApplicationName"> The name of the gallery Application Definition to be created or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 characters. </param>
/// <param name="galleryApplication"> Parameters supplied to the create or update gallery Application operation. </param>
/// <param name="waitForCompletion"> Waits for the completion of the long running operations. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="galleryApplicationName"/> or <paramref name="galleryApplication"/> is null. </exception>
public async virtual Task<GalleryApplicationCreateOrUpdateOperation> CreateOrUpdateAsync(string galleryApplicationName, GalleryApplicationData galleryApplication, bool waitForCompletion = true, CancellationToken cancellationToken = default)
{
if (galleryApplicationName == null)
{
throw new ArgumentNullException(nameof(galleryApplicationName));
}
if (galleryApplication == null)
{
throw new ArgumentNullException(nameof(galleryApplication));
}
using var scope = _clientDiagnostics.CreateScope("GalleryApplicationCollection.CreateOrUpdate");
scope.Start();
try
{
var response = await _galleryApplicationsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, galleryApplicationName, galleryApplication, cancellationToken).ConfigureAwait(false);
var operation = new GalleryApplicationCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _galleryApplicationsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, galleryApplicationName, galleryApplication).Request, response);
if (waitForCompletion)
await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
return operation;
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves information about a gallery Application Definition. </summary>
/// <param name="galleryApplicationName"> The name of the gallery Application Definition to be retrieved. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="galleryApplicationName"/> is null. </exception>
public virtual Response<GalleryApplication> Get(string galleryApplicationName, CancellationToken cancellationToken = default)
{
if (galleryApplicationName == null)
{
throw new ArgumentNullException(nameof(galleryApplicationName));
}
using var scope = _clientDiagnostics.CreateScope("GalleryApplicationCollection.Get");
scope.Start();
try
{
var response = _galleryApplicationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, galleryApplicationName, cancellationToken);
if (response.Value == null)
throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
return Response.FromValue(new GalleryApplication(Parent, response.Value), response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Retrieves information about a gallery Application Definition. </summary>
/// <param name="galleryApplicationName"> The name of the gallery Application Definition to be retrieved. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="galleryApplicationName"/> is null. </exception>
public async virtual Task<Response<GalleryApplication>> GetAsync(string galleryApplicationName, CancellationToken cancellationToken = default)
{
if (galleryApplicationName == null)
{
throw new ArgumentNullException(nameof(galleryApplicationName));
}
using var scope = _clientDiagnostics.CreateScope("GalleryApplicationCollection.Get");
scope.Start();
try
{
var response = await _galleryApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, galleryApplicationName, cancellationToken).ConfigureAwait(false);
if (response.Value == null)
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false);
return Response.FromValue(new GalleryApplication(Parent, response.Value), response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Tries to get details for this resource from the service. </summary>
/// <param name="galleryApplicationName"> The name of the gallery Application Definition to be retrieved. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="galleryApplicationName"/> is null. </exception>
public virtual Response<GalleryApplication> GetIfExists(string galleryApplicationName, CancellationToken cancellationToken = default)
{
if (galleryApplicationName == null)
{
throw new ArgumentNullException(nameof(galleryApplicationName));
}
using var scope = _clientDiagnostics.CreateScope("GalleryApplicationCollection.GetIfExists");
scope.Start();
try
{
var response = _galleryApplicationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, galleryApplicationName, cancellationToken: cancellationToken);
return response.Value == null
? Response.FromValue<GalleryApplication>(null, response.GetRawResponse())
: Response.FromValue(new GalleryApplication(this, response.Value), response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Tries to get details for this resource from the service. </summary>
/// <param name="galleryApplicationName"> The name of the gallery Application Definition to be retrieved. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="galleryApplicationName"/> is null. </exception>
public async virtual Task<Response<GalleryApplication>> GetIfExistsAsync(string galleryApplicationName, CancellationToken cancellationToken = default)
{
if (galleryApplicationName == null)
{
throw new ArgumentNullException(nameof(galleryApplicationName));
}
using var scope = _clientDiagnostics.CreateScope("GalleryApplicationCollection.GetIfExistsAsync");
scope.Start();
try
{
var response = await _galleryApplicationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, galleryApplicationName, cancellationToken: cancellationToken).ConfigureAwait(false);
return response.Value == null
? Response.FromValue<GalleryApplication>(null, response.GetRawResponse())
: Response.FromValue(new GalleryApplication(this, response.Value), response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Tries to get details for this resource from the service. </summary>
/// <param name="galleryApplicationName"> The name of the gallery Application Definition to be retrieved. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="galleryApplicationName"/> is null. </exception>
public virtual Response<bool> Exists(string galleryApplicationName, CancellationToken cancellationToken = default)
{
if (galleryApplicationName == null)
{
throw new ArgumentNullException(nameof(galleryApplicationName));
}
using var scope = _clientDiagnostics.CreateScope("GalleryApplicationCollection.Exists");
scope.Start();
try
{
var response = GetIfExists(galleryApplicationName, cancellationToken: cancellationToken);
return Response.FromValue(response.Value != null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Tries to get details for this resource from the service. </summary>
/// <param name="galleryApplicationName"> The name of the gallery Application Definition to be retrieved. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="galleryApplicationName"/> is null. </exception>
public async virtual Task<Response<bool>> ExistsAsync(string galleryApplicationName, CancellationToken cancellationToken = default)
{
if (galleryApplicationName == null)
{
throw new ArgumentNullException(nameof(galleryApplicationName));
}
using var scope = _clientDiagnostics.CreateScope("GalleryApplicationCollection.ExistsAsync");
scope.Start();
try
{
var response = await GetIfExistsAsync(galleryApplicationName, cancellationToken: cancellationToken).ConfigureAwait(false);
return Response.FromValue(response.Value != null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> List gallery Application Definitions in a gallery. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <returns> A collection of <see cref="GalleryApplication" /> that may take multiple service requests to iterate over. </returns>
public virtual Pageable<GalleryApplication> GetAll(CancellationToken cancellationToken = default)
{
Page<GalleryApplication> FirstPageFunc(int? pageSizeHint)
{
using var scope = _clientDiagnostics.CreateScope("GalleryApplicationCollection.GetAll");
scope.Start();
try
{
var response = _galleryApplicationsRestClient.ListByGallery(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken);
return Page.FromValues(response.Value.Value.Select(value => new GalleryApplication(Parent, value)), response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
Page<GalleryApplication> NextPageFunc(string nextLink, int? pageSizeHint)
{
using var scope = _clientDiagnostics.CreateScope("GalleryApplicationCollection.GetAll");
scope.Start();
try
{
var response = _galleryApplicationsRestClient.ListByGalleryNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken);
return Page.FromValues(response.Value.Value.Select(value => new GalleryApplication(Parent, value)), response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
}
/// <summary> List gallery Application Definitions in a gallery. </summary>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <returns> An async collection of <see cref="GalleryApplication" /> that may take multiple service requests to iterate over. </returns>
public virtual AsyncPageable<GalleryApplication> GetAllAsync(CancellationToken cancellationToken = default)
{
async Task<Page<GalleryApplication>> FirstPageFunc(int? pageSizeHint)
{
using var scope = _clientDiagnostics.CreateScope("GalleryApplicationCollection.GetAll");
scope.Start();
try
{
var response = await _galleryApplicationsRestClient.ListByGalleryAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value.Select(value => new GalleryApplication(Parent, value)), response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
async Task<Page<GalleryApplication>> NextPageFunc(string nextLink, int? pageSizeHint)
{
using var scope = _clientDiagnostics.CreateScope("GalleryApplicationCollection.GetAll");
scope.Start();
try
{
var response = await _galleryApplicationsRestClient.ListByGalleryNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Value.Select(value => new GalleryApplication(Parent, value)), response.Value.NextLink, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
}
IEnumerator<GalleryApplication> IEnumerable<GalleryApplication>.GetEnumerator()
{
return GetAll().GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetAll().GetEnumerator();
}
IAsyncEnumerator<GalleryApplication> IAsyncEnumerable<GalleryApplication>.GetAsyncEnumerator(CancellationToken cancellationToken)
{
return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken);
}
// Builders.
// public ArmBuilder<Azure.ResourceManager.ResourceIdentifier, GalleryApplication, GalleryApplicationData> Construct() { }
}
}
| 54.01897 | 288 | 0.648874 | [
"MIT"
] | 93mishra/azure-sdk-for-net | sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationCollection.cs | 19,933 | C# |
using Tubumu.Core.Extensions;
namespace TubumuMeeting.Mediasoup
{
public enum MethodId
{
[EnumStringValue("worker.dump")]
WORKER_DUMP = 1,
[EnumStringValue("worker.getResourceUsage")]
WORKER_GET_RESOURCE_USAGE,
[EnumStringValue("worker.updateSettings")]
WORKER_UPDATE_SETTINGS,
[EnumStringValue("worker.createRouter")]
WORKER_CREATE_ROUTER,
[EnumStringValue("router.close")]
ROUTER_CLOSE,
[EnumStringValue("router.dump")]
ROUTER_DUMP,
[EnumStringValue("router.createWebRtcTransport")]
ROUTER_CREATE_WEBRTC_TRANSPORT,
[EnumStringValue("router.createPlainTransport")]
ROUTER_CREATE_PLAIN_TRANSPORT,
[EnumStringValue("router.createPipeTransport")]
ROUTER_CREATE_PIPE_TRANSPORT,
[EnumStringValue("router.createAudioLevelObserver")]
ROUTER_CREATE_AUDIO_LEVEL_OBSERVER,
[EnumStringValue("transport.close")]
TRANSPORT_CLOSE,
[EnumStringValue("transport.dump")]
TRANSPORT_DUMP,
[EnumStringValue("transport.getStats")]
TRANSPORT_GET_STATS,
[EnumStringValue("transport.connect")]
TRANSPORT_CONNECT,
[EnumStringValue("transport.setMaxIncomingBitrate")]
TRANSPORT_SET_MAX_INCOMING_BITRATE,
[EnumStringValue("transport.restartIce")]
TRANSPORT_RESTART_ICE,
[EnumStringValue("transport.produce")]
TRANSPORT_PRODUCE,
[EnumStringValue("transport.consume")]
TRANSPORT_CONSUME,
[EnumStringValue("transport.produceData")]
TRANSPORT_PRODUCE_DATA,
[EnumStringValue("transport.consumeData")]
TRANSPORT_CONSUME_DATA,
[EnumStringValue("transport.enableTraceEvents")]
TRANSPORT_ENABLE_TRACE_EVENT,
[EnumStringValue("producer.close")]
PRODUCER_CLOSE,
[EnumStringValue("producer.dump")]
PRODUCER_DUMP,
[EnumStringValue("producer.getStats")]
PRODUCER_GET_STATS,
[EnumStringValue("producer.pause")]
PRODUCER_PAUSE,
[EnumStringValue("producer.resume")]
PRODUCER_RESUME,
[EnumStringValue("producer.enableTraceEvent")]
PRODUCER_ENABLE_TRACE_EVENT,
[EnumStringValue("consumer.close")]
CONSUMER_CLOSE,
[EnumStringValue("consumer.dump")]
CONSUMER_DUMP,
[EnumStringValue("consumer.getStats")]
CONSUMER_GET_STATS,
[EnumStringValue("consumer.pause")]
CONSUMER_PAUSE,
[EnumStringValue("consumer.resume")]
CONSUMER_RESUME,
[EnumStringValue("consumer.setPreferredLayers")]
CONSUMER_SET_PREFERRED_LAYERS,
[EnumStringValue("consumer.setPriority")]
CONSUMER_SET_PRIORITY,
[EnumStringValue("consumer.requestKeyFrame")]
CONSUMER_REQUEST_KEY_FRAME,
[EnumStringValue("consumer.enableTraceEvent")]
CONSUMER_ENABLE_TRACE_EVENT,
[EnumStringValue("dataProducer.close")]
DATA_PRODUCER_CLOSE,
[EnumStringValue("dataProducer.dump")]
DATA_PRODUCER_DUMP,
[EnumStringValue("dataProducer.getStats")]
DATA_PRODUCER_GET_STATS,
[EnumStringValue("dataConsumer.dump")]
DATA_CONSUMER_CLOSE,
[EnumStringValue("dataConsumer.close")]
DATA_CONSUMER_DUMP,
[EnumStringValue("dataConsumer.getStats")]
DATA_CONSUMER_GET_STATS,
[EnumStringValue("rtpObserver.close")]
RTP_OBSERVER_CLOSE,
[EnumStringValue("rtpObserver.pause")]
RTP_OBSERVER_PAUSE,
[EnumStringValue("rtpObserver.resume")]
RTP_OBSERVER_RESUME,
[EnumStringValue("rtpObserver.addProducer")]
RTP_OBSERVER_ADD_PRODUCER,
[EnumStringValue("rtpObserver.removeProducer")]
RTP_OBSERVER_REMOVE_PRODUCER
}
}
| 26.154362 | 60 | 0.66564 | [
"MIT"
] | 694296033/TubumuMeeting | TubumuMeeting.Mediasoup.Common/Constants/MethodId.cs | 3,899 | C# |
namespace codessentials.CGM.Commands
{
/// <remarks>
/// Class=0, ElementId=1
/// </remarks>
public class BeginMetafile : Command
{
public string FileName { get; private set; }
public BeginMetafile(CgmFile container)
: base(new CommandConstructorArguments(ClassCode.DelimiterElement, 1, container))
{
}
public BeginMetafile(CgmFile container, string fileName)
: this(container)
{
FileName = fileName;
}
public override void ReadFromBinary(IBinaryReader reader)
{
FileName = reader.ArgumentsCount > 0 ? reader.ReadString() : "";
}
public override void WriteAsBinary(IBinaryWriter writer)
{
writer.WriteString(FileName);
}
public override void WriteAsClearText(IClearTextWriter writer)
{
writer.WriteLine($"BEGMF {WriteString(FileName)};");
}
public override string ToString()
{
return "BeginMetafile " + FileName;
}
}
} | 25.857143 | 93 | 0.58011 | [
"MIT"
] | twenzel/CGM | src/Commands/BeginMetafile.cs | 1,088 | C# |
using System;
using System.IO;
using System.Text;
namespace Chat
{
/// <summary>
/// Summary description for DataStream.
/// </summary>
public class DataStream : Stream
{
private Stream source;
private bool computeInputChecksum;
private bool computeOutputChecksum;
private int inputChecksum;
private int outputChecksum;
public DataStream(Stream source)
{
this.source = source;
}
/// <summary>
/// Gets the source stream that provides data to this stream.
/// </summary>
public Stream Source
{
get
{
return source;
}
}
public override void Close()
{
base.Close ();
source.Close();
}
/// <summary>
/// Awaits the provided byte sequence. If the sequence is found in the stream, true will be returned.
/// If the stream is closed before the sequence was found, false will be returned. This is useful when
/// delimiting packets with start bytes in packet based communication protocols.
/// </summary>
/// <param name="sequence">The byte sequence to a await.</param>
/// <returns>Whether or not the sequence was found. If not, the stream has been closed.</returns>
public bool Await(byte[] sequence)
{
for(int cursor = 0;;)
{
int data = ReadByte();
if(data == -1)
{
return false;
}
else
{
if(data == sequence[cursor++])
{
if(cursor == sequence.Length)
{
return true;
}
}
else
{
cursor = 0;
}
}
}
}
#region Checksum
/// <summary>
/// Gets or sets whether or not to compute a checksum on incoming bytes. If set, each byte read will affect
/// the internal input checksum. This is useful when comparing an incoming checksum against a
/// computed checksum.
/// </summary>
public bool ComputeInputChecksum
{
get
{
return computeInputChecksum;
}
set
{
ResetInputChecksum();
computeInputChecksum = value;
}
}
/// <summary>
/// Gets or sets whether or not to compute a checksum on outgoing bytes. If set, each byte written will
/// affect the internal output checksum. This is useful when appending a checksum on a packet.
/// </summary>
public bool ComputeOutputChecksum
{
get
{
return computeOutputChecksum;
}
set
{
ResetOutputChecksum();
computeOutputChecksum = value;
}
}
/// <summary>
/// Gets the output checksum, i.e. the checksum that is computed on outgoing data.
/// </summary>
public int OutputChecksum
{
get
{
return outputChecksum;
}
}
/// <summary>
/// Returns the input checkum, i.e. the checksum that is computed on incoming data.
/// </summary>
public int InputChecksum
{
get
{
return inputChecksum;
}
}
/// <summary>
/// Resets the input checksum.
/// </summary>
public void ResetInputChecksum()
{
inputChecksum = 0;
}
/// <summary>
/// Resets the output checksum.
/// </summary>
public void ResetOutputChecksum()
{
outputChecksum = 0;
}
#endregion
#region Read and Write Data
public void WriteShort(short data)
{
Write(new byte[] { (byte)((data >> 8) & 0xFF), (byte)((data) & 0xFF) }, 0, 2);
}
public void WriteInt(int data)
{
Write(new byte[] { (byte)((data >> 24) & 0xFF), (byte)((data >> 16) & 0xFF), (byte)((data >> 8) & 0xFF), (byte)((data) & 0xFF) }, 0, 4);
}
public void WriteUTF8(String str)
{
WriteString(str, Encoding.UTF8);
}
public void WriteUnicode(String str)
{
WriteString(str, Encoding.Unicode);
}
public void WriteString(String str, Encoding encoding)
{
Encoder encoder = encoding.GetEncoder();
char[] characters = str.ToCharArray();
byte[] buffer = new byte[encoder.GetByteCount(characters, 0, characters.Length, true)];
encoder.GetBytes(characters, 0, characters.Length, buffer, 0, true);
WriteShort((short)buffer.Length);
Write(buffer, 0, buffer.Length);
}
public String ReadUTF8()
{
return ReadString(Encoding.UTF8);
}
public String ReadUnicode()
{
return ReadString(Encoding.Unicode);
}
public String ReadString(Encoding encoding)
{
// Create a new decoder that can decode encoded strings
//
Decoder decoder = encoding.GetDecoder();
// Read the length of the encoded string
//
int length = ReadShort();
// Allocate a new buffer for the encoded string
//
byte[] buffer = new byte[length];
// Read the encoded string
//
Read(buffer, 0, length);
// Allocate a buffer for the decoded string
//
char[] characters = new char[decoder.GetCharCount(buffer, 0, buffer.Length)];
// Decode the string
//
decoder.GetChars(buffer, 0, length, characters, 0);
return new String(characters);
}
public short ReadShort()
{
int high = ReadByte();
int low = ReadByte();
if(high == -1 || low == -1)
{
throw new IOException("End of file");
}
else
{
return (short)(high << 8 | low);
}
}
public int ReadInt()
{
int xhigh = ReadByte();
int xlow = ReadByte();
int high = ReadByte();
int low = ReadByte();
if(xhigh == -1 || xlow == -1 || high == -1 || low == -1)
{
throw new IOException("End of file");
}
else
{
return xhigh << 24 | xlow << 16 | high << 8 | low;
}
}
#endregion
#region Stream Members
public override long Length
{
get
{
return source.Length;
}
}
public override bool CanRead
{
get
{
return source.CanRead;
}
}
public override bool CanSeek
{
get
{
return source.CanSeek;
}
}
public override bool CanWrite
{
get
{
return source.CanWrite;
}
}
public override long Position
{
get
{
return source.Position;
}
set
{
source.Position = value;
}
}
public override void Flush()
{
source.Flush();
}
public override int Read(byte[] buffer, int offset, int count)
{
int bytesRead = source.Read(buffer, offset, count);
if(ComputeInputChecksum)
{
for(int i = offset; i < bytesRead; i++)
{
inputChecksum += inputChecksum ^ buffer[i];
}
}
return bytesRead;
}
public override void Write(byte[] buffer, int offset, int count)
{
source.Write(buffer, offset, count);
if(ComputeOutputChecksum)
{
for(int i = offset; i < count; i++)
{
outputChecksum += outputChecksum ^ buffer[i];
}
}
}
public override long Seek(long offset, SeekOrigin origin)
{
return source.Seek(offset, origin);
}
public override void SetLength(long value)
{
source.SetLength(value);
}
#endregion
}
}
| 19.676056 | 140 | 0.586256 | [
"MIT"
] | johanlantz/headsetpresenter | HeadsetPresenter_Bluetools/HeadsetPresenter/Bluetools/BlueTools SDK v1.2/dotNet/C#/Chat/DataStream.cs | 6,985 | 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.Collections.Generic;
using System.Linq;
using Microsoft.DotNet.ApiCompatibility.Abstractions;
using NuGet.Client;
using NuGet.ContentModel;
using NuGet.Frameworks;
namespace Microsoft.DotNet.PackageValidation
{
/// <summary>
/// Validates that the api surface of the compatible frameworks.
/// </summary>
public class CompatibleFrameworkInPackageValidator
{
private readonly ApiCompatRunner _apiCompatRunner;
public CompatibleFrameworkInPackageValidator(string noWarn, (string, string)[] ignoredDifferences, bool enableStrictMode, IPackageLogger log)
{
_apiCompatRunner = new(noWarn, ignoredDifferences, enableStrictMode, log);
}
/// <summary>
/// Validates that the compatible frameworks have compatible surface area.
/// </summary>
/// <param name="package">Nuget Package that needs to be validated.</param>
public void Validate(Package package)
{
_apiCompatRunner.InitializePaths(package.PackagePath, package.PackagePath);
IEnumerable<ContentItem> compileAssets = package.CompileAssets.OrderByDescending(t => ((NuGetFramework)t.Properties["tfm"]).Version);
ManagedCodeConventions conventions = new ManagedCodeConventions(null);
Queue<ContentItem> compileAssetsQueue = new Queue<ContentItem>(compileAssets);
while (compileAssetsQueue.Count > 0)
{
ContentItem compileTimeAsset = compileAssetsQueue.Dequeue();
ContentItemCollection contentItemCollection = new();
contentItemCollection.Load(compileAssetsQueue.Select(t => t.Path));
NuGetFramework framework = (NuGetFramework)compileTimeAsset.Properties["tfm"];
SelectionCriteria managedCriteria = conventions.Criteria.ForFramework(framework);
ContentItem compatibleFrameworkAsset = null;
if (package.HasRefAssemblies)
{
compatibleFrameworkAsset = contentItemCollection.FindBestItemGroup(managedCriteria, conventions.Patterns.CompileRefAssemblies)?.Items.FirstOrDefault();
}
else
{
compatibleFrameworkAsset = contentItemCollection.FindBestItemGroup(managedCriteria, conventions.Patterns.CompileLibAssemblies)?.Items.FirstOrDefault();
}
if (compatibleFrameworkAsset != null && compatibleFrameworkAsset.Path != compileTimeAsset.Path)
{
string header = string.Format(Resources.ApiCompatibilityHeader, compatibleFrameworkAsset.Path, compileTimeAsset.Path);
_apiCompatRunner.QueueApiCompatFromContentItem(package.PackageId, compatibleFrameworkAsset, compileTimeAsset, header);
}
}
_apiCompatRunner.RunApiCompat();
}
}
}
| 46.393939 | 171 | 0.678315 | [
"MIT"
] | Scopetta197/sdk | src/Compatibility/Microsoft.DotNet.PackageValidation/CompatibleFrameworkInPackageValidator.cs | 3,062 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace DirBackupper
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
| 19.896552 | 41 | 0.767764 | [
"MIT"
] | karasuma/DirBackupper | DirBackupper/Windows/MainWindow.xaml.cs | 597 | C# |
using System;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using NiL.JS.BaseLibrary;
using NiL.JS.Core.Functions;
#if NET40 || NETCORE
using NiL.JS.Backward;
#endif
namespace NiL.JS.Core.Interop
{
#if !(PORTABLE || NETCORE)
[Serializable]
#endif
internal abstract class Proxy : JSObject
{
internal Type _hostedType;
#if !(PORTABLE || NETCORE)
[NonSerialized]
#endif
internal StringMap<IList<MemberInfo>> _members;
internal GlobalContext _context;
private PropertyPair _indexerProperty;
private bool _indexersSupported;
private ConstructorInfo _instanceCtor;
private JSObject _prototypeInstance;
internal virtual JSObject PrototypeInstance
{
get
{
#if (PORTABLE || NETCORE)
if (_prototypeInstance == null && IsInstancePrototype && !_hostedType.GetTypeInfo().IsAbstract)
{
#else
if (_prototypeInstance == null && IsInstancePrototype && !_hostedType.IsAbstract)
{
try
{
#endif
if (_instanceCtor != null)
{
if (_hostedType == typeof(JSObject))
{
_prototypeInstance = CreateObject();
_prototypeInstance._objectPrototype = @null;
_prototypeInstance._fields = _fields;
_prototypeInstance._attributes |= JSValueAttributesInternal.ProxyPrototype;
}
else if (typeof(JSObject).IsAssignableFrom(_hostedType))
{
_prototypeInstance = _instanceCtor.Invoke(null) as JSObject;
_prototypeInstance._objectPrototype = __proto__;
_prototypeInstance._attributes |= JSValueAttributesInternal.ProxyPrototype;
_prototypeInstance._fields = _fields;
//_prototypeInstance.valueType = (JSValueType)System.Math.Max((int)JSValueType.Object, (int)_prototypeInstance.valueType);
_valueType = (JSValueType)System.Math.Max((int)JSValueType.Object, (int)_prototypeInstance._valueType);
}
else
{
var instance = _instanceCtor.Invoke(null);
_prototypeInstance = new ObjectWrapper(instance, this)
{
_attributes = _attributes | JSValueAttributesInternal.ProxyPrototype,
_fields = _fields,
_objectPrototype = _context.GlobalContext._GlobalPrototype
};
}
}
#if !(PORTABLE || NETCORE)
}
catch (COMException)
{
}
#endif
}
return _prototypeInstance;
}
}
internal abstract bool IsInstancePrototype { get; }
internal Proxy(GlobalContext context, Type type, bool indexersSupport)
{
_indexersSupported = indexersSupport;
_valueType = JSValueType.Object;
_oValue = this;
_attributes |= JSValueAttributesInternal.SystemObject | JSValueAttributesInternal.DoNotEnumerate;
_fields = getFieldsContainer();
_context = context;
_hostedType = type;
#if (PORTABLE || NETCORE)
_instanceCtor = _hostedType.GetTypeInfo().DeclaredConstructors.FirstOrDefault(x => x.GetParameters().Length == 0 && !x.IsStatic);
#else
_instanceCtor = _hostedType.GetConstructor(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy, null, Type.EmptyTypes, null);
#endif
}
private void fillMembers()
{
lock (this)
{
if (_members != null)
return;
var tempMembers = new StringMap<IList<MemberInfo>>();
string prewName = null;
IList<MemberInfo> temp = null;
bool instanceAttribute = false;
#if (PORTABLE || NETCORE)
var members = _hostedType.GetTypeInfo().DeclaredMembers
.Union(_hostedType.GetRuntimeMethods())
.Union(_hostedType.GetRuntimeProperties())
.Union(_hostedType.GetRuntimeFields())
.Union(_hostedType.GetRuntimeEvents()).ToArray();
#else
var members = _hostedType.GetMembers();
#endif
for (int i = 0; i < members.Length; i++)
{
var member = members[i];
if (member.IsDefined(typeof(HiddenAttribute), false))
continue;
instanceAttribute = member.IsDefined(typeof(InstanceMemberAttribute), false);
if (!IsInstancePrototype && instanceAttribute)
continue;
var property = member as PropertyInfo;
if (property != null)
{
if ((property.GetSetMethod(true) ?? property.GetGetMethod(true)).IsStatic != !(IsInstancePrototype ^ instanceAttribute))
continue;
if ((property.GetSetMethod(true) == null || !property.GetSetMethod(true).IsPublic)
&& (property.GetGetMethod(true) == null || !property.GetGetMethod(true).IsPublic))
continue;
var parentProperty = property;
while (parentProperty != null
&& parentProperty.DeclaringType != typeof(object)
&& ((property.GetGetMethod() ?? property.GetSetMethod()).Attributes & MethodAttributes.NewSlot) == 0)
{
property = parentProperty;
#if (PORTABLE || NETCORE)
parentProperty = property.DeclaringType.GetTypeInfo().BaseType?.GetRuntimeProperty(property.Name);
#else
parentProperty = property.DeclaringType.GetTypeInfo().BaseType?.GetProperty(property.Name, BindingFlags.Public | BindingFlags.Instance);
#endif
}
member = property;
}
if (member is EventInfo
&& (!(member as EventInfo).GetAddMethod(true).IsPublic || (member as EventInfo).GetAddMethod(true).IsStatic != !IsInstancePrototype))
continue;
if (member is FieldInfo && (!(member as FieldInfo).IsPublic || (member as FieldInfo).IsStatic != !IsInstancePrototype))
continue;
#if (PORTABLE || NETCORE)
if ((members[i] is TypeInfo) && !(members[i] as TypeInfo).IsPublic)
continue;
#else
if (member is Type && !(member as Type).IsPublic && !(member as Type).IsNestedPublic)
continue;
#endif
var method = member as MethodBase;
if (method != null)
{
if (method.IsStatic != !(IsInstancePrototype ^ instanceAttribute))
continue;
if (!method.IsPublic)
continue;
if (method.DeclaringType == typeof(object) && member.Name == "GetType")
continue;
if (method is ConstructorInfo)
continue;
if (method.IsVirtual && (method.Attributes & MethodAttributes.NewSlot) == 0)
{
var parameterTypes = method.GetParameters().Select(x => x.ParameterType).ToArray();
var parentMethod = method;
while (parentMethod != null && parentMethod.DeclaringType != typeof(object) && (method.Attributes & MethodAttributes.NewSlot) == 0)
{
method = parentMethod;
#if (PORTABLE || NETCORE)
parentMethod = method.DeclaringType.GetTypeInfo().BaseType?.GetMethod(method.Name, parameterTypes);
#else
parentMethod = method.DeclaringType.BaseType?.GetMethod(method.Name, BindingFlags.Public | BindingFlags.Instance, null, parameterTypes, null);
#endif
}
}
member = method;
}
var membername = member.Name;
if (member.IsDefined(typeof(JavaScriptNameAttribute), false))
{
var nameOverrideAttribute = member.GetCustomAttributes(typeof(JavaScriptNameAttribute), false).ToArray();
membername = (nameOverrideAttribute[0] as JavaScriptNameAttribute).Name;
}
else
{
membername = membername[0] == '.' ? membername : membername.Contains(".") ? membername.Substring(membername.LastIndexOf('.') + 1) : membername;
#if (PORTABLE || NETCORE)
if (members[i] is TypeInfo && membername.Contains("`"))
#else
if (member is Type && membername.Contains('`'))
#endif
{
membername = membername.Substring(0, membername.IndexOf('`'));
}
}
if (prewName != membername)
{
if (temp != null && temp.Count > 1)
{
var type = temp[0].DeclaringType;
for (var j = 1; j < temp.Count; j++)
{
if (type != temp[j].DeclaringType && type.IsAssignableFrom(temp[j].DeclaringType))
type = temp[j].DeclaringType;
}
int offset = 0;
for (var j = 1; j < temp.Count; j++)
{
if (!type.IsAssignableFrom(temp[j].DeclaringType))
{
temp.RemoveAt(j--);
tempMembers.Remove(prewName + "$" + (++offset + j));
}
}
if (temp.Count == 1)
tempMembers.Remove(prewName + "$0");
}
if (!tempMembers.TryGetValue(membername, out temp))
tempMembers[membername] = temp = new List<MemberInfo>();
prewName = membername;
}
if (membername.StartsWith("@@"))
{
if (_symbols == null)
_symbols = new Dictionary<Symbol, JSValue>();
_symbols.Add(Symbol.@for(membername.Substring(2)), proxyMember(false, new[] { member }));
}
else
{
if (temp.Count == 1)
tempMembers.Add(membername + "$0", new[] { temp[0] });
temp.Add(member);
if (temp.Count != 1)
tempMembers.Add(membername + "$" + (temp.Count - 1), new[] { member });
}
}
_members = tempMembers;
if (IsInstancePrototype)
{
if (typeof(IIterable).IsAssignableFrom(_hostedType))
{
IList<MemberInfo> iterator = null;
if (_members.TryGetValue("iterator", out iterator))
{
if (_symbols == null)
_symbols = new Dictionary<Symbol, JSValue>();
_symbols.Add(Symbol.iterator, proxyMember(false, iterator));
_members.Remove("iterator");
}
}
#if NET40
var toStringTag = _hostedType.GetCustomAttribute<ToStringTagAttribute>();
#else
var toStringTag = _hostedType.GetTypeInfo().GetCustomAttribute<ToStringTagAttribute>();
#endif
if (toStringTag != null)
{
if (_symbols == null)
_symbols = new Dictionary<Symbol, JSValue>();
_symbols.Add(Symbol.toStringTag, toStringTag.Tag);
}
}
if (_indexersSupported)
{
IList<MemberInfo> getter = null;
IList<MemberInfo> setter = null;
_members.TryGetValue("get_Item", out getter);
_members.TryGetValue("set_Item", out setter);
if (getter != null || setter != null)
{
_indexerProperty = new PropertyPair();
if (getter != null)
{
_indexerProperty.getter = (Function)proxyMember(false, getter);
_fields["get_Item"] = _indexerProperty.getter;
}
if (setter != null)
{
_indexerProperty.setter = (Function)proxyMember(false, setter);
_fields["set_Item"] = _indexerProperty.setter;
}
}
else
{
_indexersSupported = false;
}
}
}
}
internal protected override JSValue GetProperty(JSValue key, bool forWrite, PropertyScope memberScope)
{
if (_members == null)
fillMembers();
if (memberScope == PropertyScope.Super || key._valueType == JSValueType.Symbol)
return base.GetProperty(key, forWrite, memberScope);
forWrite &= (_attributes & JSValueAttributesInternal.Immutable) == 0;
string name = key.ToString();
JSValue r = null;
if (_fields.TryGetValue(name, out r))
{
if (!r.Exists && !forWrite)
{
var t = base.GetProperty(key, false, memberScope);
if (t.Exists)
{
r.Assign(t);
r._valueType = t._valueType;
}
}
if (forWrite && r.NeedClone)
_fields[name] = r = r.CloneImpl(false);
return r;
}
IList<MemberInfo> m = null;
_members.TryGetValue(name, out m);
if (m == null || m.Count == 0)
{
JSValue property;
var protoInstanceAsJs = PrototypeInstance as JSValue;
if (protoInstanceAsJs != null)
property = protoInstanceAsJs.GetProperty(key, forWrite && !_indexersSupported, memberScope);
else
property = base.GetProperty(key, forWrite && !_indexersSupported, memberScope);
if (!_indexersSupported)
return property;
if (property.Exists)
{
if (forWrite)
{
if ((property._attributes & (JSValueAttributesInternal.SystemObject & JSValueAttributesInternal.ReadOnly)) == JSValueAttributesInternal.SystemObject)
{
if (protoInstanceAsJs != null)
property = protoInstanceAsJs.GetProperty(key, true, memberScope);
else
property = base.GetProperty(key, true, memberScope);
}
}
return property;
}
if (forWrite)
{
return new JSValue
{
_valueType = JSValueType.Property,
_oValue = new PropertyPair(null, _indexerProperty.setter.bind(new Arguments { null, key }))
};
}
else
{
return new JSValue
{
_valueType = JSValueType.Property,
_oValue = new PropertyPair(_indexerProperty.getter.bind(new Arguments { null, key }), null)
};
}
}
var result = proxyMember(forWrite, m);
_fields[name] = result;
return result;
}
internal JSValue proxyMember(bool forWrite, IList<MemberInfo> m)
{
JSValue r = null;
if (m.Count > 1)
{
for (int i = 0; i < m.Count; i++)
if (!(m[i] is MethodBase))
ExceptionHelper.Throw(_context.ProxyValue(new TypeError("Incompatible fields types.")));
var cache = new MethodProxy[m.Count];
for (int i = 0; i < m.Count; i++)
cache[i] = new MethodProxy(_context, m[i] as MethodBase);
r = new MethodGroup(cache);
}
else
{
#if PORTABLE || NETCORE
switch (m[0].GetMemberType())
#else
switch (m[0].MemberType)
#endif
{
case Backward.MemberTypes.Method:
{
var method = (MethodInfo)m[0];
r = new MethodProxy(_context, method);
r._attributes &= ~(JSValueAttributesInternal.ReadOnly | JSValueAttributesInternal.DoNotDelete | JSValueAttributesInternal.NonConfigurable | JSValueAttributesInternal.DoNotEnumerate);
break;
}
case Backward.MemberTypes.Field:
{
var field = (m[0] as FieldInfo);
if ((field.Attributes & (FieldAttributes.Literal | FieldAttributes.InitOnly)) != 0
&& (field.Attributes & FieldAttributes.Static) != 0)
{
r = _context.ProxyValue(field.GetValue(null));
r._attributes |= JSValueAttributesInternal.ReadOnly;
}
else
{
r = new JSValue()
{
_valueType = JSValueType.Property,
_oValue = new PropertyPair
(
new ExternalFunction((thisBind, a) => _context.ProxyValue(field.GetValue(field.IsStatic ? null : thisBind.Value))),
!m[0].IsDefined(typeof(ReadOnlyAttribute), false) ? new ExternalFunction((thisBind, a) =>
{
field.SetValue(field.IsStatic ? null : thisBind.Value, a[0].Value);
return null;
}) : null
)
};
r._attributes = JSValueAttributesInternal.Immutable | JSValueAttributesInternal.Field;
if ((r._oValue as PropertyPair).setter == null)
r._attributes |= JSValueAttributesInternal.ReadOnly;
}
break;
}
case Backward.MemberTypes.Property:
{
var pinfo = (PropertyInfo)m[0];
r = new JSValue()
{
_valueType = JSValueType.Property,
_oValue = new PropertyPair
(
#if (PORTABLE || NETCORE)
pinfo.CanRead && pinfo.GetMethod != null ? new MethodProxy(_context, pinfo.GetMethod) : null,
pinfo.CanWrite && pinfo.SetMethod != null && !pinfo.IsDefined(typeof(ReadOnlyAttribute), false) ? new MethodProxy(_context, pinfo.SetMethod) : null
#else
pinfo.CanRead && pinfo.GetGetMethod(false) != null ? new MethodProxy(_context, pinfo.GetGetMethod(false)) : null,
pinfo.CanWrite && pinfo.GetSetMethod(false) != null && !pinfo.IsDefined(typeof(ReadOnlyAttribute), false) ? new MethodProxy(_context, pinfo.GetSetMethod(false)) : null
#endif
)
};
r._attributes = JSValueAttributesInternal.Immutable;
if ((r._oValue as PropertyPair).setter == null)
r._attributes |= JSValueAttributesInternal.ReadOnly;
if (pinfo.IsDefined(typeof(FieldAttribute), false))
r._attributes |= JSValueAttributesInternal.Field;
break;
}
case Backward.MemberTypes.Event:
{
var pinfo = (EventInfo)m[0];
r = new JSValue()
{
_valueType = JSValueType.Property,
_oValue = new PropertyPair
(
null,
#if (PORTABLE || NETCORE)
new MethodProxy(_context, pinfo.AddMethod)
#else
new MethodProxy(_context, pinfo.GetAddMethod())
#endif
)
};
break;
}
case Backward.MemberTypes.TypeInfo:
#if (PORTABLE || NETCORE)
{
r = GetConstructor((m[0] as TypeInfo).AsType());
break;
}
#else
case MemberTypes.NestedType:
{
r = _context.GetConstructor((Type)m[0]);
break;
}
default:
throw new NotImplementedException("Convertion from " + m[0].MemberType + " not implemented");
#endif
}
}
if (m[0].IsDefined(typeof(DoNotEnumerateAttribute), false))
r._attributes |= JSValueAttributesInternal.DoNotEnumerate;
if (forWrite && r.NeedClone)
r = r.CloneImpl(false);
for (var i = m.Count; i-- > 0;)
{
if (!m[i].IsDefined(typeof(DoNotEnumerateAttribute), false))
r._attributes &= ~JSValueAttributesInternal.DoNotEnumerate;
if (m[i].IsDefined(typeof(ReadOnlyAttribute), false))
r._attributes |= JSValueAttributesInternal.ReadOnly;
if (m[i].IsDefined(typeof(NotConfigurable), false))
r._attributes |= JSValueAttributesInternal.NonConfigurable;
if (m[i].IsDefined(typeof(DoNotDeleteAttribute), false))
r._attributes |= JSValueAttributesInternal.DoNotDelete;
}
return r;
}
protected internal override bool DeleteProperty(JSValue name)
{
if (_members == null)
fillMembers();
string stringName = null;
JSValue field = null;
if (_fields != null
&& _fields.TryGetValue(stringName = name.ToString(), out field)
&& (!field.Exists || (field._attributes & JSValueAttributesInternal.DoNotDelete) == 0))
{
if ((field._attributes & JSValueAttributesInternal.SystemObject) == 0)
field._valueType = JSValueType.NotExistsInObject;
return _fields.Remove(stringName) | _members.Remove(stringName); // it's not mistake
}
else
{
IList<MemberInfo> m = null;
if (_members.TryGetValue(stringName.ToString(), out m))
{
for (var i = m.Count; i-- > 0;)
{
if (m[i].IsDefined(typeof(DoNotDeleteAttribute), false))
return false;
}
}
if (!_members.Remove(stringName) && PrototypeInstance != null)
return _prototypeInstance.DeleteProperty(stringName);
}
return true;
}
public override JSValue propertyIsEnumerable(Arguments args)
{
if (args == null)
throw new ArgumentNullException("args");
var name = args[0].ToString();
JSValue temp;
if (_fields != null && _fields.TryGetValue(name, out temp))
return temp.Exists && (temp._attributes & JSValueAttributesInternal.DoNotEnumerate) == 0;
IList<MemberInfo> m = null;
if (_members.TryGetValue(name, out m))
{
for (var i = m.Count; i-- > 0;)
if (!m[i].IsDefined(typeof(DoNotEnumerateAttribute), false))
return true;
return false;
}
return false;
}
protected internal override IEnumerator<KeyValuePair<string, JSValue>> GetEnumerator(bool hideNonEnumerable, EnumerationMode enumerationMode)
{
if (_members == null)
fillMembers();
if (PrototypeInstance != null)
{
var @enum = PrototypeInstance.GetEnumerator(hideNonEnumerable, enumerationMode);
while (@enum.MoveNext())
yield return @enum.Current;
}
else
{
foreach (var f in _fields)
{
if (!hideNonEnumerable || (f.Value._attributes & JSValueAttributesInternal.DoNotEnumerate) == 0)
yield return f;
}
}
foreach (var item in _members)
{
if (_fields.ContainsKey(item.Key))
continue;
for (var i = item.Value.Count; i-- > 0;)
{
if (item.Value[i].IsDefined(typeof(HiddenAttribute), false))
continue;
if (!hideNonEnumerable || !item.Value[i].IsDefined(typeof(DoNotEnumerateAttribute), false))
{
switch (enumerationMode)
{
case EnumerationMode.KeysOnly:
{
yield return new KeyValuePair<string, JSValue>(item.Key, null);
break;
}
case EnumerationMode.RequireValues:
case EnumerationMode.RequireValuesForWrite:
{
yield return new KeyValuePair<string, JSValue>(
item.Key,
_fields[item.Key] = proxyMember(enumerationMode == EnumerationMode.RequireValuesForWrite, item.Value));
break;
}
}
break;
}
}
}
}
}
}
| 43.294469 | 210 | 0.4527 | [
"BSD-3-Clause"
] | darrenstarr/NiL.JS | NiL.JS/Core/Interop/Proxy.cs | 28,964 | C# |
//--------------------------------------------------
// <copyright file="HtmlFileLogger.cs" company="Magenic">
// Copyright 2021 Magenic, All rights Reserved
// </copyright>
// <summary>Writes event logs to HTML file</summary>
//--------------------------------------------------
using System;
using System.Globalization;
using System.IO;
using Magenic.Maqs.Utilities.Data;
using System.Web;
namespace Magenic.Maqs.Utilities.Logging
{
/// <summary>
/// Helper class for adding logs to an HTML file. Allows configurable file path.
/// </summary>
public class HtmlFileLogger : FileLogger, IDisposable
{
/// <summary>
/// The default log name
/// </summary>
private const string DEFAULTLOGNAME = "FileLog.html";
/// <summary>
/// Document Start and contains the references to the CDN's
/// </summary>
private const string DEFUALTCDNTAGS = "<!DOCTYPE html><html lang='en'><head><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1'><title>{0}</title><link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css'> <script src='https://code.jquery.com/jquery-3.4.1.slim.min.js' integrity='sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n' crossorigin='anonymous'></script> <script src='https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js' integrity='sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo' crossorigin='anonymous'></script> <script src='https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js' integrity='sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6' crossorigin='anonymous'></script> <script src='https://use.fontawesome.com/releases/v5.0.8/js/all.js'></script> </head><body>";
/// <summary>
/// Contains the CSS tags, and the JQuery Scripts
/// </summary>
private const string SCRIPTANDCSSTAGS = "<style>.modal-dialog{max-width: fit-content} p{white-space: pre-wrap} .pop{ cursor: pointer; }</style><script>$(function (){$('.pop').on('click', function (e){$('.imagepreview').attr('src', $(this).find('img').attr('src'));$('#imagemodal').modal('show');});});</script><script>$(function (){$('.pop2').on('click', function (){$('.imagepreview').attr('src', $(this).attr('src'));$('#imagemodal').modal('show');});});</script><script>$(function (){$('.dropdown-item').on('click', function (e){$(this).attr('class', function (i, old){return old=='dropdown-item' ? 'dropdown-item bg-secondary' :'dropdown-item';});var temp=$(this).data('name');$('[data-logtype=\\\'' + temp + '\\\']').toggleClass('show');e.stopPropagation();});});</script><script>$(function (){$(document).ready(function(){$('#Header').append(' ' + $('title').text())})});</script> <script>$(function(){$(document).ready(function(){$('.card-text:contains(\\\'Test\\\')').each(function (index, element){switch($(this).text()){case 'Test passed': $('#TestResult:not([class])').addClass('text-success'); case 'Test failed': $('#TestResult:not([class])').addClass('text-danger'); case 'Test was inconclusive': $('#TestResult:not([class])').addClass('text-danger'); $('#TestResult').text($(this).text()); $('#TestResult').addClass('font-weight-bold'); break;}})})}) </script>";
/// <summary>
/// Contains the FIlter By dropdown
/// </summary>
private const string FILTERDROPDOWN = "<div id='Header' class='dropdown'><button class='btn btn-secondary dropdown-toggle' type='button' id='FilterByDropdown' data-toggle='dropdown'aria-haspopup='true' aria-expanded='false'>Filter By</button><div class='dropdown-menu' aria-labelledby='FilterByDropdown'><button class='dropdown-item' data-name='ERROR'>Filter Error</button><button class='dropdown-item' data-name='WARNING'>Filter Warning</button><button class='dropdown-item' data-name='SUCCESS'>Filter Success</button><button class='dropdown-item' data-name='GENERIC'>Filter Generic</button><button class='dropdown-item' data-name='STEP'>Filter Step</button><button class='dropdown-item' data-name='ACTION'>Filter Action</button><button class='dropdown-item' data-name='INFORMATION'>Filter Information</button><button class='dropdown-item' data-name='VERBOSE'>Filter Verbose</button><button class='dropdown-item' data-name='IMAGE'>Filter Images</button></div><span id='TestResult'></span></div>";
/// <summary>
/// Contains the Modal Div that is needed to make a larger image
/// </summary>
private const string MODALDIV = "<div class='modal fade' id='imagemodal' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'><div class='modal-dialog'> <div class='modal-content'> <div class='modal-body'><button type='button' class='close' data-dismiss='modal'><span aria-hidden='true'>×</span><span class='sr-only'>Close</span></button> <img src='' class='imagepreview' style='width: 100%;' ></div></div></div></div>";
/// <summary>
/// The begininning to the cards section
/// </summary>
private const string CARDSTART = "<div class='container-fluid'><div class='row'>";
/// <summary>
/// Initializes a new instance of the HtmlFileLogger class
/// </summary>
/// <param name="logFolder">Where log files should be saved</param>
/// <param name="name">File Name</param>
/// <param name="messageLevel">Messaging level</param>
/// <param name="append">True to append to an existing log file or false to overwrite it - If the file does not exist this, flag will have no affect</param>
public HtmlFileLogger(string logFolder = "", string name = DEFAULTLOGNAME, MessageType messageLevel = MessageType.INFORMATION, bool append = false)
: base(logFolder, name, messageLevel, append)
{
StreamWriter writer = new StreamWriter(this.FilePath, true);
writer.Write(String.Format(DEFUALTCDNTAGS, Path.GetFileNameWithoutExtension(this.FilePath)));
writer.Write(SCRIPTANDCSSTAGS);
writer.Write(FILTERDROPDOWN);
writer.Write(CARDSTART);
writer.Flush();
writer.Close();
}
/// <summary>
/// Gets the file extension
/// </summary>
protected override string Extension
{
get { return ".html"; }
}
/// <summary>
/// Write the formatted message (one line) to the console as a generic message
/// </summary>
/// <param name="messageType">The type of message</param>
/// <param name="message">The message text</param>
/// <param name="args">String format arguments</param>
public override void LogMessage(MessageType messageType, string message, params object[] args)
{
// If the message level is greater that the current log level then do not log it.
if (this.ShouldMessageBeLogged(messageType))
{
// Log the message
lock (this.FileLock)
{
string date = DateTime.UtcNow.ToString(Logger.DEFAULTDATEFORMAT, CultureInfo.InvariantCulture);
try
{
using (StreamWriter writer = new StreamWriter(this.FilePath, true))
{
writer.Write(StringProcessor.SafeFormatter(
$"<div class='collapse col-12 show' data-logtype='{messageType.ToString()}'><div class='card'><div class='card-body {GetTextWithColorFlag(messageType)}'><h5 class='card-title mb-1'>{messageType.ToString()}</h5><h6 class='card-subtitle mb-1'>{date}</h6><p class='card-text'>{HttpUtility.HtmlEncode(StringProcessor.SafeFormatter(message, args))}</p></div></div></div>"));
}
}
catch (Exception e)
{
// Failed to write to the event log, write error to the console instead
ConsoleLogger console = new ConsoleLogger();
console.LogMessage(MessageType.ERROR, StringProcessor.SafeFormatter($"Failed to write to event log because: {e.Message}"));
console.LogMessage(messageType, message, args);
}
}
}
}
/// <summary>
/// Dispose the class
/// </summary>
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose the class
/// </summary>
/// <param name="disposing">True if you want to release managed resources</param>
protected virtual void Dispose(bool disposing)
{
if (disposing && File.Exists(this.FilePath))
{
var writer = new StreamWriter(this.FilePath, true);
writer.Write(MODALDIV);
writer.Write("</div></body></html>");
writer.Flush();
writer.Close();
}
}
/// <summary>
/// Get the HTML style key for the given message type
/// </summary>
/// <param name="type">The message type</param>
/// <returns>string - The HTML style key for the given message type</returns>
private string GetTextWithColorFlag(MessageType type)
{
switch (type)
{
case MessageType.VERBOSE:
return "bg-secondary";
case MessageType.ACTION:
return "text-info";
case MessageType.STEP:
return "text-primary";
case MessageType.ERROR:
return "text-danger";
case MessageType.GENERIC:
return string.Empty;
case MessageType.INFORMATION:
return "text-secondary";
case MessageType.SUCCESS:
return "text-success";
case MessageType.WARNING:
return "text-warning";
default:
Console.WriteLine(this.UnknownMessageTypeMessage(type));
return "text-white bg-dark";
}
}
}
} | 61.64497 | 1,385 | 0.600307 | [
"MIT"
] | TroyWalshProf/MAQS | Framework/Utilities/Logging/HtmlFileLogger.cs | 10,420 | C# |
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Fx.Portability.ObjectModel;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Microsoft.Fx.Portability
{
public interface IApiPortService
{
Task<ServiceResponse<IEnumerable<AvailableTarget>>> GetTargetsAsync();
Task<ServiceResponse<AnalyzeResponse>> SendAnalysisAsync(AnalyzeRequest a);
Task<ServiceResponse<IEnumerable<ReportingResultWithFormat>>> SendAnalysisAsync(AnalyzeRequest a, IEnumerable<string> format);
Task<ServiceResponse<ApiInformation>> GetApiInformationAsync(string docId);
Task<ServiceResponse<IReadOnlyCollection<ApiDefinition>>> SearchFxApiAsync(string query, int? top = null);
Task<ServiceResponse<IEnumerable<ResultFormatInformation>>> GetResultFormatsAsync();
Task<ServiceResponse<ResultFormatInformation>> GetDefaultResultFormatAsync();
Task<ServiceResponse<IReadOnlyCollection<ApiInformation>>> QueryDocIdsAsync(IEnumerable<string> docIds);
}
}
| 51.772727 | 134 | 0.784899 | [
"MIT"
] | G-Research/dotnet-apiport | src/lib/Microsoft.Fx.Portability/IApiPortService.cs | 1,141 | C# |
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using P03_SalesDatabase.Data;
namespace P03_SalesDatabase.Migrations
{
[DbContext(typeof(SalesContext))]
[Migration("20180710155110_ProductsAddColumnDescription")]
partial class ProductsAddColumnDescription
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("P03_SalesDatabase.Data.Models.Customer", b =>
{
b.Property<int>("CustomerId")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("CreditCardNumber");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(80)
.IsUnicode(false);
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.IsUnicode(true);
b.HasKey("CustomerId");
b.ToTable("Customers");
});
modelBuilder.Entity("P03_SalesDatabase.Data.Models.Product", b =>
{
b.Property<int>("ProductId")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Description")
.ValueGeneratedOnAdd()
.HasMaxLength(250)
.HasDefaultValue("No description");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.IsUnicode(true);
b.Property<decimal>("Price");
b.Property<double>("Quantity");
b.HasKey("ProductId");
b.ToTable("Products");
});
modelBuilder.Entity("P03_SalesDatabase.Data.Models.Sale", b =>
{
b.Property<int>("SaleId")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("CustomerId");
b.Property<DateTime>("Date")
.ValueGeneratedOnAdd()
.HasDefaultValueSql("GETDATE()");
b.Property<int>("ProductId");
b.Property<int>("StoreId");
b.HasKey("SaleId");
b.HasIndex("CustomerId");
b.HasIndex("ProductId");
b.HasIndex("StoreId");
b.ToTable("Sales");
});
modelBuilder.Entity("P03_SalesDatabase.Data.Models.Store", b =>
{
b.Property<int>("StoreId")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(80)
.IsUnicode(true);
b.HasKey("StoreId");
b.ToTable("Stores");
});
modelBuilder.Entity("P03_SalesDatabase.Data.Models.Sale", b =>
{
b.HasOne("P03_SalesDatabase.Data.Models.Customer", "Customer")
.WithMany("Sales")
.HasForeignKey("CustomerId")
.HasConstraintName("FK_Sales_Customers")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("P03_SalesDatabase.Data.Models.Product", "Product")
.WithMany("Sales")
.HasForeignKey("ProductId")
.HasConstraintName("FK_Sales_Products")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("P03_SalesDatabase.Data.Models.Store", "Store")
.WithMany("Sales")
.HasForeignKey("StoreId")
.HasConstraintName("FK_Sales_Stores")
.OnDelete(DeleteBehavior.Restrict);
});
#pragma warning restore 612, 618
}
}
}
| 37.115108 | 125 | 0.509401 | [
"MIT"
] | GitHarr/SoftUni | Homework/DBFundamentals/Databases Advanced - Entity Framework/04.Code-First/Exercises/P03_SalesDatabase/Migrations/20180710155110_ProductsAddColumnDescription.Designer.cs | 5,161 | C# |
// This file was @generated with LibOVRPlatform/codegen/main. Do not modify it!
namespace Oculus.Platform
{
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using Oculus.Platform.Models;
public abstract class Message<T> : Message
{
public new delegate void Callback(Message<T> message);
public Message(IntPtr c_message) : base(c_message) {
if (!IsError)
{
data = GetDataFromMessage(c_message);
}
}
public T Data { get { return data; } }
protected abstract T GetDataFromMessage(IntPtr c_message);
private T data;
}
public class Message
{
public delegate void Callback(Message message);
public Message(IntPtr c_message)
{
type = (MessageType)CAPI.ovr_Message_GetType(c_message);
var isError = CAPI.ovr_Message_IsError(c_message);
requestID = CAPI.ovr_Message_GetRequestID(c_message);
if (!isError) {
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
if (CAPI.ovr_Message_IsError(msg)) {
IntPtr errorHandle = CAPI.ovr_Message_GetError(msg);
error = new Error(
CAPI.ovr_Error_GetCode(errorHandle),
CAPI.ovr_Error_GetMessage(errorHandle),
CAPI.ovr_Error_GetHttpCode(errorHandle));
}
}
if (isError)
{
IntPtr errorHandle = CAPI.ovr_Message_GetError(c_message);
error = new Error(
CAPI.ovr_Error_GetCode(errorHandle),
CAPI.ovr_Error_GetMessage(errorHandle),
CAPI.ovr_Error_GetHttpCode(errorHandle));
}
else if (Core.LogMessages)
{
var message = CAPI.ovr_Message_GetString(c_message);
if (message != null)
{
Debug.Log(message);
}
else
{
Debug.Log(string.Format("null message string {0}", c_message));
}
}
}
~Message()
{
}
// Keep this enum in sync with ovrMessageType in OVR_Platform.h
public enum MessageType : uint
{ //TODO - rename this to type; it's already in Message class
Unknown,
Achievements_AddCount = 0x03E76231,
Achievements_AddFields = 0x14AA2129,
Achievements_GetAllDefinitions = 0x03D3458D,
Achievements_GetAllProgress = 0x4F9FDE1D,
Achievements_GetDefinitionsByName = 0x629101BC,
Achievements_GetNextAchievementDefinitionArrayPage = 0x2A7DD255,
Achievements_GetNextAchievementProgressArrayPage = 0x2F42E727,
Achievements_GetProgressByName = 0x152663B1,
Achievements_Unlock = 0x593CCBDD,
ApplicationLifecycle_GetRegisteredPIDs = 0x04E5CF62,
ApplicationLifecycle_GetSessionKey = 0x3AAF591D,
ApplicationLifecycle_RegisterSessionKey = 0x4DB6AFF8,
Application_GetVersion = 0x68670A0E,
Application_LaunchOtherApp = 0x54E2D1F8,
AssetFile_Delete = 0x6D5D7886,
AssetFile_DeleteById = 0x5AE8CD52,
AssetFile_DeleteByName = 0x420AC1CF,
AssetFile_Download = 0x11449FC5,
AssetFile_DownloadById = 0x2D008992,
AssetFile_DownloadByName = 0x6336CEFA,
AssetFile_DownloadCancel = 0x080AD3C7,
AssetFile_DownloadCancelById = 0x51659514,
AssetFile_DownloadCancelByName = 0x446AECFA,
AssetFile_GetList = 0x4AFC6F74,
AssetFile_Status = 0x02D32F60,
AssetFile_StatusById = 0x5D955D38,
AssetFile_StatusByName = 0x41CFDA50,
Challenges_Create = 0x6859D641,
Challenges_DeclineInvite = 0x568E76C0,
Challenges_Delete = 0x264885CA,
Challenges_Get = 0x77584EF3,
Challenges_GetEntries = 0x121AB45F,
Challenges_GetEntriesAfterRank = 0x08891A7F,
Challenges_GetEntriesByIds = 0x316509DC,
Challenges_GetList = 0x43264356,
Challenges_GetNextChallenges = 0x5B7CA1B6,
Challenges_GetNextEntries = 0x7F4CA0C6,
Challenges_GetPreviousChallenges = 0x0EB4040D,
Challenges_GetPreviousEntries = 0x78C90470,
Challenges_Join = 0x21248069,
Challenges_Leave = 0x296116E5,
Challenges_UpdateInfo = 0x1175BE60,
CloudStorage2_GetUserDirectoryPath = 0x76A42EEE,
CloudStorage_Delete = 0x28DA456D,
CloudStorage_GetNextCloudStorageMetadataArrayPage = 0x5C07A2EF,
CloudStorage_Load = 0x40846B41,
CloudStorage_LoadBucketMetadata = 0x7327A50D,
CloudStorage_LoadConflictMetadata = 0x445A52F2,
CloudStorage_LoadHandle = 0x326ADA36,
CloudStorage_LoadMetadata = 0x03E6A292,
CloudStorage_ResolveKeepLocal = 0x30588D05,
CloudStorage_ResolveKeepRemote = 0x7525A306,
CloudStorage_Save = 0x4BBB5C2E,
Entitlement_GetIsViewerEntitled = 0x186B58B1,
GroupPresence_Clear = 0x6DAA9CC3,
GroupPresence_LaunchInvitePanel = 0x0F9ECF9F,
GroupPresence_LaunchMultiplayerErrorDialog = 0x2955AF24,
GroupPresence_LaunchRejoinDialog = 0x1577036F,
GroupPresence_LaunchRosterPanel = 0x35728882,
GroupPresence_Set = 0x675F5C24,
GroupPresence_SetDestination = 0x4C5B268A,
GroupPresence_SetIsJoinable = 0x2A8F1055,
GroupPresence_SetLobbySession = 0x48FF55BE,
GroupPresence_SetMatchSession = 0x314C84B8,
IAP_ConsumePurchase = 0x1FBB72D9,
IAP_GetNextProductArrayPage = 0x1BD94AAF,
IAP_GetNextPurchaseArrayPage = 0x47570A95,
IAP_GetProductsBySKU = 0x7E9ACAF5,
IAP_GetViewerPurchases = 0x3A0F8419,
IAP_GetViewerPurchasesDurableCache = 0x63599E2B,
IAP_LaunchCheckoutFlow = 0x3F9B0D0D,
LanguagePack_GetCurrent = 0x1F90F0D5,
LanguagePack_SetCurrent = 0x5B4FBBE0,
Leaderboard_Get = 0x6AD44EF8,
Leaderboard_GetEntries = 0x5DB3474C,
Leaderboard_GetEntriesAfterRank = 0x18378BEF,
Leaderboard_GetEntriesByIds = 0x39607BFC,
Leaderboard_GetNextEntries = 0x4E207CD9,
Leaderboard_GetNextLeaderboardArrayPage = 0x35F6769B,
Leaderboard_GetPreviousEntries = 0x4901DAC0,
Leaderboard_WriteEntry = 0x117FC8FE,
Leaderboard_WriteEntryWithSupplementaryMetric = 0x72C692FA,
Matchmaking_Browse = 0x1E6532C8,
Matchmaking_Browse2 = 0x66429E5B,
Matchmaking_Cancel = 0x206849AF,
Matchmaking_Cancel2 = 0x10FE8DD4,
Matchmaking_CreateAndEnqueueRoom = 0x604C5DC8,
Matchmaking_CreateAndEnqueueRoom2 = 0x295BEADB,
Matchmaking_CreateRoom = 0x033B132A,
Matchmaking_CreateRoom2 = 0x496DA384,
Matchmaking_Enqueue = 0x40C16C71,
Matchmaking_Enqueue2 = 0x121212B5,
Matchmaking_EnqueueRoom = 0x708A4064,
Matchmaking_EnqueueRoom2 = 0x5528DBA4,
Matchmaking_GetAdminSnapshot = 0x3C215F94,
Matchmaking_GetStats = 0x42FC9438,
Matchmaking_JoinRoom = 0x4D32D7FD,
Matchmaking_ReportResultInsecure = 0x1A36D18D,
Matchmaking_StartMatch = 0x44D40945,
Media_ShareToFacebook = 0x00E38AEF,
Notification_GetNextRoomInviteNotificationArrayPage = 0x0621FB77,
Notification_GetRoomInvites = 0x6F916B92,
Notification_MarkAsRead = 0x717259E3,
Party_GetCurrent = 0x47933760,
RichPresence_Clear = 0x57B752B3,
RichPresence_GetDestinations = 0x586F2D14,
RichPresence_GetNextDestinationArrayPage = 0x67367F45,
RichPresence_Set = 0x3C147509,
Room_CreateAndJoinPrivate = 0x75D6E377,
Room_CreateAndJoinPrivate2 = 0x5A3A6243,
Room_Get = 0x659A8FB8,
Room_GetCurrent = 0x09A6A504,
Room_GetCurrentForUser = 0x0E0017E5,
Room_GetInvitableUsers = 0x1E325792,
Room_GetInvitableUsers2 = 0x4F53E8B0,
Room_GetModeratedRooms = 0x0983FD77,
Room_GetNextRoomArrayPage = 0x4E8379C6,
Room_InviteUser = 0x4129EC13,
Room_Join = 0x16CA8F09,
Room_Join2 = 0x4DAB1C42,
Room_KickUser = 0x49835736,
Room_LaunchInvitableUserFlow = 0x323FE273,
Room_Leave = 0x72382475,
Room_SetDescription = 0x3044852F,
Room_UpdateDataStore = 0x026E4028,
Room_UpdateMembershipLockStatus = 0x370BB7AC,
Room_UpdateOwner = 0x32B63D1D,
Room_UpdatePrivateRoomJoinPolicy = 0x1141029B,
UserDataStore_PrivateDeleteEntryByKey = 0x5C896F3E,
UserDataStore_PrivateGetEntries = 0x6C8A8228,
UserDataStore_PrivateGetEntryByKey = 0x1C068319,
UserDataStore_PrivateWriteEntry = 0x41D2828B,
UserDataStore_PublicDeleteEntryByKey = 0x1DD5E5FB,
UserDataStore_PublicGetEntries = 0x167D4BC2,
UserDataStore_PublicGetEntryByKey = 0x195C66C6,
UserDataStore_PublicWriteEntry = 0x34364A0A,
User_Get = 0x6BCF9E47,
User_GetAccessToken = 0x06A85ABE,
User_GetLoggedInUser = 0x436F345D,
User_GetLoggedInUserFriends = 0x587C2A8D,
User_GetLoggedInUserFriendsAndRooms = 0x5E870B87,
User_GetLoggedInUserRecentlyMetUsersAndRooms = 0x295FBA30,
User_GetNextUserAndRoomArrayPage = 0x7FBDD2DF,
User_GetNextUserArrayPage = 0x267CF743,
User_GetOrgScopedID = 0x18F0B01B,
User_GetSdkAccounts = 0x67526A83,
User_GetUserProof = 0x22810483,
User_LaunchFriendRequestFlow = 0x0904B598,
Voip_GetMicrophoneAvailability = 0x744CE345,
Voip_SetSystemVoipSuppressed = 0x453FC9AA,
/// Sent when a launch intent is received (for both cold and warm starts). The
/// payload is the type of the intent. ApplicationLifecycle.GetLaunchDetails()
/// should be called to get the other details.
Notification_ApplicationLifecycle_LaunchIntentChanged = 0x04B34CA3,
/// Sent to indicate download progress for asset files.
Notification_AssetFile_DownloadUpdate = 0x2FDD0CCD,
/// Result of a leader picking an application for CAL launch.
Notification_Cal_FinalizeApplication = 0x750C5099,
/// Application that the group leader has proposed for a CAL launch.
Notification_Cal_ProposeApplication = 0x2E7451F5,
/// Sent when the user is finished using the invite panel to send out
/// invitations. Contains a list of invitees.
Notification_GroupPresence_InvitationsSent = 0x679A84B6,
/// Sent when a user has chosen to join the destination/lobby/match. Read all
/// the fields to figure out where the user wants to go and take the
/// appropriate actions to bring them there. If the user is unable to go there,
/// provide adequate messaging to the user on why they cannot go there. These
/// notifications should be responded to immediately.
Notification_GroupPresence_JoinIntentReceived = 0x773889F6,
/// Sent when the user has chosen to leave the destination/lobby/match from the
/// Oculus menu. Read the specific fields to check the user is currently from
/// the destination/lobby/match and take the appropriate actions to remove
/// them. Update the user's presence clearing the appropriate fields to
/// indicate the user has left.
Notification_GroupPresence_LeaveIntentReceived = 0x4737EA1D,
/// Sent to indicate that more data has been read or an error occured.
Notification_HTTP_Transfer = 0x7DD46E2F,
/// Indicates that the livestreaming session has been updated. You can use this
/// information to throttle your game performance or increase CPU/GPU
/// performance. Use Message.GetLivestreamingStatus() to extract the updated
/// livestreaming status.
Notification_Livestreaming_StatusChange = 0x2247596E,
/// Indicates that a match has been found, for example after calling
/// Matchmaking.Enqueue(). Use Message.GetRoom() to extract the matchmaking
/// room.
Notification_Matchmaking_MatchFound = 0x0BC3FCD7,
/// Sent when the status of a connection has changed.
Notification_NetSync_ConnectionStatusChanged = 0x073484CA,
/// Sent when the list of known connected sessions has changed. Contains the
/// new list of sessions.
Notification_NetSync_SessionsChanged = 0x387E7F36,
/// Indicates that a connection has been established or there's been an error.
/// Use NetworkingPeer.GetState() to get the result; as above,
/// NetworkingPeer.GetID() returns the ID of the peer this message is for.
Notification_Networking_ConnectionStateChange = 0x5E02D49A,
/// Indicates that another user is attempting to establish a P2P connection
/// with us. Use NetworkingPeer.GetID() to extract the ID of the peer.
Notification_Networking_PeerConnectRequest = 0x4D31E2CF,
/// Generated in response to Net.Ping(). Either contains ping time in
/// microseconds or indicates that there was a timeout.
Notification_Networking_PingResult = 0x51153012,
/// Indicates that party has been updated
Notification_Party_PartyUpdate = 0x1D118AB2,
/// Indicates that the user has accepted an invitation, for example in Oculus
/// Home. Use Message.GetString() to extract the ID of the room that the user
/// has been inivted to as a string. Then call ovrID_FromString() to parse it
/// into an ovrID.
///
/// Note that you must call Rooms.Join() if you want to actually join the room.
Notification_Room_InviteAccepted = 0x6D1071B1,
/// Handle this to notify the user when they've received an invitation to join
/// a room in your game. You can use this in lieu of, or in addition to,
/// polling for room invitations via
/// Notifications.GetRoomInviteNotifications().
Notification_Room_InviteReceived = 0x6A499D54,
/// Indicates that the current room has been updated. Use Message.GetRoom() to
/// extract the updated room.
Notification_Room_RoomUpdate = 0x60EC3C2F,
/// DEPRECATED. Do not use or expose further. Use
/// MessageType.Notification_GroupPresence_InvitationsSent instead
Notification_Session_InvitationsSent = 0x07F9C880,
/// Sent when another user is attempting to establish a VoIP connection. Use
/// Message.GetNetworkingPeer() to extract information about the user, and
/// Voip.Accept() to accept the connection.
Notification_Voip_ConnectRequest = 0x36243816,
/// Indicates that the current microphone availability state has been updated.
/// Use Voip.GetMicrophoneAvailability() to extract the microphone availability
/// state.
Notification_Voip_MicrophoneAvailabilityStateUpdate = 0x3E20CB57,
/// Sent to indicate that the state of the VoIP connection changed. Use
/// Message.GetNetworkingPeer() and NetworkingPeer.GetState() to extract the
/// current state.
Notification_Voip_StateChange = 0x34EFA660,
/// Sent to indicate that some part of the overall state of SystemVoip has
/// changed. Use Message.GetSystemVoipState() and the properties of
/// SystemVoipState to extract the state that triggered the notification.
///
/// Note that the state may have changed further since the notification was
/// generated, and that you may call the `GetSystemVoip...()` family of
/// functions at any time to get the current state directly.
Notification_Voip_SystemVoipState = 0x58D254A5,
/// Get vr camera related webrtc data channel messages for update.
Notification_Vrcamera_GetDataChannelMessageUpdate = 0x6EE4F33C,
/// Get surface and update action from platform webrtc for update.
Notification_Vrcamera_GetSurfaceUpdate = 0x37F21084,
Platform_InitializeWithAccessToken = 0x35692F2B,
Platform_InitializeStandaloneOculus = 0x51F8CE0C,
Platform_InitializeAndroidAsynchronous = 0x1AD307B4,
Platform_InitializeWindowsAsynchronous = 0x6DA7BA8F,
};
public MessageType Type { get { return type; } }
public bool IsError { get { return error != null; } }
public ulong RequestID { get { return requestID; } }
private MessageType type;
private ulong requestID;
private Error error;
public virtual Error GetError() { return error; }
public virtual PingResult GetPingResult() { return null; }
public virtual NetworkingPeer GetNetworkingPeer() { return null; }
public virtual HttpTransferUpdate GetHttpTransferUpdate() { return null; }
public virtual PlatformInitialize GetPlatformInitialize() { return null; }
public virtual AbuseReportRecording GetAbuseReportRecording() { return null; }
public virtual AchievementDefinitionList GetAchievementDefinitions() { return null; }
public virtual AchievementProgressList GetAchievementProgressList() { return null; }
public virtual AchievementUpdate GetAchievementUpdate() { return null; }
public virtual ApplicationVersion GetApplicationVersion() { return null; }
public virtual AssetDetails GetAssetDetails() { return null; }
public virtual AssetDetailsList GetAssetDetailsList() { return null; }
public virtual AssetFileDeleteResult GetAssetFileDeleteResult() { return null; }
public virtual AssetFileDownloadCancelResult GetAssetFileDownloadCancelResult() { return null; }
public virtual AssetFileDownloadResult GetAssetFileDownloadResult() { return null; }
public virtual AssetFileDownloadUpdate GetAssetFileDownloadUpdate() { return null; }
public virtual CalApplicationFinalized GetCalApplicationFinalized() { return null; }
public virtual CalApplicationProposed GetCalApplicationProposed() { return null; }
public virtual CalApplicationSuggestionList GetCalApplicationSuggestionList() { return null; }
public virtual Challenge GetChallenge() { return null; }
public virtual ChallengeEntryList GetChallengeEntryList() { return null; }
public virtual ChallengeList GetChallengeList() { return null; }
public virtual CloudStorageConflictMetadata GetCloudStorageConflictMetadata() { return null; }
public virtual CloudStorageData GetCloudStorageData() { return null; }
public virtual CloudStorageMetadata GetCloudStorageMetadata() { return null; }
public virtual CloudStorageMetadataList GetCloudStorageMetadataList() { return null; }
public virtual CloudStorageUpdateResponse GetCloudStorageUpdateResponse() { return null; }
public virtual Dictionary<string, string> GetDataStore() { return null; }
public virtual DestinationList GetDestinationList() { return null; }
public virtual GroupPresenceJoinIntent GetGroupPresenceJoinIntent() { return null; }
public virtual GroupPresenceLeaveIntent GetGroupPresenceLeaveIntent() { return null; }
public virtual InstalledApplicationList GetInstalledApplicationList() { return null; }
public virtual InvitePanelResultInfo GetInvitePanelResultInfo() { return null; }
public virtual LaunchBlockFlowResult GetLaunchBlockFlowResult() { return null; }
public virtual LaunchFriendRequestFlowResult GetLaunchFriendRequestFlowResult() { return null; }
public virtual LaunchInvitePanelFlowResult GetLaunchInvitePanelFlowResult() { return null; }
public virtual LaunchReportFlowResult GetLaunchReportFlowResult() { return null; }
public virtual LaunchUnblockFlowResult GetLaunchUnblockFlowResult() { return null; }
public virtual bool GetLeaderboardDidUpdate() { return false; }
public virtual LeaderboardEntryList GetLeaderboardEntryList() { return null; }
public virtual LeaderboardList GetLeaderboardList() { return null; }
public virtual LinkedAccountList GetLinkedAccountList() { return null; }
public virtual LivestreamingApplicationStatus GetLivestreamingApplicationStatus() { return null; }
public virtual LivestreamingStartResult GetLivestreamingStartResult() { return null; }
public virtual LivestreamingStatus GetLivestreamingStatus() { return null; }
public virtual LivestreamingVideoStats GetLivestreamingVideoStats() { return null; }
public virtual MatchmakingAdminSnapshot GetMatchmakingAdminSnapshot() { return null; }
public virtual MatchmakingBrowseResult GetMatchmakingBrowseResult() { return null; }
public virtual MatchmakingEnqueueResult GetMatchmakingEnqueueResult() { return null; }
public virtual MatchmakingEnqueueResultAndRoom GetMatchmakingEnqueueResultAndRoom() { return null; }
public virtual MatchmakingStats GetMatchmakingStats() { return null; }
public virtual MicrophoneAvailabilityState GetMicrophoneAvailabilityState() { return null; }
public virtual NetSyncConnection GetNetSyncConnection() { return null; }
public virtual NetSyncSessionList GetNetSyncSessionList() { return null; }
public virtual NetSyncSessionsChangedNotification GetNetSyncSessionsChangedNotification() { return null; }
public virtual NetSyncSetSessionPropertyResult GetNetSyncSetSessionPropertyResult() { return null; }
public virtual NetSyncVoipAttenuationValueList GetNetSyncVoipAttenuationValueList() { return null; }
public virtual OrgScopedID GetOrgScopedID() { return null; }
public virtual Party GetParty() { return null; }
public virtual PartyID GetPartyID() { return null; }
public virtual PartyUpdateNotification GetPartyUpdateNotification() { return null; }
public virtual PidList GetPidList() { return null; }
public virtual ProductList GetProductList() { return null; }
public virtual Purchase GetPurchase() { return null; }
public virtual PurchaseList GetPurchaseList() { return null; }
public virtual RejoinDialogResult GetRejoinDialogResult() { return null; }
public virtual Room GetRoom() { return null; }
public virtual RoomInviteNotification GetRoomInviteNotification() { return null; }
public virtual RoomInviteNotificationList GetRoomInviteNotificationList() { return null; }
public virtual RoomList GetRoomList() { return null; }
public virtual SdkAccountList GetSdkAccountList() { return null; }
public virtual ShareMediaResult GetShareMediaResult() { return null; }
public virtual string GetString() { return null; }
public virtual SystemVoipState GetSystemVoipState() { return null; }
public virtual User GetUser() { return null; }
public virtual UserAndRoomList GetUserAndRoomList() { return null; }
public virtual UserDataStoreUpdateResponse GetUserDataStoreUpdateResponse() { return null; }
public virtual UserList GetUserList() { return null; }
public virtual UserProof GetUserProof() { return null; }
public virtual UserReportID GetUserReportID() { return null; }
internal static Message ParseMessageHandle(IntPtr messageHandle)
{
if (messageHandle.ToInt64() == 0)
{
return null;
}
Message message = null;
Message.MessageType message_type = (Message.MessageType)CAPI.ovr_Message_GetType(messageHandle);
switch(message_type) {
// OVR_MESSAGE_TYPE_START
case Message.MessageType.Achievements_GetAllDefinitions:
case Message.MessageType.Achievements_GetDefinitionsByName:
case Message.MessageType.Achievements_GetNextAchievementDefinitionArrayPage:
message = new MessageWithAchievementDefinitions(messageHandle);
break;
case Message.MessageType.Achievements_GetAllProgress:
case Message.MessageType.Achievements_GetNextAchievementProgressArrayPage:
case Message.MessageType.Achievements_GetProgressByName:
message = new MessageWithAchievementProgressList(messageHandle);
break;
case Message.MessageType.Achievements_AddCount:
case Message.MessageType.Achievements_AddFields:
case Message.MessageType.Achievements_Unlock:
message = new MessageWithAchievementUpdate(messageHandle);
break;
case Message.MessageType.Application_GetVersion:
message = new MessageWithApplicationVersion(messageHandle);
break;
case Message.MessageType.AssetFile_Status:
case Message.MessageType.AssetFile_StatusById:
case Message.MessageType.AssetFile_StatusByName:
case Message.MessageType.LanguagePack_GetCurrent:
message = new MessageWithAssetDetails(messageHandle);
break;
case Message.MessageType.AssetFile_GetList:
message = new MessageWithAssetDetailsList(messageHandle);
break;
case Message.MessageType.AssetFile_Delete:
case Message.MessageType.AssetFile_DeleteById:
case Message.MessageType.AssetFile_DeleteByName:
message = new MessageWithAssetFileDeleteResult(messageHandle);
break;
case Message.MessageType.AssetFile_DownloadCancel:
case Message.MessageType.AssetFile_DownloadCancelById:
case Message.MessageType.AssetFile_DownloadCancelByName:
message = new MessageWithAssetFileDownloadCancelResult(messageHandle);
break;
case Message.MessageType.AssetFile_Download:
case Message.MessageType.AssetFile_DownloadById:
case Message.MessageType.AssetFile_DownloadByName:
case Message.MessageType.LanguagePack_SetCurrent:
message = new MessageWithAssetFileDownloadResult(messageHandle);
break;
case Message.MessageType.Notification_AssetFile_DownloadUpdate:
message = new MessageWithAssetFileDownloadUpdate(messageHandle);
break;
case Message.MessageType.Notification_Cal_FinalizeApplication:
message = new MessageWithCalApplicationFinalized(messageHandle);
break;
case Message.MessageType.Notification_Cal_ProposeApplication:
message = new MessageWithCalApplicationProposed(messageHandle);
break;
case Message.MessageType.Challenges_Create:
case Message.MessageType.Challenges_DeclineInvite:
case Message.MessageType.Challenges_Get:
case Message.MessageType.Challenges_Join:
case Message.MessageType.Challenges_Leave:
case Message.MessageType.Challenges_UpdateInfo:
message = new MessageWithChallenge(messageHandle);
break;
case Message.MessageType.Challenges_GetList:
case Message.MessageType.Challenges_GetNextChallenges:
case Message.MessageType.Challenges_GetPreviousChallenges:
message = new MessageWithChallengeList(messageHandle);
break;
case Message.MessageType.Challenges_GetEntries:
case Message.MessageType.Challenges_GetEntriesAfterRank:
case Message.MessageType.Challenges_GetEntriesByIds:
case Message.MessageType.Challenges_GetNextEntries:
case Message.MessageType.Challenges_GetPreviousEntries:
message = new MessageWithChallengeEntryList(messageHandle);
break;
case Message.MessageType.CloudStorage_LoadConflictMetadata:
message = new MessageWithCloudStorageConflictMetadata(messageHandle);
break;
case Message.MessageType.CloudStorage_Load:
case Message.MessageType.CloudStorage_LoadHandle:
message = new MessageWithCloudStorageData(messageHandle);
break;
case Message.MessageType.CloudStorage_LoadMetadata:
message = new MessageWithCloudStorageMetadataUnderLocal(messageHandle);
break;
case Message.MessageType.CloudStorage_GetNextCloudStorageMetadataArrayPage:
case Message.MessageType.CloudStorage_LoadBucketMetadata:
message = new MessageWithCloudStorageMetadataList(messageHandle);
break;
case Message.MessageType.CloudStorage_Delete:
case Message.MessageType.CloudStorage_ResolveKeepLocal:
case Message.MessageType.CloudStorage_ResolveKeepRemote:
case Message.MessageType.CloudStorage_Save:
message = new MessageWithCloudStorageUpdateResponse(messageHandle);
break;
case Message.MessageType.UserDataStore_PrivateGetEntries:
case Message.MessageType.UserDataStore_PrivateGetEntryByKey:
message = new MessageWithDataStoreUnderPrivateUserDataStore(messageHandle);
break;
case Message.MessageType.UserDataStore_PublicGetEntries:
case Message.MessageType.UserDataStore_PublicGetEntryByKey:
message = new MessageWithDataStoreUnderPublicUserDataStore(messageHandle);
break;
case Message.MessageType.RichPresence_GetDestinations:
case Message.MessageType.RichPresence_GetNextDestinationArrayPage:
message = new MessageWithDestinationList(messageHandle);
break;
case Message.MessageType.ApplicationLifecycle_RegisterSessionKey:
case Message.MessageType.Challenges_Delete:
case Message.MessageType.Entitlement_GetIsViewerEntitled:
case Message.MessageType.GroupPresence_Clear:
case Message.MessageType.GroupPresence_LaunchMultiplayerErrorDialog:
case Message.MessageType.GroupPresence_LaunchRosterPanel:
case Message.MessageType.GroupPresence_Set:
case Message.MessageType.GroupPresence_SetDestination:
case Message.MessageType.GroupPresence_SetIsJoinable:
case Message.MessageType.GroupPresence_SetLobbySession:
case Message.MessageType.GroupPresence_SetMatchSession:
case Message.MessageType.IAP_ConsumePurchase:
case Message.MessageType.Matchmaking_Cancel:
case Message.MessageType.Matchmaking_Cancel2:
case Message.MessageType.Matchmaking_ReportResultInsecure:
case Message.MessageType.Matchmaking_StartMatch:
case Message.MessageType.Notification_MarkAsRead:
case Message.MessageType.RichPresence_Clear:
case Message.MessageType.RichPresence_Set:
case Message.MessageType.Room_LaunchInvitableUserFlow:
case Message.MessageType.Room_UpdateOwner:
message = new Message(messageHandle);
break;
case Message.MessageType.Notification_GroupPresence_JoinIntentReceived:
message = new MessageWithGroupPresenceJoinIntent(messageHandle);
break;
case Message.MessageType.Notification_GroupPresence_LeaveIntentReceived:
message = new MessageWithGroupPresenceLeaveIntent(messageHandle);
break;
case Message.MessageType.GroupPresence_LaunchInvitePanel:
message = new MessageWithInvitePanelResultInfo(messageHandle);
break;
case Message.MessageType.User_LaunchFriendRequestFlow:
message = new MessageWithLaunchFriendRequestFlowResult(messageHandle);
break;
case Message.MessageType.Notification_GroupPresence_InvitationsSent:
case Message.MessageType.Notification_Session_InvitationsSent:
message = new MessageWithLaunchInvitePanelFlowResult(messageHandle);
break;
case Message.MessageType.Leaderboard_Get:
case Message.MessageType.Leaderboard_GetNextLeaderboardArrayPage:
message = new MessageWithLeaderboardList(messageHandle);
break;
case Message.MessageType.Leaderboard_GetEntries:
case Message.MessageType.Leaderboard_GetEntriesAfterRank:
case Message.MessageType.Leaderboard_GetEntriesByIds:
case Message.MessageType.Leaderboard_GetNextEntries:
case Message.MessageType.Leaderboard_GetPreviousEntries:
message = new MessageWithLeaderboardEntryList(messageHandle);
break;
case Message.MessageType.Leaderboard_WriteEntry:
case Message.MessageType.Leaderboard_WriteEntryWithSupplementaryMetric:
message = new MessageWithLeaderboardDidUpdate(messageHandle);
break;
case Message.MessageType.Notification_Livestreaming_StatusChange:
message = new MessageWithLivestreamingStatus(messageHandle);
break;
case Message.MessageType.Matchmaking_GetAdminSnapshot:
message = new MessageWithMatchmakingAdminSnapshot(messageHandle);
break;
case Message.MessageType.Matchmaking_Browse:
case Message.MessageType.Matchmaking_Browse2:
message = new MessageWithMatchmakingBrowseResult(messageHandle);
break;
case Message.MessageType.Matchmaking_Enqueue:
case Message.MessageType.Matchmaking_Enqueue2:
case Message.MessageType.Matchmaking_EnqueueRoom:
case Message.MessageType.Matchmaking_EnqueueRoom2:
message = new MessageWithMatchmakingEnqueueResult(messageHandle);
break;
case Message.MessageType.Matchmaking_CreateAndEnqueueRoom:
case Message.MessageType.Matchmaking_CreateAndEnqueueRoom2:
message = new MessageWithMatchmakingEnqueueResultAndRoom(messageHandle);
break;
case Message.MessageType.Matchmaking_GetStats:
message = new MessageWithMatchmakingStatsUnderMatchmakingStats(messageHandle);
break;
case Message.MessageType.Voip_GetMicrophoneAvailability:
message = new MessageWithMicrophoneAvailabilityState(messageHandle);
break;
case Message.MessageType.Notification_NetSync_ConnectionStatusChanged:
message = new MessageWithNetSyncConnection(messageHandle);
break;
case Message.MessageType.Notification_NetSync_SessionsChanged:
message = new MessageWithNetSyncSessionsChangedNotification(messageHandle);
break;
case Message.MessageType.User_GetOrgScopedID:
message = new MessageWithOrgScopedID(messageHandle);
break;
case Message.MessageType.Party_GetCurrent:
message = new MessageWithPartyUnderCurrentParty(messageHandle);
break;
case Message.MessageType.Notification_Party_PartyUpdate:
message = new MessageWithPartyUpdateNotification(messageHandle);
break;
case Message.MessageType.ApplicationLifecycle_GetRegisteredPIDs:
message = new MessageWithPidList(messageHandle);
break;
case Message.MessageType.IAP_GetNextProductArrayPage:
case Message.MessageType.IAP_GetProductsBySKU:
message = new MessageWithProductList(messageHandle);
break;
case Message.MessageType.IAP_LaunchCheckoutFlow:
message = new MessageWithPurchase(messageHandle);
break;
case Message.MessageType.IAP_GetNextPurchaseArrayPage:
case Message.MessageType.IAP_GetViewerPurchases:
case Message.MessageType.IAP_GetViewerPurchasesDurableCache:
message = new MessageWithPurchaseList(messageHandle);
break;
case Message.MessageType.GroupPresence_LaunchRejoinDialog:
message = new MessageWithRejoinDialogResult(messageHandle);
break;
case Message.MessageType.Room_Get:
message = new MessageWithRoom(messageHandle);
break;
case Message.MessageType.Room_GetCurrent:
case Message.MessageType.Room_GetCurrentForUser:
message = new MessageWithRoomUnderCurrentRoom(messageHandle);
break;
case Message.MessageType.Matchmaking_CreateRoom:
case Message.MessageType.Matchmaking_CreateRoom2:
case Message.MessageType.Matchmaking_JoinRoom:
case Message.MessageType.Notification_Room_RoomUpdate:
case Message.MessageType.Room_CreateAndJoinPrivate:
case Message.MessageType.Room_CreateAndJoinPrivate2:
case Message.MessageType.Room_InviteUser:
case Message.MessageType.Room_Join:
case Message.MessageType.Room_Join2:
case Message.MessageType.Room_KickUser:
case Message.MessageType.Room_Leave:
case Message.MessageType.Room_SetDescription:
case Message.MessageType.Room_UpdateDataStore:
case Message.MessageType.Room_UpdateMembershipLockStatus:
case Message.MessageType.Room_UpdatePrivateRoomJoinPolicy:
message = new MessageWithRoomUnderViewerRoom(messageHandle);
break;
case Message.MessageType.Room_GetModeratedRooms:
case Message.MessageType.Room_GetNextRoomArrayPage:
message = new MessageWithRoomList(messageHandle);
break;
case Message.MessageType.Notification_Room_InviteReceived:
message = new MessageWithRoomInviteNotification(messageHandle);
break;
case Message.MessageType.Notification_GetNextRoomInviteNotificationArrayPage:
case Message.MessageType.Notification_GetRoomInvites:
message = new MessageWithRoomInviteNotificationList(messageHandle);
break;
case Message.MessageType.User_GetSdkAccounts:
message = new MessageWithSdkAccountList(messageHandle);
break;
case Message.MessageType.Media_ShareToFacebook:
message = new MessageWithShareMediaResult(messageHandle);
break;
case Message.MessageType.ApplicationLifecycle_GetSessionKey:
case Message.MessageType.Application_LaunchOtherApp:
case Message.MessageType.CloudStorage2_GetUserDirectoryPath:
case Message.MessageType.Notification_ApplicationLifecycle_LaunchIntentChanged:
case Message.MessageType.Notification_Room_InviteAccepted:
case Message.MessageType.Notification_Voip_MicrophoneAvailabilityStateUpdate:
case Message.MessageType.Notification_Vrcamera_GetDataChannelMessageUpdate:
case Message.MessageType.Notification_Vrcamera_GetSurfaceUpdate:
case Message.MessageType.User_GetAccessToken:
message = new MessageWithString(messageHandle);
break;
case Message.MessageType.Voip_SetSystemVoipSuppressed:
message = new MessageWithSystemVoipState(messageHandle);
break;
case Message.MessageType.User_Get:
case Message.MessageType.User_GetLoggedInUser:
message = new MessageWithUser(messageHandle);
break;
case Message.MessageType.User_GetLoggedInUserFriendsAndRooms:
case Message.MessageType.User_GetLoggedInUserRecentlyMetUsersAndRooms:
case Message.MessageType.User_GetNextUserAndRoomArrayPage:
message = new MessageWithUserAndRoomList(messageHandle);
break;
case Message.MessageType.Room_GetInvitableUsers:
case Message.MessageType.Room_GetInvitableUsers2:
case Message.MessageType.User_GetLoggedInUserFriends:
case Message.MessageType.User_GetNextUserArrayPage:
message = new MessageWithUserList(messageHandle);
break;
case Message.MessageType.UserDataStore_PrivateDeleteEntryByKey:
case Message.MessageType.UserDataStore_PrivateWriteEntry:
case Message.MessageType.UserDataStore_PublicDeleteEntryByKey:
case Message.MessageType.UserDataStore_PublicWriteEntry:
message = new MessageWithUserDataStoreUpdateResponse(messageHandle);
break;
case Message.MessageType.User_GetUserProof:
message = new MessageWithUserProof(messageHandle);
break;
case Message.MessageType.Notification_Networking_ConnectionStateChange:
case Message.MessageType.Notification_Networking_PeerConnectRequest:
message = new MessageWithNetworkingPeer(messageHandle);
break;
case Message.MessageType.Notification_Networking_PingResult:
message = new MessageWithPingResult(messageHandle);
break;
case Message.MessageType.Notification_Matchmaking_MatchFound:
message = new MessageWithMatchmakingNotification(messageHandle);
break;
case Message.MessageType.Notification_Voip_ConnectRequest:
case Message.MessageType.Notification_Voip_StateChange:
message = new MessageWithNetworkingPeer(messageHandle);
break;
case Message.MessageType.Notification_Voip_SystemVoipState:
message = new MessageWithSystemVoipState(messageHandle);
break;
case Message.MessageType.Notification_HTTP_Transfer:
message = new MessageWithHttpTransferUpdate(messageHandle);
break;
case Message.MessageType.Platform_InitializeWithAccessToken:
case Message.MessageType.Platform_InitializeStandaloneOculus:
case Message.MessageType.Platform_InitializeAndroidAsynchronous:
case Message.MessageType.Platform_InitializeWindowsAsynchronous:
message = new MessageWithPlatformInitialize(messageHandle);
break;
default:
message = PlatformInternal.ParseMessageHandle(messageHandle, message_type);
if (message == null)
{
Debug.LogError(string.Format("Unrecognized message type {0}\n", message_type));
}
break;
// OVR_MESSAGE_TYPE_END
}
return message;
}
public static Message PopMessage()
{
if (!Core.IsInitialized())
{
return null;
}
var messageHandle = CAPI.ovr_PopMessage();
Message message = ParseMessageHandle(messageHandle);
CAPI.ovr_FreeMessage(messageHandle);
return message;
}
internal delegate Message ExtraMessageTypesHandler(IntPtr messageHandle, Message.MessageType message_type);
internal static ExtraMessageTypesHandler HandleExtraMessageTypes { set; private get; }
}
public class MessageWithAbuseReportRecording : Message<AbuseReportRecording>
{
public MessageWithAbuseReportRecording(IntPtr c_message) : base(c_message) { }
public override AbuseReportRecording GetAbuseReportRecording() { return Data; }
protected override AbuseReportRecording GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetAbuseReportRecording(msg);
return new AbuseReportRecording(obj);
}
}
public class MessageWithAchievementDefinitions : Message<AchievementDefinitionList>
{
public MessageWithAchievementDefinitions(IntPtr c_message) : base(c_message) { }
public override AchievementDefinitionList GetAchievementDefinitions() { return Data; }
protected override AchievementDefinitionList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetAchievementDefinitionArray(msg);
return new AchievementDefinitionList(obj);
}
}
public class MessageWithAchievementProgressList : Message<AchievementProgressList>
{
public MessageWithAchievementProgressList(IntPtr c_message) : base(c_message) { }
public override AchievementProgressList GetAchievementProgressList() { return Data; }
protected override AchievementProgressList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetAchievementProgressArray(msg);
return new AchievementProgressList(obj);
}
}
public class MessageWithAchievementUpdate : Message<AchievementUpdate>
{
public MessageWithAchievementUpdate(IntPtr c_message) : base(c_message) { }
public override AchievementUpdate GetAchievementUpdate() { return Data; }
protected override AchievementUpdate GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetAchievementUpdate(msg);
return new AchievementUpdate(obj);
}
}
public class MessageWithApplicationVersion : Message<ApplicationVersion>
{
public MessageWithApplicationVersion(IntPtr c_message) : base(c_message) { }
public override ApplicationVersion GetApplicationVersion() { return Data; }
protected override ApplicationVersion GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetApplicationVersion(msg);
return new ApplicationVersion(obj);
}
}
public class MessageWithAssetDetails : Message<AssetDetails>
{
public MessageWithAssetDetails(IntPtr c_message) : base(c_message) { }
public override AssetDetails GetAssetDetails() { return Data; }
protected override AssetDetails GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetAssetDetails(msg);
return new AssetDetails(obj);
}
}
public class MessageWithAssetDetailsList : Message<AssetDetailsList>
{
public MessageWithAssetDetailsList(IntPtr c_message) : base(c_message) { }
public override AssetDetailsList GetAssetDetailsList() { return Data; }
protected override AssetDetailsList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetAssetDetailsArray(msg);
return new AssetDetailsList(obj);
}
}
public class MessageWithAssetFileDeleteResult : Message<AssetFileDeleteResult>
{
public MessageWithAssetFileDeleteResult(IntPtr c_message) : base(c_message) { }
public override AssetFileDeleteResult GetAssetFileDeleteResult() { return Data; }
protected override AssetFileDeleteResult GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetAssetFileDeleteResult(msg);
return new AssetFileDeleteResult(obj);
}
}
public class MessageWithAssetFileDownloadCancelResult : Message<AssetFileDownloadCancelResult>
{
public MessageWithAssetFileDownloadCancelResult(IntPtr c_message) : base(c_message) { }
public override AssetFileDownloadCancelResult GetAssetFileDownloadCancelResult() { return Data; }
protected override AssetFileDownloadCancelResult GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetAssetFileDownloadCancelResult(msg);
return new AssetFileDownloadCancelResult(obj);
}
}
public class MessageWithAssetFileDownloadResult : Message<AssetFileDownloadResult>
{
public MessageWithAssetFileDownloadResult(IntPtr c_message) : base(c_message) { }
public override AssetFileDownloadResult GetAssetFileDownloadResult() { return Data; }
protected override AssetFileDownloadResult GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetAssetFileDownloadResult(msg);
return new AssetFileDownloadResult(obj);
}
}
public class MessageWithAssetFileDownloadUpdate : Message<AssetFileDownloadUpdate>
{
public MessageWithAssetFileDownloadUpdate(IntPtr c_message) : base(c_message) { }
public override AssetFileDownloadUpdate GetAssetFileDownloadUpdate() { return Data; }
protected override AssetFileDownloadUpdate GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetAssetFileDownloadUpdate(msg);
return new AssetFileDownloadUpdate(obj);
}
}
public class MessageWithCalApplicationFinalized : Message<CalApplicationFinalized>
{
public MessageWithCalApplicationFinalized(IntPtr c_message) : base(c_message) { }
public override CalApplicationFinalized GetCalApplicationFinalized() { return Data; }
protected override CalApplicationFinalized GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetCalApplicationFinalized(msg);
return new CalApplicationFinalized(obj);
}
}
public class MessageWithCalApplicationProposed : Message<CalApplicationProposed>
{
public MessageWithCalApplicationProposed(IntPtr c_message) : base(c_message) { }
public override CalApplicationProposed GetCalApplicationProposed() { return Data; }
protected override CalApplicationProposed GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetCalApplicationProposed(msg);
return new CalApplicationProposed(obj);
}
}
public class MessageWithCalApplicationSuggestionList : Message<CalApplicationSuggestionList>
{
public MessageWithCalApplicationSuggestionList(IntPtr c_message) : base(c_message) { }
public override CalApplicationSuggestionList GetCalApplicationSuggestionList() { return Data; }
protected override CalApplicationSuggestionList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetCalApplicationSuggestionArray(msg);
return new CalApplicationSuggestionList(obj);
}
}
public class MessageWithChallenge : Message<Challenge>
{
public MessageWithChallenge(IntPtr c_message) : base(c_message) { }
public override Challenge GetChallenge() { return Data; }
protected override Challenge GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetChallenge(msg);
return new Challenge(obj);
}
}
public class MessageWithChallengeList : Message<ChallengeList>
{
public MessageWithChallengeList(IntPtr c_message) : base(c_message) { }
public override ChallengeList GetChallengeList() { return Data; }
protected override ChallengeList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetChallengeArray(msg);
return new ChallengeList(obj);
}
}
public class MessageWithChallengeEntryList : Message<ChallengeEntryList>
{
public MessageWithChallengeEntryList(IntPtr c_message) : base(c_message) { }
public override ChallengeEntryList GetChallengeEntryList() { return Data; }
protected override ChallengeEntryList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetChallengeEntryArray(msg);
return new ChallengeEntryList(obj);
}
}
public class MessageWithCloudStorageConflictMetadata : Message<CloudStorageConflictMetadata>
{
public MessageWithCloudStorageConflictMetadata(IntPtr c_message) : base(c_message) { }
public override CloudStorageConflictMetadata GetCloudStorageConflictMetadata() { return Data; }
protected override CloudStorageConflictMetadata GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetCloudStorageConflictMetadata(msg);
return new CloudStorageConflictMetadata(obj);
}
}
public class MessageWithCloudStorageData : Message<CloudStorageData>
{
public MessageWithCloudStorageData(IntPtr c_message) : base(c_message) { }
public override CloudStorageData GetCloudStorageData() { return Data; }
protected override CloudStorageData GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetCloudStorageData(msg);
return new CloudStorageData(obj);
}
}
public class MessageWithCloudStorageMetadataUnderLocal : Message<CloudStorageMetadata>
{
public MessageWithCloudStorageMetadataUnderLocal(IntPtr c_message) : base(c_message) { }
public override CloudStorageMetadata GetCloudStorageMetadata() { return Data; }
protected override CloudStorageMetadata GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetCloudStorageMetadata(msg);
return new CloudStorageMetadata(obj);
}
}
public class MessageWithCloudStorageMetadataList : Message<CloudStorageMetadataList>
{
public MessageWithCloudStorageMetadataList(IntPtr c_message) : base(c_message) { }
public override CloudStorageMetadataList GetCloudStorageMetadataList() { return Data; }
protected override CloudStorageMetadataList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetCloudStorageMetadataArray(msg);
return new CloudStorageMetadataList(obj);
}
}
public class MessageWithCloudStorageUpdateResponse : Message<CloudStorageUpdateResponse>
{
public MessageWithCloudStorageUpdateResponse(IntPtr c_message) : base(c_message) { }
public override CloudStorageUpdateResponse GetCloudStorageUpdateResponse() { return Data; }
protected override CloudStorageUpdateResponse GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetCloudStorageUpdateResponse(msg);
return new CloudStorageUpdateResponse(obj);
}
}
public class MessageWithDataStoreUnderPrivateUserDataStore : Message<Dictionary<string, string>>
{
public MessageWithDataStoreUnderPrivateUserDataStore(IntPtr c_message) : base(c_message) { }
public override Dictionary<string, string> GetDataStore() { return Data; }
protected override Dictionary<string, string> GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetDataStore(msg);
return CAPI.DataStoreFromNative(obj);
}
}
public class MessageWithDataStoreUnderPublicUserDataStore : Message<Dictionary<string, string>>
{
public MessageWithDataStoreUnderPublicUserDataStore(IntPtr c_message) : base(c_message) { }
public override Dictionary<string, string> GetDataStore() { return Data; }
protected override Dictionary<string, string> GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetDataStore(msg);
return CAPI.DataStoreFromNative(obj);
}
}
public class MessageWithDestinationList : Message<DestinationList>
{
public MessageWithDestinationList(IntPtr c_message) : base(c_message) { }
public override DestinationList GetDestinationList() { return Data; }
protected override DestinationList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetDestinationArray(msg);
return new DestinationList(obj);
}
}
public class MessageWithGroupPresenceJoinIntent : Message<GroupPresenceJoinIntent>
{
public MessageWithGroupPresenceJoinIntent(IntPtr c_message) : base(c_message) { }
public override GroupPresenceJoinIntent GetGroupPresenceJoinIntent() { return Data; }
protected override GroupPresenceJoinIntent GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetGroupPresenceJoinIntent(msg);
return new GroupPresenceJoinIntent(obj);
}
}
public class MessageWithGroupPresenceLeaveIntent : Message<GroupPresenceLeaveIntent>
{
public MessageWithGroupPresenceLeaveIntent(IntPtr c_message) : base(c_message) { }
public override GroupPresenceLeaveIntent GetGroupPresenceLeaveIntent() { return Data; }
protected override GroupPresenceLeaveIntent GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetGroupPresenceLeaveIntent(msg);
return new GroupPresenceLeaveIntent(obj);
}
}
public class MessageWithInstalledApplicationList : Message<InstalledApplicationList>
{
public MessageWithInstalledApplicationList(IntPtr c_message) : base(c_message) { }
public override InstalledApplicationList GetInstalledApplicationList() { return Data; }
protected override InstalledApplicationList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetInstalledApplicationArray(msg);
return new InstalledApplicationList(obj);
}
}
public class MessageWithInvitePanelResultInfo : Message<InvitePanelResultInfo>
{
public MessageWithInvitePanelResultInfo(IntPtr c_message) : base(c_message) { }
public override InvitePanelResultInfo GetInvitePanelResultInfo() { return Data; }
protected override InvitePanelResultInfo GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetInvitePanelResultInfo(msg);
return new InvitePanelResultInfo(obj);
}
}
public class MessageWithLaunchBlockFlowResult : Message<LaunchBlockFlowResult>
{
public MessageWithLaunchBlockFlowResult(IntPtr c_message) : base(c_message) { }
public override LaunchBlockFlowResult GetLaunchBlockFlowResult() { return Data; }
protected override LaunchBlockFlowResult GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetLaunchBlockFlowResult(msg);
return new LaunchBlockFlowResult(obj);
}
}
public class MessageWithLaunchFriendRequestFlowResult : Message<LaunchFriendRequestFlowResult>
{
public MessageWithLaunchFriendRequestFlowResult(IntPtr c_message) : base(c_message) { }
public override LaunchFriendRequestFlowResult GetLaunchFriendRequestFlowResult() { return Data; }
protected override LaunchFriendRequestFlowResult GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetLaunchFriendRequestFlowResult(msg);
return new LaunchFriendRequestFlowResult(obj);
}
}
public class MessageWithLaunchInvitePanelFlowResult : Message<LaunchInvitePanelFlowResult>
{
public MessageWithLaunchInvitePanelFlowResult(IntPtr c_message) : base(c_message) { }
public override LaunchInvitePanelFlowResult GetLaunchInvitePanelFlowResult() { return Data; }
protected override LaunchInvitePanelFlowResult GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetLaunchInvitePanelFlowResult(msg);
return new LaunchInvitePanelFlowResult(obj);
}
}
public class MessageWithLaunchReportFlowResult : Message<LaunchReportFlowResult>
{
public MessageWithLaunchReportFlowResult(IntPtr c_message) : base(c_message) { }
public override LaunchReportFlowResult GetLaunchReportFlowResult() { return Data; }
protected override LaunchReportFlowResult GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetLaunchReportFlowResult(msg);
return new LaunchReportFlowResult(obj);
}
}
public class MessageWithLaunchUnblockFlowResult : Message<LaunchUnblockFlowResult>
{
public MessageWithLaunchUnblockFlowResult(IntPtr c_message) : base(c_message) { }
public override LaunchUnblockFlowResult GetLaunchUnblockFlowResult() { return Data; }
protected override LaunchUnblockFlowResult GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetLaunchUnblockFlowResult(msg);
return new LaunchUnblockFlowResult(obj);
}
}
public class MessageWithLeaderboardList : Message<LeaderboardList>
{
public MessageWithLeaderboardList(IntPtr c_message) : base(c_message) { }
public override LeaderboardList GetLeaderboardList() { return Data; }
protected override LeaderboardList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetLeaderboardArray(msg);
return new LeaderboardList(obj);
}
}
public class MessageWithLeaderboardEntryList : Message<LeaderboardEntryList>
{
public MessageWithLeaderboardEntryList(IntPtr c_message) : base(c_message) { }
public override LeaderboardEntryList GetLeaderboardEntryList() { return Data; }
protected override LeaderboardEntryList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetLeaderboardEntryArray(msg);
return new LeaderboardEntryList(obj);
}
}
public class MessageWithLinkedAccountList : Message<LinkedAccountList>
{
public MessageWithLinkedAccountList(IntPtr c_message) : base(c_message) { }
public override LinkedAccountList GetLinkedAccountList() { return Data; }
protected override LinkedAccountList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetLinkedAccountArray(msg);
return new LinkedAccountList(obj);
}
}
public class MessageWithLivestreamingApplicationStatus : Message<LivestreamingApplicationStatus>
{
public MessageWithLivestreamingApplicationStatus(IntPtr c_message) : base(c_message) { }
public override LivestreamingApplicationStatus GetLivestreamingApplicationStatus() { return Data; }
protected override LivestreamingApplicationStatus GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetLivestreamingApplicationStatus(msg);
return new LivestreamingApplicationStatus(obj);
}
}
public class MessageWithLivestreamingStartResult : Message<LivestreamingStartResult>
{
public MessageWithLivestreamingStartResult(IntPtr c_message) : base(c_message) { }
public override LivestreamingStartResult GetLivestreamingStartResult() { return Data; }
protected override LivestreamingStartResult GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetLivestreamingStartResult(msg);
return new LivestreamingStartResult(obj);
}
}
public class MessageWithLivestreamingStatus : Message<LivestreamingStatus>
{
public MessageWithLivestreamingStatus(IntPtr c_message) : base(c_message) { }
public override LivestreamingStatus GetLivestreamingStatus() { return Data; }
protected override LivestreamingStatus GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetLivestreamingStatus(msg);
return new LivestreamingStatus(obj);
}
}
public class MessageWithLivestreamingVideoStats : Message<LivestreamingVideoStats>
{
public MessageWithLivestreamingVideoStats(IntPtr c_message) : base(c_message) { }
public override LivestreamingVideoStats GetLivestreamingVideoStats() { return Data; }
protected override LivestreamingVideoStats GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetLivestreamingVideoStats(msg);
return new LivestreamingVideoStats(obj);
}
}
public class MessageWithMatchmakingAdminSnapshot : Message<MatchmakingAdminSnapshot>
{
public MessageWithMatchmakingAdminSnapshot(IntPtr c_message) : base(c_message) { }
public override MatchmakingAdminSnapshot GetMatchmakingAdminSnapshot() { return Data; }
protected override MatchmakingAdminSnapshot GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetMatchmakingAdminSnapshot(msg);
return new MatchmakingAdminSnapshot(obj);
}
}
public class MessageWithMatchmakingEnqueueResult : Message<MatchmakingEnqueueResult>
{
public MessageWithMatchmakingEnqueueResult(IntPtr c_message) : base(c_message) { }
public override MatchmakingEnqueueResult GetMatchmakingEnqueueResult() { return Data; }
protected override MatchmakingEnqueueResult GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetMatchmakingEnqueueResult(msg);
return new MatchmakingEnqueueResult(obj);
}
}
public class MessageWithMatchmakingEnqueueResultAndRoom : Message<MatchmakingEnqueueResultAndRoom>
{
public MessageWithMatchmakingEnqueueResultAndRoom(IntPtr c_message) : base(c_message) { }
public override MatchmakingEnqueueResultAndRoom GetMatchmakingEnqueueResultAndRoom() { return Data; }
protected override MatchmakingEnqueueResultAndRoom GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetMatchmakingEnqueueResultAndRoom(msg);
return new MatchmakingEnqueueResultAndRoom(obj);
}
}
public class MessageWithMatchmakingStatsUnderMatchmakingStats : Message<MatchmakingStats>
{
public MessageWithMatchmakingStatsUnderMatchmakingStats(IntPtr c_message) : base(c_message) { }
public override MatchmakingStats GetMatchmakingStats() { return Data; }
protected override MatchmakingStats GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetMatchmakingStats(msg);
return new MatchmakingStats(obj);
}
}
public class MessageWithMicrophoneAvailabilityState : Message<MicrophoneAvailabilityState>
{
public MessageWithMicrophoneAvailabilityState(IntPtr c_message) : base(c_message) { }
public override MicrophoneAvailabilityState GetMicrophoneAvailabilityState() { return Data; }
protected override MicrophoneAvailabilityState GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetMicrophoneAvailabilityState(msg);
return new MicrophoneAvailabilityState(obj);
}
}
public class MessageWithNetSyncConnection : Message<NetSyncConnection>
{
public MessageWithNetSyncConnection(IntPtr c_message) : base(c_message) { }
public override NetSyncConnection GetNetSyncConnection() { return Data; }
protected override NetSyncConnection GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetNetSyncConnection(msg);
return new NetSyncConnection(obj);
}
}
public class MessageWithNetSyncSessionList : Message<NetSyncSessionList>
{
public MessageWithNetSyncSessionList(IntPtr c_message) : base(c_message) { }
public override NetSyncSessionList GetNetSyncSessionList() { return Data; }
protected override NetSyncSessionList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetNetSyncSessionArray(msg);
return new NetSyncSessionList(obj);
}
}
public class MessageWithNetSyncSessionsChangedNotification : Message<NetSyncSessionsChangedNotification>
{
public MessageWithNetSyncSessionsChangedNotification(IntPtr c_message) : base(c_message) { }
public override NetSyncSessionsChangedNotification GetNetSyncSessionsChangedNotification() { return Data; }
protected override NetSyncSessionsChangedNotification GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetNetSyncSessionsChangedNotification(msg);
return new NetSyncSessionsChangedNotification(obj);
}
}
public class MessageWithNetSyncSetSessionPropertyResult : Message<NetSyncSetSessionPropertyResult>
{
public MessageWithNetSyncSetSessionPropertyResult(IntPtr c_message) : base(c_message) { }
public override NetSyncSetSessionPropertyResult GetNetSyncSetSessionPropertyResult() { return Data; }
protected override NetSyncSetSessionPropertyResult GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetNetSyncSetSessionPropertyResult(msg);
return new NetSyncSetSessionPropertyResult(obj);
}
}
public class MessageWithNetSyncVoipAttenuationValueList : Message<NetSyncVoipAttenuationValueList>
{
public MessageWithNetSyncVoipAttenuationValueList(IntPtr c_message) : base(c_message) { }
public override NetSyncVoipAttenuationValueList GetNetSyncVoipAttenuationValueList() { return Data; }
protected override NetSyncVoipAttenuationValueList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetNetSyncVoipAttenuationValueArray(msg);
return new NetSyncVoipAttenuationValueList(obj);
}
}
public class MessageWithOrgScopedID : Message<OrgScopedID>
{
public MessageWithOrgScopedID(IntPtr c_message) : base(c_message) { }
public override OrgScopedID GetOrgScopedID() { return Data; }
protected override OrgScopedID GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetOrgScopedID(msg);
return new OrgScopedID(obj);
}
}
public class MessageWithParty : Message<Party>
{
public MessageWithParty(IntPtr c_message) : base(c_message) { }
public override Party GetParty() { return Data; }
protected override Party GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetParty(msg);
return new Party(obj);
}
}
public class MessageWithPartyUnderCurrentParty : Message<Party>
{
public MessageWithPartyUnderCurrentParty(IntPtr c_message) : base(c_message) { }
public override Party GetParty() { return Data; }
protected override Party GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetParty(msg);
return new Party(obj);
}
}
public class MessageWithPartyID : Message<PartyID>
{
public MessageWithPartyID(IntPtr c_message) : base(c_message) { }
public override PartyID GetPartyID() { return Data; }
protected override PartyID GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetPartyID(msg);
return new PartyID(obj);
}
}
public class MessageWithPartyUpdateNotification : Message<PartyUpdateNotification>
{
public MessageWithPartyUpdateNotification(IntPtr c_message) : base(c_message) { }
public override PartyUpdateNotification GetPartyUpdateNotification() { return Data; }
protected override PartyUpdateNotification GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetPartyUpdateNotification(msg);
return new PartyUpdateNotification(obj);
}
}
public class MessageWithPidList : Message<PidList>
{
public MessageWithPidList(IntPtr c_message) : base(c_message) { }
public override PidList GetPidList() { return Data; }
protected override PidList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetPidArray(msg);
return new PidList(obj);
}
}
public class MessageWithProductList : Message<ProductList>
{
public MessageWithProductList(IntPtr c_message) : base(c_message) { }
public override ProductList GetProductList() { return Data; }
protected override ProductList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetProductArray(msg);
return new ProductList(obj);
}
}
public class MessageWithPurchase : Message<Purchase>
{
public MessageWithPurchase(IntPtr c_message) : base(c_message) { }
public override Purchase GetPurchase() { return Data; }
protected override Purchase GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetPurchase(msg);
return new Purchase(obj);
}
}
public class MessageWithPurchaseList : Message<PurchaseList>
{
public MessageWithPurchaseList(IntPtr c_message) : base(c_message) { }
public override PurchaseList GetPurchaseList() { return Data; }
protected override PurchaseList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetPurchaseArray(msg);
return new PurchaseList(obj);
}
}
public class MessageWithRejoinDialogResult : Message<RejoinDialogResult>
{
public MessageWithRejoinDialogResult(IntPtr c_message) : base(c_message) { }
public override RejoinDialogResult GetRejoinDialogResult() { return Data; }
protected override RejoinDialogResult GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetRejoinDialogResult(msg);
return new RejoinDialogResult(obj);
}
}
public class MessageWithRoom : Message<Room>
{
public MessageWithRoom(IntPtr c_message) : base(c_message) { }
public override Room GetRoom() { return Data; }
protected override Room GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetRoom(msg);
return new Room(obj);
}
}
public class MessageWithRoomUnderCurrentRoom : Message<Room>
{
public MessageWithRoomUnderCurrentRoom(IntPtr c_message) : base(c_message) { }
public override Room GetRoom() { return Data; }
protected override Room GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetRoom(msg);
return new Room(obj);
}
}
public class MessageWithRoomUnderViewerRoom : Message<Room>
{
public MessageWithRoomUnderViewerRoom(IntPtr c_message) : base(c_message) { }
public override Room GetRoom() { return Data; }
protected override Room GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetRoom(msg);
return new Room(obj);
}
}
public class MessageWithRoomList : Message<RoomList>
{
public MessageWithRoomList(IntPtr c_message) : base(c_message) { }
public override RoomList GetRoomList() { return Data; }
protected override RoomList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetRoomArray(msg);
return new RoomList(obj);
}
}
public class MessageWithRoomInviteNotification : Message<RoomInviteNotification>
{
public MessageWithRoomInviteNotification(IntPtr c_message) : base(c_message) { }
public override RoomInviteNotification GetRoomInviteNotification() { return Data; }
protected override RoomInviteNotification GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetRoomInviteNotification(msg);
return new RoomInviteNotification(obj);
}
}
public class MessageWithRoomInviteNotificationList : Message<RoomInviteNotificationList>
{
public MessageWithRoomInviteNotificationList(IntPtr c_message) : base(c_message) { }
public override RoomInviteNotificationList GetRoomInviteNotificationList() { return Data; }
protected override RoomInviteNotificationList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetRoomInviteNotificationArray(msg);
return new RoomInviteNotificationList(obj);
}
}
public class MessageWithSdkAccountList : Message<SdkAccountList>
{
public MessageWithSdkAccountList(IntPtr c_message) : base(c_message) { }
public override SdkAccountList GetSdkAccountList() { return Data; }
protected override SdkAccountList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetSdkAccountArray(msg);
return new SdkAccountList(obj);
}
}
public class MessageWithShareMediaResult : Message<ShareMediaResult>
{
public MessageWithShareMediaResult(IntPtr c_message) : base(c_message) { }
public override ShareMediaResult GetShareMediaResult() { return Data; }
protected override ShareMediaResult GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetShareMediaResult(msg);
return new ShareMediaResult(obj);
}
}
public class MessageWithString : Message<string>
{
public MessageWithString(IntPtr c_message) : base(c_message) { }
public override string GetString() { return Data; }
protected override string GetDataFromMessage(IntPtr c_message)
{
return CAPI.ovr_Message_GetString(c_message);
}
}
public class MessageWithSystemVoipState : Message<SystemVoipState>
{
public MessageWithSystemVoipState(IntPtr c_message) : base(c_message) { }
public override SystemVoipState GetSystemVoipState() { return Data; }
protected override SystemVoipState GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetSystemVoipState(msg);
return new SystemVoipState(obj);
}
}
public class MessageWithUser : Message<User>
{
public MessageWithUser(IntPtr c_message) : base(c_message) { }
public override User GetUser() { return Data; }
protected override User GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetUser(msg);
return new User(obj);
}
}
public class MessageWithUserAndRoomList : Message<UserAndRoomList>
{
public MessageWithUserAndRoomList(IntPtr c_message) : base(c_message) { }
public override UserAndRoomList GetUserAndRoomList() { return Data; }
protected override UserAndRoomList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetUserAndRoomArray(msg);
return new UserAndRoomList(obj);
}
}
public class MessageWithUserList : Message<UserList>
{
public MessageWithUserList(IntPtr c_message) : base(c_message) { }
public override UserList GetUserList() { return Data; }
protected override UserList GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetUserArray(msg);
return new UserList(obj);
}
}
public class MessageWithUserDataStoreUpdateResponse : Message<UserDataStoreUpdateResponse>
{
public MessageWithUserDataStoreUpdateResponse(IntPtr c_message) : base(c_message) { }
public override UserDataStoreUpdateResponse GetUserDataStoreUpdateResponse() { return Data; }
protected override UserDataStoreUpdateResponse GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetUserDataStoreUpdateResponse(msg);
return new UserDataStoreUpdateResponse(obj);
}
}
public class MessageWithUserProof : Message<UserProof>
{
public MessageWithUserProof(IntPtr c_message) : base(c_message) { }
public override UserProof GetUserProof() { return Data; }
protected override UserProof GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetUserProof(msg);
return new UserProof(obj);
}
}
public class MessageWithUserReportID : Message<UserReportID>
{
public MessageWithUserReportID(IntPtr c_message) : base(c_message) { }
public override UserReportID GetUserReportID() { return Data; }
protected override UserReportID GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetUserReportID(msg);
return new UserReportID(obj);
}
}
public class MessageWithNetworkingPeer : Message<NetworkingPeer>
{
public MessageWithNetworkingPeer(IntPtr c_message) : base(c_message) { }
public override NetworkingPeer GetNetworkingPeer() { return Data; }
protected override NetworkingPeer GetDataFromMessage(IntPtr c_message)
{
var peer = CAPI.ovr_Message_GetNetworkingPeer(c_message);
return new NetworkingPeer(
CAPI.ovr_NetworkingPeer_GetID(peer),
CAPI.ovr_NetworkingPeer_GetState(peer)
);
}
}
public class MessageWithPingResult : Message<PingResult>
{
public MessageWithPingResult(IntPtr c_message) : base(c_message) { }
public override PingResult GetPingResult() { return Data; }
protected override PingResult GetDataFromMessage(IntPtr c_message)
{
var ping = CAPI.ovr_Message_GetPingResult(c_message);
bool is_timeout = CAPI.ovr_PingResult_IsTimeout(ping);
return new PingResult(
CAPI.ovr_PingResult_GetID(ping),
is_timeout ? (UInt64?)null : CAPI.ovr_PingResult_GetPingTimeUsec(ping)
);
}
}
public class MessageWithLeaderboardDidUpdate : Message<bool>
{
public MessageWithLeaderboardDidUpdate(IntPtr c_message) : base(c_message) { }
public override bool GetLeaderboardDidUpdate() { return Data; }
protected override bool GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetLeaderboardUpdateStatus(msg);
return CAPI.ovr_LeaderboardUpdateStatus_GetDidUpdate(obj);
}
}
public class MessageWithMatchmakingNotification : Message<Room>
{
public MessageWithMatchmakingNotification(IntPtr c_message) : base(c_message) {}
public override Room GetRoom() { return Data; }
protected override Room GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetRoom(msg);
return new Room(obj);
}
}
public class MessageWithMatchmakingBrowseResult : Message<MatchmakingBrowseResult>
{
public MessageWithMatchmakingBrowseResult(IntPtr c_message) : base(c_message) {}
public override MatchmakingEnqueueResult GetMatchmakingEnqueueResult() { return Data.EnqueueResult; }
public override RoomList GetRoomList() { return Data.Rooms; }
protected override MatchmakingBrowseResult GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetMatchmakingBrowseResult(msg);
return new MatchmakingBrowseResult(obj);
}
}
public class MessageWithHttpTransferUpdate : Message<HttpTransferUpdate>
{
public MessageWithHttpTransferUpdate(IntPtr c_message) : base(c_message) {}
public override HttpTransferUpdate GetHttpTransferUpdate() { return Data; }
protected override HttpTransferUpdate GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetHttpTransferUpdate(msg);
return new HttpTransferUpdate(obj);
}
}
public class MessageWithPlatformInitialize : Message<PlatformInitialize>
{
public MessageWithPlatformInitialize(IntPtr c_message) : base(c_message) {}
public override PlatformInitialize GetPlatformInitialize() { return Data; }
protected override PlatformInitialize GetDataFromMessage(IntPtr c_message)
{
var msg = CAPI.ovr_Message_GetNativeMessage(c_message);
var obj = CAPI.ovr_Message_GetPlatformInitialize(msg);
return new PlatformInitialize(obj);
}
}
}
| 46.043707 | 111 | 0.718998 | [
"Apache-2.0"
] | CannonWilson/AR-Basktball | Assets/Oculus/Platform/Scripts/Message.cs | 87,437 | C# |
// Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/Beef
using Beef.Caching.Policy;
using System;
namespace Beef.Caching
{
/// <summary>
/// Provides multi-tenancy cache management over underlying tenant-based caches using the <see cref="ExecutionContext"/> <see cref="ExecutionContext.TenantId"/>.
/// </summary>
public class MultiTenantCache<TCache> : MultiKeyCache<Guid, TCache>
where TCache : ICacheCore
{
/// <summary>
/// Initializes a new instance of the <see cref="MultiTenantCache{TCache}"/> class.
/// </summary>
/// <param name="policyKey">The policy key used to determine the cache policy configuration (see <see cref="CachePolicyManager"/>); defaults to <see cref="Guid.NewGuid()"/> ensuring uniqueness.</param>
/// <param name="createCache">The function that creates the cache for the <b>Tenant</b> <see cref="Guid"/> that should use the passed <see cref="ICachePolicy"/>.</param>
/// <param name="doNotRegister">Indicates that the automatic <see cref="CachePolicyManager.Register"/> should not occur (inheriting class must perform).</param>
public MultiTenantCache(Func<Guid, ICachePolicy, TCache> createCache, string? policyKey = null, bool doNotRegister = false) : base(createCache, policyKey, doNotRegister) { }
/// <summary>
/// Gets the tenant identifier from the Execution Context.
/// </summary>
private Guid GetTenantId()
{
if (!ExecutionContext.HasCurrent)
return Guid.Empty;
return ExecutionContext.Current.TenantId ?? Guid.Empty;
}
/// <summary>
/// Gets <typeparamref name="TCache"/> using the <see cref="ExecutionContext"/> <see cref="ExecutionContext.TenantId"/> (automatically creates where not found).
/// </summary>
/// <returns>The underlying tenant cache.</returns>
public TCache GetCache()
{
return GetCache(GetTenantId());
}
/// <summary>
/// Gets <typeparamref name="TCache"/> using the <see cref="ExecutionContext"/> <see cref="ExecutionContext.TenantId"/> where found.
/// </summary>
/// <param name="cache">When this method returns, contains the cache associated with the specified key, if the key is found; otherwise, <c>null</c>. This parameter is
/// passed uninitialized.</param>
/// <returns><c>true</c> if the tenant was found; otherwise, <c>false</c>.</returns>
public bool TryGetCache(out TCache cache)
{
return TryGetCache(GetTenantId(), out cache);
}
/// <summary>
/// Determines whether the cache contains the <see cref="ExecutionContext"/> <see cref="ExecutionContext.TenantId"/>.
/// </summary>
/// <returns><c>true</c> if the tenant exists; otherwise, <c>false</c>.</returns>
public bool Contains()
{
return Contains(GetTenantId());
}
/// <summary>
/// Removes the <see cref="ExecutionContext"/> <see cref="ExecutionContext.TenantId"/> from the cache.
/// </summary>
public void Remove()
{
Remove(GetTenantId());
}
}
} | 46.771429 | 209 | 0.626756 | [
"MIT"
] | edjo23/Beef | src/Beef.Core/Caching/MultiTenantCache.cs | 3,276 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WagoModbusNet - Modbus-Master for TCP, UDP, RTU and ASCII")]
[assembly: AssemblyDescription("WagoModbusNet provide easy to use Modbus-Master classes for TCP, UDP, RTU and ASCII. WagoModbusNet based on dot.net framework 2.0. WagoModbusNet.Masters do not throw any exception, all function returns a struct of type 'wmnRet'. For a list of supported function codes see 'enum ModbusFunctionCodes'.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("WAGO Kontakttechnik GmbH & Co.KG")]
[assembly: AssemblyProduct("WagoModbusNet")]
[assembly: AssemblyCopyright("WAGO Kontakttechnik GmbH & Co.KG 2019")]
[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("96ca2abf-9136-47e8-8f0a-4a4edce4a37e")]
// 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.1.0.4")]
[assembly: AssemblyFileVersion("1.1.0.4")]
| 49.459459 | 335 | 0.743169 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | Ekristoffe/WagoModbusNet | WagoModbusNet/Properties/AssemblyInfo.cs | 1,832 | C# |
/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* 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 Tizen;
using System.Runtime.InteropServices;
using Tizen.NUI;
using Tizen.NUI.UIComponents;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.Constants;
namespace UIControlSample
{
/// <summary>
/// A sample of InputFieldSample
/// </summary>
class InputFieldSample : IExample
{
private TextField textField;
private View textView;
private TextLabel guide;
private bool visibleFlag = false;
private InputMethodContext inputMethodContext = new InputMethodContext();
/// <summary>
/// The constructor
/// </summary>
public InputFieldSample()
{
}
/// <summary>
/// Text Sample Application initialisation.
/// </summary>
private void Initialize()
{
Window.Instance.BackgroundColor = Color.Black;
guide = new TextLabel();
guide.Focusable = true;
guide.HorizontalAlignment = HorizontalAlignment.Center;
guide.VerticalAlignment = VerticalAlignment.Center;
guide.PositionUsesPivotPoint = true;
guide.ParentOrigin = ParentOrigin.TopLeft;
guide.PivotPoint = PivotPoint.TopLeft;
guide.Size2D = new Size2D(1920, 96);
guide.FontFamily = "Samsung One 600";
guide.Position2D = new Position2D(0, 94);
guide.MultiLine = false;
//guide.PointSize = 15.0f;
guide.PointSize = DeviceCheck.PointSize15;
guide.Text = "InputField Sample \n";
guide.TextColor = Color.White;
guide.KeyEvent += OnKeyEvent;
//guide.BackgroundColor = new Color(43.0f / 255.0f, 145.0f / 255.0f, 175.0f / 255.0f, 1.0f);
Window.Instance.GetDefaultLayer().Add(guide);
InputField textFieldSample = new InputField();
textView = textFieldSample.GetView();
textView.Position = new Position(400, 400, 0);
textField = textFieldSample.GetTextField();
textField.KeyEvent += OnIMEKeyEvent;
Window.Instance.GetDefaultLayer().Add(textView);
FocusManager.Instance.SetCurrentFocusView(textField);
}
private bool OnKeyEvent(object source, View.KeyEventArgs e)
{
Tizen.Log.Fatal("NUI", "!!!!InputFieldSample!!!!! + KeyName: " + e.Key.KeyPressedName);
if (e.Key.State == Key.StateType.Up && e.Key.KeyPressedName == "Return")
{
FocusManager.Instance.SetCurrentFocusView(textField);
return true;
}
return false;
}
/// <summary>
/// Callback by _textField when have key event.
/// </summary>
/// <param name="source">_textField</param>
/// <param name="e">event</param>
/// <returns>the consume flag</returns>
private bool OnIMEKeyEvent(object source, View.KeyEventArgs e)
{
Tizen.Log.Fatal("NUI", "!!!!!OnIMEKeyEvent!!!!! + KeyName: " + e.Key.KeyPressedName);
if (e.Key.State == Key.StateType.Up)
{
if (e.Key.KeyPressedName == "Select")
{
Tizen.Log.Fatal("NUI", "!!!!!OnIMEKeyEvent!!!!! + KeyName == Select ");
HideImf();
visibleFlag = false;
return true;
}
else if (e.Key.KeyPressedName == "Cancel")
{
Tizen.Log.Fatal("NUI", "!!!!!OnIMEKeyEvent!!!!! + KeyName == Cancel ");
textField.Text = "";
HideImf();
visibleFlag = false;
return true;
}
else if (e.Key.KeyPressedName == "XF86Back")
{
Tizen.Log.Fatal("NUI", "!!!!!OnIMEKeyEvent!!!!! + KeyName == XF86Back ");
HideImf();
FocusManager.Instance.SetCurrentFocusView(guide);
return true;
}
else if (e.Key.KeyPressedName == "Return")
{
Tizen.Log.Fatal("NUI", "!!!!!OnIMEKeyEvent!!!!! + KeyName == Return ");
if (visibleFlag)
{
FocusManager.Instance.SetCurrentFocusView(textField);
ShowImf();
}
else
{
visibleFlag = true;
}
return true;
}
}
return false;
}
/// <summary>
/// Show imfManager.
/// </summary>
private void ShowImf()
{
inputMethodContext.Activate();
inputMethodContext.ShowInputPanel();
}
/// <summary>
/// Hide imfManager.
/// </summary>
private void HideImf()
{
inputMethodContext.Deactivate();
inputMethodContext.HideInputPanel();
Tizen.Log.Fatal("NUI", "Hide ImfManager!!!!!");
//FocusManager.Instance.SetCurrentFocusView(guide);
}
/// <summary>
/// Dispose textView
/// </summary>
public void Deactivate()
{
Window.Instance.GetDefaultLayer().Remove(guide);
guide.Dispose();
guide = null;
Window.Instance.GetDefaultLayer().Remove(textView);
textView.Dispose();
textView = null;
}
/// <summary>
/// Activate this class.
/// </summary>
public void Activate()
{
Initialize();
}
}
} | 33.909574 | 104 | 0.526588 | [
"Apache-2.0"
] | AchoWang/Tizen-CSharp-Samples | TV/UIControlSample/UIControlSample/src/Samples/InputFieldSample.cs | 6,375 | C# |
using Azure.Feast.Data;
using Azure.Feast.Utils;
using Feast.Core;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Azure.Feast.Clients.FeastCore
{
public interface IFeastCoreClient
{
#region Feature Views
Task<FeatureViewResponse> CreateOrUpdateFeatureViewAsync(string projectName, string featureViewName, FeatureViewRequest request, FeastCoreRequestHeaders headers);
Task<FeatureViewResponse> CreateFeatureViewAsync(string projectName, string featureViewName, FeatureViewRequest request, FeastCoreRequestHeaders headers);
Task<FeatureViewResponse> UpdateFeatureViewAsync(string projectName, string featureViewName, FeatureViewRequest request, FeastCoreRequestHeaders headers);
Task DeleteFeatureViewAsync(string projectName, string featureViewName, FeastCoreRequestHeaders headers);
Task<FeatureViewResponse> GetFeatureViewAsync(string projectName, string featureViewName, FeastCoreRequestHeaders headers);
Task<List<FeatureViewResponse>> ListFeatureViewsAsync(string projectName, FeastCoreRequestHeaders headers);
#endregion
#region Entity
Task<EntityResponse> CreateOrUpdateEntityAsync(string projectName, string entityName, EntityRequest request, FeastCoreRequestHeaders headers);
Task<EntityResponse> CreateEntityAsync(string projectName, string entityName, EntityRequest request, FeastCoreRequestHeaders headers);
Task<EntityResponse> UpdateEntityAsync(string projectName, string entityName, EntityRequest request, FeastCoreRequestHeaders headers);
Task DeleteEntityAsync(string projectName, string entityName, FeastCoreRequestHeaders headers);
Task<EntityResponse> GetEntityAsync(string projectName, string entityName, FeastCoreRequestHeaders headers);
Task<List<EntityResponse>> ListEntitiesAsync(string projectName, FeastCoreRequestHeaders headers);
#endregion
#region Feature Services
Task<FeatureServiceResponse> CreateOrUpdateFeatureServiceAsync(string projectName, string featureServiceName, FeatureServiceRequest request, FeastCoreRequestHeaders headers);
Task<FeatureServiceResponse> CreateFeatureServiceAsync(string projectName, string featureServiceName, FeatureServiceRequest request, FeastCoreRequestHeaders headers);
Task<FeatureServiceResponse> UpdateFeatureServiceAsync(string projectName, string featureServiceName, FeatureServiceRequest request, FeastCoreRequestHeaders headers);
Task DeleteFeatureServiceAsync(string projectName, string featureServiceName, FeastCoreRequestHeaders headers);
Task<FeatureServiceResponse> GetFeatureServiceAsync(string projectName, string featureServiceName, FeastCoreRequestHeaders headers);
Task<List<FeatureServiceResponse>> ListFeatureServicesAsync(string projectName, FeastCoreRequestHeaders headers);
#endregion
#region Project
Task<ProjectResponse> CreateProjectAsync(string projectName, ProjectRequest request, FeastCoreRequestHeaders headers);
Task<ProjectResponse> UpdateProjectAsync(string projectName, ProjectRequest request, FeastCoreRequestHeaders headers);
Task DeleteProjectAsync(string projectName, FeastCoreRequestHeaders headers);
Task<ProjectResponse> GetProjectAsync(string projectName, FeastCoreRequestHeaders headers);
Task<List<ProjectResponse>> ListProjectsAsync(FeastCoreRequestHeaders headers);
#endregion
}
}
| 51 | 182 | 0.807047 | [
"MIT"
] | allenwux/feast-azure | core/FeastCoreService/Clients/FeastCore/IFeastCoreClient.cs | 3,521 | C# |
namespace TeachMeSkills.Common.Constants
{
/// <summary>
/// DataAnnotation constants
/// </summary>
public static class DataAnnotationConstant
{
/// <summary>
/// DataAnnotation for display RememberMe.
/// </summary>
public const string DispayRememberMe = "Remember me?";
}
}
| 23.857143 | 62 | 0.610778 | [
"MIT"
] | AndrewBynkov/TeachMeSkills-DotNet-Template | src/TeachMeSkills.Common/Constants/DataAnnotationConstant.cs | 336 | C# |
// <auto-generated />
using System;
using HealthyLifestyleTrackingApp.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace HealthyLifestyleTrackingApp.Data.Migrations
{
[DbContext(typeof(HealthyLifestyleTrackerDbContext))]
[Migration("20210805143843_ExerciseTableChanged")]
partial class ExerciseTableChanged
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.7")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("HealthyLifestyleTrackingApp.Data.Models.Exercise", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int>("CaloriesPerHour")
.HasColumnType("int");
b.Property<int>("ExerciseCategoryId")
.HasColumnType("int");
b.Property<string>("ImageUrl")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)");
b.HasKey("Id");
b.HasIndex("ExerciseCategoryId");
b.ToTable("Exercises");
});
modelBuilder.Entity("HealthyLifestyleTrackingApp.Data.Models.ExerciseCategory", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.HasKey("Id");
b.ToTable("ExerciseCategories");
});
modelBuilder.Entity("HealthyLifestyleTrackingApp.Data.Models.Food", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Brand")
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<int>("Calories")
.HasColumnType("int");
b.Property<double>("Carbohydrates")
.HasColumnType("float");
b.Property<double>("Fat")
.HasColumnType("float");
b.Property<int>("FoodCategoryId")
.HasColumnType("int");
b.Property<string>("ImageUrl")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<double>("Protein")
.HasColumnType("float");
b.Property<double>("StandardServingAmount")
.HasColumnType("float");
b.Property<int>("StandardServingType")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("FoodCategoryId");
b.ToTable("Foods");
});
modelBuilder.Entity("HealthyLifestyleTrackingApp.Data.Models.FoodCategory", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.HasKey("Id");
b.ToTable("FoodCategories");
});
modelBuilder.Entity("HealthyLifestyleTrackingApp.Data.Models.FoodTag", b =>
{
b.Property<int>("FoodId")
.HasColumnType("int");
b.Property<int>("TagId")
.HasColumnType("int");
b.HasKey("FoodId", "TagId");
b.HasIndex("TagId");
b.ToTable("FoodTags");
});
modelBuilder.Entity("HealthyLifestyleTrackingApp.Data.Models.Tag", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.HasKey("Id");
b.ToTable("Tags");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ProviderKey")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("RoleId")
.HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Name")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("HealthyLifestyleTrackingApp.Data.Models.Exercise", b =>
{
b.HasOne("HealthyLifestyleTrackingApp.Data.Models.ExerciseCategory", "ExerciseCategory")
.WithMany("Exercises")
.HasForeignKey("ExerciseCategoryId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("ExerciseCategory");
});
modelBuilder.Entity("HealthyLifestyleTrackingApp.Data.Models.Food", b =>
{
b.HasOne("HealthyLifestyleTrackingApp.Data.Models.FoodCategory", "FoodCategory")
.WithMany("Foods")
.HasForeignKey("FoodCategoryId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("FoodCategory");
});
modelBuilder.Entity("HealthyLifestyleTrackingApp.Data.Models.FoodTag", b =>
{
b.HasOne("HealthyLifestyleTrackingApp.Data.Models.Food", "Food")
.WithMany("FoodTags")
.HasForeignKey("FoodId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("HealthyLifestyleTrackingApp.Data.Models.Tag", "Tag")
.WithMany("FoodTags")
.HasForeignKey("TagId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Food");
b.Navigation("Tag");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("HealthyLifestyleTrackingApp.Data.Models.ExerciseCategory", b =>
{
b.Navigation("Exercises");
});
modelBuilder.Entity("HealthyLifestyleTrackingApp.Data.Models.Food", b =>
{
b.Navigation("FoodTags");
});
modelBuilder.Entity("HealthyLifestyleTrackingApp.Data.Models.FoodCategory", b =>
{
b.Navigation("Foods");
});
modelBuilder.Entity("HealthyLifestyleTrackingApp.Data.Models.Tag", b =>
{
b.Navigation("FoodTags");
});
#pragma warning restore 612, 618
}
}
}
| 37.732365 | 125 | 0.464123 | [
"MIT"
] | VeselinaSidova/Healthy-Lifestyle-Tracking-App | HealthyLifestyleTrackingApp/Data/Migrations/20210805143843_ExerciseTableChanged.Designer.cs | 18,189 | C# |
using System;
namespace InceptionCore.Proxying
{
public delegate object ProxyTargetInvocation(object[] arguments);
} | 20.166667 | 69 | 0.801653 | [
"BSD-2-Clause"
] | bradleyjford/inception | src/InceptionCore/Proxying/ProxyTargetInvocation.cs | 121 | C# |
using System.Net;
using System.Threading.Tasks;
using Xunit;
namespace Condenser.Tests.Integration.Routing
{
[Collection("RoutingTests")]
public class RouterToServiceFacts
{
[Fact]
public async Task CanWeRunRegisteredServicesThroughRouter()
{
using (var fixture = new RoutingFixture())
{
var serviceName1 = fixture.GetNewServiceName();
var route1 = "/test1";
var serviceName2 = fixture.GetNewServiceName();
var route2 = "/test2";
fixture.AddService(serviceName1, route1)
.AddService(serviceName2, route2);
fixture.AddRouter();
fixture.StartAll();
if (!fixture.AreAllRegistered())
{
await fixture.WaitForRegistrationAsync();
}
var response = await fixture.CallRouterAsync(route1);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
var content = await response.Content.ReadAsStringAsync();
Assert.Equal("Called me " + serviceName1, content);
response = await fixture.CallRouterAsync(route2);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
content = await response.Content.ReadAsStringAsync();
Assert.Equal("Called me " + serviceName2, content);
}
}
}
}
| 30.9375 | 73 | 0.562963 | [
"MIT"
] | corefan/CondenserDotNet | test/Condenser.Tests.Integration/Routing/RouterToServiceFacts.cs | 1,487 | C# |
/*
Copyright (c) 2021 Denis Zykov
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
License: https://opensource.org/licenses/MIT
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace deniszykov.CommandLine.Binding
{
internal abstract class VerbBindingResult
{
public static readonly Dictionary<Verb, ParameterBindingResult[]> EmptyFailedMethodBindings = new Dictionary<Verb, ParameterBindingResult[]>();
public sealed class Bound : VerbBindingResult
{
private readonly object? target;
public Verb Verb { get; }
public object?[] Arguments { get; }
/// <inheritdoc />
public override string VerbName => this.Verb.Name;
public Bound(Verb verb, object? target, object?[] arguments)
{
if (verb == null) throw new ArgumentNullException(nameof(verb));
if (arguments == null) throw new ArgumentNullException(nameof(arguments));
this.target = target;
this.Arguments = arguments;
this.Verb = verb;
}
public Task<int> InvokeAsync()
{
return this.Verb.Invoker(this.target, this.Arguments);
}
/// <inheritdoc />
public override string ToString() => $"Successful binding to verb '{this.Verb}' with '{string.Join(", ", this.Arguments)}' arguments.";
}
public sealed class FailedToBind : VerbBindingResult
{
public Dictionary<Verb, ParameterBindingResult[]> BindingFailures { get; }
public override string VerbName { get; }
public FailedToBind(string verbName, Dictionary<Verb, ParameterBindingResult[]> bindingFailures)
{
if (verbName == null) throw new ArgumentNullException(nameof(verbName));
if (bindingFailures == null) throw new ArgumentNullException(nameof(bindingFailures));
this.BindingFailures = bindingFailures;
this.VerbName = verbName;
}
public override string ToString() => $"Failure binding to verb '{this.VerbName}'." +
string.Join(Environment.NewLine, this.BindingFailures.Select(kv => $"{kv.Key.Name}: {string.Join(", ", kv.Value.Where(p => !p.IsSuccess).Select(p => p.ToString()))}")) + ".";
}
public sealed class HelpRequested : VerbBindingResult
{
public override string VerbName { get; }
public HelpRequested(string verbName)
{
if (verbName == null) throw new ArgumentNullException(nameof(verbName));
this.VerbName = verbName;
}
/// <inheritdoc />
public override string ToString() => $"Help requested for '{this.VerbName}'.";
}
public sealed class NoVerbSpecified : VerbBindingResult
{
public override string VerbName { get; }
public NoVerbSpecified()
{
this.VerbName = CommandLine.UNKNOWN_VERB_NAME;
}
public override string ToString() => "No verb specified.";
}
// ReSharper disable once UnusedMemberInSuper.Global
public abstract string VerbName { get; }
}
}
| 30.90625 | 178 | 0.709808 | [
"MIT"
] | deniszykov/commandline | src/deniszykov.CommandLine/Binding/VerbBindingResult.cs | 2,969 | C# |
using System;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using anowaku.Updater;
namespace anowaku
{
public static class AssemblyExtensions
{
public static string GetLocationDirectory(
this Assembly asm)
=> Path.GetDirectoryName(asm.Location);
public static string GetTitle(
this Assembly asm)
{
var att = asm.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
return att.Length == 0 ? string.Empty : ((AssemblyTitleAttribute)att[0]).Title;
}
public static string GetProduct(
this Assembly asm)
{
var att = asm.GetCustomAttributes(typeof(AssemblyProductAttribute), false);
return att.Length == 0 ? string.Empty : ((AssemblyProductAttribute)att[0]).Product;
}
public static string GetDescription(
this Assembly asm)
{
var att = asm.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
return att.Length == 0 ? string.Empty : ((AssemblyDescriptionAttribute)att[0]).Description;
}
public static string GetCopyright(
this Assembly asm)
{
var att = asm.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
return att.Length == 0 ? string.Empty : ((AssemblyCopyrightAttribute)att[0]).Copyright;
}
public static string GetConfiguration(
this Assembly asm)
{
var att = asm.GetCustomAttributes(typeof(AssemblyConfigurationAttribute), false);
return att.Length == 0 ? string.Empty : ((AssemblyConfigurationAttribute)att[0]).Configuration;
}
public static ReleaseChannels GetReleaseChannels(
this Assembly asm)
{
var result = ReleaseChannels.Stable;
var config = asm.GetConfiguration();
Enum.TryParse(config, out result);
return result;
}
public static Version GetVersion(
this Assembly asm)
=> asm.GetName().Version;
public static string Guid(
this Assembly asm)
{
var att = asm.GetCustomAttributes(typeof(GuidAttribute), false);
return att.Length == 0 ? string.Empty : ((GuidAttribute)att[0]).Value;
}
}
}
| 33.821918 | 108 | 0.594573 | [
"MIT"
] | anoyetta/anowaku | anowaku.Core/Extensions/AssemblyExtensions.cs | 2,469 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using QueueIT.QueueToken.Model;
namespace QueueIT.QueueToken
{
public class Payload
{
public static EnqueueTokenPayloadGenerator Enqueue() => new EnqueueTokenPayloadGenerator();
}
public class EnqueueTokenPayloadGenerator
{
private EnqueueTokenPayload _payload;
public EnqueueTokenPayloadGenerator()
{
this._payload = new EnqueueTokenPayload();
}
public EnqueueTokenPayloadGenerator WithKey(String key)
{
this._payload = new EnqueueTokenPayload(this._payload, key);
return this;
}
public EnqueueTokenPayloadGenerator WithRelativeQuality(double relativeQuality)
{
this._payload = new EnqueueTokenPayload(this._payload, relativeQuality);
return this;
}
public EnqueueTokenPayloadGenerator WithCustomData(String key, String value)
{
this._payload = new EnqueueTokenPayload(this._payload, key, value);
return this;
}
public IEnqueueTokenPayload Generate()
{
return this._payload;
}
}
public interface IEnqueueTokenPayload
{
string Key { get; }
double? RelativeQuality { get; }
IReadOnlyDictionary<string, string> CustomData { get; }
string EncryptAndEncode(string secretKey, string tokenIdentifier);
}
internal class EnqueueTokenPayload : IEnqueueTokenPayload
{
public string Key { get; }
public double? RelativeQuality { get; }
private readonly Dictionary<string, string> _customData;
public EnqueueTokenPayload()
{
this._customData = new Dictionary<string, string>();
}
public EnqueueTokenPayload(EnqueueTokenPayload payload, string key)
{
this.Key = key;
this.RelativeQuality = payload.RelativeQuality;
this._customData = payload._customData;
}
public EnqueueTokenPayload(EnqueueTokenPayload payload, double relativeQuality)
{
this.Key = payload.Key;
this.RelativeQuality = relativeQuality;
this._customData = payload._customData;
}
public EnqueueTokenPayload(EnqueueTokenPayload payload, string customDataKey, string customDataValue)
{
this.Key = payload.Key;
this.RelativeQuality = payload.RelativeQuality;
this._customData = payload._customData;
this._customData.Add(customDataKey, customDataValue);
}
public EnqueueTokenPayload(string key, double? relativeQuality, Dictionary<string, string> customData)
{
this.Key = key;
this.RelativeQuality = relativeQuality;
this._customData = customData ?? new Dictionary<string, string>();
}
public IReadOnlyDictionary<string, string> CustomData
{
get
{
return this._customData.ToDictionary(arg => arg.Key, arg2 => arg2.Value);
}
}
internal byte[] Serialize()
{
var dto = new PayloadDto()
{
Key = Key,
RelativeQuality = RelativeQuality,
CustomData = _customData.Count > 0 ? _customData : null
};
return dto.Serialize();
}
public static EnqueueTokenPayload Deserialize(string input, string secretKey, string tokenIdentifier)
{
var dto = PayloadDto.DeserializePayload(input, secretKey, tokenIdentifier);
return new EnqueueTokenPayload(dto.Key, dto.RelativeQuality, dto.CustomData);
}
public string EncryptAndEncode(string secretKey, string tokenIdentifier)
{
try
{
byte[] encrypted = AesEncryption.Encrypt(secretKey, tokenIdentifier, Serialize());
return Base64UrlEncoding.Encode(encrypted);
}
catch (Exception ex)
{
throw new TokenSerializationException(ex);
}
}
}
} | 30.514493 | 110 | 0.607932 | [
"MIT"
] | queueit/QueueToken.V1.Net | QueueIT.QueueToken/Payload.cs | 4,213 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace PracticaUno.Views
{
public partial class Departamentos : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
} | 19.176471 | 60 | 0.696319 | [
"Apache-2.0"
] | crojastriana3/asp-net-ejercicio | App/PracticaUno/PracticaUno/Views/Departamentos.aspx.cs | 328 | C# |
#region Disclaimer/Info
///////////////////////////////////////////////////////////////////////////////////////////////////
// Subtext WebLog
//
// Subtext is an open source weblog system that is a fork of the .TEXT
// weblog system.
//
// For updated news and information please visit http://subtextproject.com/
// Subtext is hosted at Google Code at http://code.google.com/p/subtext/
// The development mailing list is at subtext@googlegroups.com
//
// This project is licensed under the BSD license. See the License.txt file for more information.
///////////////////////////////////////////////////////////////////////////////////////////////////
#endregion
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Subtext.Framework")]
[assembly: AssemblyDescription("Contains the core business logic for Subtext.")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)] | 37.153846 | 99 | 0.60766 | [
"MIT"
] | Haacked/Subtext | src/Subtext.Framework/AssemblyInfo.cs | 966 | C# |
using System;
using static MiPaCo.Combinators;
namespace MiPaCo
{
class Program
{
static void Main()
{
// Some basic examples
var digit = Char(char.IsDigit);
digit.ParseAndPrint("1a", $"{nameof(digit)}");
digit.Many().Select(string.Concat).ParseAndPrint("123a", "digit.Many().Select(string.Concat)");
Char(c => c != 'x').Many().Select(string.Concat).ParseAndPrint("abcxyz", "Char(c => c != 'x').Many()");
Parser<string> digits(int n) => digit.N(n).Select(string.Concat);
var separator = Char('-');
(from yyyy in digits(4)
from _ in separator
from mm in digits(2)
from __ in separator
from dd in digits(2)
select new DateTime(year: int.Parse(yyyy), month: int.Parse(mm), day: int.Parse(dd))).ParseAndPrint("2020-12-31.", "yyyymmdd");
// Some more complex examples
CalculatorExample.Main();
SqlExample.Main();
}
}
}
| 33.903226 | 140 | 0.544244 | [
"MIT"
] | banbh/MiPaCo | MiPaCo/Program.cs | 1,053 | C# |
namespace SubC.AllegroDotNet.Enums
{
/// <summary>
/// Used when locking a bitmap for reading or writing.
/// </summary>
public enum LockFlags : int
{
/// <summary>
/// The locked region can be written to and read from. Use this flag if a partial number of pixels need to be
/// written to, even if reading is not needed.
/// </summary>
ReadWrite = 0,
/// <summary>
/// The locked region will not be written to. This can be faster if the bitmap is a video texture, as it can
/// be discarded after the lock instead of uploaded back to the card.
/// </summary>
ReadOnly = 1,
/// <summary>
/// The locked region will not be read from. This can be faster if the bitmap is a video texture, as no data
/// need to be read from the video card. You are required to fill in all pixels before unlocking the bitmap
/// again, so be careful when using this flag.
/// </summary>
WriteOnly = 2
}
}
| 37.142857 | 117 | 0.601923 | [
"MIT"
] | sub-c/AllegroDotNet | AllegroDotNet/Enums/LockFlags.cs | 1,042 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DatabaseFirstDemo
{
class Program
{
static void Main(string[] args)
{
//Access the Db context
var context = new DatabaseFirstDemoEntities();
//Create new post
var post = new Post()
{
Body = "Μπομπ2",
DatePublished = DateTime.Now,
Title = "Title2"
};
//Add post to memory
context.Posts.Add(post);
//Add post to db by saving changes
context.SaveChanges();
}
}
}
| 20.4 | 58 | 0.508403 | [
"MIT"
] | georgetour/Entity-Framework | Chapter 1 Introduction/DatabaseFirstDemo/DatabaseFirstDemo/Program.cs | 721 | C# |
//
// Copyright (c) 2008 Microsoft Corporation. All rights reserved.
//
using System;
using System.Text;
using System.IO;
using System.Xml;
using System.Net;
using System.Management.Automation;
using System.ComponentModel;
using System.Reflection;
using System.Globalization;
using System.Management.Automation.Runspaces;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Security;
using System.Security.Principal;
using System.Resources;
using System.Threading;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Powershell.Commands.GetCounter.PdhNative;
using Microsoft.PowerShell.Commands.GetCounter;
using Microsoft.PowerShell.Commands.Diagnostics.Common;
namespace Microsoft.PowerShell.Commands
{
///
/// Class that implements the Get-Counter cmdlet.
///
[Cmdlet("Export", "Counter", DefaultParameterSetName = "ExportCounterSet", HelpUri = "http://go.microsoft.com/fwlink/?LinkID=138337")]
public sealed class ExportCounterCommand : PSCmdlet
{
//
// Path parameter
//
[Parameter(
Mandatory = true,
Position = 0,
ValueFromPipelineByPropertyName = true,
HelpMessageBaseName = "GetEventResources")]
[Alias("PSPath")]
public string Path
{
get { return _path; }
set { _path = value; }
}
private string _path;
private string _resolvedPath;
//
// Format parameter.
// Valid strings are "blg", "csv", "tsv" (case-insensitive).
//
[Parameter(
Mandatory = false,
ValueFromPipeline = false,
ValueFromPipelineByPropertyName = false,
HelpMessageBaseName = "GetEventResources")]
[ValidateNotNull]
public string FileFormat
{
get { return _format; }
set { _format = value; }
}
private string _format = "BLG";
//
// MaxSize parameter
// Maximum output file size, in megabytes.
//
[Parameter(
HelpMessageBaseName = "GetEventResources")]
public UInt32 MaxSize
{
get { return _maxSize; }
set { _maxSize = value; }
}
private UInt32 _maxSize = 0;
//
// InputObject parameter
//
[Parameter(
Mandatory = true,
ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true,
HelpMessageBaseName = "GetEventResources")]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays",
Scope = "member",
Target = "Microsoft.PowerShell.Commands.ExportCounterCommand.InputObject",
Justification = "A PerformanceCounterSampleSet[] is required here because Powershell supports arrays natively.")]
public PerformanceCounterSampleSet[] InputObject
{
get { return _counterSampleSets; }
set { _counterSampleSets = value; }
}
private PerformanceCounterSampleSet[] _counterSampleSets = new PerformanceCounterSampleSet[0];
//
// Force switch
//
[Parameter(
HelpMessageBaseName = "GetEventResources")]
public SwitchParameter Force
{
get { return _force; }
set { _force = value; }
}
private SwitchParameter _force;
//
// Circular switch
//
[Parameter(
HelpMessageBaseName = "GetEventResources")]
public SwitchParameter Circular
{
get { return _circular; }
set { _circular = value; }
}
private SwitchParameter _circular;
private ResourceManager _resourceMgr = null;
private PdhHelper _pdhHelper = null;
private bool _stopping = false;
private bool _queryInitialized = false;
private PdhLogFileType _outputFormat = PdhLogFileType.PDH_LOG_TYPE_BINARY;
//
// BeginProcessing() is invoked once per pipeline
//
protected override void BeginProcessing()
{
_resourceMgr = Microsoft.PowerShell.Commands.Diagnostics.Common.CommonUtilities.GetResourceManager();
//
// Determine the OS version: this cmdlet requires Windows 7
// because it uses new Pdh functionality.
//
if (System.Environment.OSVersion.Version.Major < 6 ||
(System.Environment.OSVersion.Version.Major == 6 && System.Environment.OSVersion.Version.Minor < 1))
{
string msg = _resourceMgr.GetString("ExportCtrWin7Required");
Exception exc = new Exception(msg);
ThrowTerminatingError(new ErrorRecord(exc, "ExportCtrWin7Required", ErrorCategory.NotImplemented, null));
}
_pdhHelper = new PdhHelper(System.Environment.OSVersion.Version.Major < 6);
//
// Validate the Format and CounterSamples arguments
//
ValidateFormat();
if (Circular.IsPresent && _maxSize == 0)
{
string msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("CounterCircularNoMaxSize"));
Exception exc = new Exception(msg);
WriteError(new ErrorRecord(exc, "CounterCircularNoMaxSize", ErrorCategory.InvalidResult, null));
}
uint res = _pdhHelper.ConnectToDataSource();
if (res != 0)
{
ReportPdhError(res, true);
}
res = _pdhHelper.OpenQuery();
if (res != 0)
{
ReportPdhError(res, true);
}
}
//
// EndProcessing() is invoked once per pipeline
//
protected override void EndProcessing()
{
_pdhHelper.Dispose();
}
///
/// Handle Control-C
///
protected override void StopProcessing()
{
_stopping = true;
_pdhHelper.Dispose();
}
//
// ProcessRecord() override.
// This is the main entry point for the cmdlet.
// When counter data comes from the pipeline, this gets invoked for each pipelined object.
// When it's passed in as an argument, ProcessRecord() is called once for the entire _counterSampleSets array.
//
protected override void ProcessRecord()
{
Debug.Assert(_counterSampleSets.Length != 0 && _counterSampleSets[0] != null);
ResolvePath();
uint res = 0;
if (!_queryInitialized)
{
if (_format.ToLower(CultureInfo.InvariantCulture).Equals("blg"))
{
res = _pdhHelper.AddRelogCounters(_counterSampleSets[0]);
}
else
{
res = _pdhHelper.AddRelogCountersPreservingPaths(_counterSampleSets[0]);
}
if (res != 0)
{
ReportPdhError(res, true);
}
res = _pdhHelper.OpenLogForWriting(_resolvedPath, _outputFormat, Force.IsPresent, _maxSize * 1024 * 1024, Circular.IsPresent, null);
if (res == PdhResults.PDH_FILE_ALREADY_EXISTS)
{
string msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("CounterFileExists"), _resolvedPath);
Exception exc = new Exception(msg);
ThrowTerminatingError(new ErrorRecord(exc, "CounterFileExists", ErrorCategory.InvalidResult, null));
}
else if (res == PdhResults.PDH_LOG_FILE_CREATE_ERROR)
{
string msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("FileCreateFailed"), _resolvedPath);
Exception exc = new Exception(msg);
ThrowTerminatingError(new ErrorRecord(exc, "FileCreateFailed", ErrorCategory.InvalidResult, null));
}
else if (res == PdhResults.PDH_LOG_FILE_OPEN_ERROR)
{
string msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("FileOpenFailed"), _resolvedPath);
Exception exc = new Exception(msg);
ThrowTerminatingError(new ErrorRecord(exc, "FileOpenFailed", ErrorCategory.InvalidResult, null));
}
else if (res != 0)
{
ReportPdhError(res, true);
}
_queryInitialized = true;
}
foreach (PerformanceCounterSampleSet set in _counterSampleSets)
{
_pdhHelper.ResetRelogValues();
foreach (PerformanceCounterSample sample in set.CounterSamples)
{
bool bUnknownKey = false;
res = _pdhHelper.SetCounterValue(sample, out bUnknownKey);
if (bUnknownKey)
{
string msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("CounterExportSampleNotInInitialSet"), sample.Path, _resolvedPath);
Exception exc = new Exception(msg);
WriteError(new ErrorRecord(exc, "CounterExportSampleNotInInitialSet", ErrorCategory.InvalidResult, null));
}
else if (res != 0)
{
ReportPdhError(res, true);
}
}
res = _pdhHelper.WriteRelogSample(set.Timestamp);
if (res != 0)
{
ReportPdhError(res, true);
}
if (_stopping)
{
break;
}
}
}
// ValidateFormat() helper.
// Validates Format argument: only "BLG", "TSV" and "CSV" are valid strings (case-insensitive)
//
private void ValidateFormat()
{
switch (_format.ToLower(CultureInfo.InvariantCulture))
{
case "blg":
_outputFormat = PdhLogFileType.PDH_LOG_TYPE_BINARY;
break;
case "csv":
_outputFormat = PdhLogFileType.PDH_LOG_TYPE_CSV;
break;
case "tsv":
_outputFormat = PdhLogFileType.PDH_LOG_TYPE_TSV;
break;
default:
string msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("CounterInvalidFormat"), _format);
Exception exc = new Exception(msg);
ThrowTerminatingError(new ErrorRecord(exc, "CounterInvalidFormat", ErrorCategory.InvalidArgument, null));
break;
}
}
private void ResolvePath()
{
try
{
Collection<PathInfo> result = null;
result = SessionState.Path.GetResolvedPSPathFromPSPath(_path);
if (result.Count > 1)
{
string msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("ExportDestPathAmbiguous"), _path);
Exception exc = new Exception(msg);
ThrowTerminatingError(new ErrorRecord(exc, "ExportDestPathAmbiguous", ErrorCategory.InvalidArgument, null));
}
foreach (PathInfo currentPath in result)
{
_resolvedPath = currentPath.ProviderPath;
}
}
catch (ItemNotFoundException pathNotFound)
{
//
// This is an expected condition - we will be creating a new file
//
_resolvedPath = pathNotFound.ItemName;
}
}
private void ReportPdhError(uint res, bool bTerminate)
{
string msg;
uint formatRes = CommonUtilities.FormatMessageFromModule(res, "pdh.dll", out msg);
if (formatRes != 0)
{
msg = string.Format(CultureInfo.InvariantCulture, _resourceMgr.GetString("CounterApiError"), res);
}
Exception exc = new Exception(msg);
if (bTerminate)
{
ThrowTerminatingError(new ErrorRecord(exc, "CounterApiError", ErrorCategory.InvalidResult, null));
}
else
{
WriteError(new ErrorRecord(exc, "CounterApiError", ErrorCategory.InvalidResult, null));
}
}
}
}
| 35.311828 | 171 | 0.551233 | [
"Apache-2.0",
"MIT"
] | HydAu/PowerShell | src/Microsoft.PowerShell.Commands.Diagnostics/ExportCounterCommand.cs | 13,136 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace Code_first_hw.Models
{
public class Game
{
public int GameId { get; set; }
public string GameName { get; set; }
public string GameDescription { get; set; }
public int? DeveloperId { get; set; }
public virtual Developer Developer { get; set; }
}
}
| 20.210526 | 56 | 0.627604 | [
"MIT"
] | Brunosil97/2020-06-c-sharp-labs | labs/Code_first_hw/Models/Game.cs | 386 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace FinishLinePics.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult About()
{
ViewBag.Message = "Your application description page.";
return View();
}
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
return View();
}
}
} | 19.366667 | 67 | 0.566265 | [
"MIT"
] | daveh551/finishlinepics | FinishLinePics/Controllers/HomeController.cs | 583 | C# |
using Microsoft.VisualStudio.Shell;
using OpenInApp.Command;
using OpenInApp.Common.Helpers;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using OpenInApp.Menu;
namespace OpenInEmacs.Options.Emacs
{
public class GeneralOptions : DialogPage, IGeneralOptionsFile // or set to IGeneralOptionsFolder
{
internal static KeyToExecutableEnum keyToExecutableEnum = KeyToExecutableEnum.Emacs;
private IEnumerable<string> defaultTypicalFileExtensions = new ConstantsForAppCommon().GetDefaultTypicalFileExtensions(keyToExecutableEnum);
private const string CommonActualPathToExeOptionLabel = CommonConstants.ActualPathToExeOptionLabelPrefix + KeyToExecutableString.Emacs;
[Category(CommonConstants.CategorySubLevel)]
[DisplayName(CommonActualPathToExeOptionLabel)]
[Description(CommonConstants.ActualPathToExeOptionDetailedDescription)]
public string ActualPathToExe { get; set; }
[Category(CommonConstants.CategorySubLevel)]
[DisplayName(CommonConstants.TypicalFileExtensionsOptionLabel)]
[Description(CommonConstants.TypicalFileExtensionsOptionDetailedDescription)]
// Set to 'internal' to hide in IDE Options (e.g. TreeSizeFree)
public string TypicalFileExtensions
{
get
{
if (string.IsNullOrEmpty(typicalFileExtensions))
{
return AllAppsHelper.GetDefaultTypicalFileExtensionsAsCsv(defaultTypicalFileExtensions);
}
else
{
return typicalFileExtensions;
}
}
set
{
typicalFileExtensions = value;
}
}
[Category(CommonConstants.CategorySubLevel)]
[DisplayName(CommonConstants.SuppressTypicalFileExtensionsWarningOptionLabel)]
[Description(CommonConstants.SuppressTypicalFileExtensionsWarningDetailedDescription)]
// Set to 'internal' to hide in IDE Options (e.g. TreeSizeFree)
public bool SuppressTypicalFileExtensionsWarning { get; set; } = false;
[Category(CommonConstants.CategorySubLevel)]
[DisplayName(CommonConstants.FileQuantityWarningLimitOptionLabel)]
[Description(CommonConstants.FileQuantityWarningLimitOptionDetailedDescription)]
public string FileQuantityWarningLimit
{
get
{
if (string.IsNullOrEmpty(fileQuantityWarningLimit))
{
return CommonConstants.DefaultFileQuantityWarningLimit;
}
else
{
return fileQuantityWarningLimit;
}
}
set
{
int x;
var isInteger = int.TryParse(value, out x);
if (!isInteger)
{
MessageBox.Show(
CommonConstants.FileQuantityWarningLimitInvalid,
new ConstantsForAppCommon().Caption,
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
else
{
fileQuantityWarningLimit = value;
}
}
}
private string fileQuantityWarningLimit;
private string typicalFileExtensions;
internal int FileQuantityWarningLimitInt
{
get
{
int x;
var isInteger = int.TryParse(FileQuantityWarningLimit, out x);
if (isInteger)
{
return x;
}
else
{
return 0;
}
}
}
public override void LoadSettingsFromStorage()
{
base.LoadSettingsFromStorage();
if (string.IsNullOrEmpty(TypicalFileExtensions))
{
TypicalFileExtensions = AllAppsHelper.GetDefaultTypicalFileExtensionsAsCsv(defaultTypicalFileExtensions);
}
if (string.IsNullOrEmpty(ActualPathToExe))
{
ActualPathToExe = GeneralOptionsHelper.GetActualPathToExe(keyToExecutableEnum);
}
previousActualPathToExe = ActualPathToExe;
}
private string previousActualPathToExe { get; set; }
protected override void OnApply(PageApplyEventArgs e)
{
var actualPathToExeChanged = false;
if (ActualPathToExe != previousActualPathToExe)
{
actualPathToExeChanged = true;
previousActualPathToExe = ActualPathToExe;
}
if (actualPathToExeChanged)
{
if (ArtefactsHelper.DoesActualPathToExeExist(ActualPathToExe))
{
PersistVSToolOptions(ActualPathToExe);
}
else
{
e.ApplyBehavior = ApplyKind.Cancel;
var caption = new ConstantsForAppCommon().Caption;
var filePrompterHelper = new FilePrompterHelper(caption, keyToExecutableEnum.Description());
var persistOptionsDto = filePrompterHelper.PromptForActualExeFile(ActualPathToExe);
if (persistOptionsDto.Persist)
{
PersistVSToolOptions(persistOptionsDto.ValueToPersist);
}
}
}
base.OnApply(e);
}
public void PersistVSToolOptions(string fileName)
{
VSPackage.Options.ActualPathToExe = fileName;
VSPackage.Options.SaveSettingsToStorage();
}
}
} | 35.101796 | 148 | 0.58103 | [
"MIT"
] | GregTrevellick/OpenInApp.Launcher | src/OpenInEmacs/Options/GeneralOptions.cs | 5,864 | C# |
using FluentValidation;
using Google.Protobuf;
using System;
using System.Collections.Generic;
using System.Linq;
using TechTalk.SpecFlow;
using Vodamep.Data.Dummy;
using Vodamep.StatLp.Model;
using Vodamep.StatLp.Validation;
using Attribute = Vodamep.StatLp.Model.Attribute;
namespace Vodamep.Specs.StatLp.StepDefinitions
{
[Binding]
public class StatLpUpdateValidationSteps
{
private readonly ReportContext _context;
public StatLpUpdateValidationSteps(ReportContext context)
{
if (context.Report == null)
{
InitContext(context);
}
_context = context;
}
[Given("es gibt eine aktualisierte StatLp-Datenmeldungen")]
public void GivenUpdateReport()
{
}
private void InitContext(ReportContext context)
{
context.GetPropertiesByType = this.GetPropertiesByType;
context.Validate = () => this.Report.Validate((StatLpReport)context.PrecedingReport);
var loc = new DisplayNameResolver();
ValidatorOptions.DisplayNameResolver = (type, memberInfo, expression) => loc.GetDisplayName(memberInfo?.Name);
var r1 = StatLpDataGenerator.Instance.CreateStatLpReport("0001", 2021, 1);
r1.Attributes.Where(x => x.ValueCase == Attribute.ValueOneofCase.CareAllowance).FirstOrDefault().CareAllowance = CareAllowance.L3;
r1.Attributes.Where(x => x.ValueCase == Attribute.ValueOneofCase.CareAllowanceArge).FirstOrDefault().CareAllowanceArge = CareAllowanceArge.L3Ar;
var r2 = new StatLpReport(r1);
context.PrecedingReport = r1;
context.Report = r2;
}
public StatLpReport Report => _context.Report as StatLpReport;
private IEnumerable<IMessage> GetPropertiesByType(string type)
{
return type switch
{
nameof(Person) => this.Report.Persons,
nameof(Admission) => this.Report.Admissions,
nameof(Leaving) => this.Report.Leavings,
nameof(Attribute) => this.Report.Attributes,
nameof(Stay) => this.Report.Stays,
nameof(Institution) => new[] { this.Report.Institution },
_ => Array.Empty<IMessage>(),
};
}
}
}
| 32.958333 | 156 | 0.62874 | [
"MIT"
] | connexiadev/Vodamep | tests/Vodamep.Specs/StatLp/StepDefinitions/StatLpUpdateValidationSteps.cs | 2,375 | C# |
// MIT License
//
// Copyright (c) 2019 Jeesu Choi
//
// 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 JSSoft.Library.ObjectModel;
using System.Reflection;
namespace JSSoft.Communication
{
public sealed class MethodDescriptorCollection : ContainerBase<MethodDescriptor>
{
public MethodDescriptorCollection(ServiceHostBase serviceHost)
{
var isServer = ServiceHostBase.IsServer(serviceHost);
var instanceType = isServer ? serviceHost.ServiceType : serviceHost.CallbackType;
var methods = instanceType.GetMethods();
foreach (var item in methods)
{
if (item.GetCustomAttribute(typeof(OperationContractAttribute)) is OperationContractAttribute)
{
var methodDescriptor = new MethodDescriptor(item);
this.AddBase(methodDescriptor.Name, methodDescriptor);
}
}
}
}
}
| 43.26087 | 110 | 0.707538 | [
"MIT"
] | s2quake/JSSoft.Communication | JSSoft.Communication/MethodDescriptorCollection.cs | 1,990 | C# |
using Volo.Abp.Modularity;
using Volo.Abp.Localization;
using EasyAbp.PrivateMessaging.Localization;
using Volo.Abp.Localization.ExceptionHandling;
using Volo.Abp.Validation;
using Volo.Abp.Validation.Localization;
using Volo.Abp.VirtualFileSystem;
namespace EasyAbp.PrivateMessaging
{
[DependsOn(
typeof(AbpValidationModule)
)]
public class PrivateMessagingDomainSharedModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<PrivateMessagingDomainSharedModule>("EasyAbp.PrivateMessaging");
});
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Add<PrivateMessagingResource>("en")
.AddBaseTypes(typeof(AbpValidationResource))
.AddVirtualJson("/Localization/PrivateMessaging");
});
Configure<AbpExceptionLocalizationOptions>(options =>
{
options.MapCodeNamespace("PrivateMessaging", typeof(PrivateMessagingResource));
});
}
}
}
| 32.605263 | 109 | 0.651332 | [
"Apache-2.0"
] | lupming/PrivateMessaging | src/EasyAbp.PrivateMessaging.Domain.Shared/PrivateMessagingDomainSharedModule.cs | 1,241 | C# |
using Unity.Entities;
using Unity.Mathematics;
using UnityEngine;
using Random = UnityEngine.Random;
[RequiresEntityConversion]
[AddComponentMenu("DOTS Samples/Orb Field")]
[ConverterVersion("jeremy", 1)]
public class OrbFieldAuthoring : MonoBehaviour, IConvertGameObjectToEntity
{
public float DegreesPerSecond = 360;
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
dstManager.AddComponentData(entity, new OrbFieldRotationSpeed { RadiansPerSecond = math.radians(DegreesPerSecond) });
dstManager.AddComponentData(entity, new IndexComponent() { Index = Random.Range(0, 11) });
}
}
| 35.526316 | 125 | 0.774815 | [
"MIT"
] | trippyogi/EcsHdrpExperiments | Assets/EcsExperiments/OrbField/Scripts/OrbFieldAuthoring.cs | 677 | C# |
desc_cs=Tunel HTTP
| 9.5 | 18 | 0.842105 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | A-damW/webmin | tunnel/module.info.cs | 19 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using Newtonsoft.Json;
namespace WinFormsGraphics
{
public partial class ShapeEditorControl : UserControl
{
private int SelectionHandleToleranceInPizels = 4;
private List<Shape> _shapes;
private EditorMode _mode;
private Point _mouseOrigin;
private Shape _currentShape = null;
private Point _currentShapeLocation;
private Size _currentShapeSize;
private SelectionHandle _currentSelectionHandle = SelectionHandle.None;
private string _currentDocumentFileName = string.Empty;
public ShapeEditorControl()
{
InitializeComponent();
_mode = EditorMode.Select;
_shapes = new List<Shape>();
}
private Shape GetSelectedShape()
{
foreach (var shape in _shapes)
{
if (shape.Selected)
{
return shape;
}
}
return null;
}
private Shape GetShapeAtPosition(Point position)
{
foreach (var shape in _shapes)
{
if (shape.IsInBounds(position))
{
return shape;
}
}
return null;
}
private void panelDraw_MouseClick(object sender, MouseEventArgs e)
{
var mousePos = e.Location;
if (_mode == EditorMode.Select && mousePos.IsWithinTolerance(_mouseOrigin, 4))
{
var shape = GetShapeAtPosition(mousePos);
if (shape != null)
{
if (Control.ModifierKeys == Keys.Shift)
{
shape.Selected = !shape.Selected;
}
else
{
shape.Selected = true;
SelectNone(excludeShape: shape);
}
}
else
SelectNone();
RefreshGraphics();
}
}
private void panelDraw_MouseDown(object sender, MouseEventArgs e)
{
_mouseOrigin = e.Location;
if (_mode == EditorMode.Select)
{
_currentShape = GetShapeAtPosition(_mouseOrigin); // GetSelectedShape();
_currentShapeLocation = _currentShape?.Location ?? Point.Empty;
_currentShapeSize = _currentShape?.Size ?? Size.Empty;
_currentSelectionHandle = _currentShape?.GetSelectionHandle(_mouseOrigin, SelectionHandleToleranceInPizels) ?? SelectionHandle.None;
}
else if (_mode == EditorMode.Rectangle)
{
_currentShape = new RectangleShape(_mouseOrigin);
_shapes.Add(_currentShape);
}
else if (_mode == EditorMode.Ellipse)
{
_currentShape = new EllipseShape(_mouseOrigin);
_shapes.Add(_currentShape);
}
}
private void panelDraw_MouseMove(object sender, MouseEventArgs e)
{
var currentLocation = e.Location;
if (MouseLocationChanged != null)
{
MouseLocationChanged(this, currentLocation);
}
// toolStripStatusLabelPosition.Text = $"X: {currentLocation.X}, Y: {currentLocation.Y}";
Cursor cursor = Cursors.Default; // Vaikimisi kursor, kui muud pole valitud
// Esiteks on vaja aru saada, kas oleme mõne valitud kujundi kohal
var shape = GetShapeAtPosition(currentLocation);
SelectionHandle selectionHandle = shape?.GetSelectionHandle(currentLocation, SelectionHandleToleranceInPizels) ?? SelectionHandle.None;
bool shapeIsInBounds = shape?.IsInBounds(currentLocation) ?? false;
bool shapeIsSelected = shape?.Selected ?? false;
// Kuna kursoreid on vaja kohandada sõltumata sellest, kas hiire nupp on alla vajutatud või mitte,
// siis kursori valik sõltub režiimist. Ehk neid on vaja kuvada vaid siis, kui Select on aktiivne
if (Mode == EditorMode.Select)
{
// Kui oleme, tuleb aru saada, kus me selle kujundi juures oleme
if (shapeIsSelected)
{
switch (selectionHandle)
{
case SelectionHandle.None:
// Kui Handle point pole määratud ja hiir asub kujundi piirides, siis saame liigutada
if (shapeIsInBounds)
{
if (shapeIsSelected)
cursor = Cursors.SizeAll;
else
cursor = Cursors.Hand;
}
break;
case SelectionHandle.TopCenter:
cursor = Cursors.SizeNS;
break;
case SelectionHandle.BottomCenter:
cursor = Cursors.SizeNS;
break;
case SelectionHandle.LeftCenter:
cursor = Cursors.SizeWE;
break;
case SelectionHandle.RightCenter:
cursor = Cursors.SizeWE;
break;
case SelectionHandle.TopLeft:
cursor = Cursors.SizeNWSE;
break;
case SelectionHandle.BottomRight:
cursor = Cursors.SizeNWSE;
break;
case SelectionHandle.TopRight:
cursor = Cursors.SizeNESW;
break;
case SelectionHandle.BottomLeft:
cursor = Cursors.SizeNESW;
break;
default:
break;
}
}
}
if (panelDraw.Cursor != cursor)
panelDraw.Cursor = cursor;
// Kui hiire vasak nupp pole alla vajutatud või puudub aktiivne kujund, võime siit haldurist lahkuda
if (e.Button == MouseButtons.None || _currentShape == null)
return;
if (Mode == EditorMode.Select)
{
// Kui nupp oli all ja meil on Select režiim, siis saame kujundit kas liigutada või suurust muuta
if (!e.Button.HasFlag(MouseButtons.Left))
return; // Jäta aktiivse kujundi puudumisel ülejäänud kood vahele
// Arvutame nihke hiire algpositsiooni ja praeguse koha vahel
int dx = e.Location.X - _mouseOrigin.X;
int dy = e.Location.Y - _mouseOrigin.Y;
if (_currentSelectionHandle != SelectionHandle.None)
{
switch (_currentSelectionHandle)
{
case SelectionHandle.None:
break;
case SelectionHandle.TopCenter: // Nihutame Location.Y positsiooni ja Size.Height väärtust
_currentShape.Location = new Point(_currentShape.Location.X, _currentShapeLocation.Y + dy);
_currentShape.Size = new Size(_currentShape.Size.Width, _currentShapeSize.Height - dy);
break;
case SelectionHandle.BottomCenter: // Muudame ainult Size.Height väärtust
_currentShape.Size = new Size(_currentShape.Size.Width, _currentShapeSize.Height + dy);
break;
case SelectionHandle.LeftCenter: // Nihutame Location.X positsiooni ja Size.Width väärtust
_currentShape.Location = new Point(_currentShapeLocation.X + dx, _currentShape.Location.Y);
_currentShape.Size = new Size(_currentShapeSize.Width - dx, _currentShape.Size.Height);
break;
case SelectionHandle.RightCenter: // Muudame ainult Size.Width väärtust
_currentShape.Size = new Size(_currentShapeSize.Width + dx, _currentShape.Size.Height);
break;
case SelectionHandle.TopLeft: // Muudame nii Location X ja Y, kui ka Size Width ja Height väärtusi
_currentShape.Location = new Point(_currentShapeLocation.X + dx, _currentShapeLocation.Y + dy);
_currentShape.Size = new Size(_currentShapeSize.Width - dx, _currentShapeSize.Height - dy);
break;
case SelectionHandle.BottomRight: // Muudame Size Width ja Height väärtusi
_currentShape.Size = new Size(_currentShapeSize.Width + dx, _currentShapeSize.Height + dy);
break;
case SelectionHandle.TopRight: // Muudame kõiki väärtusi
_currentShape.Location = new Point(_currentShapeLocation.X, _currentShapeLocation.Y + dy);
_currentShape.Size = new Size(_currentShapeSize.Width + dx, _currentShapeSize.Height - dy);
break;
case SelectionHandle.BottomLeft: // Muudame kõiki väärtusi
_currentShape.Location = new Point(_currentShapeLocation.X + dx, _currentShape.Location.Y);
_currentShape.Size = new Size(_currentShapeSize.Width - dx, _currentShapeSize.Height + dy);
break;
default:
break;
}
}
else if (shapeIsInBounds)
{
// Arvutame kujundi uue algpositsiooni, milleks on tema salvestatud algpositsioon + nihe
int newX = _currentShapeLocation.X + dx;
int newY = _currentShapeLocation.Y + dy;
_currentShape.Location = new Point(newX, newY);
}
}
else
//if (Mode != EditorMode.Select && Mode != EditorMode.Move /* && Mode != EditorMode.Delete */)
{
Point newLocation = _currentShape.Location;
Size newSize = _currentShape.Size;
if (currentLocation.X < _mouseOrigin.X)
{
newLocation.X = currentLocation.X;
newSize.Width = _mouseOrigin.X - currentLocation.X;
}
else
{
newLocation.X = _mouseOrigin.X; // Original mouse location
newSize.Width = currentLocation.X - _mouseOrigin.X;
}
if (currentLocation.Y < _mouseOrigin.Y)
{
newLocation.Y = currentLocation.Y;
newSize.Height = _mouseOrigin.Y - currentLocation.Y;
}
else
{
newLocation.Y = _mouseOrigin.Y; // Original mouse location
newSize.Height = currentLocation.Y - _mouseOrigin.Y;
}
_currentShape.Location = newLocation;
_currentShape.Size = newSize;
}
RefreshGraphics();
}
private void panelDraw_MouseUp(object sender, MouseEventArgs e)
{
var endLocation = e.Location;
_currentShape = null;
_currentShapeLocation = Point.Empty;
_currentShapeSize = Size.Empty;
_currentSelectionHandle = SelectionHandle.None;
RefreshGraphics();
}
private void panelDraw_Resize(object sender, EventArgs e)
{
RefreshGraphics();
}
public void RefreshGraphics()
{
if (_shapes == null)
return;
using (Graphics g = panelDraw.CreateGraphics())
{
g.FillRectangle(new SolidBrush(panelDraw.BackColor),
new Rectangle(0, 0, panelDraw.Size.Width, panelDraw.Size.Height));
Brush handleBrush = new SolidBrush(Color.Black);
foreach (var shape in _shapes)
{
shape.Draw(g);
if (shape.Selected)
shape.DrawSelection(g, handleBrush, 4);
}
}
}
public void DeleteSelectedShapes()
{
// Liigume kujundite listist lõpust ettepoole ja eemaldame kõik valitud kujundid
// Eest tahapoole liikudes läheks meil järjestus sassi ja foreach ei lubaks seda üldse
for (int i = _shapes.Count - 1; i >= 0; i--)
{
var shape = _shapes[i];
if (shape != null && shape.Selected)
{
_shapes.RemoveAt(i);
}
}
RefreshGraphics();
}
private void ForEachShape(Action<Shape> shapeAction, Shape excludeShape = null)
{
if (_shapes != null && _shapes.Count > 0)
{
_shapes.ForEach(shape =>
{
if (shape != excludeShape)
{
shapeAction(shape);
}
});
}
}
public void SelectNone(Shape excludeShape = null)
{
ForEachShape(shape => shape.Selected = false, excludeShape);
}
public void SelectAll(Shape excludeShape = null)
{
ForEachShape(shape => shape.Selected = true, excludeShape);
}
public void ClearAllShapes()
{
_shapes.Clear();
_currentDocumentFileName = string.Empty;
RefreshGraphics();
}
public void LoadShapesFromFile(string fileName)
{
try
{
string json = File.ReadAllText(fileName);
_shapes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Shape>>(json, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.All
});
_currentDocumentFileName = fileName;
RefreshGraphics();
}
catch (Exception ex)
{
MessageBox.Show($"Error loading file: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
public void SaveShapesToFile(string fileName)
{
try
{
string json = Newtonsoft.Json.JsonConvert.SerializeObject(_shapes, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.All
});
File.WriteAllText(fileName, json);
_currentDocumentFileName = fileName;
}
catch (Exception ex)
{
MessageBox.Show($"Error saving file: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
public string CurrentDocumentFileName
{
get { return _currentDocumentFileName; }
set { _currentDocumentFileName = value; }
}
public EditorMode Mode
{
get { return _mode; }
set
{
_mode = value;
}
}
public event EventHandler<Point> MouseLocationChanged;
}
}
| 37.843458 | 148 | 0.503982 | [
"MIT"
] | priidupaomets/c-sharp-course-code | Demo08-WinFormsGraphics/ShapeEditorControl.cs | 16,237 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ScheduleSim.Entities.Models;
using ScheduleSim.Entities.Repositories;
namespace ScheduleSim.Core.Service
{
public class FunctionDependencyAccessService : IFunctionDependencyAccessService
{
private IFunctionDependencyRepository functionDependencyRepository;
public FunctionDependencyAccessService(
IFunctionDependencyRepository functionDependencyRepository)
{
this.functionDependencyRepository = functionDependencyRepository;
}
public IEnumerable<FunctionDependency> GetAllDependencies()
{
return
this.functionDependencyRepository.Find();
}
public void Update(IEnumerable<FunctionDependency> dependencies)
{
this.functionDependencyRepository.RemoveAll();
this.functionDependencyRepository.Insert(dependencies);
}
}
}
| 29.735294 | 83 | 0.71909 | [
"MIT"
] | pondeke120/ScheduleSim | ScheduleSim.Core/Service/FunctionDependencyAccessService.cs | 1,013 | C# |
// The MIT License (MIT)
//
// Copyright (c) 2021 Henk-Jan Lebbink
//
// 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.
namespace AsmDude.CodeFolding
{
using System.ComponentModel.Composition;
using AsmDude.Tools;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
/// <summary>
/// Export a <see cref="ITaggerProvider"/>
/// </summary>
[Export(typeof(ITaggerProvider))]
[ContentType(AsmDudePackage.AsmDudeContentType)]
[TagType(typeof(IOutliningRegionTag))]
[TextViewRole(PredefinedTextViewRoles.Document)]
internal sealed class CodeFoldingTaggerProvider : ITaggerProvider
{
[Import]
private readonly IBufferTagAggregatorFactoryService aggregatorFactory_ = null;
/// <summary>
/// This method is called by VS to generate the tagger
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="buffer"> The text view we are creating a tagger for</param>
/// <returns> Returns a OutliningTagger instance</returns>
public ITagger<T> CreateTagger<T>(ITextBuffer buffer) where T : ITag
{
ITagger<T> sc()
{
ITagAggregator<SyntaxHighlighting.AsmTokenTag> aggregator = AsmDudeToolsStatic.GetOrCreate_Aggregator(buffer, this.aggregatorFactory_);
return new CodeFoldingTagger(buffer, aggregator, AsmDudeTools.Instance.Error_List_Provider) as ITagger<T>;
}
return buffer.Properties.GetOrCreateSingletonProperty(sc);
}
}
}
| 44.04918 | 151 | 0.713435 | [
"MIT"
] | HJLebbink/asm-dude | VS/CSHARP/asm-dude-vsix/CodeFolding/CodeFoldingTaggerProvider.cs | 2,689 | C# |
using System;
namespace DailyCodingProblem
{
internal class Day35
{
private static int Main(string[] args)
{
char[] array = new char[] { 'G', 'B', 'R', 'R', 'B', 'R', 'G' };
Console.Write("Original array: ");
PrintArray(array);
Console.Write(" Sorted array: ");
PrintArray(SortRGBArray(array));
Console.ReadLine();
return 0;
}
private static char[] SortRGBArray(char[] array)
{
const int TotalElements = 3;
char[] Elements = new char[TotalElements] {'R', 'G', 'B' };
char[] sortedArray = new char[array.Length];
Array.Copy(array, sortedArray, array.Length);
int partition = -1;
for (int i = 0; i < TotalElements; i++)
{
partition = PullElementsToFront(sortedArray, partition + 1, sortedArray.Length - 1, Elements[i]);
}
return sortedArray;
}
private static int PullElementsToFront(char[] array, int startIndex, int endIndex, char element)
{
int currentIndex = -1;
while (startIndex < endIndex)
{
if (array[startIndex] == element)
{
currentIndex = startIndex;
startIndex++;
}
else if (array[endIndex] != element)
{
endIndex--;
}
else
{
currentIndex = startIndex;
char temp = array[startIndex];
array[startIndex] = array[endIndex];
array[endIndex] = temp;
}
}
return currentIndex;
}
private static void PrintArray<T>(T[] array)
{
foreach (T value in array)
{
Console.Write($"{value} ");
}
Console.WriteLine();
}
}
} | 19.61039 | 101 | 0.609934 | [
"MIT"
] | LucidSigma/Daily-Coding-Problems | Days 031 - 040/Day 35/SortRGBArray.cs | 1,510 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System.Reflection;
using System.Resources;
[assembly: AssemblyTitle("Microsoft Azure Peering Management Library")]
[assembly: AssemblyDescription("Provides Microsoft Azure Peering management functions for managing the Microsoft Azure Peering service.")]
[assembly: AssemblyVersion("0.10.0")]
[assembly: AssemblyFileVersion("0.10.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure .NET SDK")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")] | 42.789474 | 138 | 0.785978 | [
"MIT"
] | AzureMentor/azure-sdk-for-net | sdk/peering/Microsoft.Azure.Management.Peering/src/Properties/AssemblyInfo.cs | 813 | C# |
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
// Licensed under the Apache License, Version 2.0.
namespace ImageMagick
{
/// <summary>
/// Starts a clip path definition which is comprized of any number of drawing commands and
/// terminated by a DrawablePopClipPath.
/// </summary>
public sealed class DrawablePushClipPath : IDrawable, IDrawingWand
{
/// <summary>
/// Initializes a new instance of the <see cref="DrawablePushClipPath"/> class.
/// </summary>
/// <param name="clipPath">The ID of the clip path.</param>
public DrawablePushClipPath(string clipPath)
{
ClipPath = clipPath;
}
/// <summary>
/// Gets or sets the ID of the clip path.
/// </summary>
public string ClipPath { get; set; }
/// <summary>
/// Draws this instance with the drawing wand.
/// </summary>
/// <param name="wand">The want to draw on.</param>
void IDrawingWand.Draw(DrawingWand wand) => wand?.PushClipPath(ClipPath);
}
} | 34.1875 | 94 | 0.606947 | [
"Apache-2.0"
] | brianpopow/Magick.NET | src/Magick.NET/Drawables/DrawablePushClipPath.cs | 1,094 | C# |
using System.Collections.ObjectModel;
using Reactive.Bindings;
using Reactive.Bindings.Extensions;
using SandBeige.MediaBox.Composition.Bases;
using SandBeige.MediaBox.Composition.Interfaces.Models.Album.Box;
using SandBeige.MediaBox.Composition.Interfaces.Models.Album.Loader;
using SandBeige.MediaBox.DataBase;
using SandBeige.MediaBox.Models.Album.AlbumObjects;
namespace SandBeige.MediaBox.Models.Album.Box {
public class AlbumBoxSelector : ModelBase, IAlbumBoxSelector {
/// <summary>
/// ルートアルバムボックス
/// </summary>
public IReactiveProperty<IAlbumBox> Shelf {
get;
} = new ReactivePropertySlim<IAlbumBox>();
/// <summary>
/// コンストラクタ
/// </summary>
public AlbumBoxSelector(IMediaBoxDbContext rdb, IAlbumLoaderFactory albumLoaderFactory) {
// 初期値
this.Shelf.Value = new AlbumBox(new ObservableCollection<RegisteredAlbumObject>().ToReadOnlyReactiveCollection(), rdb, albumLoaderFactory).AddTo(this.CompositeDisposable);
}
}
}
| 33.206897 | 174 | 0.784008 | [
"MIT"
] | southernwind/MediaBox | MediaBox/Models/Album/Box/AlbumBoxSelector.cs | 1,005 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Attract : MonoBehaviour {
Rigidbody _rigidbody;
public Transform attractTo;
public float strengthOfAttraction, maxMagnitude;
// Use this for initialization
void Start () {
_rigidbody = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update () {
if(attractTo != null)
{
Vector3 direction = attractTo.position - transform.position;
_rigidbody.AddForce(strengthOfAttraction * direction);
if(_rigidbody.velocity.magnitude > maxMagnitude)
{
_rigidbody.velocity = _rigidbody.velocity.normalized * maxMagnitude;
}
}
}
}
| 25.1 | 84 | 0.657371 | [
"MIT"
] | Garciaj007/AudioDevelopment | Assets/Scripts/Attract.cs | 755 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VLispProfiler.Setup
{
public interface ISetupManager
{
IEnumerable<SetupInstance> GetSetups();
void InstallSetup(SetupInstance setup);
void UninstallSetup(SetupInstance setup);
bool IsInstalled(SetupInstance setup);
IEnumerable<SetupInstance> FilterSetups(IEnumerable<SetupInstance> setups, IEnumerable<string> filters);
}
}
| 28.055556 | 112 | 0.744554 | [
"MIT"
] | talanc/vlisp-profiler | src/VLispProfiler/Setup/ISetupManager.cs | 507 | C# |
// Interactable Object|Interactions|30030
namespace VRTK
{
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Highlighters;
using GrabAttachMechanics;
using SecondaryControllerGrabActions;
/// <summary>
/// Event Payload
/// </summary>
/// <param name="interactingObject">The object that is initiating the interaction (e.g. a controller).</param>
public struct InteractableObjectEventArgs
{
public GameObject interactingObject;
}
/// <summary>
/// Event Payload
/// </summary>
/// <param name="sender">this object</param>
/// <param name="e"><see cref="InteractableObjectEventArgs"/></param>
public delegate void InteractableObjectEventHandler(object sender, InteractableObjectEventArgs e);
/// <summary>
/// The Interactable Object script is attached to any game object that is required to be interacted with (e.g. via the controllers).
/// </summary>
/// <remarks>
/// The basis of this script is to provide a simple mechanism for identifying objects in the game world that can be grabbed or used but it is expected that this script is the base to be inherited into a script with richer functionality.
///
/// The highlighting of an Interactable Object is defaulted to use the `VRTK_MaterialColorSwapHighlighter` if no other highlighter is applied to the Object.
/// </remarks>
/// <example>
/// `VRTK/Examples/005_Controller_BasicObjectGrabbing` uses the `VRTK_InteractTouch` and `VRTK_InteractGrab` scripts on the controllers to show how an interactable object can be grabbed and snapped to the controller and thrown around the game world.
///
/// `VRTK/Examples/013_Controller_UsingAndGrabbingMultipleObjects` shows multiple objects that can be grabbed by holding the buttons or grabbed by toggling the button click and also has objects that can have their Using state toggled to show how multiple items can be turned on at the same time.
/// </example>
public class VRTK_InteractableObject : MonoBehaviour
{
/// <summary>
/// Allowed controller type.
/// </summary>
/// <param name="Both">Both controllers are allowed to interact.</param>
/// <param name="LeftOnly">Only the left controller is allowed to interact.</param>
/// <param name="RightOnly">Only the right controller is allowed to interact.</param>
public enum AllowedController
{
Both,
LeftOnly,
RightOnly
}
/// <summary>
/// The types of valid situations that the object can be released from grab.
/// </summary>
/// <param name="NoDrop">The object cannot be dropped via the controller</param>
/// <param name="DropAnywhere">The object can be dropped anywhere in the scene via the controller.</param>
/// <param name="DropValidSnapDropZone">The object can only be dropped when it is hovering over a valid snap drop zone.</param>
public enum ValidDropTypes
{
NoDrop,
DropAnywhere,
DropValidSnapDropZone
}
[Tooltip("If this is checked then the interactable object script will be disabled when the object is not being interacted with. This will eliminate the potential number of calls the interactable objects make each frame.")]
public bool disableWhenIdle = true;
[Header("Touch Options", order = 1)]
[Tooltip("The colour to highlight the object when it is touched. This colour will override any globally set colour (for instance on the `VRTK_InteractTouch` script).")]
public Color touchHighlightColor = Color.clear;
[Tooltip("Determines which controller can initiate a touch action.")]
public AllowedController allowedTouchControllers = AllowedController.Both;
[Tooltip("An array of colliders on the object to ignore when being touched.")]
public Collider[] ignoredColliders;
[Header("Grab Options", order = 2)]
[Tooltip("Determines if the object can be grabbed.")]
public bool isGrabbable = false;
[Tooltip("If this is checked then the grab button on the controller needs to be continually held down to keep grabbing. If this is unchecked the grab button toggles the grab action with one button press to grab and another to release.")]
public bool holdButtonToGrab = true;
[Tooltip("If this is checked then the object will stay grabbed to the controller when a teleport occurs. If it is unchecked then the object will be released when a teleport occurs.")]
public bool stayGrabbedOnTeleport = true;
[Tooltip("Determines in what situation the object can be dropped by the controller grab button.")]
public ValidDropTypes validDrop = ValidDropTypes.DropAnywhere;
[Tooltip("If this is set to `Undefined` then the global grab alias button will grab the object, setting it to any other button will ensure the override button is used to grab this specific interactable object.")]
public VRTK_ControllerEvents.ButtonAlias grabOverrideButton = VRTK_ControllerEvents.ButtonAlias.Undefined;
[Tooltip("Determines which controller can initiate a grab action.")]
public AllowedController allowedGrabControllers = AllowedController.Both;
[Tooltip("This determines how the grabbed item will be attached to the controller when it is grabbed. If one isn't provided then the first Grab Attach script on the GameObject will be used, if one is not found and the object is grabbable then a Fixed Joint Grab Attach script will be created at runtime.")]
public VRTK_BaseGrabAttach grabAttachMechanicScript;
[Tooltip("The script to utilise when processing the secondary controller action on a secondary grab attempt. If one isn't provided then the first Secondary Controller Grab Action script on the GameObject will be used, if one is not found then no action will be taken on secondary grab.")]
public VRTK_BaseGrabAction secondaryGrabActionScript;
[Header("Use Options", order = 3)]
[Tooltip("Determines if the object can be used.")]
public bool isUsable = false;
[Tooltip("If this is checked then the use button on the controller needs to be continually held down to keep using. If this is unchecked the the use button toggles the use action with one button press to start using and another to stop using.")]
public bool holdButtonToUse = true;
[Tooltip("If this is checked the object can be used only if it is currently being grabbed.")]
public bool useOnlyIfGrabbed = false;
[Tooltip("If this is checked then when a Base Pointer beam (projected from the controller) hits the interactable object, if the object has `Hold Button To Use` unchecked then whilst the pointer is over the object it will run it's `Using` method. If `Hold Button To Use` is unchecked then the `Using` method will be run when the pointer is deactivated. The world pointer will not throw the `Destination Set` event if it is affecting an interactable object with this setting checked as this prevents unwanted teleporting from happening when using an object with a pointer.")]
public bool pointerActivatesUseAction = false;
[Tooltip("If this is set to `Undefined` then the global use alias button will use the object, setting it to any other button will ensure the override button is used to use this specific interactable object.")]
public VRTK_ControllerEvents.ButtonAlias useOverrideButton = VRTK_ControllerEvents.ButtonAlias.Undefined;
[Tooltip("Determines which controller can initiate a use action.")]
public AllowedController allowedUseControllers = AllowedController.Both;
/// <summary>
/// Emitted when another object touches the current object.
/// </summary>
public event InteractableObjectEventHandler InteractableObjectTouched;
/// <summary>
/// Emitted when the other object stops touching the current object.
/// </summary>
public event InteractableObjectEventHandler InteractableObjectUntouched;
/// <summary>
/// Emitted when another object grabs the current object (e.g. a controller).
/// </summary>
public event InteractableObjectEventHandler InteractableObjectGrabbed;
/// <summary>
/// Emitted when the other object stops grabbing the current object.
/// </summary>
public event InteractableObjectEventHandler InteractableObjectUngrabbed;
/// <summary>
/// Emitted when another object uses the current object (e.g. a controller).
/// </summary>
public event InteractableObjectEventHandler InteractableObjectUsed;
/// <summary>
/// Emitted when the other object stops using the current object.
/// </summary>
public event InteractableObjectEventHandler InteractableObjectUnused;
/// <summary>
/// The current using state of the object. `0` not being used, `1` being used.
/// </summary>
[HideInInspector]
public int usingState = 0;
/// <summary>
/// isKinematic is a pass through to the `isKinematic` getter/setter on the object's rigidbody component.
/// </summary>
public bool isKinematic
{
get
{
if (interactableRigidbody)
{
return interactableRigidbody.isKinematic;
}
return true;
}
set
{
if (interactableRigidbody)
{
interactableRigidbody.isKinematic = value;
}
}
}
protected Rigidbody interactableRigidbody;
protected List<GameObject> touchingObjects = new List<GameObject>();
protected List<GameObject> grabbingObjects = new List<GameObject>();
protected GameObject usingObject = null;
protected Transform trackPoint;
protected bool customTrackPoint = false;
protected Transform primaryControllerAttachPoint;
protected Transform secondaryControllerAttachPoint;
protected Transform previousParent;
protected bool previousKinematicState;
protected bool previousIsGrabbable;
protected bool forcedDropped;
protected bool forceDisabled;
protected VRTK_BaseHighlighter objectHighlighter;
protected bool autoHighlighter = false;
protected bool hoveredOverSnapDropZone = false;
protected bool snappedInSnapDropZone = false;
protected VRTK_SnapDropZone storedSnapDropZone;
protected Vector3 previousLocalScale = Vector3.zero;
protected List<GameObject> currentIgnoredColliders = new List<GameObject>();
public virtual void OnInteractableObjectTouched(InteractableObjectEventArgs e)
{
if (InteractableObjectTouched != null)
{
InteractableObjectTouched(this, e);
}
}
public virtual void OnInteractableObjectUntouched(InteractableObjectEventArgs e)
{
if (InteractableObjectUntouched != null)
{
InteractableObjectUntouched(this, e);
}
}
public virtual void OnInteractableObjectGrabbed(InteractableObjectEventArgs e)
{
if (InteractableObjectGrabbed != null)
{
InteractableObjectGrabbed(this, e);
}
}
public virtual void OnInteractableObjectUngrabbed(InteractableObjectEventArgs e)
{
if (InteractableObjectUngrabbed != null)
{
InteractableObjectUngrabbed(this, e);
}
}
public virtual void OnInteractableObjectUsed(InteractableObjectEventArgs e)
{
if (InteractableObjectUsed != null)
{
InteractableObjectUsed(this, e);
}
}
public virtual void OnInteractableObjectUnused(InteractableObjectEventArgs e)
{
if (InteractableObjectUnused != null)
{
InteractableObjectUnused(this, e);
}
}
public InteractableObjectEventArgs SetInteractableObjectEvent(GameObject interactingObject)
{
InteractableObjectEventArgs e;
e.interactingObject = interactingObject;
return e;
}
/// <summary>
/// The IsTouched method is used to determine if the object is currently being touched.
/// </summary>
/// <returns>Returns `true` if the object is currently being touched.</returns>
public virtual bool IsTouched()
{
return (touchingObjects.Count > 0);
}
/// <summary>
/// The IsGrabbed method is used to determine if the object is currently being grabbed.
/// </summary>
/// <param name="grabbedBy">An optional GameObject to check if the Interactable Object is grabbed by that specific GameObject. Defaults to `null`</param>
/// <returns>Returns `true` if the object is currently being grabbed.</returns>
public virtual bool IsGrabbed(GameObject grabbedBy = null)
{
if (grabbingObjects.Count > 0 && grabbedBy != null)
{
return (grabbingObjects.Contains(grabbedBy));
}
return (grabbingObjects.Count > 0);
}
/// <summary>
/// The IsUsing method is used to determine if the object is currently being used.
/// </summary>
/// <param name="usedBy">An optional GameObject to check if the Interactable Object is used by that specific GameObject. Defaults to `null`</param>
/// <returns>Returns `true` if the object is currently being used.</returns>
public virtual bool IsUsing(GameObject usedBy = null)
{
if (usingObject && usedBy != null)
{
return (usingObject == usedBy);
}
return (usingObject != null);
}
/// <summary>
/// The StartTouching method is called automatically when the object is touched initially. It is also a virtual method to allow for overriding in inherited classes.
/// </summary>
/// <param name="currentTouchingObject">The game object that is currently touching this object.</param>
public virtual void StartTouching(GameObject currentTouchingObject)
{
IgnoreColliders(currentTouchingObject);
if (!touchingObjects.Contains(currentTouchingObject))
{
ToggleEnableState(true);
touchingObjects.Add(currentTouchingObject);
OnInteractableObjectTouched(SetInteractableObjectEvent(currentTouchingObject));
}
}
/// <summary>
/// The StopTouching method is called automatically when the object has stopped being touched. It is also a virtual method to allow for overriding in inherited classes.
/// </summary>
/// <param name="previousTouchingObject">The game object that was previously touching this object.</param>
public virtual void StopTouching(GameObject previousTouchingObject)
{
if (touchingObjects.Contains(previousTouchingObject))
{
ResetUseState(previousTouchingObject);
OnInteractableObjectUntouched(SetInteractableObjectEvent(previousTouchingObject));
touchingObjects.Remove(previousTouchingObject);
}
}
/// <summary>
/// The Grabbed method is called automatically when the object is grabbed initially. It is also a virtual method to allow for overriding in inherited classes.
/// </summary>
/// <param name="currentGrabbingObject">The game object that is currently grabbing this object.</param>
public virtual void Grabbed(GameObject currentGrabbingObject)
{
ToggleEnableState(true);
if (!IsGrabbed() || IsSwappable())
{
PrimaryControllerGrab(currentGrabbingObject);
}
else
{
SecondaryControllerGrab(currentGrabbingObject);
}
OnInteractableObjectGrabbed(SetInteractableObjectEvent(currentGrabbingObject));
}
/// <summary>
/// The Ungrabbed method is called automatically when the object has stopped being grabbed. It is also a virtual method to allow for overriding in inherited classes.
/// </summary>
/// <param name="previousGrabbingObject">The game object that was previously grabbing this object.</param>
public virtual void Ungrabbed(GameObject previousGrabbingObject)
{
GameObject secondaryGrabbingObject = GetSecondaryGrabbingObject();
if (!secondaryGrabbingObject || secondaryGrabbingObject != previousGrabbingObject)
{
SecondaryControllerUngrab(secondaryGrabbingObject);
PrimaryControllerUngrab(previousGrabbingObject, secondaryGrabbingObject);
}
else
{
SecondaryControllerUngrab(previousGrabbingObject);
}
OnInteractableObjectUngrabbed(SetInteractableObjectEvent(previousGrabbingObject));
}
/// <summary>
/// The StartUsing method is called automatically when the object is used initially. It is also a virtual method to allow for overriding in inherited classes.
/// </summary>
/// <param name="currentUsingObject">The game object that is currently using this object.</param>
public virtual void StartUsing(GameObject currentUsingObject)
{
ToggleEnableState(true);
if (IsUsing() && !IsUsing(currentUsingObject))
{
ResetUsingObject();
}
OnInteractableObjectUsed(SetInteractableObjectEvent(currentUsingObject));
usingObject = currentUsingObject;
}
/// <summary>
/// The StopUsing method is called automatically when the object has stopped being used. It is also a virtual method to allow for overriding in inherited classes.
/// </summary>
/// <param name="previousUsingObject">The game object that was previously using this object.</param>
public virtual void StopUsing(GameObject previousUsingObject)
{
OnInteractableObjectUnused(SetInteractableObjectEvent(previousUsingObject));
ResetUsingObject();
usingState = 0;
usingObject = null;
}
/// <summary>
/// The ToggleHighlight method is used to turn on or off the colour highlight of the object.
/// </summary>
/// <param name="toggle">The state to determine whether to activate or deactivate the highlight. `true` will enable the highlight and `false` will remove the highlight.</param>
public virtual void ToggleHighlight(bool toggle)
{
InitialiseHighlighter();
if (touchHighlightColor != Color.clear && objectHighlighter)
{
if (toggle && !IsGrabbed())
{
objectHighlighter.Highlight(touchHighlightColor);
}
else
{
objectHighlighter.Unhighlight();
}
}
}
/// <summary>
/// The ResetHighlighter method is used to reset the currently attached highlighter.
/// </summary>
public virtual void ResetHighlighter()
{
if (objectHighlighter)
{
objectHighlighter.ResetHighlighter();
}
}
/// <summary>
/// The PauseCollisions method temporarily pauses all collisions on the object at grab time by removing the object's rigidbody's ability to detect collisions. This can be useful for preventing clipping when initially grabbing an item.
/// </summary>
/// <param name="delay">The amount of time to pause the collisions for.</param>
public virtual void PauseCollisions(float delay)
{
if (delay > 0f)
{
foreach (Rigidbody rb in GetComponentsInChildren<Rigidbody>())
{
rb.detectCollisions = false;
}
Invoke("UnpauseCollisions", delay);
}
}
/// <summary>
/// The ZeroVelocity method resets the velocity and angular velocity to zero on the rigidbody attached to the object.
/// </summary>
public virtual void ZeroVelocity()
{
if (interactableRigidbody)
{
interactableRigidbody.velocity = Vector3.zero;
interactableRigidbody.angularVelocity = Vector3.zero;
}
}
/// <summary>
/// The SaveCurrentState method stores the existing object parent and the object's rigidbody kinematic setting.
/// </summary>
public virtual void SaveCurrentState()
{
if (!IsGrabbed() && !snappedInSnapDropZone)
{
previousParent = transform.parent;
if (!IsSwappable())
{
previousIsGrabbable = isGrabbable;
}
if (interactableRigidbody)
{
previousKinematicState = interactableRigidbody.isKinematic;
}
}
}
/// <summary>
/// The GetTouchingObjects method is used to return the collecetion of valid game objects that are currently touching this object.
/// </summary>
/// <returns>A list of game object of that are currently touching the current object.</returns>
public virtual List<GameObject> GetTouchingObjects()
{
return touchingObjects;
}
/// <summary>
/// The GetGrabbingObject method is used to return the game object that is currently grabbing this object.
/// </summary>
/// <returns>The game object of what is grabbing the current object.</returns>
public virtual GameObject GetGrabbingObject()
{
return (IsGrabbed() ? grabbingObjects[0] : null);
}
/// <summary>
/// The GetSecondaryGrabbingObject method is used to return the game object that is currently being used to influence this object whilst it is being grabbed by a secondary controller.
/// </summary>
/// <returns>The game object of the secondary controller influencing the current grabbed object.</returns>
public virtual GameObject GetSecondaryGrabbingObject()
{
return (grabbingObjects.Count > 1 ? grabbingObjects[1] : null);
}
/// <summary>
/// The GetUsingObject method is used to return the game object that is currently using this object.
/// </summary>
/// <returns>The game object of what is using the current object.</returns>
public virtual GameObject GetUsingObject()
{
return usingObject;
}
/// <summary>
/// The IsValidInteractableController method is used to check to see if a controller is allowed to perform an interaction with this object as sometimes controllers are prohibited from grabbing or using an object depedning on the use case.
/// </summary>
/// <param name="actualController">The game object of the controller that is being checked.</param>
/// <param name="controllerCheck">The value of which controller is allowed to interact with this object.</param>
/// <returns>Is true if the interacting controller is allowed to grab the object.</returns>
public virtual bool IsValidInteractableController(GameObject actualController, AllowedController controllerCheck)
{
if (controllerCheck == AllowedController.Both)
{
return true;
}
var controllerHand = VRTK_DeviceFinder.GetControllerHandType(controllerCheck.ToString().Replace("Only", ""));
return (VRTK_DeviceFinder.IsControllerOfHand(actualController, controllerHand));
}
/// <summary>
/// The ForceStopInteracting method forces the object to no longer be interacted with and will cause a controller to drop the object and stop touching it. This is useful if the controller is required to auto interact with another object.
/// </summary>
public virtual void ForceStopInteracting()
{
if (gameObject.activeInHierarchy)
{
forceDisabled = false;
StartCoroutine(ForceStopInteractingAtEndOfFrame());
}
if (!gameObject.activeInHierarchy && forceDisabled)
{
ForceStopAllInteractions();
forceDisabled = false;
}
}
/// <summary>
/// The ForceStopSecondaryGrabInteraction method forces the object to no longer be influenced by the second controller grabbing it.
/// </summary>
public virtual void ForceStopSecondaryGrabInteraction()
{
var grabbingObject = GetSecondaryGrabbingObject();
if (grabbingObject)
{
grabbingObject.GetComponent<VRTK_InteractGrab>().ForceRelease();
}
}
/// <summary>
/// The RegisterTeleporters method is used to find all objects that have a teleporter script and register the object on the `OnTeleported` event. This is used internally by the object for keeping Tracked objects positions updated after teleporting.
/// </summary>
public virtual void RegisterTeleporters()
{
StartCoroutine(RegisterTeleportersAtEndOfFrame());
}
/// <summary>
/// The UnregisterTeleporters method is used to unregister all teleporter events that are active on this object.
/// </summary>
public virtual void UnregisterTeleporters()
{
foreach (var teleporter in VRTK_ObjectCache.registeredTeleporters)
{
teleporter.Teleporting -= new TeleportEventHandler(OnTeleporting);
teleporter.Teleported -= new TeleportEventHandler(OnTeleported);
}
}
/// <summary>
/// the StoreLocalScale method saves the current transform local scale values.
/// </summary>
public virtual void StoreLocalScale()
{
previousLocalScale = transform.localScale;
}
/// <summary>
/// The ToggleSnapDropZone method is used to set the state of whether the interactable object is in a Snap Drop Zone or not.
/// </summary>
/// <param name="snapDropZone">The Snap Drop Zone object that is being interacted with.</param>
/// <param name="state">The state of whether the interactable object is fixed in or removed from the Snap Drop Zone. True denotes the interactable object is fixed to the Snap Drop Zone and false denotes it has been removed from the Snap Drop Zone.</param>
public virtual void ToggleSnapDropZone(VRTK_SnapDropZone snapDropZone, bool state)
{
snappedInSnapDropZone = state;
if (state)
{
storedSnapDropZone = snapDropZone;
}
else
{
ResetDropSnapType();
}
}
/// <summary>
/// The IsInSnapDropZone method determines whether the interactable object is currently snapped to a drop zone.
/// </summary>
/// <returns>Returns true if the interactable object is currently snapped in a drop zone and returns false if it is not.</returns>
public virtual bool IsInSnapDropZone()
{
return snappedInSnapDropZone;
}
/// <summary>
/// The SetSnapDropZoneHover method sets whether the interactable object is currently being hovered over a valid Snap Drop Zone.
/// </summary>
/// <param name="state">The state of whether the object is being hovered or not.</param>
public virtual void SetSnapDropZoneHover(bool state)
{
hoveredOverSnapDropZone = state;
}
/// <summary>
/// The GetStoredSnapDropZone method returns the snap drop zone that the interactable object is currently snapped to.
/// </summary>
/// <returns>The SnapDropZone that the interactable object is currently snapped to.</returns>
public virtual VRTK_SnapDropZone GetStoredSnapDropZone()
{
return storedSnapDropZone;
}
/// <summary>
/// The IsDroppable method returns whether the object can be dropped or not in it's current situation.
/// </summary>
/// <returns>Returns true if the object can currently be dropped and returns false if it is not currently possible to drop.</returns>
public virtual bool IsDroppable()
{
switch (validDrop)
{
case ValidDropTypes.NoDrop:
return false;
case ValidDropTypes.DropAnywhere:
return true;
case ValidDropTypes.DropValidSnapDropZone:
return hoveredOverSnapDropZone;
}
return false;
}
/// <summary>
/// The IsSwappable method returns whether the object can be grabbed with one controller and then swapped to another controller by grabbing with the secondary controller.
/// </summary>
/// <returns>Returns true if the object can be grabbed by a secondary controller whilst already being grabbed and the object will swap controllers. Returns false if the object cannot be swapped.</returns>
public virtual bool IsSwappable()
{
return (secondaryGrabActionScript ? secondaryGrabActionScript.IsSwappable() : false);
}
/// <summary>
/// The PerformSecondaryAction method returns whether the object has a secondary action that can be performed when grabbing the object with a secondary controller.
/// </summary>
/// <returns>Returns true if the obejct has a secondary action, returns false if it has no secondary action or is swappable.</returns>
public virtual bool PerformSecondaryAction()
{
return (!GetSecondaryGrabbingObject() && secondaryGrabActionScript ? secondaryGrabActionScript.IsActionable() : false);
}
/// <summary>
/// The ResetIgnoredColliders method is used to clear any stored ignored colliders in case the `Ignored Colliders` array parameter is changed at runtime. This needs to be called manually if changes are made at runtime.
/// </summary>
public virtual void ResetIgnoredColliders()
{
currentIgnoredColliders.Clear();
}
protected virtual void Awake()
{
interactableRigidbody = GetComponent<Rigidbody>();
if (interactableRigidbody)
{
interactableRigidbody.maxAngularVelocity = float.MaxValue;
}
if (disableWhenIdle && enabled)
{
enabled = false;
}
}
protected virtual void OnEnable()
{
InitialiseHighlighter();
RegisterTeleporters();
forceDisabled = false;
if (forcedDropped)
{
LoadPreviousState();
}
forcedDropped = false;
}
protected virtual void OnDisable()
{
UnregisterTeleporters();
if (autoHighlighter)
{
Destroy(objectHighlighter);
objectHighlighter = null;
}
forceDisabled = true;
ForceStopInteracting();
}
protected virtual void FixedUpdate()
{
if (trackPoint && grabAttachMechanicScript)
{
grabAttachMechanicScript.ProcessFixedUpdate();
}
if (secondaryGrabActionScript)
{
secondaryGrabActionScript.ProcessFixedUpdate();
}
}
protected virtual void Update()
{
AttemptSetGrabMechanic();
AttemptSetSecondaryGrabAction();
if (trackPoint && grabAttachMechanicScript)
{
grabAttachMechanicScript.ProcessUpdate();
}
if (secondaryGrabActionScript)
{
secondaryGrabActionScript.ProcessUpdate();
}
}
protected virtual void LateUpdate()
{
if (disableWhenIdle && !IsTouched() && !IsGrabbed() && !IsUsing())
{
ToggleEnableState(false);
}
}
protected virtual void LoadPreviousState()
{
if (gameObject.activeInHierarchy)
{
transform.SetParent(previousParent);
forcedDropped = false;
}
if (interactableRigidbody)
{
interactableRigidbody.isKinematic = previousKinematicState;
}
if (!IsSwappable())
{
isGrabbable = previousIsGrabbable;
}
}
protected virtual void InitialiseHighlighter()
{
if (touchHighlightColor != Color.clear && !objectHighlighter)
{
autoHighlighter = false;
objectHighlighter = VRTK_BaseHighlighter.GetActiveHighlighter(gameObject);
if (objectHighlighter == null)
{
autoHighlighter = true;
objectHighlighter = gameObject.AddComponent<VRTK_MaterialColorSwapHighlighter>();
}
objectHighlighter.Initialise(touchHighlightColor);
}
}
protected virtual void IgnoreColliders(GameObject touchingObject)
{
if (ignoredColliders != null && !currentIgnoredColliders.Contains(touchingObject))
{
bool objectIgnored = false;
Collider[] touchingColliders = touchingObject.GetComponentsInChildren<Collider>();
for (int i = 0; i < ignoredColliders.Length; i++)
{
for (int j = 0; j < touchingColliders.Length; j++)
{
Physics.IgnoreCollision(touchingColliders[j], ignoredColliders[i]);
objectIgnored = true;
}
}
if (objectIgnored)
{
currentIgnoredColliders.Add(touchingObject);
}
}
}
protected virtual void ToggleEnableState(bool state)
{
if (disableWhenIdle)
{
enabled = state;
}
}
protected virtual void AttemptSetGrabMechanic()
{
if (isGrabbable && grabAttachMechanicScript == null)
{
var setGrabMechanic = GetComponent<VRTK_BaseGrabAttach>();
if (!setGrabMechanic)
{
setGrabMechanic = gameObject.AddComponent<VRTK_FixedJointGrabAttach>();
}
grabAttachMechanicScript = setGrabMechanic;
}
}
protected virtual void AttemptSetSecondaryGrabAction()
{
if (isGrabbable && secondaryGrabActionScript == null)
{
secondaryGrabActionScript = GetComponent<VRTK_BaseGrabAction>();
}
}
protected virtual void ForceReleaseGrab()
{
var grabbingObject = GetGrabbingObject();
if (grabbingObject)
{
grabbingObject.GetComponent<VRTK_InteractGrab>().ForceRelease();
}
}
protected virtual void PrimaryControllerGrab(GameObject currentGrabbingObject)
{
if (snappedInSnapDropZone)
{
ToggleSnapDropZone(storedSnapDropZone, false);
}
ForceReleaseGrab();
RemoveTrackPoint();
grabbingObjects.Add(currentGrabbingObject);
SetTrackPoint(currentGrabbingObject);
if (!IsSwappable())
{
previousIsGrabbable = isGrabbable;
isGrabbable = false;
}
}
protected virtual void SecondaryControllerGrab(GameObject currentGrabbingObject)
{
if (!grabbingObjects.Contains(currentGrabbingObject))
{
grabbingObjects.Add(currentGrabbingObject);
secondaryControllerAttachPoint = CreateAttachPoint(currentGrabbingObject.name, "Secondary", currentGrabbingObject.transform);
if (secondaryGrabActionScript)
{
secondaryGrabActionScript.Initialise(this, GetGrabbingObject().GetComponent<VRTK_InteractGrab>(), GetSecondaryGrabbingObject().GetComponent<VRTK_InteractGrab>(), primaryControllerAttachPoint, secondaryControllerAttachPoint);
}
}
}
protected virtual void PrimaryControllerUngrab(GameObject previousGrabbingObject, GameObject previousSecondaryGrabbingObject)
{
UnpauseCollisions();
RemoveTrackPoint();
ResetUseState(previousGrabbingObject);
grabbingObjects.Clear();
if (secondaryGrabActionScript != null && previousSecondaryGrabbingObject != null)
{
secondaryGrabActionScript.OnDropAction();
previousSecondaryGrabbingObject.GetComponent<VRTK_InteractGrab>().ForceRelease();
}
LoadPreviousState();
}
protected virtual void SecondaryControllerUngrab(GameObject previousGrabbingObject)
{
if (grabbingObjects.Contains(previousGrabbingObject))
{
grabbingObjects.Remove(previousGrabbingObject);
Destroy(secondaryControllerAttachPoint.gameObject);
secondaryControllerAttachPoint = null;
if (secondaryGrabActionScript)
{
secondaryGrabActionScript.ResetAction();
}
}
}
protected virtual void UnpauseCollisions()
{
foreach (Rigidbody rb in GetComponentsInChildren<Rigidbody>())
{
rb.detectCollisions = true;
}
}
protected virtual void SetTrackPoint(GameObject currentGrabbingObject)
{
AddTrackPoint(currentGrabbingObject);
primaryControllerAttachPoint = CreateAttachPoint(GetGrabbingObject().name, "Original", trackPoint);
if (grabAttachMechanicScript)
{
grabAttachMechanicScript.SetTrackPoint(trackPoint);
grabAttachMechanicScript.SetInitialAttachPoint(primaryControllerAttachPoint);
}
}
protected virtual Transform CreateAttachPoint(string namePrefix, string nameSuffix, Transform origin)
{
var attachPoint = new GameObject(string.Format("[{0}][{1}]_Controller_AttachPoint", namePrefix, nameSuffix)).transform;
attachPoint.parent = transform;
attachPoint.position = origin.position;
attachPoint.rotation = origin.rotation;
return attachPoint;
}
protected virtual void AddTrackPoint(GameObject currentGrabbingObject)
{
var grabScript = currentGrabbingObject.GetComponent<VRTK_InteractGrab>();
var controllerPoint = ((grabScript && grabScript.controllerAttachPoint) ? grabScript.controllerAttachPoint.transform : currentGrabbingObject.transform);
if (grabAttachMechanicScript)
{
trackPoint = grabAttachMechanicScript.CreateTrackPoint(controllerPoint, gameObject, currentGrabbingObject, ref customTrackPoint);
}
}
protected virtual void RemoveTrackPoint()
{
if (customTrackPoint && trackPoint)
{
Destroy(trackPoint.gameObject);
}
else
{
trackPoint = null;
}
if (primaryControllerAttachPoint)
{
Destroy(primaryControllerAttachPoint.gameObject);
}
}
protected virtual void OnTeleporting(object sender, DestinationMarkerEventArgs e)
{
if (!stayGrabbedOnTeleport)
{
ZeroVelocity();
ForceStopAllInteractions();
}
}
protected virtual void OnTeleported(object sender, DestinationMarkerEventArgs e)
{
if (grabAttachMechanicScript && grabAttachMechanicScript.IsTracked() && stayGrabbedOnTeleport && trackPoint)
{
var actualController = VRTK_DeviceFinder.GetActualController(GetGrabbingObject());
transform.position = (actualController ? actualController.transform.position : transform.position);
}
}
protected virtual IEnumerator RegisterTeleportersAtEndOfFrame()
{
yield return new WaitForEndOfFrame();
foreach (var teleporter in VRTK_ObjectCache.registeredTeleporters)
{
teleporter.Teleporting += new TeleportEventHandler(OnTeleporting);
teleporter.Teleported += new TeleportEventHandler(OnTeleported);
}
}
protected virtual void ResetUseState(GameObject checkObject)
{
var usingObjectCheck = checkObject.GetComponent<VRTK_InteractUse>();
if (usingObjectCheck)
{
if (holdButtonToUse)
{
usingObjectCheck.ForceStopUsing();
}
}
}
protected virtual IEnumerator ForceStopInteractingAtEndOfFrame()
{
yield return new WaitForEndOfFrame();
ForceStopAllInteractions();
}
protected virtual void ForceStopAllInteractions()
{
if (touchingObjects == null)
{
return;
}
StopTouchingInteractions();
StopGrabbingInteractions();
StopUsingInteractions();
}
protected virtual void StopTouchingInteractions()
{
for (int i = 0; i < touchingObjects.Count; i++)
{
var touchingObject = touchingObjects[i];
if (touchingObject.activeInHierarchy || forceDisabled)
{
touchingObject.GetComponent<VRTK_InteractTouch>().ForceStopTouching();
}
}
}
protected virtual void StopGrabbingInteractions()
{
var grabbingObject = GetGrabbingObject();
if (grabbingObject != null && (grabbingObject.activeInHierarchy || forceDisabled))
{
grabbingObject.GetComponent<VRTK_InteractTouch>().ForceStopTouching();
grabbingObject.GetComponent<VRTK_InteractGrab>().ForceRelease();
forcedDropped = true;
}
}
protected virtual void StopUsingInteractions()
{
if (usingObject != null && (usingObject.activeInHierarchy || forceDisabled))
{
usingObject.GetComponent<VRTK_InteractTouch>().ForceStopTouching();
usingObject.GetComponent<VRTK_InteractUse>().ForceStopUsing();
}
}
protected virtual void ResetDropSnapType()
{
switch (storedSnapDropZone.snapType)
{
case VRTK_SnapDropZone.SnapTypes.UseKinematic:
case VRTK_SnapDropZone.SnapTypes.UseParenting:
LoadPreviousState();
break;
case VRTK_SnapDropZone.SnapTypes.UseJoint:
var snapDropZoneJoint = storedSnapDropZone.GetComponent<Joint>();
if (snapDropZoneJoint)
{
snapDropZoneJoint.connectedBody = null;
}
break;
}
if (!previousLocalScale.Equals(Vector3.zero))
{
transform.localScale = previousLocalScale;
}
storedSnapDropZone.OnObjectUnsnappedFromDropZone(storedSnapDropZone.SetSnapDropZoneEvent(gameObject));
storedSnapDropZone = null;
}
protected virtual void ResetUsingObject()
{
if (usingObject)
{
var usingObjectScript = usingObject.GetComponent<VRTK_InteractUse>();
if (usingObjectScript)
{
usingObjectScript.ForceResetUsing();
}
}
}
}
} | 42.669166 | 581 | 0.615489 | [
"MIT"
] | HJAgresta/Wutang | Assets/VRTK/Scripts/Interactions/VRTK_InteractableObject.cs | 45,530 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.