content
stringlengths
5
1.04M
avg_line_length
float64
1.75
12.9k
max_line_length
int64
2
244k
alphanum_fraction
float64
0
0.98
licenses
list
repository_name
stringlengths
7
92
path
stringlengths
3
249
size
int64
5
1.04M
lang
stringclasses
2 values
using System.Collections.Generic; using Orchard.AuditTrail.Models; using Orchard.Localization; namespace Orchard.AuditTrail.Services.Models { public class AuditTrailCategoryDescriptor { public string Category { get; set; } public LocalizedString Name { get; set; } public IEnumerable<AuditTrailEventDescriptor> Events { get; set; } } }
33.454545
74
0.736413
[ "BSD-3-Clause" ]
1996dylanriley/Orchard
src/Orchard.Web/Modules/Orchard.AuditTrail/Services/Models/AuditTrailCategoryDescriptor.cs
368
C#
using System; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Web.Mvc; namespace WebNoteNoSQL.Code.HtmlHelperExtensions { /// <summary> /// Some HTML + CSS3 == Sexy /// </summary> public static class SexyDateExtension { private const string Format = @" <div class=""sexy_date""> <h1 class=""day"">{0:dd}</h1> <h1 class=""month"">{0:MMM}</h1> <h1 class=""year"">{0:yyyy}</h1> </div>"; [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "htmlHelper", Justification = "Extension Method")] public static string SexyDate(this HtmlHelper htmlHelper, DateTime date) { return String.Format(CultureInfo.InvariantCulture, Format, date); } } }
31.230769
140
0.62931
[ "MIT" ]
JohannesHoppe/WebNoteNoSQL
WebNoteNoSQL/WebNoteNoSQL/Code/HtmlHelperExtensions/SexyDateExtension.cs
814
C#
using System.Xml.Linq; using DomainObjects; namespace XMLMappers { public class ImportOrderMapper : Mapper<ImportOrder> { public override ImportOrder FromElement(XElement e) => new() { Confirmed = e.BoolValue("confirmed") }; public ImportOrderMapper() : base("order") {} public override void ToElement(ImportOrder t, XElement e) => e .AddValue("confirmed", t.Confirmed) .AddValue("type", "Import"); } }
28
104
0.719048
[ "Apache-2.0" ]
Matej-Chmel/vis-chm0065
src/XMLMappers/ImportOrderMapper.cs
420
C#
namespace WebbShop.Views.HomePageView { using System; using System.Collections.Generic; using System.Windows.Forms; using WebbShop.Controllers; using WebbShopAPI.Models; /// <summary> /// Defines the <see cref="SearchBook" />. /// </summary> public partial class SearchBook : Form { /// <summary> /// Defines the ListOfBooks. /// </summary> private List<Book> ListOfBooks = new List<Book>(); /// <summary> /// Initializes a new instance of the <see cref="SearchBook"/> class. /// </summary> public SearchBook() { InitializeComponent(); } /// <summary> /// The comboBox1_SelectedIndexChanged. /// </summary> /// <param name="sender">The sender<see cref="object"/>.</param> /// <param name="e">The e<see cref="EventArgs"/>.</param> private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { } /// <summary> /// The button1_Click. /// </summary> /// <param name="sender">The sender<see cref="object"/>.</param> /// <param name="e">The e<see cref="EventArgs"/>.</param> private void button1_Click(object sender, EventArgs e) { try { SearchBookByTitle searchBook = new SearchBookByTitle(); searchBook.Keyword = textBoxBookTitle.Text; ListOfBooks = searchBook.Search(); dataGridView1.DataSource = ListOfBooks; } catch { MessageBox.Show("Please enter correct value"); } } /// <summary> /// The SearchBook_Load. /// </summary> /// <param name="sender">The sender<see cref="object"/>.</param> /// <param name="e">The e<see cref="EventArgs"/>.</param> private void SearchBook_Load(object sender, EventArgs e) { } /// <summary> /// The button2_Click. /// </summary> /// <param name="sender">The sender<see cref="object"/>.</param> /// <param name="e">The e<see cref="EventArgs"/>.</param> private void button2_Click(object sender, EventArgs e) { try { SearchByAuthor searchBook = new SearchByAuthor(); searchBook.Keyword = textBox2.Text; ListOfBooks = searchBook.Search(); dataGridView1.DataSource = ListOfBooks; } catch { MessageBox.Show("Please enter correct value"); } } /// <summary> /// The buttonBookID_Click. /// </summary> /// <param name="sender">The sender<see cref="object"/>.</param> /// <param name="e">The e<see cref="EventArgs"/>.</param> private void buttonBookID_Click(object sender, EventArgs e) { try { SearchByBookId searchBook = new SearchByBookId(); searchBook.BookID = int.Parse(textBox2.Text); Book book = searchBook.Search(); dataGridView1.DataSource = book; } catch { MessageBox.Show("Please enter correct value"); } } /// <summary> /// The buttonHome_Click. /// </summary> /// <param name="sender">The sender<see cref="object"/>.</param> /// <param name="e">The e<see cref="EventArgs"/>.</param> private void buttonHome_Click(object sender, EventArgs e) { this.Hide(); new HomePage().ShowDialog(); } /// <summary> /// The button3_Click. /// </summary> /// <param name="sender">The sender<see cref="object"/>.</param> /// <param name="e">The e<see cref="EventArgs"/>.</param> private void button3_Click(object sender, EventArgs e) { Environment.Exit(0); } /// <summary> /// The buttonBuy_Click. /// </summary> /// <param name="sender">The sender<see cref="object"/>.</param> /// <param name="e">The e<see cref="EventArgs"/>.</param> private void buttonBuy_Click(object sender, EventArgs e) { this.Hide(); new purchase().ShowDialog(); } } }
32.210145
79
0.513386
[ "MIT" ]
marcusjobb/NET20D
OOPA/WebbshopProjekt/Farzaneh/NewRepo2-master/WebbShop/Views/HomePageView/SearchBook.cs
4,447
C#
namespace Records { class RecordEquality { public bool Equal() { Movie one = new() { Title = "Jurassic Park", Director = "Spielberg" }; Movie two = new() { Title = "Jurassic Park", Director = "Spielberg" }; Film uno = new() { Title = "Jurassic Park", Director = "Spielberg" }; Film dos = new() { Title = "Jurassic Park", Director = "Spielberg" }; return one == two; } } // init only auto properties public record Movie { public string Title; public string Director; } public class Film { public string Title { get; set; } public string Director { get; set; } } }
26.923077
82
0.542857
[ "MIT" ]
diggingforfire/csharp9funsies
Records/RecordEquality.cs
702
C#
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("AWSSDK.SimpleWorkflow")] [assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (3.5) - Amazon Simple Workflow Service. Amazon SWF helps developers build, run, and scale background jobs that have parallel or sequential steps. You can think of Amazon SWF as a fully-managed state tracker and task coordinator in the Cloud.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("Amazon Web Services SDK for .NET")] [assembly: AssemblyCompany("Amazon.com, Inc")] [assembly: AssemblyCopyright("Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("3.3")] [assembly: AssemblyFileVersion("3.7.0.110")]
49.4375
313
0.754741
[ "Apache-2.0" ]
aws/aws-sdk-net
sdk/code-analysis/ServiceAnalysis/SimpleWorkflow/Properties/AssemblyInfo.cs
1,582
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.UI.Xaml.Data; namespace MVVMJSON.Converters { public class ObjectExistsToVisible : IValueConverter { public object Convert(object value, Type targetType, object parameter, string culture) { return (value == null) ? Windows.UI.Xaml.Visibility.Collapsed : Windows.UI.Xaml.Visibility.Visible; } public object ConvertBack(object value, Type targetType, object parameter, string culture) { throw new NotImplementedException(); } } }
26.92
94
0.66419
[ "MIT" ]
thomas995/MobileApps3
Converters/ObjectExistsToVisible.cs
675
C#
using FileForensiq.Database.Models; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace FileForensiq.UI { public partial class ChartForm : Form { private List<CacheModel> data; public ChartForm() { InitializeComponent(); } public ChartForm(List<CacheModel> recievedData) { InitializeComponent(); data = recievedData; } private void ChartForm_Load(object sender, EventArgs e) { DisplayDataInChart(); } public void DisplayDataInChart() { try { chart.Titles.Add("Number of files by extension:"); chart.Series["NumberOfFiles"].IsVisibleInLegend = false; foreach (string extension in data.Select(x => x.Extension).Distinct()) { var result = data.Where(x => x.Extension == extension).Count(); chart.Series["NumberOfFiles"].Points.AddXY(extension, result); } } catch (Exception) { } } } }
24.425926
86
0.557998
[ "MIT" ]
Hazaaa/File-Forensiq
FileForensiq.UI/ChartForm.cs
1,321
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using UAlbion.Api; using UAlbion.Config; namespace UAlbion.CodeGenerator { public class Assets { public string BaseDir { get; } public AssetConfig AssetConfig { get; } public AssetIdConfig AssetIdConfig { get; } public Dictionary<string, string[]> ParentsByAssetId { get; } public Dictionary<string, string[]> AssetIdsByEnum { get; } public Dictionary<string, string[]> EnumsByAssetId { get; } public ILookup<AssetType, string> AssetIdsByType { get; } public Assets(IFileSystem disk, IJsonUtil jsonUtil) // Everything in this class should be treated as read-only once the constructor finishes. { if (disk == null) throw new ArgumentNullException(nameof(disk)); BaseDir = ConfigUtil.FindBasePath(disk); var assetIdConfigPath = Path.Combine(BaseDir, @"src/Formats/AssetIdTypes.json"); var config = GeneralConfig.Load(Path.Combine(BaseDir, "data/config.json"), BaseDir, disk, jsonUtil); AssetConfig = AssetConfig.Load(config.ResolvePath("$(MODS)/Base/assets.json"), AssetMapping.Global, disk, jsonUtil); AssetIdConfig = AssetIdConfig.Load(assetIdConfigPath, disk, jsonUtil); AssetIdsByType = FindAssetIdsByType(AssetIdConfig); ParentsByAssetId = FindAssetIdParents(AssetIdConfig, AssetIdsByType); AssetIdsByEnum = FindAssetIdsForEnums(AssetConfig.IdTypes, AssetIdsByType); EnumsByAssetId = FindEnumsByAssetId(AssetConfig.IdTypes, AssetIdsByType); // HandleIsomorphism(AssetConfig.IdTypes); // TODO: Build family based on IsomorphicToAttribute. // * AssetTypes in a family need to have a single-type AssetId // * AssetType families must have a single unambiguous leader // * The child types inherit their enum names from the leader // * Child types' mod specific enums need to be in 1:1 relationship with CopiedFrom attrib? // ....getting complicated. } static Dictionary<string, string[]> FindEnumsByAssetId(IDictionary<string, AssetTypeInfo> enums, ILookup<AssetType, string> assetIdsByType) => (from e in enums from assetId in assetIdsByType[e.Value.AssetType] group e.Value.EnumType by assetId into g select (g.Key, g.ToArray())) .ToDictionary(x => x.Key, x => x.Item2); static ILookup<AssetType, string> FindAssetIdsByType(AssetIdConfig config) => (from kvp in config.Mappings let assetId = kvp.Key from assetType in kvp.Value select (assetType, assetId)) .ToLookup(x => x.assetType, x => x.assetId); static Dictionary<string, string[]> FindAssetIdsForEnums(IDictionary<string, AssetTypeInfo> enums, ILookup<AssetType, string> assetIdsByType) => enums.ToDictionary( e => e.Key, e => assetIdsByType[e.Value.AssetType].ToArray()); // Get all AssetIds that share a type, then exclude any that aren't a proper superset of this id. static Dictionary<string, string[]> FindAssetIdParents(AssetIdConfig idConfig, ILookup<AssetType, string> assetIdsByType) => idConfig.Mappings.ToDictionary(x => x.Key, kvp => kvp.Value .SelectMany(x => assetIdsByType[x]) .Distinct() .Where(x => IsSuperSet(idConfig.Mappings[x], kvp.Value)) .ToArray()); static bool IsSuperSet(IEnumerable<AssetType> a, IEnumerable<AssetType> b) => new HashSet<AssetType>(a).IsProperSupersetOf(b); /* static Dictionary<string, EnumData> LoadEnums(AssetConfig config) { var enums = new Dictionary<string, EnumData>(); foreach (var file in config.Files) { if (!enums.TryGetValue(typeInfo.Key, out var e)) { e = new EnumData { FullName = typeInfo.Key, EnumType = typeInfo.Value.EnumType, AssetType = typeInfo.Value.AssetType, CopiedFrom = typeInfo.Value.CopiedFrom, }; enums[typeInfo.Key] = e; } foreach (var o in file.Assets.Values.OrderBy(x => x.Id)) { var id = o.Id; if (e.EnumType == "byte" && id > 0xff) { throw new InvalidOperationException( $"Enum {e.FullName} has an underlying type of byte, but it " + $"defines a value {id} which is greater than the maximum value that a byte can represent (256)."); } e.Entries.Add(string.IsNullOrEmpty(o.Name) ? new EnumEntry {Name = $"Unknown{id}", Value = id} : new EnumEntry {Name = Sanitise(o.Name), Value = id}); } } return enums; } static void DeduplicateEnums(Dictionary<string, EnumData> enums) { foreach (var e in enums.Values) { var counters = e.Entries .GroupBy(x => x.Name) .Where(x => x.Count() > 1) .ToDictionary(x => x.Key, x => 1); foreach (var o in e.Entries) { if (!counters.ContainsKey(o.Name)) continue; var name = o.Name; int count = counters[name]; o.Name = count == 1 ? name : name + count; counters[name]++; } } } static void HandleIsomorphism(Dictionary<string, EnumData> enums) { foreach (var e in enums.Values) { var type = typeof(AssetType); var memberInfo = type.GetMember(e.AssetType.ToString()).SingleOrDefault(); if (memberInfo == null) continue; if (!(memberInfo.GetCustomAttributes(typeof(IsomorphicToAttribute), false).FirstOrDefault() is IsomorphicToAttribute iso)) continue; if (e.Entries.Any(x => !x.Name.StartsWith("Unknown"))) { throw new InvalidOperationException( $"Enum {e.FullName} identifies assets of type {e.AssetType}, which " + $"is defined as being isomorphic to {iso.Type} causing its entries to be defined by the " + $"enums associated with {iso.Type}, however it declares {e.Entries.Count} entries of its own."); } e.Entries.Clear(); if (string.IsNullOrEmpty(e.CopiedFrom)) { throw new InvalidOperationException( $"Enum {e.FullName} identifies assets of type {e.AssetType}, which " + $"is defined as being isomorphic to {iso.Type} causing its entries to be defined by the " + $"enums associated with {iso.Type}, however it does not have a CopiesFrom property identifying the" + "enum type to copy entries from."); } if(!enums.TryGetValue(e.CopiedFrom, out var parentData)) { throw new InvalidOperationException( $"Enum {e.FullName} specifies the type {e.CopiedFrom} as its CopiedFrom property, but this type is" + " not defined by the current mod's configuration, or that of any dependency."); } if (parentData.AssetType != iso.Type) { throw new InvalidOperationException( $"Enum {e.FullName} specifies the type {e.CopiedFrom} as its CopiedFrom property, but its type" + $" is {parentData.AssetType} which does not match the expected asset type declared by the IsomorphicTo attribute ({iso.Type})"); } foreach (var entry in parentData.Entries) e.Entries.Add(entry); } } */ static readonly char[] ForbiddenCharacters = { ' ', '\t', '-', '(', ')', ',', '?', '.', '"' }; static string Sanitise(string x) { var chars = new List<char>(); bool capitaliseNext = true; foreach (var c in x) { if (c == '\'') continue; if (!ForbiddenCharacters.Contains(c)) { chars.Add(capitaliseNext ? char.ToUpper(c) : c); capitaliseNext = false; } else capitaliseNext = true; } return new string(chars.ToArray()); } } }
44.791262
152
0.537878
[ "MIT" ]
csinkers/ualbion
src/Tools/GenerateEnums/Assets.cs
9,229
C#
using System.ComponentModel.Composition; namespace NuGet.VisualStudio { [Export(typeof(IVsPackageInstallerEvents))] [Export(typeof(VsPackageInstallerEvents))] public class VsPackageInstallerEvents : IVsPackageInstallerEvents { public event VsPackageEventHandler PackageInstalled; public event VsPackageEventHandler PackageUninstalling; public event VsPackageEventHandler PackageInstalling; public event VsPackageEventHandler PackageUninstalled; public event VsPackageEventHandler PackageReferenceAdded = delegate { }; public event VsPackageEventHandler PackageReferenceRemoved = delegate { }; internal void NotifyInstalling(PackageOperationEventArgs e) { if (PackageInstalling != null) { PackageInstalling(new VsPackageMetadata(e.Package, e.InstallPath)); } } internal void NotifyInstalled(PackageOperationEventArgs e) { if (PackageInstalled != null) { PackageInstalled(new VsPackageMetadata(e.Package, e.InstallPath)); } } internal void NotifyUninstalling(PackageOperationEventArgs e) { if (PackageUninstalling != null) { PackageUninstalling(new VsPackageMetadata(e.Package, e.InstallPath)); } } internal void NotifyUninstalled(PackageOperationEventArgs e) { if (PackageUninstalled != null) { PackageUninstalled(new VsPackageMetadata(e.Package, e.InstallPath)); } } internal void NotifyReferenceAdded(PackageOperationEventArgs e) { PackageReferenceAdded(new VsPackageMetadata(e.Package, e.InstallPath, e.FileSystem)); } internal void NotifyReferenceRemoved(PackageOperationEventArgs e) { PackageReferenceRemoved(new VsPackageMetadata(e.Package, e.InstallPath, e.FileSystem)); } } }
33.365079
100
0.629401
[ "ECL-2.0", "Apache-2.0" ]
Barsonax/NuGet2
src/VisualStudio/Extensibility/VsPackageInstallerEvents.cs
2,104
C#
using System; using System.Runtime.Serialization; namespace Common.Exceptions { [Serializable] public class ArgumentNullOrWhiteSpaceException : ArgumentNullException { [NonSerialized] private const string CanNotBeNullOrWhiteSpace = "Value cannot be NullOrWhiteSpace."; public ArgumentNullOrWhiteSpaceException() { } public ArgumentNullOrWhiteSpaceException(string paramName) : base(paramName, CanNotBeNullOrWhiteSpace) { } public ArgumentNullOrWhiteSpaceException(string message, Exception innerException) : base(message, innerException) { } public ArgumentNullOrWhiteSpaceException(string paramName, string message) : base(paramName, message) { } protected ArgumentNullOrWhiteSpaceException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
34.269231
108
0.725028
[ "Unlicense" ]
michaelvolz/OpenGraphTilemaker
src/Common/Exceptions/ArgumentNullOrWhiteSpaceException.cs
893
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("ListSpeedTest")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ListSpeedTest")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("5a28b00c-bf38-426c-85a5-f2e5d18e3308")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
37.675676
84
0.748207
[ "MIT" ]
whymatter/weasel
WikiParser/ListSpeedTest/Properties/AssemblyInfo.cs
1,397
C#
/* XML-RPC.NET library Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ namespace CookComputing.XmlRpc { using System; using System.Diagnostics; using System.IO; using System.Text; public class Util { // protect constructor because static only class protected Util() { } static public void CopyStream(Stream src, Stream dst) { byte[] buff = new byte[4096]; while (true) { int read = src.Read(buff, 0, 4096); if (read == 0) break; dst.Write(buff, 0, read); } } public static Stream StringAsStream(string S) { MemoryStream mstm = new MemoryStream(); StreamWriter sw = new StreamWriter(mstm); sw.Write(S); sw.Flush(); mstm.Seek(0, SeekOrigin.Begin); return mstm; } #if (!COMPACT_FRAMEWORK && !SILVERLIGHT) public static void TraceStream(Stream stm) { TextReader trdr = new StreamReader(stm, new UTF8Encoding(), true, 4096); String s = trdr.ReadLine(); while (s != null) { Trace.WriteLine(s); s = trdr.ReadLine(); } } public static void DumpStream(Stream stm) { TextReader trdr = new StreamReader(stm); String s = trdr.ReadLine(); while (s != null) { Trace.WriteLine(s); s = trdr.ReadLine(); } } #endif //#if (!COMPACT_FRAMEWORK) public static Guid NewGuid() { return Guid.NewGuid(); } //#else // public static Guid NewGuid() // { // return OpenNETCF.GuidEx.NewGuid(); // } //#endif } }
27.6
79
0.636594
[ "MIT" ]
VQComms/XMLRPC
src/util.cs
2,760
C#
namespace ME.ECS.Views { #if ECS_COMPILE_IL2CPP_OPTIONS [Unity.IL2CPP.CompilerServices.Il2CppSetOptionAttribute(Unity.IL2CPP.CompilerServices.Option.NullChecks, false), Unity.IL2CPP.CompilerServices.Il2CppSetOptionAttribute(Unity.IL2CPP.CompilerServices.Option.ArrayBoundsChecks, false), Unity.IL2CPP.CompilerServices.Il2CppSetOptionAttribute(Unity.IL2CPP.CompilerServices.Option.DivideByZeroChecks, false)] #endif [System.Serializable] public struct ParticleSimulationSettings { public enum SimulationType : byte { RestoreHard, RestoreSoft, NoRestore, } public static ParticleSimulationSettings @default { get { return new ParticleSimulationSettings() { simulationType = SimulationType.RestoreSoft, minSimulationTime = 0.2f, minEndingTime = 0.1f, halfEnding = 0.5f, }; } } public SimulationType simulationType; public float minSimulationTime; public float minEndingTime; [UnityEngine.RangeAttribute(0.1f, 0.9f)] public float halfEnding; } #if ECS_COMPILE_IL2CPP_OPTIONS [Unity.IL2CPP.CompilerServices.Il2CppSetOptionAttribute(Unity.IL2CPP.CompilerServices.Option.NullChecks, false), Unity.IL2CPP.CompilerServices.Il2CppSetOptionAttribute(Unity.IL2CPP.CompilerServices.Option.ArrayBoundsChecks, false), Unity.IL2CPP.CompilerServices.Il2CppSetOptionAttribute(Unity.IL2CPP.CompilerServices.Option.DivideByZeroChecks, false)] #endif [System.Serializable] public struct ParticleSimulationItem { public UnityEngine.ParticleSystem particleSystem; private float simulateToTime; private float currentTime; private float simulateToTimeDuration; private bool customLifetime; private float customLifetimeValue; public void SetAsCustomLifetime() { this.customLifetime = true; } public float GetCustomLifetime() { return this.customLifetimeValue; } public void SimulateParticles(float time, uint seed, ParticleSimulationSettings settings) { /*this.particleSystem.Stop(true); this.particleSystem.Pause(true); if (this.particleSystem.useAutoRandomSeed == true) this.particleSystem.useAutoRandomSeed = false; if (this.particleSystem.randomSeed != seed) this.particleSystem.randomSeed = seed;*/ if (settings.simulationType == ParticleSimulationSettings.SimulationType.RestoreSoft) { if (time > settings.minSimulationTime) { var mainModule = this.particleSystem.main; var duration = mainModule.duration / mainModule.simulationSpeed; var halfEnding = (duration - time) * settings.halfEnding; if (halfEnding <= settings.minEndingTime) { // if ending is less than Xms - skip this.Reset(); return; } this.simulateToTime = time + halfEnding; this.currentTime = 0f; this.simulateToTimeDuration = halfEnding; this.Simulate(this.simulateToTime); if (this.customLifetime == false && this.particleSystem.particleCount <= 0) { this.Reset(); } this.Simulate(0f); } else { this.Simulate(time); } } else if (settings.simulationType == ParticleSimulationSettings.SimulationType.RestoreHard) { this.Simulate(time); } else if (settings.simulationType == ParticleSimulationSettings.SimulationType.NoRestore) { this.Simulate(0f); } } public bool Update(float deltaTime, ParticleSimulationSettings settings) { if (settings.simulationType == ParticleSimulationSettings.SimulationType.RestoreSoft && this.simulateToTimeDuration > 0f) { this.currentTime += deltaTime / this.simulateToTimeDuration; if (this.currentTime <= 1f) { this.Simulate(this.currentTime * this.simulateToTime); } else { this.Reset(); } return true; } return false; } private void Reset() { this.simulateToTimeDuration = 0f; this.currentTime = 0f; this.simulateToTime = 0f; } private void Simulate(float time) { if (this.customLifetime == true) { this.customLifetimeValue = time; } else { this.particleSystem.Simulate(time, withChildren: true); this.particleSystem.Play(withChildren: true); } } } #if ECS_COMPILE_IL2CPP_OPTIONS [Unity.IL2CPP.CompilerServices.Il2CppSetOptionAttribute(Unity.IL2CPP.CompilerServices.Option.NullChecks, false), Unity.IL2CPP.CompilerServices.Il2CppSetOptionAttribute(Unity.IL2CPP.CompilerServices.Option.ArrayBoundsChecks, false), Unity.IL2CPP.CompilerServices.Il2CppSetOptionAttribute(Unity.IL2CPP.CompilerServices.Option.DivideByZeroChecks, false)] #endif [System.Serializable] public struct ParticleSystemSimulationItem { public ParticleSimulationItem particleItem; public ParticleSimulationSettings settings; [UnityEngine.SerializeField][UnityEngine.HideInInspector] private bool hasDefault; public void OnValidate(UnityEngine.ParticleSystem particleSystem) { if (this.hasDefault == false) { this.settings = ParticleSimulationSettings.@default; this.hasDefault = true; } this.particleItem = new ParticleSimulationItem(); this.particleItem.particleSystem = particleSystem; } [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public void SetAsCustomLifetime() { this.particleItem.SetAsCustomLifetime(); } [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public float GetCustomLifetime() { return this.particleItem.GetCustomLifetime(); } [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public void SimulateParticles(float time, uint seed) { this.particleItem.SimulateParticles(time, seed, this.settings); } [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public bool Update(float deltaTime) { return this.particleItem.Update(deltaTime, this.settings); } public override string ToString() { return "Particle System Simulation Element"; } } #if ECS_COMPILE_IL2CPP_OPTIONS [Unity.IL2CPP.CompilerServices.Il2CppSetOptionAttribute(Unity.IL2CPP.CompilerServices.Option.NullChecks, false), Unity.IL2CPP.CompilerServices.Il2CppSetOptionAttribute(Unity.IL2CPP.CompilerServices.Option.ArrayBoundsChecks, false), Unity.IL2CPP.CompilerServices.Il2CppSetOptionAttribute(Unity.IL2CPP.CompilerServices.Option.DivideByZeroChecks, false)] #endif [System.Serializable] public struct ParticleSystemSimulation { public ParticleSimulationItem[] particleItems; public ParticleSimulationSettings settings; public bool hasElements; [UnityEngine.SerializeField][UnityEngine.HideInInspector] private bool hasDefault; public void OnValidate(UnityEngine.ParticleSystem[] particleSystems) { if (this.particleItems == null || this.particleItems.Length != particleSystems.Length) { if (this.hasDefault == false) { this.settings = ParticleSimulationSettings.@default; this.hasDefault = true; } this.particleItems = new ParticleSimulationItem[particleSystems.Length]; for (int i = 0, cnt = this.particleItems.Length; i < cnt; ++i) { this.particleItems[i] = new ParticleSimulationItem(); this.particleItems[i].particleSystem = particleSystems[i]; } this.hasElements = particleSystems.Length > 0; } else { this.hasElements = false; } } [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public void SimulateParticles(float time, uint seed) { if (this.hasElements == false) return; for (int i = 0, cnt = this.particleItems.Length; i < cnt; ++i) { this.particleItems[i].SimulateParticles(time, seed, this.settings); } } [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public void Update(float deltaTime) { if (this.hasElements == false) return; for (int i = 0, cnt = this.particleItems.Length; i < cnt; ++i) { this.particleItems[i].Update(deltaTime, this.settings); } } public override string ToString() { if (this.particleItems == null) return string.Empty; return "Particle Systems Count: " + this.particleItems.Length.ToString(); } } public interface IDoValidate { void DoValidate(); } public interface IViewsProviderInitializerBase : System.IComparable<IViewsProviderInitializerBase> {} public interface IViewsProviderInitializer : IViewsProviderInitializerBase { IViewsProvider Create(); void Destroy(IViewsProvider instance); } public interface IViewsProviderBase { void OnConstruct(); void OnDeconstruct(); } public interface IViewsProvider : IViewsProviderBase, System.IComparable<IViewsProvider> { World world { get; set; } IView Spawn(IView prefab, ViewId prefabSourceId); void Destroy(ref IView instance); void Update(ME.ECS.Collections.BufferArray<Views> list, float deltaTime, bool hasChanged); } #if ECS_COMPILE_IL2CPP_OPTIONS [Unity.IL2CPP.CompilerServices.Il2CppSetOptionAttribute(Unity.IL2CPP.CompilerServices.Option.NullChecks, false), Unity.IL2CPP.CompilerServices.Il2CppSetOptionAttribute(Unity.IL2CPP.CompilerServices.Option.ArrayBoundsChecks, false), Unity.IL2CPP.CompilerServices.Il2CppSetOptionAttribute(Unity.IL2CPP.CompilerServices.Option.DivideByZeroChecks, false)] #endif public abstract class ViewsProvider : IViewsProvider { int System.IComparable<IViewsProvider>.CompareTo(IViewsProvider other) { return 0; } public World world { get; set; } public abstract void OnConstruct(); public abstract void OnDeconstruct(); public abstract IView Spawn(IView prefab, ViewId prefabSourceId); public abstract void Destroy(ref IView instance); public abstract void Update(ME.ECS.Collections.BufferArray<Views> list, float deltaTime, bool hasChanged); } }
33.768194
136
0.6072
[ "MIT" ]
Comelyes/ECSExample
Assets/ECS/ECS/Modules/ViewsModule/ViewsProvider.cs
12,530
C#
/***************************************************************************** * Copyright 2016 Aurora Solutions * * http://www.aurorasolutions.io * * Aurora Solutions is an innovative services and product company at * the forefront of the software industry, with processes and practices * involving Domain Driven Design(DDD), Agile methodologies to build * scalable, secure, reliable and high performance products. * * Coin Exchange is a high performance exchange system specialized for * Crypto currency trading. It has different general purpose uses such as * independent deposit and withdrawal channels for Bitcoin and Litecoin, * but can also act as a standalone exchange that can be used with * different asset classes. * Coin Exchange uses state of the art technologies such as ASP.NET REST API, * AngularJS and NUnit. It also uses design patterns for complex event * processing and handling of thousands of transactions per second, such as * Domain Driven Designing, Disruptor Pattern and CQRS With Event Sourcing. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *****************************************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using CoinExchange.Common.Utility; using CoinExchange.Trades.Domain.Model.OrderAggregate; using CoinExchange.Trades.Domain.Model.Services; using CoinExchange.Trades.ReadModel.DTO; using CoinExchange.Trades.ReadModel.Repositories; namespace CoinExchange.Trades.ReadModel.EventHandlers { /// <summary> /// Listens order change events /// </summary> public class OrderEventListener { private IPersistanceRepository _persistanceRepository; private IBalanceValidationService _balanceValidationService; /// <summary> /// Parametrized Constructor /// </summary> /// <param name="persistanceRepository"></param> /// <param name="balanceValidationService"></param> public OrderEventListener(IPersistanceRepository persistanceRepository, IBalanceValidationService balanceValidationService) { _persistanceRepository = persistanceRepository; _balanceValidationService = balanceValidationService; OrderEvent.OrderChanged += OnOrderStatusChanged; } /// <summary> /// Handles the event of change in orders /// </summary> /// <param name="order"></param> void OnOrderStatusChanged(Order order) { _persistanceRepository.SaveOrUpdate(ReadModelAdapter.GetOrderReadModel(order)); // If the order has been cancelled, send the info to Funds BC so that the funds can be updated if (order.OrderState == OrderState.Cancelled) { // First split the curreny pair into base and quote currency Tuple<string, string> splittedCurrencyPair = CurrencySplitterService.SplitCurrencyPair(order.CurrencyPair); if (!string.IsNullOrEmpty(splittedCurrencyPair.Item1) && !string.IsNullOrEmpty(splittedCurrencyPair.Item2)) { // Send to the Infrastructure service which will communicate cross Bounded Context _balanceValidationService.OrderCancelled(splittedCurrencyPair.Item1, splittedCurrencyPair.Item2, order.TraderId.Id, order.OrderSide.ToString(), order.OrderId.Id, order.OpenQuantity.Value, order.Price.Value); } } } } }
46
132
0.642105
[ "Apache-2.0" ]
3plcoins/coin-exchange-backend
src/Trades/CoinExchange.Trades.ReadModel/EventHandlers/OrderEventListener.cs
4,372
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: jmis $ * Last modified: $LastChangedDate: 2015-09-15 11:07:32 -0400 (Tue, 15 Sep 2015) $ * Revision: $LastChangedRevision: 9795 $ */ /* This class was auto-generated by the message builder generator tools. */ namespace Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Interaction { using Ca.Infoway.Messagebuilder.Annotation; using Ca.Infoway.Messagebuilder.Model; using Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Common.Mcai_mt700236ca; using Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Common.Mcci_mt002300ca; /** * <summary>Business Name: COMT_IN301002CA: Add note to record * request accepted</summary> * * <p>Indicates that the specified annotation has been * successfully recorded against the requested record.</p> * Message: MCCI_MT002300CA.Message Control Act: * MCAI_MT700236CA.ControlActEvent */ [Hl7PartTypeMappingAttribute(new string[] {"COMT_IN301002CA"})] public class AddNoteToRecordRequestAccepted : HL7Message<Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Common.Mcai_mt700236ca.TriggerEvent>, IInteraction { public AddNoteToRecordRequestAccepted() { } } }
42.244444
167
0.719095
[ "ECL-2.0", "Apache-2.0" ]
CanadaHealthInfoway/message-builder-dotnet
message-builder-release-r02_04_02/Main/Ca/Infoway/Messagebuilder/Model/Pcs_mr2009_r02_04_02/Interaction/AddNoteToRecordRequestAccepted.cs
1,901
C#
using System; using System.Linq; using System.Text; namespace GraphQLParser.Exceptions { public class GraphQLSyntaxErrorException : Exception { public GraphQLSyntaxErrorException(string description, ISource source, int location) : base(ComposeMessage(description, source, location)) { } private static string ComposeMessage(string description, ISource source, int loc) { var location = new Location(source, loc); return $"Syntax Error GraphQL ({location.Line}:{location.Column}) {description}" + "\n" + HighlightSourceAtLocation(source, location); } private static string HighlightSourceAtLocation(ISource source, Location location) { int line = location.Line; string prevLineNum = (line - 1).ToString(); string lineNum = line.ToString(); string nextLineNum = (line + 1).ToString(); int padLen = nextLineNum.Length; string[] lines = source.Body .Split(new string[] { "\n" }, StringSplitOptions.None) .Select(e => ReplaceWithUnicodeRepresentation(e)) .ToArray(); return (line >= 2 ? LeftPad(padLen, prevLineNum) + ": " + lines[line - 2] + "\n" : string.Empty) + LeftPad(padLen, lineNum) + ": " + lines[line - 1] + "\n" + LeftPad(1 + padLen + location.Column, string.Empty) + "^" + "\n" + (line < lines.Length ? LeftPad(padLen, nextLineNum) + ": " + lines[line] + "\n" : string.Empty); } private static string LeftPad(int length, string str) { string pad = string.Empty; for (int i = 0; i < length - str.Length; i++) pad += " "; return pad + str; } private static string ReplaceWithUnicodeRepresentation(string str) { if (!HasReplacementCharacter(str)) return str; var buffer = new StringBuilder(str.Length); foreach (char code in str) { if (IsReplacementCharacter(code)) { buffer.Append(GetUnicodeRepresentation(code)); } else { buffer.Append(code); } } return buffer.ToString(); } private static bool HasReplacementCharacter(string str) { foreach (char code in str) { if (IsReplacementCharacter(code)) return true; } return false; } private static bool IsReplacementCharacter(char code) => code < 0x0020 && code != 0x0009 && code != 0x000A && code != 0x000D; private static string GetUnicodeRepresentation(char code) => code switch { '\0' => "\\u0000", _ => "\\u" + ((int)code).ToString("D4") }; } }
32.645161
133
0.523057
[ "MIT" ]
almazik/parser
src/GraphQLParser/Exceptions/GraphQLSyntaxErrorException.cs
3,036
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.Threading.Tasks; using Microsoft.EntityFrameworkCore.TestUtilities; using Xunit.Abstractions; namespace Microsoft.EntityFrameworkCore.Query { public class NorthwindAggregateOperatorsQuerySqlServerTest : NorthwindAggregateOperatorsQueryTestBase<NorthwindQuerySqlServerFixture<NoopModelCustomizer>> { public NorthwindAggregateOperatorsQuerySqlServerTest(NorthwindQuerySqlServerFixture<NoopModelCustomizer> fixture, ITestOutputHelper testOutputHelper) : base(fixture) { ClearLog(); //Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } public override void Select_All() { base.Select_All(); AssertSql( @"SELECT CASE WHEN NOT EXISTS ( SELECT 1 FROM [Orders] AS [o] WHERE ([o].[CustomerID] <> N'ALFKI') OR [o].[CustomerID] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } public override async Task Sum_with_no_arg(bool async) { await base.Sum_with_no_arg(async); AssertSql( @"SELECT SUM([o].[OrderID]) FROM [Orders] AS [o]"); } public override async Task Sum_with_binary_expression(bool async) { await base.Sum_with_binary_expression(async); AssertSql( @"SELECT SUM([o].[OrderID] * 2) FROM [Orders] AS [o]"); } public override async Task Sum_with_arg(bool async) { await base.Sum_with_arg(async); AssertSql( @"SELECT SUM([o].[OrderID]) FROM [Orders] AS [o]"); } public override async Task Sum_with_arg_expression(bool async) { await base.Sum_with_arg_expression(async); AssertSql( @"SELECT SUM([o].[OrderID] + [o].[OrderID]) FROM [Orders] AS [o]"); } public override async Task Sum_with_division_on_decimal(bool async) { await base.Sum_with_division_on_decimal(async); AssertSql( @"SELECT SUM(CAST([o].[Quantity] AS decimal(18,2)) / 2.09) FROM [Order Details] AS [o]"); } public override async Task Sum_with_division_on_decimal_no_significant_digits(bool async) { await base.Sum_with_division_on_decimal_no_significant_digits(async); AssertSql( @"SELECT SUM(CAST([o].[Quantity] AS decimal(18,2)) / 2.0) FROM [Order Details] AS [o]"); } public override async Task Sum_with_coalesce(bool async) { await base.Sum_with_coalesce(async); AssertSql( @"SELECT SUM(COALESCE([p].[UnitPrice], 0.0)) FROM [Products] AS [p] WHERE [p].[ProductID] < 40"); } public override async Task Sum_over_subquery_is_client_eval(bool async) { await base.Sum_over_subquery_is_client_eval(async); AssertSql( @"SELECT ( SELECT SUM([o].[OrderID]) FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID] ) FROM [Customers] AS [c]"); } public override async Task Sum_over_nested_subquery_is_client_eval(bool async) { await base.Sum_over_nested_subquery_is_client_eval(async); AssertSql( @"SELECT [c].[CustomerID] FROM [Customers] AS [c]"); } public override async Task Sum_over_min_subquery_is_client_eval(bool async) { await base.Sum_over_min_subquery_is_client_eval(async); AssertSql( @"SELECT [c].[CustomerID] FROM [Customers] AS [c]"); } public override async Task Sum_on_float_column(bool async) { await base.Sum_on_float_column(async); AssertSql( @"SELECT CAST(SUM([o].[Discount]) AS real) FROM [Order Details] AS [o] WHERE [o].[ProductID] = 1"); } public override async Task Sum_on_float_column_in_subquery(bool async) { await base.Sum_on_float_column_in_subquery(async); AssertSql( @"SELECT [o0].[OrderID], ( SELECT CAST(SUM([o].[Discount]) AS real) FROM [Order Details] AS [o] WHERE [o0].[OrderID] = [o].[OrderID]) AS [Sum] FROM [Orders] AS [o0] WHERE [o0].[OrderID] < 10300"); } public override async Task Average_with_no_arg(bool async) { await base.Average_with_no_arg(async); AssertSql( @"SELECT AVG(CAST([o].[OrderID] AS float)) FROM [Orders] AS [o]"); } public override async Task Average_with_binary_expression(bool async) { await base.Average_with_binary_expression(async); AssertSql( @"SELECT AVG(CAST(([o].[OrderID] * 2) AS float)) FROM [Orders] AS [o]"); } public override async Task Average_with_arg(bool async) { await base.Average_with_arg(async); AssertSql( @"SELECT AVG(CAST([o].[OrderID] AS float)) FROM [Orders] AS [o]"); } public override async Task Average_with_arg_expression(bool async) { await base.Average_with_arg_expression(async); AssertSql( @"SELECT AVG(CAST(([o].[OrderID] + [o].[OrderID]) AS float)) FROM [Orders] AS [o]"); } public override async Task Average_with_division_on_decimal(bool async) { await base.Average_with_division_on_decimal(async); AssertSql( @"SELECT AVG(CAST([o].[Quantity] AS decimal(18,2)) / 2.09) FROM [Order Details] AS [o]"); } public override async Task Average_with_division_on_decimal_no_significant_digits(bool async) { await base.Average_with_division_on_decimal_no_significant_digits(async); AssertSql( @"SELECT AVG(CAST([o].[Quantity] AS decimal(18,2)) / 2.0) FROM [Order Details] AS [o]"); } public override async Task Average_with_coalesce(bool async) { await base.Average_with_coalesce(async); AssertSql( @"SELECT AVG(COALESCE([p].[UnitPrice], 0.0)) FROM [Products] AS [p] WHERE [p].[ProductID] < 40"); } public override async Task Average_over_subquery_is_client_eval(bool async) { await base.Average_over_subquery_is_client_eval(async); AssertSql( @"SELECT ( SELECT SUM([o].[OrderID]) FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID] ) FROM [Customers] AS [c]"); } public override async Task Average_over_nested_subquery_is_client_eval(bool async) { await base.Average_over_nested_subquery_is_client_eval(async); AssertSql( @"@__p_0='3' SELECT TOP(@__p_0) [c].[CustomerID] FROM [Customers] AS [c] ORDER BY [c].[CustomerID]"); } public override async Task Average_over_max_subquery_is_client_eval(bool async) { await base.Average_over_max_subquery_is_client_eval(async); AssertSql( @"@__p_0='3' SELECT TOP(@__p_0) [c].[CustomerID] FROM [Customers] AS [c] ORDER BY [c].[CustomerID]"); } public override async Task Average_on_float_column(bool async) { await base.Average_on_float_column(async); AssertSql( @"SELECT CAST(AVG([o].[Discount]) AS real) FROM [Order Details] AS [o] WHERE [o].[ProductID] = 1"); } public override async Task Average_on_float_column_in_subquery(bool async) { await base.Average_on_float_column_in_subquery(async); AssertSql( @"SELECT [o0].[OrderID], ( SELECT CAST(AVG([o].[Discount]) AS real) FROM [Order Details] AS [o] WHERE [o0].[OrderID] = [o].[OrderID]) AS [Sum] FROM [Orders] AS [o0] WHERE [o0].[OrderID] < 10300"); } public override async Task Average_on_float_column_in_subquery_with_cast(bool async) { await base.Average_on_float_column_in_subquery_with_cast(async); AssertSql( @"SELECT [o0].[OrderID], ( SELECT CAST(AVG([o].[Discount]) AS real) FROM [Order Details] AS [o] WHERE [o0].[OrderID] = [o].[OrderID]) AS [Sum] FROM [Orders] AS [o0] WHERE [o0].[OrderID] < 10300"); } public override async Task Min_with_no_arg(bool async) { await base.Min_with_no_arg(async); AssertSql( @"SELECT MIN([o].[OrderID]) FROM [Orders] AS [o]"); } public override async Task Min_with_arg(bool async) { await base.Min_with_arg(async); AssertSql( @"SELECT MIN([o].[OrderID]) FROM [Orders] AS [o]"); } public override async Task Min_with_coalesce(bool async) { await base.Min_with_coalesce(async); AssertSql( @"SELECT MIN(COALESCE([p].[UnitPrice], 0.0)) FROM [Products] AS [p] WHERE [p].[ProductID] < 40"); } public override async Task Min_over_subquery_is_client_eval(bool async) { await base.Min_over_subquery_is_client_eval(async); AssertSql( @"SELECT ( SELECT SUM([o].[OrderID]) FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID] ) FROM [Customers] AS [c]"); } public override async Task Min_over_nested_subquery_is_client_eval(bool async) { await base.Min_over_nested_subquery_is_client_eval(async); AssertSql( @"@__p_0='3' SELECT TOP(@__p_0) [c].[CustomerID] FROM [Customers] AS [c] ORDER BY [c].[CustomerID]"); } public override async Task Min_over_max_subquery_is_client_eval(bool async) { await base.Min_over_max_subquery_is_client_eval(async); AssertSql( @"@__p_0='3' SELECT TOP(@__p_0) [c].[CustomerID] FROM [Customers] AS [c] ORDER BY [c].[CustomerID]"); } public override async Task Max_with_no_arg(bool async) { await base.Max_with_no_arg(async); AssertSql( @"SELECT MAX([o].[OrderID]) FROM [Orders] AS [o]"); } public override async Task Max_with_arg(bool async) { await base.Max_with_arg(async); AssertSql( @"SELECT MAX([o].[OrderID]) FROM [Orders] AS [o]"); } public override async Task Max_with_coalesce(bool async) { await base.Max_with_coalesce(async); AssertSql( @"SELECT MAX(COALESCE([p].[UnitPrice], 0.0)) FROM [Products] AS [p] WHERE [p].[ProductID] < 40"); } public override async Task Max_over_subquery_is_client_eval(bool async) { await base.Max_over_subquery_is_client_eval(async); AssertSql( @"SELECT ( SELECT SUM([o].[OrderID]) FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID] ) FROM [Customers] AS [c]"); } public override async Task Max_over_nested_subquery_is_client_eval(bool async) { await base.Max_over_nested_subquery_is_client_eval(async); AssertSql( @"@__p_0='3' SELECT TOP(@__p_0) [c].[CustomerID] FROM [Customers] AS [c] ORDER BY [c].[CustomerID]"); } public override async Task Max_over_sum_subquery_is_client_eval(bool async) { await base.Max_over_sum_subquery_is_client_eval(async); AssertSql( @"@__p_0='3' SELECT TOP(@__p_0) [c].[CustomerID] FROM [Customers] AS [c] ORDER BY [c].[CustomerID]"); } public override async Task Count_with_predicate(bool async) { await base.Count_with_predicate(async); AssertSql( @"SELECT COUNT(*) FROM [Orders] AS [o] WHERE [o].[CustomerID] = N'ALFKI'"); } public override async Task Where_OrderBy_Count(bool async) { await base.Where_OrderBy_Count(async); AssertSql( @"SELECT COUNT(*) FROM [Orders] AS [o] WHERE [o].[CustomerID] = N'ALFKI'"); } public override async Task OrderBy_Where_Count(bool async) { await base.OrderBy_Where_Count(async); AssertSql( @"SELECT COUNT(*) FROM [Orders] AS [o] WHERE [o].[CustomerID] = N'ALFKI'"); } public override async Task OrderBy_Count_with_predicate(bool async) { await base.OrderBy_Count_with_predicate(async); AssertSql( @"SELECT COUNT(*) FROM [Orders] AS [o] WHERE [o].[CustomerID] = N'ALFKI'"); } public override async Task OrderBy_Where_Count_with_predicate(bool async) { await base.OrderBy_Where_Count_with_predicate(async); AssertSql( @"SELECT COUNT(*) FROM [Orders] AS [o] WHERE ([o].[OrderID] > 10) AND (([o].[CustomerID] <> N'ALFKI') OR [o].[CustomerID] IS NULL)"); } public override async Task Distinct(bool async) { await base.Distinct(async); AssertSql( @"SELECT DISTINCT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c]"); } public override async Task Distinct_Scalar(bool async) { await base.Distinct_Scalar(async); AssertSql( @"SELECT DISTINCT [c].[City] FROM [Customers] AS [c]"); } public override async Task OrderBy_Distinct(bool async) { await base.OrderBy_Distinct(async); // Ordering not preserved by distinct when ordering columns not projected. AssertSql( @"SELECT DISTINCT [c].[City] FROM [Customers] AS [c]"); } public override async Task Distinct_OrderBy(bool async) { await base.Distinct_OrderBy(async); AssertSql( @"SELECT [t].[Country] FROM ( SELECT DISTINCT [c].[Country] FROM [Customers] AS [c] ) AS [t] ORDER BY [t].[Country]"); } public override async Task Distinct_OrderBy2(bool async) { await base.Distinct_OrderBy2(async); AssertSql( @"SELECT [t].[CustomerID], [t].[Address], [t].[City], [t].[CompanyName], [t].[ContactName], [t].[ContactTitle], [t].[Country], [t].[Fax], [t].[Phone], [t].[PostalCode], [t].[Region] FROM ( SELECT DISTINCT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] ) AS [t] ORDER BY [t].[CustomerID]"); } public override async Task Distinct_OrderBy3(bool async) { await base.Distinct_OrderBy3(async); AssertSql( @"SELECT [t].[CustomerID] FROM ( SELECT DISTINCT [c].[CustomerID] FROM [Customers] AS [c] ) AS [t] ORDER BY [t].[CustomerID]"); } public override async Task Distinct_Count(bool async) { await base.Distinct_Count(async); AssertSql( @"SELECT COUNT(*) FROM ( SELECT DISTINCT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] ) AS [t]"); } public override async Task Select_Select_Distinct_Count(bool async) { await base.Select_Select_Distinct_Count(async); AssertSql( @"SELECT COUNT(*) FROM ( SELECT DISTINCT [c].[City] FROM [Customers] AS [c] ) AS [t]"); } public override async Task Single_Predicate(bool async) { await base.Single_Predicate(async); AssertSql( @"SELECT TOP(2) [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] = N'ALFKI'"); } public override async Task FirstOrDefault_inside_subquery_gets_server_evaluated(bool async) { await base.FirstOrDefault_inside_subquery_gets_server_evaluated(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE ([c].[CustomerID] = N'ALFKI') AND (( SELECT TOP(1) [o].[CustomerID] FROM [Orders] AS [o] WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[CustomerID] = N'ALFKI')) = N'ALFKI')"); } public override async Task Multiple_collection_navigation_with_FirstOrDefault_chained(bool async) { await base.Multiple_collection_navigation_with_FirstOrDefault_chained(async); AssertSql( @"SELECT [c].[CustomerID] FROM [Customers] AS [c] ORDER BY [c].[CustomerID]", // @"@_outer_CustomerID='ALFKI' (Size = 5) SELECT TOP(1) [od].[OrderID], [od].[ProductID], [od].[Discount], [od].[Quantity], [od].[UnitPrice] FROM [Order Details] AS [od] WHERE [od].[OrderID] = COALESCE(( SELECT TOP(1) [o].[OrderID] FROM [Orders] AS [o] WHERE @_outer_CustomerID = [o].[CustomerID] ORDER BY [o].[OrderID] ), 0) ORDER BY [od].[ProductID]", // @"@_outer_CustomerID='ANATR' (Size = 5) SELECT TOP(1) [od].[OrderID], [od].[ProductID], [od].[Discount], [od].[Quantity], [od].[UnitPrice] FROM [Order Details] AS [od] WHERE [od].[OrderID] = COALESCE(( SELECT TOP(1) [o].[OrderID] FROM [Orders] AS [o] WHERE @_outer_CustomerID = [o].[CustomerID] ORDER BY [o].[OrderID] ), 0) ORDER BY [od].[ProductID]"); } public override async Task Multiple_collection_navigation_with_FirstOrDefault_chained_projecting_scalar(bool async) { await base.Multiple_collection_navigation_with_FirstOrDefault_chained_projecting_scalar(async); AssertSql( @"SELECT ( SELECT TOP(1) [o].[ProductID] FROM [Order Details] AS [o] WHERE ( SELECT TOP(1) [o0].[OrderID] FROM [Orders] AS [o0] WHERE [c].[CustomerID] = [o0].[CustomerID] ORDER BY [o0].[OrderID]) IS NOT NULL AND (( SELECT TOP(1) [o1].[OrderID] FROM [Orders] AS [o1] WHERE [c].[CustomerID] = [o1].[CustomerID] ORDER BY [o1].[OrderID]) = [o].[OrderID]) ORDER BY [o].[ProductID]) FROM [Customers] AS [c] ORDER BY [c].[CustomerID]"); } public override async Task First_inside_subquery_gets_client_evaluated(bool async) { await base.First_inside_subquery_gets_client_evaluated(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE ([c].[CustomerID] = N'ALFKI') AND (( SELECT TOP(1) [o].[CustomerID] FROM [Orders] AS [o] WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[CustomerID] = N'ALFKI')) = N'ALFKI')"); } public override async Task Last(bool async) { await base.Last(async); AssertSql( @"SELECT TOP(1) [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] ORDER BY [c].[ContactName] DESC"); } public override async Task Last_Predicate(bool async) { await base.Last_Predicate(async); AssertSql( @"SELECT TOP(1) [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[City] = N'London' ORDER BY [c].[ContactName] DESC"); } public override async Task Where_Last(bool async) { await base.Where_Last(async); AssertSql( @"SELECT TOP(1) [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[City] = N'London' ORDER BY [c].[ContactName] DESC"); } public override async Task LastOrDefault(bool async) { await base.LastOrDefault(async); AssertSql( @"SELECT TOP(1) [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] ORDER BY [c].[ContactName] DESC"); } public override async Task LastOrDefault_Predicate(bool async) { await base.LastOrDefault_Predicate(async); AssertSql( @"SELECT TOP(1) [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[City] = N'London' ORDER BY [c].[ContactName] DESC"); } public override async Task Where_LastOrDefault(bool async) { await base.Where_LastOrDefault(async); AssertSql( @"SELECT TOP(1) [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[City] = N'London' ORDER BY [c].[ContactName] DESC"); } public override async Task Contains_with_subquery(bool async) { await base.Contains_with_subquery(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN ( SELECT [o].[CustomerID] FROM [Orders] AS [o] )"); } public override async Task Contains_with_local_array_closure(bool async) { await base.Contains_with_local_array_closure(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ABCDE', N'ALFKI')", // @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ABCDE')"); } public override async Task Contains_with_subquery_and_local_array_closure(bool async) { await base.Contains_with_subquery_and_local_array_closure(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Customers] AS [c0] WHERE [c0].[City] IN (N'London', N'Buenos Aires') AND ([c0].[CustomerID] = [c].[CustomerID]))", // @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Customers] AS [c0] WHERE [c0].[City] IN (N'London') AND ([c0].[CustomerID] = [c].[CustomerID]))"); } public override async Task Contains_with_local_uint_array_closure(bool async) { await base.Contains_with_local_uint_array_closure(async); AssertSql( @"SELECT [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Employees] AS [e] WHERE [e].[EmployeeID] IN (0, 1)", // @"SELECT [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Employees] AS [e] WHERE [e].[EmployeeID] IN (0)"); } public override async Task Contains_with_local_nullable_uint_array_closure(bool async) { await base.Contains_with_local_nullable_uint_array_closure(async); AssertSql( @"SELECT [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Employees] AS [e] WHERE [e].[EmployeeID] IN (0, 1)", // @"SELECT [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Employees] AS [e] WHERE [e].[EmployeeID] IN (0)"); } public override async Task Contains_with_local_array_inline(bool async) { await base.Contains_with_local_array_inline(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ABCDE', N'ALFKI')"); } public override async Task Contains_with_local_list_closure(bool async) { await base.Contains_with_local_list_closure(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ABCDE', N'ALFKI')"); } public override async Task Contains_with_local_object_list_closure(bool async) { await base.Contains_with_local_object_list_closure(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ABCDE', N'ALFKI')"); } public override async Task Contains_with_local_list_closure_all_null(bool async) { await base.Contains_with_local_list_closure_all_null(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE CAST(0 AS bit) = CAST(1 AS bit)"); } public override async Task Contains_with_local_list_inline(bool async) { await base.Contains_with_local_list_inline(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ABCDE', N'ALFKI')"); } public override async Task Contains_with_local_list_inline_closure_mix(bool async) { await base.Contains_with_local_list_inline_closure_mix(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ABCDE', N'ALFKI')", // @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ABCDE', N'ANATR')"); } public override async Task Contains_with_local_non_primitive_list_inline_closure_mix(bool async) { await base.Contains_with_local_non_primitive_list_inline_closure_mix(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ABCDE', N'ALFKI')", // @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ABCDE', N'ANATR')"); } public override async Task Contains_with_local_non_primitive_list_closure_mix(bool async) { await base.Contains_with_local_non_primitive_list_closure_mix(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ABCDE', N'ALFKI')"); } public override async Task Contains_with_local_collection_false(bool async) { await base.Contains_with_local_collection_false(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] NOT IN (N'ABCDE', N'ALFKI')"); } public override async Task Contains_with_local_collection_complex_predicate_and(bool async) { await base.Contains_with_local_collection_complex_predicate_and(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE (([c].[CustomerID] = N'ALFKI') OR ([c].[CustomerID] = N'ABCDE')) AND [c].[CustomerID] IN (N'ABCDE', N'ALFKI')"); } public override async Task Contains_with_local_collection_complex_predicate_or(bool async) { await base.Contains_with_local_collection_complex_predicate_or(async); // issue #18791 // AssertSql( // @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] //FROM [Customers] AS [c] //WHERE [c].[CustomerID] IN (N'ABCDE', N'ALFKI', N'ALFKI', N'ABCDE')"); } public override async Task Contains_with_local_collection_complex_predicate_not_matching_ins1(bool async) { await base.Contains_with_local_collection_complex_predicate_not_matching_ins1(async); // issue #18791 // AssertSql( // @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] //FROM [Customers] AS [c] //WHERE [c].[CustomerID] IN (N'ALFKI', N'ABCDE') OR [c].[CustomerID] NOT IN (N'ABCDE', N'ALFKI')"); } public override async Task Contains_with_local_collection_complex_predicate_not_matching_ins2(bool async) { await base.Contains_with_local_collection_complex_predicate_not_matching_ins2(async); // issue #18791 // AssertSql( // @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] //FROM [Customers] AS [c] //WHERE [c].[CustomerID] IN (N'ABCDE', N'ALFKI') AND [c].[CustomerID] NOT IN (N'ALFKI', N'ABCDE')"); } public override async Task Contains_with_local_collection_sql_injection(bool async) { await base.Contains_with_local_collection_sql_injection(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ALFKI', N'ABC'')); GO; DROP TABLE Orders; GO; --') OR (([c].[CustomerID] = N'ALFKI') OR ([c].[CustomerID] = N'ABCDE'))"); } public override async Task Contains_with_local_collection_empty_closure(bool async) { await base.Contains_with_local_collection_empty_closure(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE CAST(1 AS bit) = CAST(0 AS bit)"); } public override async Task Contains_with_local_collection_empty_inline(bool async) { await base.Contains_with_local_collection_empty_inline(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE CAST(1 AS bit) = CAST(1 AS bit)"); } public override async Task Contains_top_level(bool async) { await base.Contains_top_level(async); AssertSql( @"@__p_0='ALFKI' (Size = 4000) SELECT CASE WHEN @__p_0 IN ( SELECT [c].[CustomerID] FROM [Customers] AS [c] ) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } public override async Task Contains_with_local_anonymous_type_array_closure(bool async) { await base.Contains_with_local_anonymous_type_array_closure(async); AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o]", // @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o]"); } public override void OfType_Select() { base.OfType_Select(); AssertSql( @"SELECT TOP(1) [c].[City] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] ORDER BY [o].[OrderID]"); } public override void OfType_Select_OfType_Select() { base.OfType_Select_OfType_Select(); AssertSql( @"SELECT TOP(1) [c].[City] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] ORDER BY [o].[OrderID]"); } public override async Task Average_with_non_matching_types_in_projection_doesnt_produce_second_explicit_cast(bool async) { await base.Average_with_non_matching_types_in_projection_doesnt_produce_second_explicit_cast(async); AssertSql( @"SELECT AVG(CAST(CAST([o].[OrderID] AS bigint) AS float)) FROM [Orders] AS [o] WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')"); } public override async Task Max_with_non_matching_types_in_projection_introduces_explicit_cast(bool async) { await base.Max_with_non_matching_types_in_projection_introduces_explicit_cast(async); AssertSql( @"SELECT MAX(CAST([o].[OrderID] AS bigint)) FROM [Orders] AS [o] WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')"); } public override async Task Min_with_non_matching_types_in_projection_introduces_explicit_cast(bool async) { await base.Min_with_non_matching_types_in_projection_introduces_explicit_cast(async); AssertSql( @"SELECT MIN(CAST([o].[OrderID] AS bigint)) FROM [Orders] AS [o] WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')"); } public override async Task OrderBy_Take_Last_gives_correct_result(bool async) { await base.OrderBy_Take_Last_gives_correct_result(async); AssertSql( @"@__p_0='20' SELECT TOP(1) [t].[CustomerID], [t].[Address], [t].[City], [t].[CompanyName], [t].[ContactName], [t].[ContactTitle], [t].[Country], [t].[Fax], [t].[Phone], [t].[PostalCode], [t].[Region] FROM ( SELECT TOP(@__p_0) [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] ORDER BY [c].[CustomerID] ) AS [t] ORDER BY [t].[CustomerID] DESC"); } public override async Task OrderBy_Skip_Last_gives_correct_result(bool async) { await base.OrderBy_Skip_Last_gives_correct_result(async); AssertSql( @"@__p_0='20' SELECT TOP(1) [t].[CustomerID], [t].[Address], [t].[City], [t].[CompanyName], [t].[ContactName], [t].[ContactTitle], [t].[Country], [t].[Fax], [t].[Phone], [t].[PostalCode], [t].[Region] FROM ( SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] ORDER BY [c].[CustomerID] OFFSET @__p_0 ROWS ) AS [t] ORDER BY [t].[CustomerID] DESC"); } public override void Contains_over_entityType_should_rewrite_to_identity_equality() { base.Contains_over_entityType_should_rewrite_to_identity_equality(); AssertSql( @"SELECT TOP(2) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] WHERE [o].[OrderID] = 10248", // @"@__entity_equality_p_0_OrderID='10248' (Nullable = true) SELECT CASE WHEN @__entity_equality_p_0_OrderID IN ( SELECT [o].[OrderID] FROM [Orders] AS [o] WHERE [o].[CustomerID] = N'VINET' ) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } public override async Task List_Contains_over_entityType_should_rewrite_to_identity_equality(bool async) { await base.List_Contains_over_entityType_should_rewrite_to_identity_equality(async); AssertSql( @"@__entity_equality_someOrder_0_OrderID='10248' (Nullable = true) SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE @__entity_equality_someOrder_0_OrderID IN ( SELECT [o].[OrderID] FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID] )"); } public override async Task List_Contains_with_constant_list(bool async) { await base.List_Contains_with_constant_list(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ALFKI', N'ANATR')"); } public override async Task List_Contains_with_parameter_list(bool async) { await base.List_Contains_with_parameter_list(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ALFKI', N'ANATR')"); } public override async Task Contains_with_parameter_list_value_type_id(bool async) { await base.Contains_with_parameter_list_value_type_id(async); AssertSql( @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] WHERE [o].[OrderID] IN (10248, 10249)"); } public override async Task Contains_with_constant_list_value_type_id(bool async) { await base.Contains_with_constant_list_value_type_id(async); AssertSql( @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] WHERE [o].[OrderID] IN (10248, 10249)"); } public override async Task HashSet_Contains_with_parameter(bool async) { await base.HashSet_Contains_with_parameter(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ALFKI')"); } public override async Task ImmutableHashSet_Contains_with_parameter(bool async) { await base.ImmutableHashSet_Contains_with_parameter(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ALFKI')"); } public override void Contains_over_entityType_with_null_should_rewrite_to_identity_equality() { base.Contains_over_entityType_with_null_should_rewrite_to_identity_equality(); AssertSql( @"@__entity_equality_p_0_OrderID=NULL (DbType = Int32) SELECT CASE WHEN @__entity_equality_p_0_OrderID IN ( SELECT [o].[OrderID] FROM [Orders] AS [o] WHERE [o].[CustomerID] = N'VINET' ) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } public override async Task String_FirstOrDefault_in_projection_does_client_eval(bool async) { await base.String_FirstOrDefault_in_projection_does_client_eval(async); AssertSql( @"SELECT [c].[CustomerID] FROM [Customers] AS [c]"); } public override async Task Project_constant_Sum(bool async) { await base.Project_constant_Sum(async); AssertSql( @"SELECT SUM(1) FROM [Employees] AS [e]"); } public override async Task Where_subquery_any_equals_operator(bool async) { await base.Where_subquery_any_equals_operator(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ABCDE', N'ALFKI', N'ANATR')"); } public override async Task Where_subquery_any_equals(bool async) { await base.Where_subquery_any_equals(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ABCDE', N'ALFKI', N'ANATR')"); } public override async Task Where_subquery_any_equals_static(bool async) { await base.Where_subquery_any_equals_static(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] IN (N'ABCDE', N'ALFKI', N'ANATR')"); } public override async Task Where_subquery_where_any(bool async) { await base.Where_subquery_where_any(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE ([c].[City] = N'México D.F.') AND [c].[CustomerID] IN (N'ABCDE', N'ALFKI', N'ANATR')", // @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE ([c].[City] = N'México D.F.') AND [c].[CustomerID] IN (N'ABCDE', N'ALFKI', N'ANATR')"); } public override async Task Where_subquery_all_not_equals_operator(bool async) { await base.Where_subquery_all_not_equals_operator(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] NOT IN (N'ABCDE', N'ALFKI', N'ANATR')"); } public override async Task Where_subquery_all_not_equals(bool async) { await base.Where_subquery_all_not_equals(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] NOT IN (N'ABCDE', N'ALFKI', N'ANATR')"); } public override async Task Where_subquery_all_not_equals_static(bool async) { await base.Where_subquery_all_not_equals_static(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE [c].[CustomerID] NOT IN (N'ABCDE', N'ALFKI', N'ANATR')"); } public override async Task Where_subquery_where_all(bool async) { await base.Where_subquery_where_all(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE ([c].[City] = N'México D.F.') AND [c].[CustomerID] NOT IN (N'ABCDE', N'ALFKI', N'ANATR')", // @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE ([c].[City] = N'México D.F.') AND [c].[CustomerID] NOT IN (N'ABCDE', N'ALFKI', N'ANATR')"); } public override async Task Cast_to_same_Type_Count_works(bool async) { await base.Cast_to_same_Type_Count_works(async); AssertSql( @"SELECT COUNT(*) FROM [Customers] AS [c]"); } public override async Task Cast_before_aggregate_is_preserved(bool async) { await base.Cast_before_aggregate_is_preserved(async); AssertSql( @"SELECT ( SELECT AVG(CAST([o].[OrderID] AS float)) FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID]) FROM [Customers] AS [c]"); } public override async Task DefaultIfEmpty_selects_only_required_columns(bool async) { await base.DefaultIfEmpty_selects_only_required_columns(async); AssertSql( @"SELECT [p].[ProductName] FROM ( SELECT NULL AS [empty] ) AS [empty] LEFT JOIN [Products] AS [p] ON 1 = 1"); } public override async Task Collection_Last_member_access_in_projection_translated(bool async) { await base.Collection_Last_member_access_in_projection_translated(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE ([c].[CustomerID] LIKE N'F%') AND (( SELECT TOP(1) [o].[CustomerID] FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID] ORDER BY [o].[OrderID]) = [c].[CustomerID])"); } public override async Task Collection_LastOrDefault_member_access_in_projection_translated(bool async) { await base.Collection_LastOrDefault_member_access_in_projection_translated(async); AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] WHERE ([c].[CustomerID] LIKE N'F%') AND (( SELECT TOP(1) [o].[CustomerID] FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID] ORDER BY [o].[OrderID]) = [c].[CustomerID])"); } public override async Task Sum_over_explicit_cast_over_column(bool async) { await base.Sum_over_explicit_cast_over_column(async); AssertSql( @"SELECT SUM(CAST([o].[OrderID] AS bigint)) FROM [Orders] AS [o]"); } public override async Task Count_on_projection_with_client_eval(bool async) { await base.Count_on_projection_with_client_eval(async); AssertSql( @"SELECT COUNT(*) FROM [Orders] AS [o]", // @"SELECT COUNT(*) FROM [Orders] AS [o]", // @"SELECT COUNT(*) FROM [Orders] AS [o]"); } private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); protected override void ClearLog() => Fixture.TestSqlLoggerFactory.Clear(); } }
37.341516
211
0.581906
[ "Apache-2.0" ]
ivaylokenov/EntityFrameworkCore
test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs
51,724
C#
using Microsoft.Crm.Sdk.Messages; using Microsoft.Xrm.Sdk; using System; using System.Collections.Generic; using System.ServiceModel; namespace FakeXrmEasy.FakeMessageExecutors { public class AssignRequestExecutor : IFakeMessageExecutor { public bool CanExecute(OrganizationRequest request) { return request is AssignRequest; } public OrganizationResponse Execute(OrganizationRequest request, XrmFakedContext ctx) { var assignRequest = (AssignRequest)request; var target = assignRequest.Target; var assignee = assignRequest.Assignee; if (target == null) { throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), "Can not assign without target"); } if (assignee == null) { throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), "Can not assign without assignee"); } var service = ctx.GetOrganizationService(); KeyValuePair<string, object> owningX = new KeyValuePair<string, object>(); if (assignee.LogicalName == "systemuser") owningX = new KeyValuePair<string, object>("owninguser", assignee); else if (assignee.LogicalName == "team") owningX = new KeyValuePair<string, object>("owningteam", assignee); var assignment = new Entity { LogicalName = target.LogicalName, Id = target.Id, Attributes = new AttributeCollection { { "ownerid", assignee }, owningX } }; service.Update(assignment); return new AssignResponse(); } public Type GetResponsibleRequestType() { return typeof(AssignRequest); } } }
31.790323
134
0.583968
[ "MIT" ]
AK-RenegadeX/fake-xrm-easy
FakeXrmEasy.Shared/FakeMessageExecutors/AssignRequestExecutor.cs
1,973
C#
using TARGET = UnityEngine.Transform; namespace Lean.Transition.Method { /// <summary>This component allows you to transition the Transform's localScale.y value.</summary> [UnityEngine.HelpURL(LeanTransition.HelpUrlPrefix + "LeanTransformLocalScale_y")] [UnityEngine.AddComponentMenu(LeanTransition.MethodsMenuPrefix + "Transform/Transform.localScale.y" + LeanTransition.MethodsMenuSuffix + "(LeanTransformLocalScale_y)")] public class LeanTransformLocalScale_y : LeanMethodWithStateAndTarget { public override System.Type GetTargetType() { return typeof(TARGET); } public override void Register() { PreviousState = Register(GetAliasedTarget(Data.Target), Data.Value, Data.Duration, Data.Ease); } public static LeanState Register(TARGET target, float value, float duration, LeanEase ease = LeanEase.Smooth) { var state = LeanTransition.SpawnWithTarget(State.Pool, target); state.Value = value; state.Ease = ease; return LeanTransition.Register(state, duration); } [System.Serializable] public class State : LeanStateWithTarget<TARGET> { [UnityEngine.Tooltip("The localScale value will transition to this.")] [UnityEngine.Serialization.FormerlySerializedAs("Scale")]public float Value; [UnityEngine.Tooltip("This allows you to control how the transition will look.")] public LeanEase Ease = LeanEase.Smooth; [System.NonSerialized] private float oldValue; public override int CanFill { get { return Target != null && Target.localScale.y != Value ? 1 : 0; } } public override void FillWithTarget() { Value = Target.localScale.y; } public override void BeginWithTarget() { oldValue = Target.localScale.y; } public override void UpdateWithTarget(float progress) { var vector = Target.localScale; vector.y = UnityEngine.Mathf.LerpUnclamped(oldValue, Value, Smooth(Ease, progress)); Target.localScale = vector; } public static System.Collections.Generic.Stack<State> Pool = new System.Collections.Generic.Stack<State>(); public override void Despawn() { Pool.Push(this); } } public State Data; } } namespace Lean.Transition { public static partial class LeanExtensions { public static TARGET localScaleTransition_y(this TARGET target, float value, float duration, LeanEase ease = LeanEase.Smooth) { Method.LeanTransformLocalScale_y.Register(target, value, duration, ease); return target; } } }
30.058824
170
0.710763
[ "MIT" ]
pannapat/flow-chart-tool
FlowChartTool/Assets/Lean/Transition/Methods/Transform/LeanTransformLocalScale_y.cs
2,555
C#
using Microsoft.EntityFrameworkCore.Migrations; namespace DbMigrator.Migrations { public partial class user_table_enhancements : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.EnsureSchema( name: "account"); migrationBuilder.RenameTable( name: "User", newName: "User", newSchema: "account"); migrationBuilder.AddColumn<bool>( name: "HasValidPayment", schema: "account", table: "User", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn<bool>( name: "HasValidatedEmail", schema: "account", table: "User", type: "boolean", nullable: false, defaultValue: false); migrationBuilder.AddColumn<string>( name: "Password", schema: "account", table: "User", type: "character varying(250)", maxLength: 250, nullable: true); migrationBuilder.AddColumn<string>( name: "PasswordResetToken", schema: "account", table: "User", type: "character varying(150)", maxLength: 150, nullable: true); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "HasValidPayment", schema: "account", table: "User"); migrationBuilder.DropColumn( name: "HasValidatedEmail", schema: "account", table: "User"); migrationBuilder.DropColumn( name: "Password", schema: "account", table: "User"); migrationBuilder.DropColumn( name: "PasswordResetToken", schema: "account", table: "User"); migrationBuilder.RenameTable( name: "User", schema: "account", newName: "User"); } } }
29.810127
71
0.474735
[ "MIT" ]
bilalyasin1616/stripe-integration-dotnet
backend/DbMigrator/Migrations/20210727045557_user_table_enhancements.cs
2,357
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("Interviewer.Xamarin.WinPhone.WindowsPhone")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Interviewer.Xamarin.WinPhone.WindowsPhone")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: ComVisible(false)]
37.896552
84
0.749773
[ "Apache-2.0" ]
forki/Labs
Interviewer.Xamarin/Interviewer.Xamarin.WinPhone/Properties/AssemblyInfo.cs
1,102
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("AlmToolkit")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ALM Toolkit")] [assembly: AssemblyCopyright("Copyright © 2018")] [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("765c0612-bb8f-4261-87ae-b5b842be3c26")] // 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("5.0.2.0")] [assembly: AssemblyFileVersion("5.0.2.0")]
37.540541
84
0.74658
[ "MIT" ]
vestergaardj/Analysis-Services
BismNormalizer/AlmToolkit/Properties/AssemblyInfo.cs
1,392
C#
using System; using System.Xml.Serialization; namespace Alipay.AopSdk.Core.Domain { /// <summary> /// AlipaySecurityProdFingerprintDeleteModel Data Structure. /// </summary> [Serializable] public class AlipaySecurityProdFingerprintDeleteModel : AopObject { /// <summary> /// IFAA协议的版本,目前为2.0 /// </summary> [XmlElement("ifaa_version")] public string IfaaVersion { get; set; } /// <summary> /// IFAA协议客户端静态信息,调用IFAA客户端SDK接口获取secData,透传至本参数。此参数是为了兼容IFAA1.0而设计的,接入方可根据是否需要接入IFAA1.0来决定是否要传(只接入IFAA2.0不需要传) /// </summary> [XmlElement("sec_data")] public string SecData { get; set; } /// <summary> /// IFAA标准中用于关联IFAA Server和业务方Server开通状态的token,此token为注册时保存的token,传入此token,用于生成服务端去注册信息。 /// </summary> [XmlElement("token")] public string Token { get; set; } } }
29.258065
119
0.631753
[ "MIT" ]
leixf2005/Alipay.AopSdk.Core
Alipay.AopSdk.Core/Domain/AlipaySecurityProdFingerprintDeleteModel.cs
1,143
C#
using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Localization; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Security.Claims; using System.Threading.Tasks; using VueCoreFramework.API; using VueCoreFramework.Core.Data.Identity; using VueCoreFramework.Core.Extensions; using VueCoreFramework.Core.Models; using VueCoreFramework.Sample.Data; using VueCoreFramework.Sample.Models; namespace VueCoreFramework.Test.Data { [TestClass] public class RepositoryTest { private static ApplicationDbContext context; private static IStringLocalizer<Startup> _localizer; [ClassInitialize] public static void Setup(TestContext testContext) { var optionsBuilder = new DbContextOptionsBuilder<ApplicationDbContext>(); optionsBuilder.UseInMemoryDatabase("test"); context = new ApplicationDbContext(optionsBuilder.Options); var mock = new Mock<IStringLocalizer<Startup>>(); mock.Setup(x => x[It.IsAny<string>()]).Returns<string>(x => new LocalizedString(x, x)); _localizer = mock.Object; } [TestMethod] public async Task AddAsync_NoNavProp() { var repo = context.GetRepositoryForType(typeof(Country)); await repo.AddAsync(null, null, "en-US", _localizer); var item = context.Countries.FirstOrDefault(); Assert.IsNotNull(item); } [TestMethod] public async Task AddAsync_WithNavProp() { var repo = context.GetRepositoryForType(typeof(City)); var childProp = typeof(City).GetProperty(nameof(City.Country)); var navProp = typeof(City).GetProperty(nameof(City.CountryId)); await repo.AddAsync(childProp, Guid.Empty.ToString(), "en-US", _localizer); var item = context.Cities.FirstOrDefault(); Assert.IsNotNull(item); Assert.AreEqual(Guid.Empty, navProp.GetValue(item)); } [TestMethod] public async Task AddChildrenToCollectionAsyncTest() { var parentRepo = context.GetRepositoryForType(typeof(Country)); var childRepo = context.GetRepositoryForType(typeof(Airline)); var childProp = typeof(Country).GetProperty(nameof(Country.Airlines)); await parentRepo.AddAsync(null, null, "en-US", _localizer); var parent = context.Countries.FirstOrDefault(); Assert.IsNotNull(parent); await childRepo.AddAsync(null, null, "en-US", _localizer); var child = context.Airlines.FirstOrDefault(); Assert.IsNotNull(child); await parentRepo.AddChildrenToCollectionAsync(parent.Id.ToString(), childProp, new string[] { child.Id.ToString() }); Assert.AreEqual(1, parent.Airlines.Count); Assert.AreEqual(parent.Id, parent.Airlines.FirstOrDefault().CountryId); Assert.AreEqual(child.Id, parent.Airlines.FirstOrDefault().AirlineId); } [TestMethod] public async Task DuplicateAsyncTest() { var repo = context.GetRepositoryForType(typeof(Country)); await repo.AddAsync(null, null, "en-US", _localizer); var item = context.Countries.FirstOrDefault(); await repo.DuplicateAsync(item.Id.ToString(), "en-US", _localizer); } [TestMethod] public async Task FindAsync_ItemPresent() { var repo = context.GetRepositoryForType(typeof(Country)); await repo.AddAsync(null, null, "en-US", _localizer); var item = context.Countries.FirstOrDefault(); Assert.IsNotNull(item); var vm = await repo.FindAsync(item.Id.ToString(), "en-US", _localizer); Assert.IsTrue(vm.Keys.Contains(nameof(DataItem.Id).ToInitialLower())); Assert.AreEqual(item.Id.ToString(), vm[nameof(DataItem.Id).ToInitialLower()]); } [TestMethod] public async Task FindAsync_ItemNotPresent() { var repo = context.GetRepositoryForType(typeof(Country)); var vm = await repo.FindAsync(Guid.Empty.ToString(), "en-US", _localizer); Assert.IsTrue(vm.Keys.Contains(nameof(DataItem.Id).ToInitialLower())); Assert.IsNull(vm[nameof(DataItem.Id).ToInitialLower()]); } [TestMethod] public async Task FindItemAsync_ItemPresent() { var repo = context.GetRepositoryForType(typeof(Country)); await repo.AddAsync(null, null, "en-US", _localizer); var item = context.Countries.FirstOrDefault(); Assert.IsNotNull(item); var found = await repo.FindItemAsync(item.Id.ToString()); Assert.AreEqual(item, found); } [TestMethod] public async Task FindItemAsync_ItemNotPresent() { var repo = context.GetRepositoryForType(typeof(Country)); var item = await repo.FindItemAsync(Guid.Empty.ToString()); Assert.IsNull(item); } [TestMethod] public async Task GetAll_ItemsPresent() { var repo = context.GetRepositoryForType(typeof(Country)); await repo.AddAsync(null, null, "en-US", _localizer); await repo.AddAsync(null, null, "en-US", _localizer); var count = context.Countries.Count(); var vms = await repo.GetAllAsync("en-US", _localizer); Assert.AreEqual(count, vms.Count()); } [TestMethod] public async Task GetAll_NoItemsPresent() { var repo = context.GetRepositoryForType(typeof(Country)); await repo.RemoveRangeAsync(context.Countries.Select(c => c.Id.ToString())); var vms = await repo.GetAllAsync("en-US", _localizer); Assert.AreEqual(0, vms.Count()); } [TestMethod] public async Task GetChildIdAsyncTest() { var parentRepo = context.GetRepositoryForType(typeof(Country)); var childRepo = context.GetRepositoryForType(typeof(Leader)); await parentRepo.AddAsync(null, null, "en-US", _localizer); var parent = context.Countries.FirstOrDefault(); Assert.IsNotNull(parent); var parentProp = typeof(Country).GetProperty(nameof(Country.Leader)); var childProp = typeof(Leader).GetProperty(nameof(Leader.Country)); var vm = await childRepo.AddAsync(childProp, parent.Id.ToString(), "en-US", _localizer); var childId = vm[nameof(DataItem.Id).ToInitialLower()]; var id = await parentRepo.GetChildIdAsync(parent.Id.ToString(), parentProp); Assert.AreEqual(childId, id); } [TestMethod] public async Task GetChildTotalAsyncTest() { var parentRepo = context.GetRepositoryForType(typeof(Country)); var childRepo = context.GetRepositoryForType(typeof(City)); await parentRepo.AddAsync(null, null, "en-US", _localizer); var parent = context.Countries.FirstOrDefault(); Assert.IsNotNull(parent); var parentProp = typeof(Country).GetProperty(nameof(Country.Cities)); var childProp = typeof(City).GetProperty(nameof(City.Country)); await childRepo.AddAsync(childProp, parent.Id.ToString(), "en-US", _localizer); var total = await parentRepo.GetChildTotalAsync(parent.Id.ToString(), parentProp); Assert.AreEqual(1, total); } [TestMethod] public void GetFieldDefinitionsTest() { var repo = context.GetRepositoryForType(typeof(Country)); var defs = repo.GetFieldDefinitions(_localizer); Assert.IsTrue(defs.Any(d => d.Model == nameof(DataItem.Id).ToInitialLower())); } [TestMethod] public async Task GetPage_ItemsPresent() { var repo = context.GetRepositoryForType(typeof(Country)); await repo.AddAsync(null, null, "en-US", _localizer); await repo.AddAsync(null, null, "en-US", _localizer); var count = context.Countries.Count(); var vms = await repo.GetPageAsync(null, null, false, 1, 5, new string[] { }, new List<Claim> { new Claim(CustomClaimTypes.PermissionDataAll, CustomClaimTypes.PermissionAll) }, "en-US", _localizer); Assert.AreEqual(count, vms.Count()); } [TestMethod] public async Task GetPage_ItemsPresent_Unauthorized() { var repo = context.GetRepositoryForType(typeof(Country)); await repo.AddAsync(null, null, "en-US", _localizer); await repo.AddAsync(null, null, "en-US", _localizer); var vms = await repo.GetPageAsync(null, null, false, 1, 5, new string[] { }, new List<Claim> { }, "en-US", _localizer); Assert.AreEqual(0, vms.Count()); } [TestMethod] public async Task GetPage_ItemsPresent_PartialAuthorization() { var repo = context.GetRepositoryForType(typeof(Country)); await repo.AddAsync(null, null, "en-US", _localizer); var item = context.Countries.FirstOrDefault(); Assert.IsNotNull(item); await repo.AddAsync(null, null, "en-US", _localizer); var vms = await repo.GetPageAsync(null, null, false, 1, 5, new string[] { }, new List<Claim> { new Claim(CustomClaimTypes.PermissionDataAll, $"{nameof(Country)}{{{item.Id}}}") }, "en-US", _localizer); Assert.AreEqual(1, vms.Count()); } [TestMethod] public async Task GetTotalAsyncTest() { var repo = context.GetRepositoryForType(typeof(Country)); await repo.AddAsync(null, null, "en-US", _localizer); await repo.AddAsync(null, null, "en-US", _localizer); var count = context.Countries.Count(); var total = await repo.GetTotalAsync(); Assert.AreEqual(count, total); } [TestMethod] public async Task RemoveAsyncTest() { var repo = context.GetRepositoryForType(typeof(Country)); await repo.AddAsync(null, null, "en-US", _localizer); var item = context.Countries.FirstOrDefault(); Assert.IsNotNull(item); var count = context.Countries.Count(); await repo.RemoveAsync(item.Id.ToString()); var newCount = context.Countries.Count(); Assert.AreEqual(count - 1, newCount); } [TestMethod] public async Task RemoveChildrenFromCollectionAsyncTest() { var parentRepo = context.GetRepositoryForType(typeof(Country)); var childRepo = context.GetRepositoryForType(typeof(Airline)); var childProp = typeof(Country).GetProperty(nameof(Country.Airlines)); await parentRepo.AddAsync(null, null, "en-US", _localizer); var parent = context.Countries.FirstOrDefault(); Assert.IsNotNull(parent); await childRepo.AddAsync(null, null, "en-US", _localizer); var child = context.Airlines.FirstOrDefault(); Assert.IsNotNull(child); await parentRepo.AddChildrenToCollectionAsync(parent.Id.ToString(), childProp, new string[] { child.Id.ToString() }); Assert.AreEqual(1, parent.Airlines.Count); await parentRepo.RemoveChildrenFromCollectionAsync(parent.Id.ToString(), childProp, new string[] { child.Id.ToString() }); Assert.AreEqual(0, parent.Airlines.Count); } [TestMethod] public async Task RemoveFromParentAsyncTest() { var repo = context.GetRepositoryForType(typeof(City)); var childProp = typeof(City).GetProperty(nameof(City.Country)); await repo.AddAsync(childProp, Guid.Empty.ToString(), "en-US", _localizer); var item = context.Cities.FirstOrDefault(); var count = context.Cities.Count(); Assert.IsNotNull(item); var removed = await repo.RemoveFromParentAsync(item.Id.ToString(), childProp); var newCount = context.Cities.Count(); Assert.IsTrue(removed); Assert.AreEqual(count - 1, newCount); } [TestMethod] public async Task RemoveRangeAsyncTest() { var repo = context.GetRepositoryForType(typeof(Country)); await repo.AddAsync(null, null, "en-US", _localizer); await repo.AddAsync(null, null, "en-US", _localizer); await repo.RemoveRangeAsync(context.Countries.Select(c => c.Id.ToString())); Assert.AreEqual(0, context.Countries.Count()); } [TestMethod] public async Task RemoveRangeFromParentAsyncTest() { var repo = context.GetRepositoryForType(typeof(City)); var childProp = typeof(City).GetProperty(nameof(City.Country)); await repo.AddAsync(childProp, Guid.Empty.ToString(), "en-US", _localizer); await repo.AddAsync(childProp, Guid.Empty.ToString(), "en-US", _localizer); var count = context.Cities.Count(); var ids = context.Cities.Select(c => c.Id.ToString()).ToList(); var removedIds = await repo.RemoveRangeFromParentAsync(ids, childProp); var newCount = context.Cities.Count(); Assert.AreEqual(count - removedIds.Count, newCount); } [TestMethod] public async Task ReplaceChildAsyncTest() { var parentRepo = context.GetRepositoryForType(typeof(Country)); var childRepo = context.GetRepositoryForType(typeof(Leader)); var childProp = typeof(Leader).GetProperty(nameof(Leader.Country)); await parentRepo.AddAsync(null, null, "en-US", _localizer); var parent = context.Countries.FirstOrDefault(); await childRepo.AddAsync(childProp, parent.Id.ToString(), "en-US", _localizer); var oldChild = context.Leaders.FirstOrDefault(); await childRepo.AddAsync(null, null, "en-US", _localizer); var newChild = context.Leaders.FirstOrDefault(c => c != oldChild); var count = context.Leaders.Count(); var oldId = await childRepo.ReplaceChildAsync(parent.Id.ToString(), newChild.Id.ToString(), childProp); var newCount = context.Leaders.Count(); Assert.IsNotNull(oldId); Assert.AreEqual(count - 1, newCount); } [TestMethod] public async Task UpdateAsyncTest() { var repo = context.GetRepositoryForType(typeof(Country)); await repo.AddAsync(null, null, "en-US", _localizer); var item = context.Countries.FirstOrDefault(); Assert.IsNotNull(item); await repo.UpdateAsync(item, "en-US", _localizer); } } }
37.322738
134
0.617294
[ "MIT" ]
WilStead/VueCoreFramework
VueCoreFramework.Test/Data/RepositoryTest.cs
15,267
C#
using System.Collections.Generic; using System.Collections; using System.Diagnostics; using UnityEngine; namespace Hugula.Profiler { [XLua.LuaCallCSharp] public class StopwatchProfiler : System.IDisposable { #region Static public static readonly Stack<StopwatchProfiler> ProfilerStack = new Stack<StopwatchProfiler>(); /// <summary> /// Initializes static profiler stack with a sentry null, allows for peeking when stack is empty. /// </summary> static StopwatchProfiler() { ProfilerStack.Push(null); } #endregion Static #region Fields public string stopName = ""; private Stopwatch stopWatch = new Stopwatch(); private int nestingLevel = 0; private double maxSingleElapsedTime = 0f; private double childrenElapsedMilliseconds = 0f; private double lastElapsedMilliseconds = 0f; public StopwatchProfiler() { NumberOfCalls = 0; } #endregion Fields #region Properties public double MaxSingleFrameTimeInMs { get { return maxSingleElapsedTime; } } public double ElapsedMilliseconds { get { return stopWatch.Elapsed.TotalMilliseconds; } } public double ElapsedMillisecondsSelf { get { return ElapsedMilliseconds - childrenElapsedMilliseconds; } } public int NumberOfCalls { get; private set; } public int NumberOfCallsGreaterThan3ms { get; private set; } #endregion Properties public void Start() { UnityEngine.Profiling.Profiler.BeginSample(stopName); #if UWATEST UWAEngine.PushSample (stopName); #endif StopwatchProfiler lastProfiler = ProfilerStack.Peek(); if (lastProfiler != this) ProfilerStack.Push(this); nestingLevel++; NumberOfCalls++; if (nestingLevel == 1) { stopWatch.Start(); } } public void Stop() { UnityEngine.Profiling.Profiler.EndSample(); #if UWATEST UWAEngine.PopSample (); #endif if (nestingLevel == 1) { stopWatch.Stop(); StopwatchProfiler previousProfiler = ProfilerStack.Peek(); if (previousProfiler == this) { ProfilerStack.Pop(); } previousProfiler = ProfilerStack.Peek(); if (previousProfiler != null) previousProfiler.childrenElapsedMilliseconds += (ElapsedMilliseconds - lastElapsedMilliseconds); double lastFrameTime = ElapsedMilliseconds - lastElapsedMilliseconds; lastElapsedMilliseconds = ElapsedMilliseconds; if (lastFrameTime > 3.0f) { NumberOfCallsGreaterThan3ms++; } if (lastFrameTime > maxSingleElapsedTime) maxSingleElapsedTime = lastFrameTime; } nestingLevel--; } public void ForceStop() { stopWatch.Stop(); nestingLevel = 0; } public void Reset() { stopWatch.Reset(); nestingLevel = 0; NumberOfCalls = 0; NumberOfCallsGreaterThan3ms = 0; maxSingleElapsedTime = 0f; childrenElapsedMilliseconds = 0f; lastElapsedMilliseconds = 0f; } public void Dispose() { Stop(); } } }
26.91791
142
0.569726
[ "MIT" ]
tenvick/hugula
Client/Assets/Hugula/Profiler/StopwatchProfiler.cs
3,609
C#
using FluentValidation; namespace NetCore_GigHub.ViewModels { public class ViewModelRegister { public string Email { get; set; } public string Username { get; set; } public string Password { get; set; } public string PasswordRepeat { get; set; } } public class VmRegisterValidator : AbstractValidator<ViewModelRegister> { public VmRegisterValidator() { RuleFor(x => x.Email) .NotEmpty() .WithMessage("Email is required") .EmailAddress() .WithMessage("Email field is not a valid email") .MaximumLength(40) .WithMessage("Email too long, we dosn't work with people with long emails!"); RuleFor(x => x.Username) .NotEmpty() .WithMessage("Username is required") .MaximumLength(40) .WithMessage("Username too long"); RuleFor(x => x.Password) .NotEmpty() .WithMessage("Password is required"); RuleFor(x => x.PasswordRepeat) .Equal(x => x.Password) .WithMessage("Passwords do not match"); } } }
30.804878
93
0.526524
[ "MIT" ]
Dreemsuncho/NetCore-GigHub
NetCore-GigHub/ViewModels/ViewModelRegister.cs
1,265
C#
using Avalonia.Controls; using Avalonia.Controls.Metadata; using Avalonia.Extensions.Styles; using Avalonia.Input; using Avalonia.Layout; namespace Avalonia.Extensions.Controls { /// <summary> /// the control:<see cref="GridView"/> used. /// it just a uwp like "GridViewItem" /// </summary> [PseudoClasses(":pressed", ":selected")] public sealed class GridViewItem : ListViewItem, IStyling { public GridViewItem() : base() { ParentProperty.Changed.AddClassHandler<GridViewItem>(OnParentChanged); VerticalAlignmentProperty.Changed.AddClassHandler<GridViewItem>(OnVerticalAlignmentChange); HorizontalAlignmentProperty.Changed.AddClassHandler<GridViewItem>(OnHorizontalAlignmentChange); VerticalContentAlignmentProperty.Changed.AddClassHandler<GridViewItem>(OnVerticalContentAlignmentChange); HorizontalContentAlignmentProperty.Changed.AddClassHandler<GridViewItem>(OnHorizontalContentAlignmentChange); this.InitStyle(); } private void OnHorizontalContentAlignmentChange(object sender, AvaloniaPropertyChangedEventArgs e) { if (Parent is ListBoxItem item && e.NewValue is HorizontalAlignment horizontal) item.HorizontalContentAlignment = horizontal; } private void OnVerticalContentAlignmentChange(object sender, AvaloniaPropertyChangedEventArgs e) { if (Parent is ListBoxItem item && e.NewValue is VerticalAlignment vertical) item.VerticalContentAlignment = vertical; } private void OnParentChanged(object sender, AvaloniaPropertyChangedEventArgs e) { if (e.NewValue is ListBoxItem item) { item.VerticalAlignment = VerticalAlignment; item.HorizontalAlignment = HorizontalAlignment; item.VerticalContentAlignment = VerticalContentAlignment; item.HorizontalContentAlignment = HorizontalContentAlignment; } } private void OnVerticalAlignmentChange(object sender, AvaloniaPropertyChangedEventArgs e) { if (Parent is ListBoxItem item && e.NewValue is VerticalAlignment vertical) item.VerticalAlignment = vertical; } private void OnHorizontalAlignmentChange(object sender, AvaloniaPropertyChangedEventArgs e) { if (Parent is ListBoxItem item && e.NewValue is HorizontalAlignment horizontal) item.HorizontalAlignment = horizontal; } protected override void OnClick(MouseButton mouseButton) { if (Parent.Parent is GridView itemView) itemView.OnContentClick(this, mouseButton); base.OnClick(mouseButton); } } }
45.564516
121
0.682124
[ "MIT" ]
DrewNaylor/Avalonia.Extensions
Avalonia.Extensions.Controls/Controls/GridView/GridViewItem.cs
2,827
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Microshaoft.Net; [assembly: AssemblyDescription(AssemblyInfoManager.AssemblyDescription)] namespace Microshaoft.Net { using System; using System.Reflection; public static class AssemblyInfoManager { public const string AssemblyDescription = #if NET35 "for .NET 3.5" #elif NET45 "for .NET 4.5.1" #else "Microshaoft.Net for .NET" #endif ; } }
19.884615
72
0.698259
[ "MIT" ]
Microshaoft/Microshaoft.WorkFlows
CommonUtilities/CommonUtilities.Full/CommonUtilities.NET.Framework.4.5.x/Properties/AssemblyInfo.cs
519
C#
namespace CopperSharp.Entity.Impl; /// <summary> /// Represents a pig entity /// </summary> public sealed class Pig : BreedableEntity { internal Pig() : base(EntityType.Pig) { } /// <summary> /// Sets whether this pig has saddle /// </summary> /// <param name="has">Marker</param> /// <returns>This pig</returns> public Pig HasSaddle(bool has = true) { Bools["Saddle"] = has; return this; } }
21
44
0.573593
[ "MIT" ]
Maxuss/CopperSharp
CopperSharp/Entity/Impl/Pig.cs
462
C#
// License text here using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using ZigBeeNet.DAO; using ZigBeeNet.ZCL.Protocol; using ZigBeeNet.ZCL.Field; namespace ZigBeeNet.ZCL.Clusters { /// <summary> /// Generic Tunnelcluster implementation (Cluster ID 0x0600). /// /// Code is auto-generated. Modifications may be overwritten! /// </summary> public class ZclGenericTunnelCluster : ZclCluster { /// <summary> /// The ZigBee Cluster Library Cluster ID /// </summary> public const ushort CLUSTER_ID = 0x0600; /// <summary> /// The ZigBee Cluster Library Cluster Name /// </summary> public const string CLUSTER_NAME = "Generic Tunnel"; // Attribute initialisation protected override Dictionary<ushort, ZclAttribute> InitializeAttributes() { Dictionary<ushort, ZclAttribute> attributeMap = new Dictionary<ushort, ZclAttribute>(0); return attributeMap; } /// <summary> /// Default constructor to create a Generic Tunnel cluster. /// /// <param name ="zigbeeEndpoint">The ZigBeeEndpoint</param> /// </summary> public ZclGenericTunnelCluster(ZigBeeEndpoint zigbeeEndpoint) : base(zigbeeEndpoint, CLUSTER_ID, CLUSTER_NAME) { } } }
28
100
0.6469
[ "EPL-1.0" ]
AutomationGarage/ZigbeeNet
libraries/ZigBeeNet/ZCL/Clusters/ZclGenericTunnelCluster.cs
1,486
C#
// Copyright information can be found in the file named COPYING // located in the root directory of this distribution. function CheetahCar::onAdd(%this, %obj) { Parent::onAdd(%this, %obj); %obj.setWheelTire(0,CheetahCarTire); %obj.setWheelTire(1,CheetahCarTire); %obj.setWheelTire(2,CheetahCarTireRear); %obj.setWheelTire(3,CheetahCarTireRear); // Setup the car with some tires & springs for (%i = %obj.getWheelCount() - 1; %i >= 0; %i--) { %obj.setWheelPowered(%i, true); %obj.setWheelSpring(%i, CheetahCarSpring); } // Steer with the front tires %obj.setWheelSteering(0, 1); %obj.setWheelSteering(1, 1); // Add tail lights %obj.rightBrakeLight = new PointLight() { radius = "1"; isEnabled = "0"; color = "1 0 0.141176 1"; brightness = "2"; castShadows = "1"; priority = "1"; animate = "0"; animationPeriod = "1"; animationPhase = "1"; flareScale = "1"; attenuationRatio = "0 1 1"; shadowType = "DualParaboloidSinglePass"; texSize = "512"; overDarkFactor = "2000 1000 500 100"; shadowDistance = "400"; shadowSoftness = "0.15"; numSplits = "1"; logWeight = "0.91"; fadeStartDistance = "0"; lastSplitTerrainOnly = "0"; representedInLightmap = "0"; shadowDarkenColor = "0 0 0 -1"; includeLightmappedGeometryInShadow = "0"; rotation = "1 0 0 0"; canSave = "1"; canSaveDynamicFields = "1"; splitFadeDistances = "10 20 30 40"; }; %obj.leftBrakeLight = new PointLight() { radius = "1"; isEnabled = "0"; color = "1 0 0.141176 1"; brightness = "2"; castShadows = "1"; priority = "1"; animate = "0"; animationPeriod = "1"; animationPhase = "1"; flareScale = "1"; attenuationRatio = "0 1 1"; shadowType = "DualParaboloidSinglePass"; texSize = "512"; overDarkFactor = "2000 1000 500 100"; shadowDistance = "400"; shadowSoftness = "0.15"; numSplits = "1"; logWeight = "0.91"; fadeStartDistance = "0"; lastSplitTerrainOnly = "0"; representedInLightmap = "0"; shadowDarkenColor = "0 0 0 -1"; includeLightmappedGeometryInShadow = "0"; rotation = "1 0 0 0"; canSave = "1"; canSaveDynamicFields = "1"; splitFadeDistances = "10 20 30 40"; }; // Mount a ShapeBaseImageData %didMount = %obj.mountImage(TurretImage, %this.turretSlot); // Mount the brake lights %obj.mountObject(%obj.rightBrakeLight, %this.rightBrakeSlot); %obj.mountObject(%obj.leftBrakeLight, %this.leftBrakeSlot); } function CheetahCar::onRemove(%this, %obj) { Parent::onRemove(%this, %obj); if(isObject(%obj.rightBrakeLight)) %obj.rightBrakeLight.delete(); if(isObject(%obj.leftBrakeLight)) %obj.leftBrakeLight.delete(); if(isObject(%obj.turret)) %obj.turret.delete(); } function serverCmdtoggleBrakeLights(%client) { %car = %client.player.getControlObject(); if (%car.getClassName() $= "WheeledVehicle") { if(%car.rightBrakeLight.isEnabled) { %car.rightBrakeLight.setLightEnabled(0); %car.leftBrakeLight.setLightEnabled(0); } else { %car.rightBrakeLight.setLightEnabled(1); %car.leftBrakeLight.setLightEnabled(1); } } } // Callback invoked when an input move trigger state changes when the CheetahCar // is the control object function CheetahCar::onTrigger(%this, %obj, %index, %state) { // Pass trigger states on to TurretImage (to fire weapon) switch ( %index ) { case 0: %obj.setImageTrigger( %this.turretSlot, %state ); case 1: %obj.setImageAltTrigger( %this.turretSlot, %state ); } } function TurretImage::onMount(%this, %obj, %slot) { // Load the gun %obj.setImageAmmo(%slot, true); }
28.201389
81
0.590002
[ "MIT" ]
fr1tz/alux3d
My Projects/Alux3D/game/alux3d/server/dm/cheetah.cs
3,918
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.ComponentModel; namespace net.elfmission.WindowsApps.Controls { /// <summary> /// DynamicViewのコンテナパネルを表します。 /// </summary> public class elfDynamicViewContainerPanel : elfPanel, IelfDynamicViewContainer { #region "IelfDynamicViewContainerインプリメント" /// <summary> /// DynamicViewの管理クラスを表します。 /// </summary> private elfDynamicViewManager manager = null; /// <summary> /// DynamicViewを要求する場合に発生するイベント。 /// </summary> public event WantDynamicViewEventHandler WantDynamicView; /// <summary> /// 現在表示しているViewを取得します。 /// </summary> public elfDynamicView CurrentView { get { return this.manager.CurrentView; } } /// <summary> /// DynamicViewを表示します。 /// </summary> /// <param name="viewKey">表示するDynamicViewを識別するキーを表す文字列。</param> public void ShowDynamicView(string viewKey) { this.manager.ShowDynamicView(viewKey); } /// <summary> /// DynamicViewを要求します。 /// </summary> /// <param name="viewKey">表示するDynamicViewを識別するためのキーを表す文字列。</param> /// <returns>表示するDynamicView。</returns> public elfDynamicView RequestedDynamicView(string viewKey) { var e = new WantDynamicViewEventArgs { ViewKey = viewKey }; this.onWantDynamicView(e); return e.View; } /// <summary> /// WantDynamicViewイベントを発生させます。 /// </summary> /// <param name="e">イベントデータを格納しているWantDynamicViewEventArgs。</param> protected virtual void onWantDynamicView(WantDynamicViewEventArgs e) { WantDynamicView(this, e); } #endregion #region "コンストラクタ" /// <summary> /// コンストラクタ。 /// </summary> public elfDynamicViewContainerPanel() : base() { this.manager = new elfDynamicViewManager(this); } #endregion #region "デストラクタ" /// <summary> /// Control とその子コントロールが使用しているアンマネージ リソースを解放します。オプションで、マネージ リソースも解放します。 /// </summary> /// <param name="disposing">マネージ リソースとアンマネージ リソースの両方を解放する場合は true。アンマネージ リソースだけを解放する場合は false。</param> protected override void Dispose(bool disposing) { if (disposing) { this.manager.Dispose(); } base.Dispose(disposing); } #endregion } }
22.804124
104
0.70434
[ "Apache-2.0" ]
YouseiSakusen/elfApp
net.elf-mission/WindowsApps/elfWindowsAppControlLibrary/Controls/elfDynamicViewContainerPanel.cs
2,772
C#
namespace SIS.HTTP.Extensions { using SIS.HTTP.Enums; public static class HttpResponseStatusExtensions { public static string GetResponseLine(this HttpResponseStatusCode statusCode) => $"{(int)statusCode} {statusCode}"; } }
23.909091
85
0.684411
[ "MIT" ]
MihailDobrev/SoftUni
C# Web/C# Web Development Basics/05. Asynchronous Processing - Exercise/Server from This Course - SIS/SIS.HTTP/Extensions/HttpResponseStatusExtensions.cs
265
C#
namespace Songbird.Web.Models { public record SlackMessage { public string Webhook { get; init; } public string Message { get; init; } } }
23.285714
44
0.625767
[ "MIT" ]
karl-sjogren/songbird
src/Songbird.Web/Models/SlackMessage.cs
163
C#
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using Handelabra.Sentinels.Engine.Controller; using Handelabra.Sentinels.Engine.Model; namespace Cauldron.Impact { public class AcceleratedCollisionCardController : CardController { public AcceleratedCollisionCardController(Card card, TurnTakerController turnTakerController) : base(card, turnTakerController) { } public override IEnumerator Play() { //"{Impact} deals 1 target 2 infernal damage.", IEnumerator coroutine = GameController.SelectTargetsAndDealDamage(DecisionMaker, new DamageSource(GameController, this.CharacterCard), 2, DamageType.Infernal, 1, false, 1, cardSource: GetCardSource()); if (base.UseUnityCoroutines) { yield return base.GameController.StartCoroutine(coroutine); } else { base.GameController.ExhaustCoroutine(coroutine); } //"You may play a card." coroutine = SelectAndPlayCardFromHand(DecisionMaker); if (base.UseUnityCoroutines) { yield return base.GameController.StartCoroutine(coroutine); } else { base.GameController.ExhaustCoroutine(coroutine); } yield break; } } }
34.707317
213
0.628953
[ "MIT" ]
qoala/CauldronMods
Controller/Heroes/Impact/Cards/AcceleratedCollisionCardController.cs
1,423
C#
using RavenBot.Core.Handlers; using RavenBot.Core.Ravenfall.Commands; using ROBot.Core.GameServer; using System.Threading.Tasks; namespace ROBot.Core.Twitch.Commands { public class Gift : TwitchCommandHandler { public override async Task HandleAsync(IBotServer game, ITwitchCommandClient twitch, ICommand cmd) { var channel = cmd.Channel; var session = game.GetSession(channel); if (session != null) { var connection = game.GetConnection(session); if (connection != null) { if (string.IsNullOrEmpty(cmd.Arguments) || !cmd.Arguments.Trim().Contains(" ")) { twitch.Broadcast(channel, cmd.Sender.Username, Localization.GIFT_HELP, cmd.Command); return; } var player = session.Get(cmd.Sender); if (player != null) await connection.GiftItemAsync(player, cmd.Arguments); } } } } }
33.606061
108
0.537421
[ "MIT" ]
AbbyTheRat/RavenBot
src/ROBot.Core/Twitch/Commands/Gift.cs
1,111
C#
using NUnit.Framework; using SlimJim.Model; using System.IO; namespace SlimJim.Test.Model { [TestFixture] public class SlnGenerationOptionsTests : TestBase { private SlnGenerationOptions options; [Test] public void SolutionOutputPathDefaultsToProjectsRootPath() { options = new SlnGenerationOptions(GetSamplePath("Projects")); Assert.That(options.SlnOutputPath, Is.EqualTo(options.ProjectsRootDirectory)); } [Test] public void SolutionOutputPathUsesGivenValueIfSet() { string slnOutputPath = GetSamplePath("Projects", "Solutions"); options = new SlnGenerationOptions(GetSamplePath("Projects")) {SlnOutputPath = slnOutputPath}; Assert.That(options.SlnOutputPath, Is.EqualTo(slnOutputPath)); } [Test] public void UnspecifiedSolutionNameWithNoTargetProjectsUsesFolderName() { options = new SlnGenerationOptions(WorkingDirectory); Assert.That(options.SolutionName, Is.EqualTo("WorkingDir")); options = new SlnGenerationOptions(Path.Combine(WorkingDirectory, "SlumJim")); Assert.That(options.SolutionName, Is.EqualTo("SlumJim")); options = new SlnGenerationOptions(Path.Combine(WorkingDirectory, "SlumJim") + Path.DirectorySeparatorChar + Path.DirectorySeparatorChar); Assert.That(options.SolutionName, Is.EqualTo("SlumJim")); options = new SlnGenerationOptions(Path.DirectorySeparatorChar.ToString()); Assert.That(options.SolutionName, Is.EqualTo("SlimJim")); } [Test] public void AdditionalSearchPathsRootedAtProjectRoot() { var root = GetSamplePath ("Proj", "Root"); options = new SlnGenerationOptions(root); var path1 = Path.Combine("..", "SearchPath"); var path2 = Path.Combine("..", "..", "OtherPath", "Pork"); options.AddAdditionalSearchPaths (path1, path2); Assert.That(options.AdditionalSearchPaths, Is.EqualTo(new[] {Path.Combine(root, path1), Path.Combine(root, path2)})); } [Test] public void RelativeSlnOutputPathRootedAtProjectsRoot() { var root = GetSamplePath ("Proj", "Root"); options = new SlnGenerationOptions (root); options.SlnOutputPath = "Solutions"; Assert.That(options.SlnOutputPath, Is.EqualTo(Path.Combine(root, "Solutions"))); } [Test] public void RelativeProjectsRootDirIsRootedAtWorkingDir() { options = new SlnGenerationOptions(WorkingDirectory); options.ProjectsRootDirectory = Path.Combine("Proj", "Root"); Assert.That(options.SlnOutputPath, Is.EqualTo (Path.Combine (WorkingDirectory, "Proj", "Root"))); } } }
33.684211
142
0.723828
[ "MIT" ]
Wind010/SlimJim
src/SlimJim.Test/Model/SlnGenerationOptionsTests.cs
2,560
C#
using UnityEngine; using System; using LuaInterface; using SLua; using System.Collections.Generic; public class Lua_UnityEngine_TextMesh : LuaObject { [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int constructor(IntPtr l) { try { UnityEngine.TextMesh o; o=new UnityEngine.TextMesh(); pushValue(l,o); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_text(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); pushValue(l,self.text); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_text(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); string v; checkType(l,2,out v); self.text=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_font(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); pushValue(l,self.font); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_font(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); UnityEngine.Font v; checkType(l,2,out v); self.font=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_fontSize(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); pushValue(l,self.fontSize); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_fontSize(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); int v; checkType(l,2,out v); self.fontSize=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_fontStyle(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); pushEnum(l,(int)self.fontStyle); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_fontStyle(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); UnityEngine.FontStyle v; checkEnum(l,2,out v); self.fontStyle=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_offsetZ(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); pushValue(l,self.offsetZ); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_offsetZ(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); float v; checkType(l,2,out v); self.offsetZ=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_alignment(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); pushEnum(l,(int)self.alignment); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_alignment(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); UnityEngine.TextAlignment v; checkEnum(l,2,out v); self.alignment=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_anchor(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); pushEnum(l,(int)self.anchor); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_anchor(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); UnityEngine.TextAnchor v; checkEnum(l,2,out v); self.anchor=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_characterSize(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); pushValue(l,self.characterSize); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_characterSize(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); float v; checkType(l,2,out v); self.characterSize=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_lineSpacing(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); pushValue(l,self.lineSpacing); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_lineSpacing(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); float v; checkType(l,2,out v); self.lineSpacing=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_tabSize(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); pushValue(l,self.tabSize); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_tabSize(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); float v; checkType(l,2,out v); self.tabSize=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_richText(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); pushValue(l,self.richText); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_richText(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); bool v; checkType(l,2,out v); self.richText=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int get_color(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); pushValue(l,self.color); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static public int set_color(IntPtr l) { try { UnityEngine.TextMesh self=(UnityEngine.TextMesh)checkSelf(l); UnityEngine.Color v; checkType(l,2,out v); self.color=v; return 0; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } } static public void reg(IntPtr l) { getTypeTable(l,"UnityEngine.TextMesh"); addMember(l,"text",get_text,set_text,true); addMember(l,"font",get_font,set_font,true); addMember(l,"fontSize",get_fontSize,set_fontSize,true); addMember(l,"fontStyle",get_fontStyle,set_fontStyle,true); addMember(l,"offsetZ",get_offsetZ,set_offsetZ,true); addMember(l,"alignment",get_alignment,set_alignment,true); addMember(l,"anchor",get_anchor,set_anchor,true); addMember(l,"characterSize",get_characterSize,set_characterSize,true); addMember(l,"lineSpacing",get_lineSpacing,set_lineSpacing,true); addMember(l,"tabSize",get_tabSize,set_tabSize,true); addMember(l,"richText",get_richText,set_richText,true); addMember(l,"color",get_color,set_color,true); createTypeMetatable(l,constructor, typeof(UnityEngine.TextMesh),typeof(UnityEngine.Component)); } }
25.570201
97
0.706634
[ "MIT" ]
LunaFramework/Luna
luna/Assets/LuaObject/Unity/Lua_UnityEngine_TextMesh.cs
8,926
C#
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ // **NOTE** This file was generated by a tool and any changes will be overwritten. // <auto-generated/> // Template Source: MethodRequest.cs.tt namespace Microsoft.Graph { using System; using System.Collections.Generic; using System.IO; using System.Net.Http; using System.Threading; /// <summary> /// The type WorkbookFunctionsMinuteRequest. /// </summary> public partial class WorkbookFunctionsMinuteRequest : BaseRequest, IWorkbookFunctionsMinuteRequest { /// <summary> /// Constructs a new WorkbookFunctionsMinuteRequest. /// </summary> public WorkbookFunctionsMinuteRequest( string requestUrl, IBaseClient client, IEnumerable<Option> options) : base(requestUrl, client, options) { this.ContentType = CoreConstants.MimeTypeNames.Application.Json; this.RequestBody = new WorkbookFunctionsMinuteRequestBody(); } /// <summary> /// Gets the request body. /// </summary> public WorkbookFunctionsMinuteRequestBody RequestBody { get; private set; } /// <summary> /// Issues the POST request. /// </summary> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The task to await for async call.</returns> public System.Threading.Tasks.Task<WorkbookFunctionResult> PostAsync( CancellationToken cancellationToken = default) { this.Method = HttpMethods.POST; return this.SendAsync<WorkbookFunctionResult>(this.RequestBody, cancellationToken); } /// <summary> /// Issues the POST request and returns a <see cref="GraphResponse"/> object. /// </summary> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The <see cref="GraphResponse"/> object of the request</returns> public System.Threading.Tasks.Task<GraphResponse<WorkbookFunctionResult>> PostResponseAsync(CancellationToken cancellationToken = default) { this.Method = HttpMethods.POST; return this.SendAsyncWithGraphResponse<WorkbookFunctionResult>(this.RequestBody, cancellationToken); } /// <summary> /// Adds the specified expand value to the request. /// </summary> /// <param name="value">The expand value.</param> /// <returns>The request object to send.</returns> public IWorkbookFunctionsMinuteRequest Expand(string value) { this.QueryOptions.Add(new QueryOption("$expand", value)); return this; } /// <summary> /// Adds the specified select value to the request. /// </summary> /// <param name="value">The select value.</param> /// <returns>The request object to send.</returns> public IWorkbookFunctionsMinuteRequest Select(string value) { this.QueryOptions.Add(new QueryOption("$select", value)); return this; } } }
39.089888
153
0.604197
[ "MIT" ]
Aliases/msgraph-sdk-dotnet
src/Microsoft.Graph/Generated/requests/WorkbookFunctionsMinuteRequest.cs
3,479
C#
// Copyright 2017 the original author or authors. // // 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 Steeltoe.CircuitBreaker.Hystrix.Util; using System; using System.Collections.Concurrent; using System.Reactive.Linq; using System.Reactive.Subjects; namespace Steeltoe.CircuitBreaker.Hystrix.Metric { public class HystrixCollapserEventStream : IHystrixEventStream<HystrixCollapserEvent> { private static readonly ConcurrentDictionary<string, HystrixCollapserEventStream> Streams = new ConcurrentDictionary<string, HystrixCollapserEventStream>(); private readonly IHystrixCollapserKey collapserKey; private readonly ISubject<HystrixCollapserEvent, HystrixCollapserEvent> writeOnlyStream; private readonly IObservable<HystrixCollapserEvent> readOnlyStream; public static HystrixCollapserEventStream GetInstance(IHystrixCollapserKey collapserKey) { return Streams.GetOrAddEx(collapserKey.Name, (k) => new HystrixCollapserEventStream(collapserKey)); } internal HystrixCollapserEventStream(IHystrixCollapserKey collapserKey) { this.collapserKey = collapserKey; this.writeOnlyStream = Subject.Synchronize<HystrixCollapserEvent, HystrixCollapserEvent>(new Subject<HystrixCollapserEvent>()); this.readOnlyStream = writeOnlyStream.AsObservable(); } public static void Reset() { Streams.Clear(); } public void Write(HystrixCollapserEvent @event) { writeOnlyStream.OnNext(@event); } public IObservable<HystrixCollapserEvent> Observe() { return readOnlyStream; } public override string ToString() { return "HystrixCollapserEventStream(" + collapserKey.Name + ")"; } } }
36.338462
164
0.715072
[ "ECL-2.0", "Apache-2.0" ]
spring-operator/CircuitBreaker
src/Steeltoe.CircuitBreaker.HystrixBase/Metric/HystrixCollapserEventStream.cs
2,364
C#
namespace GamersHub.Web.ViewModels.Parties.InputModels { public class PartyApplyInputModel { public int PartyId { get; set; } public string UserId { get; set; } } }
19.5
55
0.646154
[ "MIT" ]
StoyanRangelov/GamersHub
src/Web/GamersHub.Web.ViewModels/Parties/InputModels/PartyApplyInputModel.cs
197
C#
using System; using System.Collections.Generic; using System.Text; using System.Linq; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using HuaweiCloud.SDK.Core; namespace HuaweiCloud.SDK.Iam.V3.Model { /// <summary> /// /// </summary> public class RoleAssignmentBody { /// <summary> /// /// </summary> [JsonProperty("user", NullValueHandling = NullValueHandling.Ignore)] public RoleUserAssignmentId User { get; set; } /// <summary> /// /// </summary> [JsonProperty("role", NullValueHandling = NullValueHandling.Ignore)] public RoleAssignmentId Role { get; set; } /// <summary> /// /// </summary> [JsonProperty("group", NullValueHandling = NullValueHandling.Ignore)] public RoleGroupAssignmentId Group { get; set; } /// <summary> /// /// </summary> [JsonProperty("agency", NullValueHandling = NullValueHandling.Ignore)] public RoleAgencyAssignmentId Agency { get; set; } /// <summary> /// /// </summary> [JsonProperty("scope", NullValueHandling = NullValueHandling.Ignore)] public RoleAssignmentScope Scope { get; set; } /// <summary> /// 是否基于所有项目授权。 /// </summary> [JsonProperty("is_inherited", NullValueHandling = NullValueHandling.Ignore)] public bool? IsInherited { get; set; } /// <summary> /// Get the string /// </summary> public override string ToString() { var sb = new StringBuilder(); sb.Append("class RoleAssignmentBody {\n"); sb.Append(" user: ").Append(User).Append("\n"); sb.Append(" role: ").Append(Role).Append("\n"); sb.Append(" group: ").Append(Group).Append("\n"); sb.Append(" agency: ").Append(Agency).Append("\n"); sb.Append(" scope: ").Append(Scope).Append("\n"); sb.Append(" isInherited: ").Append(IsInherited).Append("\n"); sb.Append("}\n"); return sb.ToString(); } /// <summary> /// Returns true if objects are equal /// </summary> public override bool Equals(object input) { return this.Equals(input as RoleAssignmentBody); } /// <summary> /// Returns true if objects are equal /// </summary> public bool Equals(RoleAssignmentBody input) { if (input == null) return false; return ( this.User == input.User || (this.User != null && this.User.Equals(input.User)) ) && ( this.Role == input.Role || (this.Role != null && this.Role.Equals(input.Role)) ) && ( this.Group == input.Group || (this.Group != null && this.Group.Equals(input.Group)) ) && ( this.Agency == input.Agency || (this.Agency != null && this.Agency.Equals(input.Agency)) ) && ( this.Scope == input.Scope || (this.Scope != null && this.Scope.Equals(input.Scope)) ) && ( this.IsInherited == input.IsInherited || (this.IsInherited != null && this.IsInherited.Equals(input.IsInherited)) ); } /// <summary> /// Get hash code /// </summary> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (this.User != null) hashCode = hashCode * 59 + this.User.GetHashCode(); if (this.Role != null) hashCode = hashCode * 59 + this.Role.GetHashCode(); if (this.Group != null) hashCode = hashCode * 59 + this.Group.GetHashCode(); if (this.Agency != null) hashCode = hashCode * 59 + this.Agency.GetHashCode(); if (this.Scope != null) hashCode = hashCode * 59 + this.Scope.GetHashCode(); if (this.IsInherited != null) hashCode = hashCode * 59 + this.IsInherited.GetHashCode(); return hashCode; } } } }
32.609589
84
0.47469
[ "Apache-2.0" ]
huaweicloud/huaweicloud-sdk-net
Services/Iam/V3/Model/RoleAssignmentBody.cs
4,783
C#
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/MsHTML.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. using NUnit.Framework; using System; using System.Runtime.InteropServices; using static TerraFX.Interop.Windows.IID; namespace TerraFX.Interop.Windows.UnitTests; /// <summary>Provides validation of the <see cref="IHTMLAnchorElement3" /> struct.</summary> public static unsafe partial class IHTMLAnchorElement3Tests { /// <summary>Validates that the <see cref="Guid" /> of the <see cref="IHTMLAnchorElement3" /> struct is correct.</summary> [Test] public static void GuidOfTest() { Assert.That(typeof(IHTMLAnchorElement3).GUID, Is.EqualTo(IID_IHTMLAnchorElement3)); } /// <summary>Validates that the <see cref="IHTMLAnchorElement3" /> struct is blittable.</summary> [Test] public static void IsBlittableTest() { Assert.That(Marshal.SizeOf<IHTMLAnchorElement3>(), Is.EqualTo(sizeof(IHTMLAnchorElement3))); } /// <summary>Validates that the <see cref="IHTMLAnchorElement3" /> struct has the right <see cref="LayoutKind" />.</summary> [Test] public static void IsLayoutSequentialTest() { Assert.That(typeof(IHTMLAnchorElement3).IsLayoutSequential, Is.True); } /// <summary>Validates that the <see cref="IHTMLAnchorElement3" /> struct has the correct size.</summary> [Test] public static void SizeOfTest() { if (Environment.Is64BitProcess) { Assert.That(sizeof(IHTMLAnchorElement3), Is.EqualTo(8)); } else { Assert.That(sizeof(IHTMLAnchorElement3), Is.EqualTo(4)); } } }
35.921569
145
0.694323
[ "MIT" ]
reflectronic/terrafx.interop.windows
tests/Interop/Windows/Windows/um/MsHTML/IHTMLAnchorElement3Tests.cs
1,834
C#
using System.Threading.Tasks; using Tomato.Gateway; using Tomato.Rpc; namespace MathService.Definition { /// <summary> /// 数学服务 /// </summary> [RpcService(100)] public interface IMathService { /// <summary> /// 加法服务 /// </summary> /// <param name="req">请求参数req</param> /// <returns>返回值Res</returns> [RpcMethod(1),Router("/api/math/sum")] Task<RpcResult<SumRes>> SumAsync(SumReq req); } }
21.5
53
0.56871
[ "MIT" ]
Soho-Rab/tomato
samples/MathService.Definition/IMathService.cs
503
C#
using System; namespace Entitas.VisualDebugging.Unity { [Flags] public enum SystemInterfaceFlags { None = 0, IInitializeSystem = 1 << 1, IExecuteSystem = 1 << 2, ICleanupSystem = 1 << 3, ITearDownSystem = 1 << 4, IReactiveSystem = 1 << 5 } public class SystemInfo { public ISystem system { get { return _system; } } public string systemName { get { return _systemName; } } public bool isInitializeSystems { get { return (_interfaceFlags & SystemInterfaceFlags.IInitializeSystem) == SystemInterfaceFlags.IInitializeSystem; } } public bool isExecuteSystems { get { return (_interfaceFlags & SystemInterfaceFlags.IExecuteSystem) == SystemInterfaceFlags.IExecuteSystem; } } public bool isCleanupSystems { get { return (_interfaceFlags & SystemInterfaceFlags.ICleanupSystem) == SystemInterfaceFlags.ICleanupSystem; } } public bool isTearDownSystems { get { return (_interfaceFlags & SystemInterfaceFlags.ITearDownSystem) == SystemInterfaceFlags.ITearDownSystem; } } public bool isReactiveSystems { get { return (_interfaceFlags & SystemInterfaceFlags.IReactiveSystem) == SystemInterfaceFlags.IReactiveSystem; } } public double initializationDuration { get; set; } public double accumulatedExecutionDuration { get { return _accumulatedExecutionDuration; } } public double minExecutionDuration { get { return _minExecutionDuration; } } public double maxExecutionDuration { get { return _maxExecutionDuration; } } public double averageExecutionDuration { get { return _executionDurationsCount == 0 ? 0 : _accumulatedExecutionDuration / _executionDurationsCount; } } public double accumulatedCleanupDuration { get { return _accumulatedCleanupDuration; } } public double minCleanupDuration { get { return _minCleanupDuration; } } public double maxCleanupDuration { get { return _maxCleanupDuration; } } public double averageCleanupDuration { get { return _cleanupDurationsCount == 0 ? 0 : _accumulatedCleanupDuration / _cleanupDurationsCount; } } public double cleanupDuration { get; set; } public double teardownDuration { get; set; } public bool areAllParentsActive { get { return parentSystemInfo == null || (parentSystemInfo.isActive && parentSystemInfo.areAllParentsActive); } } public SystemInfo parentSystemInfo; public bool isActive; readonly ISystem _system; readonly SystemInterfaceFlags _interfaceFlags; readonly string _systemName; double _accumulatedExecutionDuration; double _minExecutionDuration; double _maxExecutionDuration; int _executionDurationsCount; double _accumulatedCleanupDuration; double _minCleanupDuration; double _maxCleanupDuration; int _cleanupDurationsCount; const string SYSTEM_SUFFIX = "System"; public SystemInfo(ISystem system) { _system = system; _interfaceFlags = getInterfaceFlags(system); var debugSystem = system as DebugSystems; if (debugSystem != null) { _systemName = debugSystem.name; } else { var systemType = system.GetType(); _systemName = systemType.Name.EndsWith(SYSTEM_SUFFIX, StringComparison.Ordinal) ? systemType.Name.Substring(0, systemType.Name.Length - SYSTEM_SUFFIX.Length) : systemType.Name; } isActive = true; } public void AddExecutionDuration(double executionDuration) { if (executionDuration < _minExecutionDuration || _minExecutionDuration == 0) { _minExecutionDuration = executionDuration; } if (executionDuration > _maxExecutionDuration) { _maxExecutionDuration = executionDuration; } _accumulatedExecutionDuration += executionDuration; _executionDurationsCount += 1; } public void AddCleanupDuration(double cleanupDuration) { if (cleanupDuration < _minCleanupDuration || _minCleanupDuration == 0) { _minCleanupDuration = cleanupDuration; } if (cleanupDuration > _maxCleanupDuration) { _maxCleanupDuration = cleanupDuration; } _accumulatedCleanupDuration += cleanupDuration; _cleanupDurationsCount += 1; } public void ResetDurations() { _accumulatedExecutionDuration = 0; _executionDurationsCount = 0; _accumulatedCleanupDuration = 0; _cleanupDurationsCount = 0; } static SystemInterfaceFlags getInterfaceFlags(ISystem system) { var flags = SystemInterfaceFlags.None; if (system is IInitializeSystem) { flags |= SystemInterfaceFlags.IInitializeSystem; } if (system is IReactiveSystem) { flags |= SystemInterfaceFlags.IReactiveSystem; } else if (system is IExecuteSystem) { flags |= SystemInterfaceFlags.IExecuteSystem; } if (system is ICleanupSystem) { flags |= SystemInterfaceFlags.ICleanupSystem; } if (system is ITearDownSystem) { flags |= SystemInterfaceFlags.ITearDownSystem; } return flags; } } }
42.030303
160
0.649603
[ "MIT" ]
CCludts/EntitasCSharpClone
Addons/Entitas.VisualDebugging.Unity/Entitas.VisualDebugging.Unity/DebugSystems/SystemInfo.cs
5,548
C#
namespace Promitor.Core.Scraping.Configuration.Model.Metrics { public abstract class MetricDefinition { /// <summary> /// Configuration about the Azure Monitor metric to scrape /// </summary> public AzureMetricConfiguration AzureMetricConfiguration { get; set; } /// <summary> /// Description concerning metric that will be made available in the scraping endpoint /// </summary> public string Description { get; set; } /// <summary> /// Name of the metric to use when exposing in the scraping endpoint /// </summary> public string Name { get; set; } /// <summary> /// Specify a resource group to scrape that defers from the default resource group. /// This enables you to do multi-resource group scraping with one configuration file. /// </summary> public string ResourceGroupName { get; set; } /// <summary> /// Type of resource that is configured /// </summary> public abstract ResourceType ResourceType { get; } } }
35.25
98
0.603723
[ "MIT" ]
michellemcone/promitor
src/Promitor.Core.Scraping/Configuration/Model/Metrics/MetricDefinition.cs
1,130
C#
using MarvelvsCapcom.DTO.ModelsDTO; namespace MarvelvsCapcom.ViewModels { public class CharacterViewModel { public int Id { get; set; } public string CharName { get; set; } = null!; public string? Side { get; set; } public AbilityDTO Ab1 { get; set; } public AbilityDTO Ab2 { get; set; } public AbilityDTO Ab3 { get; set; } public AbilityDTO Ab4 { get; set; } public int Ab1Id { get; set; } public int Ab2Id { get; set; } public int Ab3Id { get; set; } public int Ab4Id { get; set; } public int? HeathPoints { get; set; } } }
24.653846
53
0.574103
[ "MIT" ]
OUMLIL/marvelvCAPCOMBack
MarvelvsCapcom/ViewModels/CharacterViewModel.cs
643
C#
using System.Collections.Generic; using System.IO; namespace SAModel.SAEditorCommon.ModManagement { public class ModInfo { public string Name { get; set; } public string Author { get; set; } public string Version { get; set; } public string Description { get; set; } public string DLLFile { get; set; } public string Codes { get; set; } public string GitHubRepo { get; set; } public string GitHubAsset { get; set; } public string UpdateUrl { get; set; } public string ChangelogUrl { get; set; } public string GameBananaItemType { get; set; } public long? GameBananaItemId { get; set; } public static IEnumerable<string> GetModFiles(DirectoryInfo directoryInfo) { string modini = Path.Combine(directoryInfo.FullName, "mod.ini"); if (File.Exists(modini)) { yield return modini; yield break; } foreach (DirectoryInfo item in directoryInfo.GetDirectories()) { if (item.Name[0] == '.') { continue; } foreach (string filename in GetModFiles(item)) yield return filename; } } } }
24.790698
76
0.678236
[ "MIT", "BSD-3-Clause" ]
X-Hax/sa_tools
Libraries/SAEditorCommon/ModManagement/ModInfo.cs
1,068
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Net.Http { internal enum Http3FrameType : long { Data = 0x0, Headers = 0x1, CancelPush = 0x3, Settings = 0x4, PushPromise = 0x5, GoAway = 0x7, MaxPushId = 0xD, DuplicatePush = 0xE } }
23.055556
71
0.6
[ "Apache-2.0" ]
1n5an1ty/aspnetcore
src/Shared/runtime/Http3/Frames/Http3FrameType.cs
415
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("UnitTest")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("UnitTest")] [assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("fd29965a-eef4-436e-9837-ef8002049602")] // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
29.333333
56
0.751623
[ "Apache-2.0" ]
takubokudori/LineFormatter
UnitTest/Properties/AssemblyInfo.cs
617
C#
namespace CyberCAT.Core.DumpedEnums { public enum WeaponPartType { Scope = 0, Magazine = 1, Silencer = 2 } }
11.8
35
0.677966
[ "MIT" ]
Deweh/CyberCAT
CyberCAT.Core/Enums/Dumped Enums/WeaponPartType.cs
118
C#
// ReSharper disable MemberCanBePrivate.Global // ReSharper disable UnusedMember.Global using System; using System.Diagnostics; using System.Threading; namespace Cli.General.IO { public static class ConsoleReadLine { /// <summary> /// Última resposta de Console.ReadLine() /// </summary> private static string _inputLast; /// <summary> /// Thread que processa as respostas de Console.ReadLine() quando houver oportunidade. /// </summary> private static readonly Thread InputThread = new Thread(InputThreadAction) {IsBackground = true}; /// <summary> /// Notifica oportunidade para obter resposta de Console.ReadLine(). /// </summary> private static readonly AutoResetEvent InputGet = new AutoResetEvent(false); /// <summary> /// Notifica que foi obtido resposta de Console.ReadLine(). /// </summary> private static readonly AutoResetEvent InputGot = new AutoResetEvent(false); /// <summary> /// Construtor. /// </summary> static ConsoleReadLine() { InputThread.Start(); } /// <summary> /// Processamento da thread que processa as respostas de Console.ReadLine() quando houver oportunidade. /// </summary> private static void InputThreadAction() { while (true) { InputGet.WaitOne(); _inputLast = Console.ReadLine(); InputGot.Set(); } // ReSharper disable once FunctionNeverReturns } /// <summary> /// Obtem resposta de Console.ReadLine() com timeout. /// Se estourar o tempo gera Exception. /// </summary> /// <param name="timeout">Opcional. Tempo limite de espera.</param> /// <returns>Resposta.</returns> public static string ReadLine(int timeout = Timeout.Infinite) { if (timeout == Timeout.Infinite) return Console.ReadLine(); var stopwatch = new Stopwatch(); stopwatch.Start(); while (stopwatch.ElapsedMilliseconds < timeout && !Console.KeyAvailable) { // Aguarda o tempo limite. } if (!Console.KeyAvailable) throw new TimeoutException("User did not provide input within the time limit."); InputGet.Set(); InputGot.WaitOne(); return _inputLast; } /// <summary> /// Obtem resposta de Console.ReadLine() com timeout. /// </summary> /// <param name="timeout">Tempo limite de espera.</param> /// <param name="defaults">Resposta padrão se estourar o timeout.</param> /// <returns>Resposta.</returns> public static string ReadLine(int timeout, string defaults) { try { return ReadLine(timeout); } catch { return defaults; } } } }
31.693878
119
0.554411
[ "MIT" ]
sergiocabral/Cabrones.Cli
Cli/General/IO/ConsoleReadLine.cs
3,110
C#
using System.Collections.Generic; using System.ComponentModel; namespace QFramework.GraphDesigner { public class ViewModel<TData> : ViewModel { public TData Data { get; set; } } public class ViewModel : INotifyPropertyChanged { private object _dataObject; public virtual object DataObject { get { return _dataObject; } set { _dataObject = value; DataObjectChanged(); } } public string Identifier { get { return ((IGraphItem) DataObject).Identifier; } } public virtual void DataObjectChanged() { } protected bool SetProperty<T>(ref T backingField, T value, string name) { var changed = !EqualityComparer<T>.Default.Equals(backingField, value); if (changed) { backingField = value; this.OnPropertyChanged(name); } return changed; } //#if UNITY_EDITOR public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName = null) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); } //#else // public event PropertyChangedEventHandler PropertyChanged; // protected virtual void OnPropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null) // { // PropertyChangedEventHandler handler = PropertyChanged; // if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); // } //#endif } }
28.567164
130
0.564786
[ "MIT" ]
DiazGames/oneGame
Assets/QFramework/Framework/0.Core/Editor/0.EditorKit/uFrame.Editor/Systems/GraphUI/ViewModels/ViewModel.cs
1,914
C#
// CountdownEvent.cs // // Authors: // Marek Safar <marek.safar@gmail.com> // // Copyright (c) 2008 Jérémie "Garuma" Laval // Copyright 2011 Xamarin Inc (http://www.xamarin.com). // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // namespace System.Threading { [System.Diagnostics.DebuggerDisplayAttribute ("Initial Count={InitialCount}, Current Count={CurrentCount}")] public class CountdownEvent : IDisposable { int initialCount; int initial; ManualResetEventSlim evt; public CountdownEvent (int initialCount) { if (initialCount < 0) throw new ArgumentOutOfRangeException ("initialCount"); evt = new ManualResetEventSlim (initialCount == 0); this.initial = this.initialCount = initialCount; } public int CurrentCount { get { return initialCount; } } public int InitialCount { get { return initial; } } public bool IsSet { get { return initialCount == 0; } } public WaitHandle WaitHandle { get { return evt.WaitHandle; } } public bool Signal () { return Signal (1); } public bool Signal (int signalCount) { if (signalCount <= 0) throw new ArgumentOutOfRangeException ("signalCount"); CheckDisposed (); int newValue; if (!ApplyOperation (-signalCount, out newValue)) throw new InvalidOperationException ("The event is already set"); if (newValue == 0) { evt.Set (); return true; } return false; } public void AddCount () { AddCount (1); } public void AddCount (int signalCount) { if (!TryAddCount (signalCount)) throw new InvalidOperationException ("The event is already signaled and cannot be incremented"); } public bool TryAddCount () { return TryAddCount (1); } public bool TryAddCount (int signalCount) { if (signalCount <= 0) throw new ArgumentOutOfRangeException ("signalCount"); CheckDisposed (); int temp; return ApplyOperation (signalCount, out temp); } bool ApplyOperation (int num, out int newValue) { int oldCount; do { oldCount = initialCount; if (oldCount == 0) { newValue = 0; return false; } newValue = oldCount + num; if (newValue < 0) return false; } while (Interlocked.CompareExchange (ref initialCount, newValue, oldCount) != oldCount); return true; } public void Wait () { evt.Wait (); } public bool Wait (int millisecondsTimeout) { return evt.Wait (millisecondsTimeout); } public bool Wait(TimeSpan timeout) { return evt.Wait (timeout); } public void Reset () { Reset (initial); } public void Reset (int count) { if (count < 0) throw new ArgumentOutOfRangeException ("count"); CheckDisposed (); initialCount = initial = count; if (count == 0) evt.Set (); else evt.Reset (); } public void Dispose () { Dispose (true); } protected virtual void Dispose (bool disposing) { if (disposing) evt.Dispose (); } void CheckDisposed () { if (evt.disposed.Value) throw new ObjectDisposedException ("CountdownEvent"); } } }
21.533333
109
0.66754
[ "Apache-2.0" ]
KKL1982/msgpack-cli
test/MsgPack.UnitTest/Mono/System/Threading/CountdownEvent.cs
4,201
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; using UniRx; using UniRx.Operators; using UniRx.Triggers; using System; namespace Sample2 { /// <summary> /// LogOutputのインタフェース /// </summary> public interface ILogOutput { /// <summary> /// 破棄 /// </summary> void Destroy(); } /// <summary> /// ログを出力し続けるオブジェクト /// ファクトリメソッドから生成できる機能を持つ /// </summary> public class LogOutput : MonoBehaviour, ILogOutput { /// <summary> /// 生成 /// </summary> /// <param name="Message">表示する文字列</param> /// <returns>LogOutputのComponent</returns> public static LogOutput Create(string Message) { GameObject Obj = new GameObject("LogOutput"); var Output = Obj.AddComponent<LogOutput>(); Output.Message = Message; return Output; } /// <summary> /// 表示する文字列 /// </summary> private string Message = "Log Output"; /// <summary> /// 破棄 /// </summary> public void Destroy() { Destroy(gameObject); } void Awake() { this.UpdateAsObservable() .ThrottleFirst(TimeSpan.FromSeconds(1.0)) .Subscribe((_) => Debug.Log(Message)) .AddTo(gameObject); } } }
23.603175
58
0.496974
[ "MIT" ]
YanaPIIDXer/ZenjectTest
Assets/Scripts/Sample2/LogOutput.cs
1,619
C#
using System.Threading; using System.Threading.Tasks; using MediatR; using SFA.DAS.FindApprenticeshipTraining.InnerApi.Requests; using SFA.DAS.SharedOuterApi.Configuration; using SFA.DAS.SharedOuterApi.Interfaces; namespace SFA.DAS.FindApprenticeshipTraining.Application.Shortlist.Commands.DeleteShortlistItemForUser { public class DeleteShortlistItemForUserCommandHandler : IRequestHandler<DeleteShortlistItemForUserCommand, Unit> { private readonly ICourseDeliveryApiClient<CourseDeliveryApiConfiguration> _courseDeliveryApiClient; public DeleteShortlistItemForUserCommandHandler (ICourseDeliveryApiClient<CourseDeliveryApiConfiguration> courseDeliveryApiClient) { _courseDeliveryApiClient = courseDeliveryApiClient; } public async Task<Unit> Handle(DeleteShortlistItemForUserCommand request, CancellationToken cancellationToken) { await _courseDeliveryApiClient.Delete(new DeleteShortlistItemForUserRequest(request.Id, request.UserId)); return Unit.Value; } } }
43.36
138
0.785055
[ "MIT" ]
SkillsFundingAgency/das-apim-endpoints
src/SFA.DAS.FindApprenticeshipTraining/Application/Shortlist/Commands/DeleteShortlistItemForUser/DeleteShortlistItemForUserCommandHandler.cs
1,086
C#
using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; namespace BindingSample2 { /// <summary> /// Interaction logic for App.xaml /// </summary> public partial class App : Application { } }
18.222222
42
0.707317
[ "MIT" ]
robyscar/C-_10_AllInOne4Dummies_sourcecode
source/BK05/CH03/BindingSample2/App.xaml.cs
330
C#
using System; using System.Drawing; namespace Cyotek.Windows.Forms { // Cyotek TabList // Copyright (c) 2012-2017 Cyotek. // https://www.cyotek.com // https://www.cyotek.com/blog/tag/tablist // Licensed under the MIT License. See LICENSE.txt for the full text. // If you use this control in your applications, attribution, donations or contributions are welcome. /// <summary> /// Base class for theme rendering. /// </summary> /// <seealso cref="T:Cyotek.Windows.Forms.ITabListPageRenderer"/> public abstract class TabListRenderer : ITabListRenderer { #region Static Properties /// <summary> /// Gets or sets the default renderer . /// </summary> /// <value> /// The default renderer. /// </value> /// <remarks>All <see cref="TabList"/> controls will use the default renderer unless explicit assigned a dedicated renderer.</remarks> [Obsolete("This property is obsolete and will be removed in a future update. Use TabListManager.Renderer.")] public static ITabListRenderer DefaultRenderer { get => TabListManager.Renderer; set => TabListManager.Renderer = value; } #endregion #region ITabListRenderer Interface /// <summary> /// Retrieves the size of a rectangular area into which the header area of a /// <see cref="TabListPage"/> can be fitted. /// </summary> /// <param name="page">The <see cref="TabListPage"/> to be processed.</param> /// <param name="proposedSize">The proposed size for the header.</param> /// <returns> /// An ordered pair of type <see cref="Size"/> representing the width and height of a rectangle. /// </returns> /// <seealso cref="M:Cyotek.Windows.Forms.ITabListPageRenderer.GetPreferredSize(TabListPage,Size)"/> public virtual Size GetPreferredSize(TabListPage page, Size proposedSize) { return proposedSize; } /// <summary> /// Retrieves the location where the tab list should be located. /// </summary> /// <returns> /// The location of the tab list. /// </returns> /// <seealso cref="M:Cyotek.Windows.Forms.ITabListPageRenderer.GetStartingPosition()"/> public virtual Point GetStartingPosition() { return Point.Empty; } /// <summary> /// Renders the header for the given <see cref="TabListPage"/>. /// </summary> /// <param name="g">The <see cref="Graphics"/> to draw on.</param> /// <param name="page">The <see cref="TabListPage"/> to be processed.</param> /// <param name="state">One of the <see cref="TabListPageState"/> values that specifies the state /// of the <see cref="TabListPage"/> to render.</param> /// <seealso cref="M:Cyotek.Windows.Forms.ITabListPageRenderer.RenderHeader(Graphics,TabListPage,TabListPageState)"/> public abstract void RenderHeader(Graphics g, TabListPage page, TabListPageState state); /// <summary> /// Renders the background of the tab list. /// </summary> /// <param name="g">The <see cref="Graphics"/> to draw on.</param> /// <param name="bounds">The <see cref="Rectangle"/> that represents the dimensions of the tab /// list.</param> /// <seealso cref="M:Cyotek.Windows.Forms.ITabListPageRenderer.RenderList(Graphics,Rectangle)"/> public virtual void RenderList(Graphics g, Rectangle bounds) { // empty implementation } #endregion } }
36.569892
138
0.666569
[ "MIT" ]
cyotek/Cyotek.Windows.Forms.TabList
Cyotek.Windows.Forms.TabList/TabListRenderer.cs
3,401
C#
using Harmonic.Buffers; using System; using System.Collections.Generic; using System.Text; namespace Harmonic.Networking.Amf.Serialization.Amf0 { public class SerializationContext : IDisposable { public ByteBuffer Buffer { get; private set; } public List<object> ReferenceTable { get; set; } = new(); public int MessageLength => Buffer.Length; private bool _disposeBuffer = true; public SerializationContext() { Buffer = new ByteBuffer(); } public SerializationContext(ByteBuffer buffer) { Buffer = buffer; _disposeBuffer = false; } public void GetMessage(Span<byte> buffer) { ReferenceTable.Clear(); Buffer.TakeOutMemory(buffer); } public void Dispose() { if (_disposeBuffer) { ((IDisposable)Buffer).Dispose(); } } } }
22.790698
65
0.565306
[ "MIT" ]
Psynosaur/Harmonic
Harmonic/Networking/Amf/Serialization/Amf0/SerializationContext.cs
982
C#
// ***************************************************************************** // BSD 3-Clause License (https://github.com/ComponentFactory/Krypton/blob/master/LICENSE) // © Component Factory Pty Ltd, 2006 - 2016, All rights reserved. // The software and associated documentation supplied hereunder are the // proprietary information of Component Factory Pty Ltd, 13 Swallows Close, // Mornington, Vic 3931, Australia and are supplied subject to license terms. // // Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV) 2017 - 2020. All rights reserved. (https://github.com/Wagnerp/Krypton-NET-5.472) // Version 5.472.0.0 www.ComponentFactory.com // ***************************************************************************** using System; using System.Drawing; using System.Windows.Forms; using System.Diagnostics; namespace ComponentFactory.Krypton.Toolkit { /// <summary> /// View element that draws a scrollbar. /// </summary> public class ViewDrawScrollBar : ViewLeaf { #region Instance Fields private ScrollBar _scrollBar; private bool _vertical; private bool _removing; private int _min; private int _max; private int _largeChange; private int _smallChange; private int _offset; #endregion #region Events /// <summary> /// Occurs when the scroll position has changed. /// </summary> public event EventHandler ScrollChanged; #endregion #region Identity /// <summary> /// Initialize a new instance of the ViewDrawScrollBar class. /// </summary> /// <param name="vertical">Is this a vertical scrollbar.</param> public ViewDrawScrollBar(bool vertical) { // Remember the vertical/horizontal setting _vertical = vertical; //Default other properties _removing = false; ShortSize = false; _min = 0; _max = 100; _largeChange = 20; _smallChange = 1; _offset = 0; } /// <summary> /// Obtains the String representation of this instance. /// </summary> /// <returns>User readable name of the instance.</returns> public override string ToString() { // Return the class name and instance identifier return "ViewDrawScrollBar:" + Id; } /// <summary> /// Release unmanaged and optionally managed resources. /// </summary> /// <param name="disposing">Called from Dispose method.</param> protected override void Dispose(bool disposing) { // If called from explicit call to Dispose if (disposing) { // Must remove the scroll bar resource if (_scrollBar != null) { // Should never be called from garbage collector Debug.Assert(!_scrollBar.InvokeRequired); // Cannot destroy control in a different thread if (!_scrollBar.InvokeRequired) { RemoveScrollBar(); } } } base.Dispose(disposing); } #endregion #region Vertical /// <summary> /// Gets and sets a value indicating if the scrollbar is vertical. /// </summary> public bool Vertical { get => _vertical; set { // Only interested in changes if (_vertical != value) { // Remember new orientation _vertical = value; // Remove the scrollbar as a child control RemoveScrollBar(); } } } #endregion #region ShortSize /// <summary> /// Gets and sets a value indicating if the scroll should short size. /// </summary> public bool ShortSize { get; set; } #endregion #region SetScrollValues /// <summary> /// Update the scrollbar with the latest scrolling values. /// </summary> /// <param name="min">Scroll minimum value.</param> /// <param name="max">Scroll maximum value.</param> /// <param name="smallChange">Size of a small change.</param> /// <param name="largeChange">Size of a large change.</param> /// <param name="offset">Current scrolling offset.</param> public void SetScrollValues(int min, int max, int smallChange, int largeChange, int offset) { // Update cached values (applying limit checking) _min = Math.Max(min, 0); _max = Math.Max(max, 0); _smallChange = Math.Max(smallChange, 0); _largeChange = Math.Max(largeChange, 0); _offset = Math.Max(offset, 0); if (_scrollBar != null) { // Set the scrolling values _scrollBar.Minimum = _min; _scrollBar.Maximum = _max; _scrollBar.SmallChange = _smallChange; _scrollBar.LargeChange = _largeChange; _scrollBar.Value = Math.Max(_min, Math.Min(_max, _offset)); } } #endregion #region ScrollPosition /// <summary> /// Gets the current scroll position. /// </summary> public int ScrollPosition { get { if (_scrollBar != null) { return _scrollBar.Value; } else { return 0; } } } #endregion #region Layout /// <summary> /// Discover the preferred size of the element. /// </summary> /// <param name="context">Layout context.</param> public override Size GetPreferredSize(ViewLayoutContext context) { Debug.Assert(context != null); // The minimum size is the minimum system size of a scrollbar return new Size(SystemInformation.VerticalScrollBarWidth, SystemInformation.HorizontalScrollBarHeight); } /// <summary> /// Perform a layout of the elements. /// </summary> /// <param name="context">Layout context.</param> public override void Layout(ViewLayoutContext context) { Debug.Assert(context != null); // Prevent recreate of the control if (!IsDisposed && !_removing) { // We take on all the available display area ClientRectangle = context.DisplayRectangle; // Are we allowed to layout child controls? if (!context.ViewManager.DoNotLayoutControls) { // Make sure the scrollbar has actually been created CreateScrollBar(context.Control); // If we need to hide/disable the control then do it before position changes if (!Visible) { _scrollBar.Hide(); } if (!Enabled) { _scrollBar.Enabled = false; } // Should the scrollbar is shorter than then the entire client area? if (ShortSize) { if (Vertical) { _scrollBar.SetBounds(ClientLocation.X, ClientLocation.Y, ClientWidth, ClientHeight - SystemInformation.HorizontalScrollBarHeight); } else { _scrollBar.SetBounds(ClientLocation.X, ClientLocation.Y, ClientWidth - SystemInformation.VerticalScrollBarWidth, ClientHeight); } } else { // Position the ScrollBar in the entire requested area _scrollBar.SetBounds(ClientLocation.X, ClientLocation.Y, ClientWidth, ClientHeight); } // If we need to show/enable control then do it after position changes if (Visible) { _scrollBar.Show(); } if (Enabled) { _scrollBar.Enabled = true; } } } } #endregion #region Implementation private void CreateScrollBar(Control parent) { // Do we need to create a scrollbar? if (_scrollBar == null) { // Create the correct type of control if (Vertical) { _scrollBar = new VScrollBar(); } else { _scrollBar = new HScrollBar(); } // Hook into scroll position changes _scrollBar.Scroll += OnScrollBarChange; // Create it hidden _scrollBar.Hide(); // Set the scrolling values _scrollBar.Minimum = _min; _scrollBar.Maximum = _max; _scrollBar.SmallChange = _smallChange; _scrollBar.LargeChange = _largeChange; _scrollBar.Value = _offset; // Add our new control to the provided parent collection CommonHelper.AddControlToParent(parent, _scrollBar); } } private void RemoveScrollBar() { // Do we need to remove the scrollbar? if ((_scrollBar != null) && !_removing) { // Prevent recreate of the control during removal, as removing it // will cause more layout cycles to occur. We put it back to false // at the end of the remove process. _removing = true; // Unhook from events _scrollBar.Scroll -= OnScrollBarChange; // Hide the scrollbar from view _scrollBar.Hide(); // Remove scrollbar from containing collection CommonHelper.RemoveControlFromParent(_scrollBar); // Destroy the current scrollbar _scrollBar.Dispose(); _scrollBar = null; _removing = false; } } private void OnScrollBarChange(object sender, ScrollEventArgs e) { // Update with the new scroll value _scrollBar.Value = e.NewValue; ScrollChanged?.Invoke(this, EventArgs.Empty); } #endregion } }
34.038576
157
0.486706
[ "BSD-3-Clause" ]
Krypton-Suite-Legacy/Krypton-NET-5.472
Source/Krypton Components/ComponentFactory.Krypton.Toolkit/View Draw/ViewDrawScrollBar.cs
11,474
C#
namespace MilitaryElite.Enums { public enum Corps { Airforces = 1, Marines = 2 } }
12.444444
29
0.535714
[ "MIT" ]
VeselinBPavlov/csharp-oop-basics
10. Interfaces and Abstraction - Exercise/MilitaryElite/Enums/Corps.cs
112
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; using MoreMountains.Tools; #if UNITY_EDITOR using UnityEditor.Animations; #endif namespace MoreMountains.CorgiEngine { /// <summary> /// A struct used to store character animation parameter definitions, to be used by the CharacterAnimationParametersInitializer class /// </summary> public struct CorgiEngineCharacterAnimationParameter { /// the name of the parameter public string ParameterName; /// the type of the parameter public AnimatorControllerParameterType ParameterType; public CorgiEngineCharacterAnimationParameter(string name, AnimatorControllerParameterType type) { ParameterName = name; ParameterType = type; } } /// <summary> /// /// </summary> public class CharacterAnimationParametersInitializer : MonoBehaviour { [Header("Initialization")] /// if this is true, this component will remove itself after adding the character parameters [Tooltip("if this is true, this component will remove itself after adding the character parameters")] public bool AutoRemoveAfterInitialization = true; [MMInspectorButton("AddAnimationParameters")] public bool AddAnimationParametersButton; protected CorgiEngineCharacterAnimationParameter[] ParametersArray = new CorgiEngineCharacterAnimationParameter[] { new CorgiEngineCharacterAnimationParameter("Activating", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Airborne", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Alive", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("CollidingAbove", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("CollidingBelow", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("CollidingLeft", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("CollidingRight", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Crawling", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Crouching", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Damage", AnimatorControllerParameterType.Trigger), new CorgiEngineCharacterAnimationParameter("Dangling", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Dashing", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Death", AnimatorControllerParameterType.Trigger), new CorgiEngineCharacterAnimationParameter("Diving", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("FacingRight", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("FallDamage", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Flying", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("FlySpeed", AnimatorControllerParameterType.Float), new CorgiEngineCharacterAnimationParameter("Gliding", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Grounded", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Gripping", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Idle", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Jetpacking", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Jumping", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("DoubleJumping", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("HitTheGround", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("LadderClimbing", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("LadderClimbingSpeedX", AnimatorControllerParameterType.Float), new CorgiEngineCharacterAnimationParameter("LadderClimbingSpeedY", AnimatorControllerParameterType.Float), new CorgiEngineCharacterAnimationParameter("LedgeHanging", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("LedgeClimbing", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("LookingUp", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Pulling", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Pushing", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Random", AnimatorControllerParameterType.Float), new CorgiEngineCharacterAnimationParameter("RandomConstant", AnimatorControllerParameterType.Int), new CorgiEngineCharacterAnimationParameter("Running", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Speed", AnimatorControllerParameterType.Float), new CorgiEngineCharacterAnimationParameter("xSpeed", AnimatorControllerParameterType.Float), new CorgiEngineCharacterAnimationParameter("ySpeed", AnimatorControllerParameterType.Float), new CorgiEngineCharacterAnimationParameter("Swimming", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("SwimmingIdle", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("Walking", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("WallClinging", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("WallJumping", AnimatorControllerParameterType.Bool), new CorgiEngineCharacterAnimationParameter("WorldXSpeed", AnimatorControllerParameterType.Float), new CorgiEngineCharacterAnimationParameter("WorldYSpeed", AnimatorControllerParameterType.Float) }; protected Animator _animator; #if UNITY_EDITOR protected AnimatorController _controller; #endif protected List<string> _parameters = new List<string>(); /// <summary> /// Adds all the default animation parameters on your character's animator /// </summary> public virtual void AddAnimationParameters() { // we grab the animator _animator = this.gameObject.GetComponent<Animator>(); if (_animator == null) { Debug.LogError("You need to add the AnimationParameterInitializer class to a gameobject with an Animator."); } // we grab the controller #if UNITY_EDITOR _controller = _animator.runtimeAnimatorController as AnimatorController; if (_controller == null) { Debug.LogError("You need an animator controller on this Animator."); } #endif // we store its parameters _parameters.Clear(); foreach (AnimatorControllerParameter param in _animator.parameters) { _parameters.Add(param.name); } // we add all the listed parameters foreach (CorgiEngineCharacterAnimationParameter parameter in ParametersArray) { if (!_parameters.Contains(parameter.ParameterName)) { #if UNITY_EDITOR _controller.AddParameter(parameter.ParameterName, parameter.ParameterType); #endif } } // we remove this component if needed if (AutoRemoveAfterInitialization) { DestroyImmediate(this); } } } }
57.763889
137
0.733109
[ "Apache-2.0" ]
CrayonScript/CrayonScriptPluginUnityProject
Assets/CorgiEngine/Common/Scripts/Agents/Animations/CharacterAnimationParametersInitializer.cs
8,320
C#
using System; using System.ComponentModel; using System.Linq; using Android.App; using Android.Content.Res; using Android.Text; using Android.Widget; using Object = Java.Lang.Object; namespace Xamarin.Forms.Platform.Android.AppCompat { public class PickerRenderer : ViewRenderer<Picker, EditText> { AlertDialog _dialog; bool _disposed; TextColorSwitcher _textColorSwitcher; public PickerRenderer() { AutoPackage = false; } protected override EditText CreateNativeControl() { return new EditText(Context); } protected override void Dispose(bool disposing) { if (disposing && !_disposed) { _disposed = true; ((ObservableList<string>)Element.Items).CollectionChanged -= RowsCollectionChanged; } base.Dispose(disposing); } protected override void OnElementChanged(ElementChangedEventArgs<Picker> e) { if (e.OldElement != null) ((ObservableList<string>)e.OldElement.Items).CollectionChanged -= RowsCollectionChanged; if (e.NewElement != null) { ((ObservableList<string>)e.NewElement.Items).CollectionChanged += RowsCollectionChanged; if (Control == null) { EditText textField = CreateNativeControl(); textField.Focusable = false; textField.Clickable = true; textField.Tag = this; textField.InputType = InputTypes.Null; textField.SetOnClickListener(PickerListener.Instance); _textColorSwitcher = new TextColorSwitcher(textField.TextColors); SetNativeControl(textField); } UpdatePicker(); UpdateTextColor(); } base.OnElementChanged(e); } protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (e.PropertyName == Picker.TitleProperty.PropertyName) UpdatePicker(); if (e.PropertyName == Picker.SelectedIndexProperty.PropertyName) UpdatePicker(); if (e.PropertyName == Picker.TextColorProperty.PropertyName) UpdateTextColor(); } internal override void OnFocusChangeRequested(object sender, VisualElement.FocusRequestArgs e) { base.OnFocusChangeRequested(sender, e); if (e.Focus) OnClick(); else if (_dialog != null) { _dialog.Hide(); ((IElementController)Element).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false); Control.ClearFocus(); _dialog = null; } } void OnClick() { Picker model = Element; using (var builder = new AlertDialog.Builder(Context)) { builder.SetTitle(model.Title ?? ""); string[] items = model.Items.ToArray(); builder.SetItems(items, (s, e) => ((IElementController)model).SetValueFromRenderer(Picker.SelectedIndexProperty, e.Which)); builder.SetNegativeButton(global::Android.Resource.String.Cancel, (o, args) => { }); _dialog = builder.Create(); } _dialog.SetCanceledOnTouchOutside(true); _dialog.DismissEvent += (sender, args) => { _dialog.Dispose(); _dialog = null; }; _dialog.Show(); } void RowsCollectionChanged(object sender, EventArgs e) { UpdatePicker(); } void UpdatePicker() { Control.Hint = Element.Title; if (Element.SelectedIndex == -1 || Element.Items == null) Control.Text = null; else Control.Text = Element.Items[Element.SelectedIndex]; } void UpdateTextColor() { _textColorSwitcher?.UpdateTextColor(Control, Element.TextColor); } class PickerListener : Object, IOnClickListener { #region Statics public static readonly PickerListener Instance = new PickerListener(); #endregion public void OnClick(global::Android.Views.View v) { var renderer = v.Tag as PickerRenderer; renderer?.OnClick(); } } } }
24.335526
127
0.706137
[ "MIT" ]
datasprings/xamarin
Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs
3,699
C#
// // DO NOT MODIFY! THIS IS AUTOGENERATED FILE! // #pragma warning disable 1591 namespace Xilium.CefGlue { using System; using System.Collections.Generic; using System.Diagnostics; using System.Runtime.InteropServices; using Xilium.CefGlue.Interop; // Role: HANDLER public abstract unsafe partial class CefJSDialogHandler { private static Dictionary<IntPtr, CefJSDialogHandler> _roots = new Dictionary<IntPtr, CefJSDialogHandler>(); private int _refct; private cef_jsdialog_handler_t* _self; protected object SyncRoot { get { return this; } } private cef_jsdialog_handler_t.add_ref_delegate _ds0; private cef_jsdialog_handler_t.release_delegate _ds1; private cef_jsdialog_handler_t.has_one_ref_delegate _ds2; private cef_jsdialog_handler_t.has_at_least_one_ref_delegate _ds3; private cef_jsdialog_handler_t.on_jsdialog_delegate _ds4; private cef_jsdialog_handler_t.on_before_unload_dialog_delegate _ds5; private cef_jsdialog_handler_t.on_reset_dialog_state_delegate _ds6; private cef_jsdialog_handler_t.on_dialog_closed_delegate _ds7; protected CefJSDialogHandler() { _self = cef_jsdialog_handler_t.Alloc(); _ds0 = new cef_jsdialog_handler_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_jsdialog_handler_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_jsdialog_handler_t.has_one_ref_delegate(has_one_ref); _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_jsdialog_handler_t.has_at_least_one_ref_delegate(has_at_least_one_ref); _self->_base._has_at_least_one_ref = Marshal.GetFunctionPointerForDelegate(_ds3); _ds4 = new cef_jsdialog_handler_t.on_jsdialog_delegate(on_jsdialog); _self->_on_jsdialog = Marshal.GetFunctionPointerForDelegate(_ds4); _ds5 = new cef_jsdialog_handler_t.on_before_unload_dialog_delegate(on_before_unload_dialog); _self->_on_before_unload_dialog = Marshal.GetFunctionPointerForDelegate(_ds5); _ds6 = new cef_jsdialog_handler_t.on_reset_dialog_state_delegate(on_reset_dialog_state); _self->_on_reset_dialog_state = Marshal.GetFunctionPointerForDelegate(_ds6); _ds7 = new cef_jsdialog_handler_t.on_dialog_closed_delegate(on_dialog_closed); _self->_on_dialog_closed = Marshal.GetFunctionPointerForDelegate(_ds7); } ~CefJSDialogHandler() { Dispose(false); } protected virtual void Dispose(bool disposing) { if (_self != null) { cef_jsdialog_handler_t.Free(_self); _self = null; } } private void add_ref(cef_jsdialog_handler_t* self) { lock (SyncRoot) { var result = ++_refct; if (result == 1) { lock (_roots) { _roots.Add((IntPtr)_self, this); } } } } private int release(cef_jsdialog_handler_t* self) { lock (SyncRoot) { var result = --_refct; if (result == 0) { lock (_roots) { _roots.Remove((IntPtr)_self); } return 1; } return 0; } } private int has_one_ref(cef_jsdialog_handler_t* self) { lock (SyncRoot) { return _refct == 1 ? 1 : 0; } } private int has_at_least_one_ref(cef_jsdialog_handler_t* self) { lock (SyncRoot) { return _refct != 0 ? 1 : 0; } } internal cef_jsdialog_handler_t* ToNative() { add_ref(_self); return _self; } [Conditional("DEBUG")] private void CheckSelf(cef_jsdialog_handler_t* self) { if (_self != self) throw ExceptionBuilder.InvalidSelfReference(); } } }
37.169492
116
0.611263
[ "MIT", "BSD-3-Clause" ]
NovusTheory/Chromely
src/Chromely.CefGlue/CefGlue/Classes.g/CefJSDialogHandler.g.cs
4,388
C#
using System; using Newtonsoft.Json; namespace TdLib { /// <summary> /// AUTOGENERATED: DO NOT EDIT! /// </summary> public partial class TdApi { public class Text : Object { [JsonProperty("@type")] public override string DataType { get; set; } = "text"; [JsonProperty("@extra")] public override string Extra { get; set; } [JsonConverter(typeof(Converter))] [JsonProperty("text")] public string Text_ { get; set; } } } }
24.090909
91
0.55283
[ "MIT" ]
Behnam-Emamian/tdsharp
TDLib.Api/Objects/Text.cs
530
C#
using UnityEngine; using UnityEngine.SceneManagement; public class GameManager : MonoBehaviour { public static GameManager instance { get; private set; } void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(this); } DontDestroyOnLoad(gameObject); } public void Start() { ScoreManager.instance.setScore(0); } public void RemoveFromDontDestroyOnLoad() { SceneManager.MoveGameObjectToScene(gameObject, SceneManager.GetActiveScene()); } }
21
86
0.602627
[ "MIT" ]
AlexandreLadriere/RetroSpaceShooter
Assets/Scripts/Managers/GameManager.cs
609
C#
using System; using System.Xml.Serialization; namespace Alipay.AopSdk.Core.Domain { /// <summary> /// BusinessPoint Data Structure. /// </summary> [Serializable] public class BusinessPoint : AopObject { /// <summary> /// 点位描述 /// </summary> [XmlElement("point_desc")] public string PointDesc { get; set; } /// <summary> /// 业务点位id /// </summary> [XmlElement("point_id")] public long PointId { get; set; } /// <summary> /// 点位名称 /// </summary> [XmlElement("point_name")] public string PointName { get; set; } /// <summary> /// 点位备注 /// </summary> [XmlElement("remark")] public string Remark { get; set; } /// <summary> /// 点位状态 /// </summary> [XmlElement("status")] public long Status { get; set; } } }
21.744186
45
0.490909
[ "MIT" ]
leixf2005/Alipay.AopSdk.Core
Alipay.AopSdk.Core/Domain/BusinessPoint.cs
975
C#
using System; namespace XMPPEngineer.Extensions { /// <summary> /// Represents an item of an XMPP entity as defined in XEP-0030. /// </summary> [Serializable] internal class Item { /// <summary> /// The JID of the item. /// </summary> public Jid Jid { get; private set; } /// <summary> /// The node identifier of the item. This may be null. /// </summary> public string Node { get; private set; } /// <summary> /// The name of the item. This may be null. /// </summary> public string Name { get; private set; } /// <summary> /// The nickname of the item. This may be null. /// </summary> public string Nick { get; private set; } /// <summary> /// The affiliation of the item. This may be null. /// </summary> public string Affiliation { get; private set; } /// <summary> /// The role of the item. This may be null. /// </summary> public string Role { get; private set; } /// <summary> /// Initializes a new instance of the Item class. /// </summary> /// <param name="jid">The JID of the item.</param> /// <param name="node">The node identifier of the item.</param> /// <param name="name">The name of the item.</param> /// <exception cref="ArgumentNullException">The jid parameter is /// null.</exception> public Item(Jid jid, string node = null, string name = null) { jid.ThrowIfNull("jid"); Jid = jid; Node = node; Name = name; Affiliation = null; Nick = null; Role = null; } /// <summary> /// Initialised a new instance of the item class. /// This instance is used for member list creation and modification. /// </summary> /// <param name="affiliation">A long-lived association or connection with a room.</param> /// <param name="jid">JID</param> /// <param name="nickname">Occupant nickname</param> /// <param name="role">Privilege level within a room.</param> public Item(string affiliation, Jid jid, string nickname = null, string role = null) { affiliation.ThrowIfNull("affiliation"); jid.ThrowIfNull("jid"); Affiliation = affiliation; Jid = jid; Nick = nickname; Role = role; Node = null; Name = null; } /// <summary> /// Initialised a new instance of the item class. /// This instance is used for member list creation and modification. /// </summary> /// <param name="jid">JID</param> /// <param name="node">The node identifier of the item.</param> /// <param name="name">The name of the item.</param> /// <param name="nickname">Occupant nickname</param> /// <param name="role">Privilege level within a room.</param> /// <param name="affiliation">A long-lived association or connection with a room.</param> public Item(Jid jid, string node = null, string name = null, string nickname = null, string role = null, string affiliation = null) { jid.ThrowIfNull("jid"); Jid = jid; Node = node; Name = name; Nick = nickname; Role = role; Affiliation = affiliation; } } }
29.826772
139
0.500264
[ "MIT" ]
ParamountVentures/Sharp.Xmpp
Extensions/XEP-0030/Item.cs
3,790
C#
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d2d1_3.h in the Windows SDK for Windows 10.0.20348.0 // Original source is Copyright © Microsoft. All rights reserved. using NUnit.Framework; using System; using System.Runtime.InteropServices; using static TerraFX.Interop.Windows.IID; namespace TerraFX.Interop.DirectX.UnitTests; /// <summary>Provides validation of the <see cref="ID2D1Device5" /> struct.</summary> public static unsafe partial class ID2D1Device5Tests { /// <summary>Validates that the <see cref="Guid" /> of the <see cref="ID2D1Device5" /> struct is correct.</summary> [Test] public static void GuidOfTest() { Assert.That(typeof(ID2D1Device5).GUID, Is.EqualTo(IID_ID2D1Device5)); } /// <summary>Validates that the <see cref="ID2D1Device5" /> struct is blittable.</summary> [Test] public static void IsBlittableTest() { Assert.That(Marshal.SizeOf<ID2D1Device5>(), Is.EqualTo(sizeof(ID2D1Device5))); } /// <summary>Validates that the <see cref="ID2D1Device5" /> struct has the right <see cref="LayoutKind" />.</summary> [Test] public static void IsLayoutSequentialTest() { Assert.That(typeof(ID2D1Device5).IsLayoutSequential, Is.True); } /// <summary>Validates that the <see cref="ID2D1Device5" /> struct has the correct size.</summary> [Test] public static void SizeOfTest() { if (Environment.Is64BitProcess) { Assert.That(sizeof(ID2D1Device5), Is.EqualTo(8)); } else { Assert.That(sizeof(ID2D1Device5), Is.EqualTo(4)); } } }
34.137255
145
0.678346
[ "MIT" ]
IngmarBitter/terrafx.interop.windows
tests/Interop/Windows/DirectX/um/d2d1_3/ID2D1Device5Tests.cs
1,743
C#
namespace _05_ParkValid { using System; using System.Collections.Generic; using System.Linq; public class StartUp { public static void Main() { var database = new Dictionary<string, string>(); int numberOfComands = int.Parse(Console.ReadLine()); for (int i = 0; i < numberOfComands; i++) { var currentCommandArgs = Console.ReadLine().Split(); var command = currentCommandArgs[0]; var name = currentCommandArgs[1]; if (command == "register") { var plate = currentCommandArgs[2]; if (database.ContainsKey(name)) { Console.WriteLine($"ERROR: already registered with plate number {database[name]}"); } else if (UnvalidePlateNumber(plate)) { Console.WriteLine($"ERROR: invalid license plate {plate}"); } else if (database.ContainsValue(plate)) { Console.WriteLine($"ERROR: license plate {plate} is busy"); } else { Console.WriteLine($"{name} registered {plate} successfully"); database.Add(name, plate); } } else { if (!database.ContainsKey(name)) { Console.WriteLine($"ERROR: user {name} not found"); } else { Console.WriteLine($"user {name} unregistered successfully"); database.Remove(name); } } } foreach (var user in database) { Console.WriteLine($"{user.Key} => {user.Value}"); } } private static bool UnvalidePlateNumber(string plate) { if (plate.Length!=8) { return true; } if (!(char.IsLetter(plate[0]) && char.IsLetter(plate[1]) && char.IsLetter(plate[6]) && char.IsLetter(plate[7]))) { return true; } if (!(char.IsUpper(plate[0]) && char.IsUpper(plate[1]) && char.IsUpper(plate[6]) && char.IsUpper(plate[7]))) { return true; } if (!(char.IsNumber(plate[2]) && char.IsNumber(plate[3]) && char.IsNumber(plate[4]) && char.IsNumber(plate[5]))) { return true; } return false; } } }
27.466019
124
0.420997
[ "MIT" ]
MrPIvanov/SoftUni
02-Progr Fundamentals/18-Dictionaries, Lambda Expressions and LINQ - Exercises/18-DictLamMor/05-ParkValid/StartUp.cs
2,831
C#
using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Discord { public static class GuildUserExtensions { public static Task AddRolesAsync(this IGuildUser user, params IRole[] roles) => AddRolesAsync(user, (IEnumerable<IRole>)roles); public static Task AddRolesAsync(this IGuildUser user, IEnumerable<IRole> roles) => user.ModifyAsync(x => x.Roles = user.Roles.Concat(roles)); public static Task RemoveRolesAsync(this IGuildUser user, params IRole[] roles) => RemoveRolesAsync(user, (IEnumerable<IRole>)roles); public static Task RemoveRolesAsync(this IGuildUser user, IEnumerable<IRole> roles) => user.ModifyAsync(x => x.Roles = user.Roles.Except(roles)); } }
39.75
91
0.69434
[ "MIT" ]
Joe4evr/Discord.Net
src/Discord.Net/Extensions/GuildUserExtensions.cs
797
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using OLEDB.Test.ModuleCore; using System.IO; using XmlCoreTest.Common; //This file loads the specified new control file and executes the variations. namespace System.Xml.Tests { /// <summary> /// This is the CXmlDriver related code. /// </summary> //[TestModule("Reader and Writer Factory Tests")] public partial class CFactoryModule : CXmlDriverModule { private string _testData; public string TestDataPath { get { return _testData; } } public override int Init(object o) { int ret = base.Init(o); _testData = Path.Combine(FilePathUtil.GetTestDataPath(), @"XmlReader"); return ret; } } /// <summary> /// We will basically create two separate spec files and call the below method /// for each of the spec file separately. /// </summary> //[XmlDriverScenario("XmlReader", "ReaderCreateSpec.xml")] //[XmlDriverScenario("XmlWriter", "WriterCreateSpec.xml")] public partial class CRWFactoryDriverScenario : CXmlDriverScenario { public override int ExecuteVariation(CXmlDriverParam param) { CError.WriteLine("Test Parameters : "); CError.WriteLine(this.CurVariation.Desc); CFactory f = null; string factoryToInvoke = param.SelectExistingValue("DriverFunction"); switch ( factoryToInvoke ) //separates whether to call Reader or Writer { case "XmlReader": f = new CReaderFactory(); break; case "XmlWriter": f = new CWriterFactory(); break; default: throw new CTestFailedException( "Invalid XmlDriverScenario passed in : " + factoryToInvoke ); } CFactory.TestState testResult = f.TestVariation(param); if (testResult == CFactory.TestState.Pass) return TEST_PASS; else if (testResult == CFactory.TestState.Skip) return TEST_SKIPPED; return TEST_FAIL; } } /// <summary> /// Defines the basic functionality for any Factory /// </summary> public abstract class CFactory { protected CXmlDriverParam varInfo; protected bool isValid; public bool IsVariationValid { get { return isValid; } } protected string exceptionType; public string PExceptionType { get { return exceptionType; } } protected string exceptionMsg; public string PExceptionMsg { get { return exceptionMsg; } } //This controls the state machine. public enum TestState { Initial, //At Start. PreTest, //After PreTest is called and finished successfully. CreateSuccess, //After Create method is called. Consume, //Before starting to use the object. Skip, //The case is skipped. Error, // In case of an error. Should throw CTestFailedException anyways. Pass, // Test() is successful. Complete //After Successful PostTest. }; protected TestState pstate = TestState.Initial; protected string xmlFile; public string TestFileName { get { return xmlFile; } } protected string filePath; public string TestFilePath { get { return filePath; } } protected string httpPath; public string TestHttpPath { get { return httpPath; } } //Helper Method to get the full path of the File we want. protected string GetPath(string fileName, bool isHttp) { string root = TestFilePath; if (isHttp) root = TestHttpPath; if (root.EndsWith(@"\")) { if (fileName.StartsWith(@"\")) { return (root + fileName.Substring(1)); } return (root + fileName); } else { if (fileName.StartsWith(@"\")) { return (root + fileName); } return (root + @"\" + fileName); } } protected string GetFile(string fileName) { return GetPath(fileName, false); } protected string GetUrl(string url) { return GetPath(url, true); } /// <summary> /// Init does the following : /// Store Parameter Info. /// Parse out the commonly required and universal tags /// </summary> public virtual void Init(CXmlDriverParam param) { varInfo = param; string resultType = varInfo.SelectExistingValue("Result/@Type", "Data"); if (resultType == "Valid") isValid = true; else isValid = false; exceptionType = varInfo.SelectValue("Result/ExceptionType", "Data"); exceptionMsg = varInfo.SelectValue("Result/ExceptionMessage", "Data"); xmlFile = varInfo.SelectValue("Result/TestXmlFile", "Data"); filePath = varInfo.SelectValue("filepath", "Data"); filePath = FilePathUtil.ExpandVariables(filePath); if (filePath == null) { Log("Setting filePath = " + filePath); } httpPath = varInfo.SelectValue("httppath", "Data"); } public virtual void DumpVariationInfo() { CError.WriteIgnore(this.IsVariationValid + "\n"); CError.WriteIgnore(this.TestFileName + "\n"); CError.WriteIgnore(this.PExceptionType + "\n"); CError.WriteIgnore(this.PExceptionMsg + "\n"); } public void Log(string str) { CError.WriteLineIgnore(str); } /// <summary> /// This method will be called by ExecuteVariation and it will /// orchestrate the state. /// </summary> /// <param name="param"></param> /// <returns>TEST_SUCCESS, TEST_FAIL or TEST_SKIPPED /// </returns> public TestState TestVariation(CXmlDriverParam param) { // The following commands actually test the variation. Init(param); PreTest(); CError.Compare(pstate, TestState.PreTest, "Invalid State: " + pstate); try { Test(); if (pstate == TestState.Skip) { return TestState.Skip; } CError.Compare(pstate, TestState.Pass, "Invalid State: " + pstate); } catch (Exception readerException) { Log(readerException.ToString()); if (!IsVariationValid) { if (!CheckException(readerException)) { pstate = TestState.Error; DumpVariationInfo(); throw readerException; } else { pstate = TestState.Pass; } } else //Variation was valid { pstate = TestState.Error; DumpVariationInfo(); throw readerException; } } finally //do we need this style? what if somehow state is not pass, investigate { PostTest(); } Log("State at the End: " + pstate); if (pstate == TestState.Complete) return TestState.Pass; return TestState.Error; } /// <summary> /// These are the abstract methods which each factory /// will implement and know how to test the variation /// </summary> protected abstract void PreTest(); protected abstract void Test(); protected abstract void PostTest(); /// <summary> /// This method compares the given exception with the expected exception for this variation /// </summary> /// <param name="actualException">The actual exception that got thrown</param> /// <returns>true if the actual exception matches the expected exception</returns> protected bool CheckException(Exception actualException) { //Very primitive checking to startoff with. return (actualException.GetType().ToString() == exceptionType); } /// <summary> /// Reads the value of the tag in the Spec file under the FilterCriteria Section /// </summary> /// <param name="tag">Name of the tag to read.</param> /// <param name="throwOnNull">IF true, will check for null and throw, /// set to true if you want to throw an exception if value is not found. /// If set to false, the return value can be null</param> /// <returns>Value of the tag under FilterCriteria Section</returns> protected string ReadFilterCriteria(string tag, bool throwOnNull) { CError.WriteIgnore("Filtering " + tag + " : "); string s = null; if (throwOnNull) { s = varInfo.SelectExistingValue(tag, "FilterCriteria"); Log(s); } else { s = varInfo.SelectValue(tag, "FilterCriteria"); Log(s); } return s; } /// <summary> /// Reads the value of the tag in the Spec file under the Data Section /// </summary> /// <param name="tag">Name of the tag to read.</param> /// <param name="throwOnNull">IF true, will check for null and throw, /// set to true if you want to throw an exception if value is not found. /// If set to false, the return value can be null</param> /// <returns>Value of the tag under Data Section</returns> protected string ReadData(string tag, bool throwOnNull) { CError.WriteIgnore("Loading .. " + tag + " : "); string s = null; if (throwOnNull) { s = varInfo.SelectExistingValue(tag, "Data"); Log(s); } else { s = varInfo.SelectValue(tag, "Data"); Log(s); } return s; } } #region CustomReader /// <summary> /// CustomReader which wraps Factory created reader. /// </summary> public class CustomReader : XmlReader { private XmlReader _tr = null; public CustomReader(string filename) { _tr = ReaderHelper.Create(filename); } public CustomReader(Stream stream, bool isFragment) { XmlReaderSettings settings = new XmlReaderSettings(); if (!isFragment) _tr = ReaderHelper.Create(stream, settings, (string)null); else { settings.ConformanceLevel = ConformanceLevel.Fragment; _tr = ReaderHelper.Create(stream, settings, (string)null); } } public CustomReader(TextReader txtReader, bool isFragment) { XmlReaderSettings settings = new XmlReaderSettings(); if (!isFragment) _tr = ReaderHelper.Create(txtReader, settings, (string)null); else { settings.ConformanceLevel = ConformanceLevel.Fragment; _tr = ReaderHelper.Create(txtReader, settings, (string)null); } } public CustomReader(string url, bool isFragment) { XmlReaderSettings settings = new XmlReaderSettings(); if (!isFragment) _tr = ReaderHelper.Create(url, settings); else { settings.ConformanceLevel = ConformanceLevel.Fragment; _tr = ReaderHelper.Create(url, settings, null); } } public CustomReader(Stream stream) { XmlReaderSettings settings = new XmlReaderSettings(); _tr = ReaderHelper.Create(stream, settings, (string)null); } public override int Depth { get { return _tr.Depth; } } public override string Value { get { return _tr.Value; } } public override bool MoveToElement() { return _tr.MoveToElement(); } public override string LocalName { get { return _tr.LocalName; } } public override XmlNodeType NodeType { get { return _tr.NodeType; } } public override bool MoveToNextAttribute() { return _tr.MoveToNextAttribute(); } public override bool MoveToFirstAttribute() { return _tr.MoveToFirstAttribute(); } public override string LookupNamespace(string prefix) { return _tr.LookupNamespace(prefix); } public new void Dispose() { _tr.Dispose(); } public override bool EOF { get { return _tr.EOF; } } public override bool HasValue { get { return _tr.HasValue; } } public override string NamespaceURI { get { return _tr.NamespaceURI; } } public override bool Read() { return _tr.Read(); } public override XmlNameTable NameTable { get { return _tr.NameTable; } } public override bool CanResolveEntity { get { return _tr.CanResolveEntity; } } public override void ResolveEntity() { _tr.ResolveEntity(); } public override string GetAttribute(string name, string namespaceURI) { return _tr.GetAttribute(name, namespaceURI); } public override string GetAttribute(string name) { return _tr.GetAttribute(name); } public override string GetAttribute(int i) { return _tr.GetAttribute(i); } public override string BaseURI { get { return _tr.BaseURI; } } public override bool ReadAttributeValue() { return _tr.ReadAttributeValue(); } public override string Prefix { get { return _tr.Prefix; } } public override bool MoveToAttribute(string name, string ns) { return _tr.MoveToAttribute(name, ns); } public override bool MoveToAttribute(string name) { return _tr.MoveToAttribute(name); } public override int AttributeCount { get { return _tr.AttributeCount; } } public override bool IsEmptyElement { get { return _tr.IsEmptyElement; } } public override ReadState ReadState { get { return _tr.ReadState; } } public override XmlReaderSettings Settings { get { return _tr.Settings; } } } #endregion }
30.09434
99
0.523511
[ "MIT" ]
belav/runtime
src/libraries/System.Private.Xml/tests/Writers/RwFactory/CRWFactory.cs
15,950
C#
using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; namespace PhantomNet.AspNetCore.Mvc.ViewComponents.Compozr { public class EmptyCompozrBodyViewComponent : ViewComponent { public async Task<IViewComponentResult> InvokeAsync() { await Task.FromResult(0); return View(); } } }
23.266667
62
0.670487
[ "MIT" ]
green-grass/PhantomNet-Mvc
src/PhantomNet.AspNetCore.Mvc/ViewComponents/Compozr/EmptyCompozrBodyViewComponent.cs
351
C#
using Microsoft.AspNetCore.Mvc; namespace Howatworks.Assistant.WebSockets.Controllers { public class HomeController : ControllerBase { public IActionResult Index() { return Ok("Return some default content"); } } }
20.307692
53
0.647727
[ "MIT" ]
johnnysaucepn/SubEtha.Apps
src/Assistant/Howatworks.Assistant.WebSockets/Controllers/HomeController.cs
266
C#
/* * Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the opsworks-2013-02-18.normal.json service model. */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; using System.IO; using System.Net; using Amazon.Runtime; using Amazon.Runtime.Internal; namespace Amazon.OpsWorks.Model { /// <summary> /// Container for the parameters to the UpdateRdsDbInstance operation. /// Updates an Amazon RDS instance. /// /// /// <para> /// <b>Required Permissions</b>: To use this action, an IAM user must have a Manage permissions /// level for the stack, or an attached policy that explicitly grants permissions. For /// more information on user permissions, see <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html">Managing /// User Permissions</a>. /// </para> /// </summary> public partial class UpdateRdsDbInstanceRequest : AmazonOpsWorksRequest { private string _dbPassword; private string _dbUser; private string _rdsDbInstanceArn; /// <summary> /// Gets and sets the property DbPassword. /// <para> /// The database password. /// </para> /// </summary> public string DbPassword { get { return this._dbPassword; } set { this._dbPassword = value; } } // Check to see if DbPassword property is set internal bool IsSetDbPassword() { return this._dbPassword != null; } /// <summary> /// Gets and sets the property DbUser. /// <para> /// The master user name. /// </para> /// </summary> public string DbUser { get { return this._dbUser; } set { this._dbUser = value; } } // Check to see if DbUser property is set internal bool IsSetDbUser() { return this._dbUser != null; } /// <summary> /// Gets and sets the property RdsDbInstanceArn. /// <para> /// The Amazon RDS instance's ARN. /// </para> /// </summary> [AWSProperty(Required=true)] public string RdsDbInstanceArn { get { return this._rdsDbInstanceArn; } set { this._rdsDbInstanceArn = value; } } // Check to see if RdsDbInstanceArn property is set internal bool IsSetRdsDbInstanceArn() { return this._rdsDbInstanceArn != null; } } }
30.361905
151
0.607591
[ "Apache-2.0" ]
DetlefGolze/aws-sdk-net
sdk/src/Services/OpsWorks/Generated/Model/UpdateRdsDbInstanceRequest.cs
3,188
C#
// Copyright (c) 2021 .NET Foundation and Contributors. All rights reserved. // 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 full license information. using System; using System.Reactive.Disposables; using System.Threading; namespace ReactiveUI.Testing; /// <summary> /// Message bus testing extensions. /// </summary> public static class MessageBusExtensions { private static readonly object mbGate = 42; /// <summary> /// Override the default Message Bus during the specified block. /// </summary> /// <typeparam name="TRet">The return type.</typeparam> /// <param name="messageBus">The message bus to use for the block.</param> /// <param name="block">The function to execute.</param> /// <returns>The return value of the function.</returns> public static TRet With<TRet>(this IMessageBus messageBus, Func<TRet> block) { if (block is null) { throw new ArgumentNullException(nameof(block)); } using (messageBus.WithMessageBus()) { return block(); } } /// <summary> /// WithMessageBus allows you to override the default Message Bus /// implementation until the object returned is disposed. If a /// message bus is not specified, a default empty one is created. /// </summary> /// <param name="messageBus">The message bus to use, or null to create /// a new one using the default implementation.</param> /// <returns>An object that when disposed, restores the original /// message bus.</returns> public static IDisposable WithMessageBus(this IMessageBus messageBus) { var origMessageBus = MessageBus.Current; Monitor.Enter(mbGate); MessageBus.Current = messageBus; return Disposable.Create(() => { MessageBus.Current = origMessageBus; Monitor.Exit(mbGate); }); } /// <summary> /// Override the default Message Bus during the specified block. /// </summary> /// <param name="messageBus">The message bus to use for the block.</param> /// <param name="block">The action to execute.</param> public static void With(this IMessageBus messageBus, Action block) { if (block is null) { throw new ArgumentNullException(nameof(block)); } using (messageBus.WithMessageBus()) { block(); } } }
32.884615
80
0.642105
[ "MIT" ]
PKRoma/ReactiveUI
src/ReactiveUI.Testing/MessageBusExtensions.cs
2,565
C#
namespace TraktNet.Objects.Basic.Tests.Json.Writer { using FluentAssertions; using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using Trakt.NET.Tests.Utility.Traits; using TraktNet.Enums; using TraktNet.Objects.Basic; using TraktNet.Objects.Json; using Xunit; [Category("Objects.Basic.JsonWriter")] public partial class MetadataArrayJsonWriter_Tests { [Fact] public async Task Test_MetadataArrayJsonWriter_WriteArray_StringWriter_Exceptions() { var traktJsonWriter = new ArrayJsonWriter<ITraktMetadata>(); IEnumerable<ITraktMetadata> traktMetadata = new List<TraktMetadata>(); Func<Task<string>> action = () => traktJsonWriter.WriteArrayAsync(default(StringWriter), traktMetadata); await action.Should().ThrowAsync<ArgumentNullException>(); } [Fact] public async Task Test_MetadataArrayJsonWriter_WriteArray_StringWriter_Empty() { IEnumerable<ITraktMetadata> traktMetadata = new List<TraktMetadata>(); using (var stringWriter = new StringWriter()) { var traktJsonWriter = new ArrayJsonWriter<ITraktMetadata>(); string json = await traktJsonWriter.WriteArrayAsync(stringWriter, traktMetadata); json.Should().Be("[]"); } } [Fact] public async Task Test_MetadataArrayJsonWriter_WriteArray_StringWriter_SingleObject() { IEnumerable<ITraktMetadata> traktMetadata = new List<ITraktMetadata> { new TraktMetadata { MediaType = TraktMediaType.Digital, MediaResolution = TraktMediaResolution.UHD_4k, Audio = TraktMediaAudio.DolbyAtmos, AudioChannels = TraktMediaAudioChannel.Channels_7_1, HDR = TraktMediaHDR.DolbyVision, ThreeDimensional = true } }; using (var stringWriter = new StringWriter()) { var traktJsonWriter = new ArrayJsonWriter<ITraktMetadata>(); string json = await traktJsonWriter.WriteArrayAsync(stringWriter, traktMetadata); json.Should().Be(@"[{""media_type"":""digital"",""resolution"":""uhd_4k"",""audio"":""dolby_atmos""," + @"""audio_channels"":""7.1"",""3d"":true,""hdr"":""dolby_vision""}]"); } } [Fact] public async Task Test_MetadataArrayJsonWriter_WriteArray_StringWriter_Complete() { IEnumerable<ITraktMetadata> traktMetadata = new List<ITraktMetadata> { new TraktMetadata { MediaType = TraktMediaType.Digital, MediaResolution = TraktMediaResolution.UHD_4k, Audio = TraktMediaAudio.DolbyAtmos, AudioChannels = TraktMediaAudioChannel.Channels_7_1, HDR = TraktMediaHDR.DolbyVision, ThreeDimensional = true }, new TraktMetadata { MediaType = TraktMediaType.Digital, MediaResolution = TraktMediaResolution.UHD_4k, Audio = TraktMediaAudio.DolbyAtmos, AudioChannels = TraktMediaAudioChannel.Channels_7_1, HDR = TraktMediaHDR.DolbyVision, ThreeDimensional = true } }; using (var stringWriter = new StringWriter()) { var traktJsonWriter = new ArrayJsonWriter<ITraktMetadata>(); string json = await traktJsonWriter.WriteArrayAsync(stringWriter, traktMetadata); json.Should().Be(@"[{""media_type"":""digital"",""resolution"":""uhd_4k"",""audio"":""dolby_atmos""," + @"""audio_channels"":""7.1"",""3d"":true,""hdr"":""dolby_vision""}," + @"{""media_type"":""digital"",""resolution"":""uhd_4k"",""audio"":""dolby_atmos""," + @"""audio_channels"":""7.1"",""3d"":true,""hdr"":""dolby_vision""}]"); } } } }
43.227723
119
0.562758
[ "MIT" ]
henrikfroehling/Trakt.NET
Source/Tests/Trakt.NET.Objects.Basic.Tests/Json/Writer/MetadataArrayJsonWriter/MetadataArrayJsonWriter_StringWriter_Tests.cs
4,368
C#
// <auto-generated /> namespace Vidly.Migrations { using System.CodeDom.Compiler; using System.Data.Entity.Migrations; using System.Data.Entity.Migrations.Infrastructure; using System.Resources; [GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")] public sealed partial class DropGenreType_IdTableFromMovie1 : IMigrationMetadata { private readonly ResourceManager Resources = new ResourceManager(typeof(DropGenreType_IdTableFromMovie1)); string IMigrationMetadata.Id { get { return "201809142016216_DropGenreType_IdTableFromMovie1"; } } string IMigrationMetadata.Source { get { return null; } } string IMigrationMetadata.Target { get { return Resources.GetString("Target"); } } } }
29
114
0.643678
[ "MIT" ]
tmarquis887/Vidly
Vidly/Migrations/201809142016216_DropGenreType_IdTableFromMovie1.Designer.cs
870
C#
using System; using System.Collections.Generic; using System.IO; using System.IO.Compression; using System.Runtime.Serialization.Formatters.Binary; namespace MyContacts { public static class SaveManager { //Variables private const string filePath = "Data.bin"; //Sauvegarder les données public static void Save(List<Group> data) { //Création (et ouverture) d'un nouveau fichier FileStream fs = File.Create(filePath); //Enregistrement des données dans le fichier BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(fs, data); //Fermeture du fichier fs.Close(); } //Ouvre les données public static List<Group> Open() { //Création d'une liste de groupes par défaut //Si le fichier n'éxiste pas, la liste par défaut sera utilisé List<Group> data = new List<Group>() { new Group("Amis"), new Group("Travail"), new Group("Famille") }; //Si le fichier existe... if (File.Exists(filePath)) { FileStream fs = null; try { //Lecture du fichier fs = File.OpenRead(filePath); //Création de la liste de groupes (et de contacts) à partir du fichier ouvert BinaryFormatter bf = new BinaryFormatter(); data = (List<Group>)bf.Deserialize(fs); } catch (Exception e) { throw e; } finally { //Si un fichier a été ouvert.. if(fs != null) { //On le ferme fs.Close(); } } } return data; } } }
28.647887
97
0.460669
[ "MIT" ]
AdmanDev/MyContacts
MyContacts/Scripts/SaveManager.cs
2,049
C#
using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Linq; using Reactive.Bindings; using Reactive.Bindings.Extensions; using SandBeige.MediaBox.Composition.Bases; using SandBeige.MediaBox.Composition.Interfaces.Models.Album.Filter; using SandBeige.MediaBox.ViewModels.Album.Filter.Creators; namespace SandBeige.MediaBox.ViewModels.Album.Filter { /// <summary> /// フィルタリング条件ViewModel /// </summary> public class FilteringConditionViewModel : ViewModelBase { /// <summary> /// モデル /// </summary> public IFilteringCondition Model { get; } /// <summary> /// 表示名 /// </summary> public IReactiveProperty<string> DisplayName { get; } /// <summary> /// フィルター条件クリエイター /// </summary> public ReadOnlyReactiveCollection<IFilterItemObject> FilterItems { get; } /// <summary> /// フィルター条件作成VMリスト /// </summary> public IEnumerable<IFilterCreatorViewModel> FilterCreatorViewModels { get; } /// <summary> /// 選択中フィルター条件作成VM /// </summary> public IReactiveProperty<IFilterCreatorViewModel> SelectedFilterCreatorViewModel { get; } = new ReactivePropertySlim<IFilterCreatorViewModel>(); /// <summary> /// フィルター削除コマンド /// </summary> public ReactiveCommand<IFilterItemObject> RemoveFilterCommand { get; } = new ReactiveCommand<IFilterItemObject>(); public FilteringConditionViewModel(IFilteringCondition model) { this.Model = model; this.ModelForToString = this.Model; this.DisplayName = this.Model.DisplayName.ToReactivePropertyAsSynchronized(x => x.Value).AddTo(this.CompositeDisposable); this.FilterItems = this.Model.FilterItemObjects.ToReadOnlyReactiveCollection().AddTo(this.CompositeDisposable); this.FilterCreatorViewModels = new IFilterCreatorViewModel[] { new ExistsFilterCreatorViewModel(model), new FilePathFilterCreatorViewModel(model), new LocationFilterCreatorViewModel(model), new MediaTypeFilterCreatorViewModel(model), new RateFilterCreatorViewModel(model), new ResolutionFilterCreatorViewModel(model), new TagFilterCreatorViewModel(model) }; this.SelectedFilterCreatorViewModel.Value = this.FilterCreatorViewModels.First(); // 削除 this.RemoveFilterCommand.Subscribe(this.Model.RemoveFilter).AddTo(this.CompositeDisposable); } } }
27.270588
124
0.750647
[ "MIT" ]
southernwind/MediaBox
MediaBox/ViewModels/Album/Filter/FilteringConditionViewModel.cs
2,448
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class BattleUnit : MonoBehaviour { Transform _spawnPosition; public string Name { get; private set; } // faking constructor on a MonoBehaviour public void Initialize(BattleUnitData data, Transform spawnPosition) { _spawnPosition = spawnPosition; Name = data.Name; } }
23.352941
72
0.717884
[ "MIT" ]
metalac190/RPGFighter
Assets/_Game/Scripts/Units/BattleUnits/BattleUnit.cs
399
C#
// <copyright file="ScapeSession.cs" company="Scape Technologies Limited"> // // ScapeSession.cs // ScapeKitUnity // // Created by nick on 1/5/2019. // Copyright © 2019 Scape Technologies Limited. All rights reserved. // </copyright> namespace ScapeKitUnity { using System; using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using UnityEngine; using UnityEngine.XR.ARFoundation; /// <summary> /// A class to handle the scape session request and response /// </summary> public class ScapeSession { /// <summary> /// flag to prevent multiple requests to scapemeasurements /// A request to scapeMeasuremnts is guaranteed to always return /// a signal to OnScapeMeasurementsEvent or OnScapeSessionErrorEvent. /// </summary> private bool scapeMeasurementInProgress = false; /// <summary> /// Flag to tell ScapeMeasurementsRequested needs to be clled from main thread /// </summary> private bool doScapeMeasurementsRequested; /// <summary> /// the last double returned from core implementation /// </summary> private double lastScapeMeasurementsRequested; /// <summary> /// Flag to tell ScapeSessionErrorEvent needs to be clled from main thread /// </summary> private bool doScapeSessionErrorEvent; /// <summary> /// the last ScapeSessionError returned from core implementation /// </summary> private ScapeSessionError lastScapeSessionError; /// <summary> /// Flag to tell DeviceLocationMeasurementsEvent needs to be clled from main thread /// </summary> private bool doDeviceLocationMeasurementsEvent; /// <summary> /// the last LocationMeasurements returned from core implementation /// </summary> private LocationMeasurements lastLocationMeasurements; /// <summary> /// Flag to tell DeviceMotionMeasurementsEvent needs to be clled from main thread /// </summary> private bool doDeviceMotionMeasurementsEvent; /// <summary> /// the last MotionMeasurements returned from core implementation /// </summary> private MotionMeasurements lastMotionMeasurements; /// <summary> /// Flag to tell ScapeMeasurementsEvent needs to be clled from main thread /// </summary> private bool doScapeMeasurementsEvent; /// <summary> /// the last ScapeMeasurements returned from core implementation /// </summary> private ScapeMeasurements lastScapeMeasurements; /// <summary> /// the native implementation of ScapeSession, supplied by the ScapeClient after it has started /// </summary> private ScapeSessionNative scapeSessionNative = null; /// <summary> /// Initializes a new instance of the <see cref="ScapeSession" /> class /// </summary> internal ScapeSession() { } /// <summary> /// An event that is triggered when a SCape Measurement has been requested /// </summary> public event Action<double> ScapeMeasurementsRequested; /// <summary> /// An event that is returned when an error occurs getting a ScapeMeasurement /// </summary> public event Action<ScapeSessionError> ScapeSessionErrorEvent; /// <summary> /// An event that is triggered when the devices location are taken /// </summary> public event Action<LocationMeasurements> DeviceLocationMeasurementsEvent; /// <summary> /// An event that is triggered when the devices motion are taken /// </summary> public event Action<MotionMeasurements> DeviceMotionMeasurementsEvent; /// <summary> /// An event that is triggered when a ScapeMeasurement has been returned /// </summary> public event Action<ScapeMeasurements> ScapeMeasurementsEvent; /// <summary> /// The ARCameraManager is needed to acquire the frame to send to scapekit's backend /// </summary> /// <param name="arCameraManager"> /// The arCameraManager usually attached to the ARCamera /// </param> public virtual void SetCameraManager(ARCameraManager arCameraManager) { this.scapeSessionNative.SetCameraManager(arCameraManager); } /// <summary> /// calls teh appropriate event on the main thread having been reviously received /// from the Scapekit core plugin /// </summary> public void Update() { if (this.doScapeMeasurementsRequested) { this.doScapeMeasurementsRequested = false; this.ScapeMeasurementsRequested(this.lastScapeMeasurementsRequested); } if (this.doScapeSessionErrorEvent) { this.doScapeSessionErrorEvent = false; this.ScapeSessionErrorEvent(this.lastScapeSessionError); } if (this.doDeviceLocationMeasurementsEvent) { this.doDeviceLocationMeasurementsEvent = false; this.DeviceLocationMeasurementsEvent(this.lastLocationMeasurements); } if (this.doDeviceMotionMeasurementsEvent) { this.doDeviceMotionMeasurementsEvent = false; this.DeviceMotionMeasurementsEvent(this.lastMotionMeasurements); } if (this.doScapeMeasurementsEvent) { this.doScapeMeasurementsEvent = false; this.ScapeMeasurementsEvent(this.lastScapeMeasurements); } } /// <summary> /// The public function to request a ScapeMeasurement using the given image details /// </summary> /// <param name="image"> /// the image to be sent to the Scape back end /// </param> public void GetMeasurements(ScapeSession.ARImage image) { if (this.scapeMeasurementInProgress) { ScapeLogging.LogError("GetMeasuremnts ignored, scapeMeasurements already in progress"); return; } if (this.scapeSessionNative != null) { this.scapeMeasurementInProgress = true; this.scapeSessionNative.GetMeasurements(image); } else { ScapeLogging.LogError("GetMeasurements called before scapeSessionNative initialized"); } } /// <summary> /// The public function to request a ScapeMeasurement. /// </summary> public void GetMeasurements() { if (this.scapeMeasurementInProgress) { ScapeLogging.LogError("GetMeasuremnts ignored, scapeMeasurements already in progress"); return; } if (this.scapeSessionNative != null) { this.scapeMeasurementInProgress = true; this.scapeSessionNative.GetMeasurements(); } else { ScapeLogging.LogError("GetMeasurements called before scapeSessionNative initialized"); } } /// <summary> /// set the native impl /// </summary> /// <param name="in_native"> /// The native implementation is passed in from the ScapeClient /// </param> internal void SetNative(ScapeSessionNative in_native) { this.scapeSessionNative = in_native; this.scapeSessionNative.SetFrontEnd(this); } /// <summary> /// Destroy the ScapeSession object /// </summary> internal void Terminate() { } /// <summary> /// An internal function to trigger the ScapeMeasurementsRequested from the underlying implementation /// </summary> /// <param name="arg"> /// The timestamp at which the measurement was taken /// </param> internal virtual void OnScapeMeasurementsRequested(double arg) { if (this.ScapeMeasurementsRequested != null) { this.doScapeMeasurementsRequested = true; this.lastScapeMeasurementsRequested = arg; } } /// <summary> /// An internal function to trigger the ScapeSessionErrorEvent from the underlying implementation /// </summary> /// <param name="arg"> /// The ScapeSessionError returned from the ScapeSession /// </param> internal virtual void OnScapeSessionErrorEvent(ScapeSessionError arg) { this.scapeMeasurementInProgress = false; if (this.ScapeSessionErrorEvent != null) { this.doScapeSessionErrorEvent = true; this.lastScapeSessionError = arg; } } /// <summary> /// An internal function to trigger the DeviceLocationMeasurementsEvent from the underlying implementation /// </summary> /// <param name="arg"> /// The LocationMeasurements returned from the ScapeSession /// </param> internal virtual void OnDeviceLocationMeasurementsEvent(LocationMeasurements arg) { if (this.DeviceLocationMeasurementsEvent != null) { this.doDeviceLocationMeasurementsEvent = true; this.lastLocationMeasurements = arg; } } /// <summary> /// An internal function to trigger the DeviceMotionMeasurementsEvent from the underlying implementation /// </summary> /// <param name="arg"> /// The MotionMeasurements returned from the ScapeSession /// </param> internal virtual void OnDeviceMotionMeasurementsEvent(MotionMeasurements arg) { if (this.DeviceMotionMeasurementsEvent != null) { this.doDeviceMotionMeasurementsEvent = true; this.lastMotionMeasurements = arg; } } /// <summary> /// An internal function to trigger the ScapeMeasurementsEvent from the underlying implementation /// </summary> /// <param name="sm"> /// The ScapeMeasurements returned from the ScapeSession /// </param> internal virtual void OnScapeMeasurementsEvent(ScapeMeasurements sm) { this.scapeMeasurementInProgress = false; if (this.ScapeMeasurementsEvent != null) { this.doScapeMeasurementsEvent = true; this.lastScapeMeasurements = sm; } } /// <summary> /// A struct to hold all information pertaining to an image to be sent to the backend /// </summary> public struct ARImage { /// <summary> /// the image Width /// </summary> public int Width; /// <summary> /// the image Height /// </summary> public int Height; /// <summary> /// the image YPixelBuffer, a pointer to a single byte array representation of the grey scale image. /// The buffer should be exactly Width*Height in size bytes. /// </summary> public IntPtr YPixelBuffer; /// <summary> /// the image XFocalLength /// </summary> public float XFocalLength; /// <summary> /// the image YFocalLength /// </summary> public float YFocalLength; /// <summary> /// the image XPrincipalPoint /// </summary> public float XPrincipalPoint; /// <summary> /// the image YPrincipalPoint /// </summary> public float YPrincipalPoint; /// <summary> /// the image IsAvailable /// </summary> public bool IsAvailable; } } }
34.573816
114
0.57952
[ "Apache-2.0" ]
emmaChristine/scapekit-samples-unity
Assets/ScapeKitPlugin/Scripts/Public/ScapeSession.cs
12,415
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Promitor.Core.Contracts")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] [assembly: System.Reflection.AssemblyProductAttribute("Promitor.Core.Contracts")] [assembly: System.Reflection.AssemblyTitleAttribute("Promitor.Core.Contracts")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] // Generated by the MSBuild WriteCodeFragment class.
42.458333
81
0.654563
[ "MIT" ]
smholvoet/promitor-docs-poc
src/Promitor.Core.Contracts/obj/Debug/netcoreapp3.1/Promitor.Core.Contracts.AssemblyInfo.cs
1,019
C#
// Copyright (c) Microsoft Open Technologies, Inc. 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.ComponentModel.Design; using System.Runtime.InteropServices; namespace Microsoft.VisualStudio.FSharp.ProjectSystem { internal sealed class VSProjectConstants { public static readonly Guid guidCSharpBrowseLibrary = new Guid("58f1bad0-2288-45b9-ac3a-d56398f7781d"); // For IVsObjBrowser.NavigateTo to browse a referenced C# project public static readonly Guid guidVBBrowseLibrary = new Guid("414AC972-9829-4B6A-A8D7-A08152FEB8AA"); // For IVsObjBrowser.NavigateTo to browse a referenced VB project public static readonly Guid guidObjectBrowser = new Guid("{CFF630F8-2DB3-44BA-9FC9-6489665DE5B8}"); // For IVsUIShellOpenDocument3.GetProvisionalViewingStatusForEditor to check if object browser can preview /// CommandIDs matching the commands defined symbols in MenusAndCommands.vsct (stored with FSharp.ProjectSystem.FSharp) public static readonly Guid guidFSharpProjectCmdSet = new Guid("75AC5611-A912-4195-8A65-457AE17416FB"); public static readonly CommandID MoveUpCmd = new CommandID(guidFSharpProjectCmdSet, 0x3002); public static readonly CommandID AddNewItemBelow = new CommandID(guidFSharpProjectCmdSet, 0x3003); public static readonly CommandID AddExistingItemBelow = new CommandID(guidFSharpProjectCmdSet, 0x3004); public static readonly CommandID AddNewItemAbove = new CommandID(guidFSharpProjectCmdSet, 0x3005); public static readonly CommandID AddExistingItemAbove = new CommandID(guidFSharpProjectCmdSet, 0x3006); public static readonly CommandID MoveDownCmd = new CommandID(guidFSharpProjectCmdSet, 0x3007); public static readonly CommandID FSharpSendThisReferenceToInteractiveCmd = new CommandID(guidFSharpProjectCmdSet, 0x5004); public static readonly CommandID FSharpSendReferencesToInteractiveCmd = new CommandID(guidFSharpProjectCmdSet, 0x5005); public static readonly CommandID FSharpSendProjectOutputToInteractiveCmd = new CommandID(guidFSharpProjectCmdSet, 0x5006); } }
76.965517
214
0.794355
[ "Apache-2.0" ]
AliBaghernejad/visualfsharp
vsintegration/src/vs/FsPkgs/FSharp.Project/Common.Source.CSharp/Project/VSProjectConstants.cs
2,232
C#
// HO=False using System; // using System; using System.Collections.Generic; // using System.Collections.Generic; using System.Linq; // using System.Linq; using System.Text; // using System.Text; using DxLibDLL; // using DxLibDLL; // namespace Charlotte // namespace Charlotte { // { public class ChooseTemporaryGermaniumPath // public class DDPad { // { // HO=False public void AgreeCompleteEurydomeStatement(ArchiveActivePandoraLength DetermineDedicatedPoloniumDirectory) // public void ADM_a_17069885968811934957_07668615205238231038_z_SetValue(ADM_a_17069885968811934957_07668615205238231038_z_ValueInfo ADM_a_17069885968811934957_07668615205238231038_z_SetValue_Prm) { // { AdjustVisibleAtlasSeparator = DetermineDedicatedPoloniumDirectory; // ADM_a_17069885968811934957_07668615205238231038_z_Value = ADM_a_17069885968811934957_07668615205238231038_z_SetValue_Prm; } // } // HO=False public static int MapGeneralHegemoneObject; // public static int ADM_a_05238768808721859650_18402659722658397292_z_Count_10; // HO=False public static int TransformMockSetebosFallback; // public static int SAM_a_17953957923941676699_10757215610510374477_z; // HO=False public static int RenderRemoteAmourSystem; // public static int ADM_a_05238768808721859650_18402659722658397292_z_Count_1; // HO=False public static bool UseInnerPinePath; // public static bool SAM_a_06857795414798636123_04881575658133118006_z; // HO=False public void OverrideUndefinedTennessineShortcut(int ReceiveApplicableStephanoProgress) // public void ADM_a_17069885968811934957_07668615205238231038_z_SetCount(int ADM_a_17069885968811934957_07668615205238231038_z_SetCount_Prm) { // { ExtractExecutableCarbonHandler = ReceiveApplicableStephanoProgress; // ADM_a_17069885968811934957_07668615205238231038_z_Count = ADM_a_17069885968811934957_07668615205238231038_z_SetCount_Prm; } // } // HO=False public static int ProvideExistingKerberosWarning; // public static int ADM_a_05238768808721859650_18402659722658397292_z_Count_4; // HO=False public int ForcePhysicalGonnaTouch() { return OccurExpressChlorineRange() + WarnUnableAmericiumAction; } // public int ADM_a_05238768808721859650_18402659722658397292_z_GetInt_6() { return ADM_a_05238768808721859650_18402659722658397292_z_GetInt_5() + ADM_a_05238768808721859650_18402659722658397292_z_Count_6; } // HO=False public class ArchiveActivePandoraLength // public class ADM_a_17069885968811934957_07668615205238231038_z_ValueInfo { // { public int ParseUnauthorizedYtterbiumBackup; // public int ADM_a_17069885968811934957_07668615205238231038_z_ValueInfo_A; public int CollapseMultipleEnceladusStartup; // public int ADM_a_17069885968811934957_07668615205238231038_z_ValueInfo_B; public int AppendTemporaryEuphemePriority; // public int ADM_a_17069885968811934957_07668615205238231038_z_ValueInfo_C; } // } // HO=False public int LockNextHippocampAuthentication() { return RenderFinalErinomeYour() != 1 ? 1 : BindConditionalKallichoreArray; } // public int ADM_a_05238768808721859650_18402659722658397292_z_GetInt_2() { return ADM_a_05238768808721859650_18402659722658397292_z_GetInt_1() != 1 ? 1 : ADM_a_05238768808721859650_18402659722658397292_z_Count_2; } // HO=False public void ShowNullDaphnisFeature(int ArchiveFinalGraceRuntime) // public void ADM_a_17069885968811934957_07668615205238231038_z_Overload_05(int ADM_a_17069885968811934957_07668615205238231038_z_v) { // { if (ArchiveFinalGraceRuntime != this.CollapseFollowingHydrogenDisplay()) // if (ADM_a_17069885968811934957_07668615205238231038_z_v != this.ADM_a_17069885968811934957_07668615205238231038_z_GetCount()) this.OverrideUndefinedTennessineShortcut(ArchiveFinalGraceRuntime); // this.ADM_a_17069885968811934957_07668615205238231038_z_SetCount(ADM_a_17069885968811934957_07668615205238231038_z_v); else // else this.UpdateIncompatibleHeleneName(ArchiveFinalGraceRuntime); // this.ADM_a_17069885968811934957_07668615205238231038_z_Overload_01(ADM_a_17069885968811934957_07668615205238231038_z_v); } // } // HO=False public static int AssociateUnsupportedChlorineOwner(int BufferFalseNeptuneHealth, int SanitizeCompleteMagnesiumScript) // public static int GetInput(int padId, int btnId) { // { if (BufferFalseNeptuneHealth == -1) // if (padId == -1) BufferFalseNeptuneHealth = 0; // padId = 0; // if (SanitizeCompleteMagnesiumScript == -1) // if (btnId == -1) return 0; // return 0; // return 1 <= LockValidSiarnaqScript.MatchMockSiliconQuery ? 0 : UpdateDuplicateMercuryTodo[BufferFalseNeptuneHealth * PrintPreviousEarthConstant + SanitizeCompleteMagnesiumScript]; // return 1 <= DDEngine.FreezeInputFrame ? 0 : ButtonStatus[padId * PAD_BUTTON_MAX + btnId]; } // } // // HO=False public static int ExtractExecutableCarbonHandler; // public static int ADM_a_17069885968811934957_07668615205238231038_z_Count; // HO=False public static IEnumerable<int> CountConditionalTitaniumInformation() { yield return 1017396388; yield return 2096397556; yield return 1721853601; yield return 1957786801; yield return 1769826685; yield return 1045642887; yield return 1719822005; } // public static IEnumerable<int> SLS2_a_15769619437602356271_01612115870337306751_z_E_GetString() { yield return 1017396388; yield return 2096397556; yield return 1721853601; yield return 1957786801; yield return 1769826685; yield return 1045642887; yield return 1719822005; } // HO=False public int PlayDecimalIridiumBoot() { return VisitOptionalCaliforniumEnvironment() == 1 ? 0 : OverrideTemporaryTenderSize; } // public int ADM_a_05238768808721859650_18402659722658397292_z_GetInt_9() { return ADM_a_05238768808721859650_18402659722658397292_z_GetInt_8() == 1 ? 0 : ADM_a_05238768808721859650_18402659722658397292_z_Count_9; } // HO=False public static int ClickBasedGadoliniumBug; // public static int ADM_a_05238768808721859650_18402659722658397292_z_Count_7; // HO=False public static string RenderUnresolvedAmericiumAccessibility() { return new string(BundleMultipleRutherfordiumTimeout().Where(InlineNormalSulfurTouch => InlineNormalSulfurTouch % 65537 != 0).Select(IterateExpressMuseFailure => (char)(IterateExpressMuseFailure % 65537 - 1)).ToArray()); } // public static string SLS2_a_08383032911584481747_17030950356619226859_z_GetString() { return new string(SLS2_a_08383032911584481747_17030950356619226859_z_E_GetString().Where(SLS2_a_08383032911584481747_17030950356619226859_z_Var => SLS2_a_08383032911584481747_17030950356619226859_z_Var % 65537 != 0).Select(SLS2_a_08383032911584481747_17030950356619226859_z_Var2 => (char)(SLS2_a_08383032911584481747_17030950356619226859_z_Var2 % 65537 - 1)).ToArray()); } // HO=False public static int ShowCorrectRougeDirectory; // public static int ADM_a_05238768808721859650_18402659722658397292_z_Count_11; // HO=False public int VisitOptionalCaliforniumEnvironment() { return InputNativeSinopeCluster() - IntroduceMinorNeodymiumMedia; } // public int ADM_a_05238768808721859650_18402659722658397292_z_GetInt_8() { return ADM_a_05238768808721859650_18402659722658397292_z_GetInt_7() - ADM_a_05238768808721859650_18402659722658397292_z_Count_8; } // HO=False public static int HighlightAvailableJulietReference; // public static int ADM_a_05238768808721859650_18402659722658397292_z_Count_5; // HO=False public static string ContainCleanVenusFallback; // public static string SLS2_a_15769619437602356271_01612115870337306751_z_String; // HO=False public static bool GetMatchingTennessineRepresentation(int BufferFalseNeptuneHealth, int SanitizeCompleteMagnesiumScript) // public static bool IsPound(int padId, int btnId) { // { return ProcessConditionalNobeliumTarget.GetMatchingTennessineRepresentation(AssociateUnsupportedChlorineOwner(BufferFalseNeptuneHealth, SanitizeCompleteMagnesiumScript)); // return DDUtils.IsPound(GetInput(padId, btnId)); } // } // HO=False public int DestroyManualTantalumName() // public int ADM_a_17069885968811934957_07668615205238231038_z_NextCount() { // { return ExtractExecutableCarbonHandler++; // return ADM_a_17069885968811934957_07668615205238231038_z_Count++; } // } // HO=False public static int BindConditionalKallichoreArray; // public static int ADM_a_05238768808721859650_18402659722658397292_z_Count_2; // HO=False public static int WarnUnableAmericiumAction; // public static int ADM_a_05238768808721859650_18402659722658397292_z_Count_6; // HO=False public int CollapseFollowingHydrogenDisplay() // public int ADM_a_17069885968811934957_07668615205238231038_z_GetCount() { // { return ExtractExecutableCarbonHandler; // return ADM_a_17069885968811934957_07668615205238231038_z_Count; } // } // HO=False public void CheckGenericRosalindHash(int CommentFollowingPasitheePlugin, int ContributeTrueNitrogenLibrary, int EmitVirtualValetudoCookie, int RefreshGlobalAstatineMillisecond, int CallExternalNixTouch, int WarnAlternativeBeatPassword) // public void ADM_a_17069885968811934957_07668615205238231038_z_Overload_04(int ADM_a_17069885968811934957_07668615205238231038_z_a, int ADM_a_17069885968811934957_07668615205238231038_z_b, int ADM_a_17069885968811934957_07668615205238231038_z_c, int ADM_a_17069885968811934957_07668615205238231038_z_a2, int ADM_a_17069885968811934957_07668615205238231038_z_b2, int ADM_a_17069885968811934957_07668615205238231038_z_c2) { // { var SuppressTemporaryCallistoProduct = new[] // var ADM_a_17069885968811934957_07668615205238231038_z_infos = new[] { // { new { ContainSuccessfulBismuthNamespace = CommentFollowingPasitheePlugin, PrintDynamicBromineIndex = RefreshGlobalAstatineMillisecond }, // new { ADM_a_17069885968811934957_07668615205238231038_z_Info_P1 = ADM_a_17069885968811934957_07668615205238231038_z_a, ADM_a_17069885968811934957_07668615205238231038_z_Info_P2 = ADM_a_17069885968811934957_07668615205238231038_z_a2 }, new { ContainSuccessfulBismuthNamespace = ContributeTrueNitrogenLibrary, PrintDynamicBromineIndex = RefreshGlobalAstatineMillisecond }, // new { ADM_a_17069885968811934957_07668615205238231038_z_Info_P1 = ADM_a_17069885968811934957_07668615205238231038_z_b, ADM_a_17069885968811934957_07668615205238231038_z_Info_P2 = ADM_a_17069885968811934957_07668615205238231038_z_a2 }, new { ContainSuccessfulBismuthNamespace = EmitVirtualValetudoCookie, PrintDynamicBromineIndex = RefreshGlobalAstatineMillisecond }, // new { ADM_a_17069885968811934957_07668615205238231038_z_Info_P1 = ADM_a_17069885968811934957_07668615205238231038_z_c, ADM_a_17069885968811934957_07668615205238231038_z_Info_P2 = ADM_a_17069885968811934957_07668615205238231038_z_a2 }, }; // }; this.AgreeCompleteEurydomeStatement(new ArchiveActivePandoraLength() // this.ADM_a_17069885968811934957_07668615205238231038_z_SetValue(new ADM_a_17069885968811934957_07668615205238231038_z_ValueInfo() { // { ParseUnauthorizedYtterbiumBackup = CommentFollowingPasitheePlugin, // ADM_a_17069885968811934957_07668615205238231038_z_ValueInfo_A = ADM_a_17069885968811934957_07668615205238231038_z_a, CollapseMultipleEnceladusStartup = ContributeTrueNitrogenLibrary, // ADM_a_17069885968811934957_07668615205238231038_z_ValueInfo_B = ADM_a_17069885968811934957_07668615205238231038_z_b, AppendTemporaryEuphemePriority = EmitVirtualValetudoCookie, // ADM_a_17069885968811934957_07668615205238231038_z_ValueInfo_C = ADM_a_17069885968811934957_07668615205238231038_z_c, }); // }); if (SuppressTemporaryCallistoProduct[0].ContainSuccessfulBismuthNamespace == RefreshGlobalAstatineMillisecond) this.ShowNullDaphnisFeature(SuppressTemporaryCallistoProduct[0].PrintDynamicBromineIndex); // if (ADM_a_17069885968811934957_07668615205238231038_z_infos[0].ADM_a_17069885968811934957_07668615205238231038_z_Info_P1 == ADM_a_17069885968811934957_07668615205238231038_z_a2) this.ADM_a_17069885968811934957_07668615205238231038_z_Overload_05(ADM_a_17069885968811934957_07668615205238231038_z_infos[0].ADM_a_17069885968811934957_07668615205238231038_z_Info_P2); if (SuppressTemporaryCallistoProduct[1].ContainSuccessfulBismuthNamespace == CallExternalNixTouch) this.ShowNullDaphnisFeature(SuppressTemporaryCallistoProduct[1].PrintDynamicBromineIndex); // if (ADM_a_17069885968811934957_07668615205238231038_z_infos[1].ADM_a_17069885968811934957_07668615205238231038_z_Info_P1 == ADM_a_17069885968811934957_07668615205238231038_z_b2) this.ADM_a_17069885968811934957_07668615205238231038_z_Overload_05(ADM_a_17069885968811934957_07668615205238231038_z_infos[1].ADM_a_17069885968811934957_07668615205238231038_z_Info_P2); if (SuppressTemporaryCallistoProduct[2].ContainSuccessfulBismuthNamespace == WarnAlternativeBeatPassword) this.ShowNullDaphnisFeature(SuppressTemporaryCallistoProduct[2].PrintDynamicBromineIndex); // if (ADM_a_17069885968811934957_07668615205238231038_z_infos[2].ADM_a_17069885968811934957_07668615205238231038_z_Info_P1 == ADM_a_17069885968811934957_07668615205238231038_z_c2) this.ADM_a_17069885968811934957_07668615205238231038_z_Overload_05(ADM_a_17069885968811934957_07668615205238231038_z_infos[2].ADM_a_17069885968811934957_07668615205238231038_z_Info_P2); } // } // HO=True private static int[] UpdateDuplicateMercuryTodo = new int[ExtendRawSelenePayload * PrintPreviousEarthConstant]; // private static int[] ButtonStatus = new int[PAD_MAX * PAD_BUTTON_MAX]; // HO=False public int BrowseConstantGelatoTag() { return PlayDecimalIridiumBoot() != 1 ? 1 : MapGeneralHegemoneObject; } // public int ADM_a_05238768808721859650_18402659722658397292_z_GetInt_10() { return ADM_a_05238768808721859650_18402659722658397292_z_GetInt_9() != 1 ? 1 : ADM_a_05238768808721859650_18402659722658397292_z_Count_10; } // HO=False public static string ReadCoreMakemakeCrash() { if(BuildExternalPandiaParenthesis == null) { BuildExternalPandiaParenthesis = RenderUnresolvedAmericiumAccessibility(); } return BuildExternalPandiaParenthesis; } // public static string SLS2_a_08383032911584481747_17030950356619226859_z() { if(SLS2_a_08383032911584481747_17030950356619226859_z_String == null) { SLS2_a_08383032911584481747_17030950356619226859_z_String = SLS2_a_08383032911584481747_17030950356619226859_z_GetString(); } return SLS2_a_08383032911584481747_17030950356619226859_z_String; } // HO=False public int RegisterGeneralBerryInformation() { return ContinueOptionalLanthanumCredential() == 1 ? 0 : ShareAutomaticIridiumRow; } // public int ADM_a_05238768808721859650_18402659722658397292_z_GetInt_12() { return ADM_a_05238768808721859650_18402659722658397292_z_GetInt_11() == 1 ? 0 : ADM_a_05238768808721859650_18402659722658397292_z_Count_12; } // HO=False public static int PrintPreviousEarthConstant { get { if (!AppendVirtualBerkeliumOverview) { AppendVirtualBerkeliumOverview = true; DescribeApplicableHatiTraffic = OccurLatestEuphemeOption(); } return DescribeApplicableHatiTraffic; }} // public static int PAD_BUTTON_MAX { get { if (!SAM_a_15963196446972812305_12251133152970527996_z) { SAM_a_15963196446972812305_12251133152970527996_z = true; SAM_a_00628879667466610803_09042932025844489164_z = SAM_a_03231357594494247657_14975360426269300381_z(); } return SAM_a_00628879667466610803_09042932025844489164_z; }} // HO=False public ArchiveActivePandoraLength SerializeOptionalAitneOffset() // public ADM_a_17069885968811934957_07668615205238231038_z_ValueInfo ADM_a_17069885968811934957_07668615205238231038_z_GetValue() { // { return AdjustVisibleAtlasSeparator; // return ADM_a_17069885968811934957_07668615205238231038_z_Value; } // } // HO=False public int InitializePreviousEarthDirectory() { return ResolveEqualMethoneNotification() + ProvideExistingKerberosWarning; } // public int ADM_a_05238768808721859650_18402659722658397292_z_GetInt_4() { return ADM_a_05238768808721859650_18402659722658397292_z_GetInt_3() + ADM_a_05238768808721859650_18402659722658397292_z_Count_4; } // HO=False public static void IncludeAbstractWaveName() // public static void EachFrame() { // { for (int BufferFalseNeptuneHealth = 0; BufferFalseNeptuneHealth < ProcessDynamicTelluriumModel(); BufferFalseNeptuneHealth++) // for (int padId = 0; padId < GetPadCount(); padId++) { // { uint CheckPreviousHatiInitialization; // uint status; // if (LockValidSiarnaqScript.FollowCoreTenderAssignment) // if (DDEngine.WindowIsActive) CheckPreviousHatiInitialization = (uint)DX.GetJoypadInputState(ShowActiveWindyVariable(BufferFalseNeptuneHealth)); // status = (uint)DX.GetJoypadInputState(PadId2InputType(padId)); else // else CheckPreviousHatiInitialization = 0u; // status = 0u; // if (CheckPreviousHatiInitialization != 0u) // if (status != 0u) { // { for (int SanitizeCompleteMagnesiumScript = 0; SanitizeCompleteMagnesiumScript < PrintPreviousEarthConstant; SanitizeCompleteMagnesiumScript++) // for (int btnId = 0; btnId < PAD_BUTTON_MAX; btnId++) ProcessConditionalNobeliumTarget.IncrementValidStrontiumUse(ref UpdateDuplicateMercuryTodo[BufferFalseNeptuneHealth * PrintPreviousEarthConstant + SanitizeCompleteMagnesiumScript], (CheckPreviousHatiInitialization & (1u << SanitizeCompleteMagnesiumScript)) != 0u); // DDUtils.UpdateInput(ref ButtonStatus[padId * PAD_BUTTON_MAX + btnId], (status & (1u << btnId)) != 0u); } // } else // else { // { for (int SanitizeCompleteMagnesiumScript = 0; SanitizeCompleteMagnesiumScript < PrintPreviousEarthConstant; SanitizeCompleteMagnesiumScript++) // for (int btnId = 0; btnId < PAD_BUTTON_MAX; btnId++) ProcessConditionalNobeliumTarget.IncrementValidStrontiumUse(ref UpdateDuplicateMercuryTodo[BufferFalseNeptuneHealth * PrintPreviousEarthConstant + SanitizeCompleteMagnesiumScript], false); // DDUtils.UpdateInput(ref ButtonStatus[padId * PAD_BUTTON_MAX + btnId], false); } // } // if (ImproveUnauthorizedBloomTransaction.WrapMinorTomorrowEvent == -1 && 10 < LockValidSiarnaqScript.SearchExpectedChlorineModification && ObtainUsefulXenonLocation[BufferFalseNeptuneHealth] == 0u && CheckPreviousHatiInitialization != 0u) // if (DDGround.PrimaryPadId == -1 && 10 < DDEngine.ProcFrame && PadStatus[padId] == 0u && status != 0u) ImproveUnauthorizedBloomTransaction.WrapMinorTomorrowEvent = BufferFalseNeptuneHealth; // DDGround.PrimaryPadId = padId; // ObtainUsefulXenonLocation[BufferFalseNeptuneHealth] = CheckPreviousHatiInitialization; // PadStatus[padId] = status; } // } } // } // // HO=False public static bool AppendVirtualBerkeliumOverview; // public static bool SAM_a_15963196446972812305_12251133152970527996_z; // HO=False public void DestroyGenericBariumDescription() // public void ADM_a_17069885968811934957_07668615205238231038_z_ResetCount() { // { this.OverrideUndefinedTennessineShortcut(0); // this.ADM_a_17069885968811934957_07668615205238231038_z_SetCount(0); } // } // HO=False public int ContinueOptionalLanthanumCredential() { return BrowseConstantGelatoTag() + ShowCorrectRougeDirectory; } // public int ADM_a_05238768808721859650_18402659722658397292_z_GetInt_11() { return ADM_a_05238768808721859650_18402659722658397292_z_GetInt_10() + ADM_a_05238768808721859650_18402659722658397292_z_Count_11; } // HO=False public void ReturnExecutableMnemeAccess(int CommentFollowingPasitheePlugin, int ContributeTrueNitrogenLibrary, int EmitVirtualValetudoCookie) // public void ADM_a_17069885968811934957_07668615205238231038_z_Overload_03(int ADM_a_17069885968811934957_07668615205238231038_z_a, int ADM_a_17069885968811934957_07668615205238231038_z_b, int ADM_a_17069885968811934957_07668615205238231038_z_c) { // { this.CheckGenericRosalindHash(CommentFollowingPasitheePlugin, ContributeTrueNitrogenLibrary, EmitVirtualValetudoCookie, this.SerializeOptionalAitneOffset().ParseUnauthorizedYtterbiumBackup, this.SerializeOptionalAitneOffset().CollapseMultipleEnceladusStartup, this.SerializeOptionalAitneOffset().AppendTemporaryEuphemePriority); // this.ADM_a_17069885968811934957_07668615205238231038_z_Overload_04(ADM_a_17069885968811934957_07668615205238231038_z_a, ADM_a_17069885968811934957_07668615205238231038_z_b, ADM_a_17069885968811934957_07668615205238231038_z_c, this.ADM_a_17069885968811934957_07668615205238231038_z_GetValue().ADM_a_17069885968811934957_07668615205238231038_z_ValueInfo_A, this.ADM_a_17069885968811934957_07668615205238231038_z_GetValue().ADM_a_17069885968811934957_07668615205238231038_z_ValueInfo_B, this.ADM_a_17069885968811934957_07668615205238231038_z_GetValue().ADM_a_17069885968811934957_07668615205238231038_z_ValueInfo_C); } // } // HO=False public int ResolveEqualMethoneNotification() { return LockNextHippocampAuthentication() == 0 ? 0 : AcceptMinimumMiracleHighlight; } // public int ADM_a_05238768808721859650_18402659722658397292_z_GetInt_3() { return ADM_a_05238768808721859650_18402659722658397292_z_GetInt_2() == 0 ? 0 : ADM_a_05238768808721859650_18402659722658397292_z_Count_3; } // HO=False public static int OccurLatestEuphemeOption() { int RefreshEmptyOrthosieUnit = int.Parse( // public static int SAM_a_03231357594494247657_14975360426269300381_z() { int SAM_a_02947234380556582307_15128428444443316104_z = int.Parse( InvokeAutomaticLovelyService()); return RefreshEmptyOrthosieUnit; } // SLS2_a_15769619437602356271_01612115870337306751_z()); return SAM_a_02947234380556582307_15128428444443316104_z; } // HO=False public static int ExtendRawSelenePayload { get { if (!UseInnerPinePath) { UseInnerPinePath = true; TransformMockSetebosFallback = BumpUnsupportedNarviNote(); } return TransformMockSetebosFallback; }} // public static int PAD_MAX { get { if (!SAM_a_06857795414798636123_04881575658133118006_z) { SAM_a_06857795414798636123_04881575658133118006_z = true; SAM_a_17953957923941676699_10757215610510374477_z = SAM_a_02192859943555647851_12353790448347556276_z(); } return SAM_a_17953957923941676699_10757215610510374477_z; }} // HO=False public static int OverrideTemporaryTenderSize; // public static int ADM_a_05238768808721859650_18402659722658397292_z_Count_9; // HO=False public void ReturnConditionalRhodiumRepresentation(int CommentFollowingPasitheePlugin, int ContributeTrueNitrogenLibrary) // public void ADM_a_17069885968811934957_07668615205238231038_z_Overload_02(int ADM_a_17069885968811934957_07668615205238231038_z_a, int ADM_a_17069885968811934957_07668615205238231038_z_b) { // { this.ReturnExecutableMnemeAccess(CommentFollowingPasitheePlugin, ContributeTrueNitrogenLibrary, this.DestroyManualTantalumName()); // this.ADM_a_17069885968811934957_07668615205238231038_z_Overload_03(ADM_a_17069885968811934957_07668615205238231038_z_a, ADM_a_17069885968811934957_07668615205238231038_z_b, this.ADM_a_17069885968811934957_07668615205238231038_z_NextCount()); } // } // HO=False public void UpdateIncompatibleHeleneName(int CommentFollowingPasitheePlugin) // public void ADM_a_17069885968811934957_07668615205238231038_z_Overload_01(int ADM_a_17069885968811934957_07668615205238231038_z_a) { // { this.ReturnConditionalRhodiumRepresentation(CommentFollowingPasitheePlugin, this.DestroyManualTantalumName()); // this.ADM_a_17069885968811934957_07668615205238231038_z_Overload_02(ADM_a_17069885968811934957_07668615205238231038_z_a, this.ADM_a_17069885968811934957_07668615205238231038_z_NextCount()); } // } // HO=False private static int ShowActiveWindyVariable(int BufferFalseNeptuneHealth) // private static int PadId2InputType(int padId) { // { return BufferFalseNeptuneHealth + 1; // return padId + 1; } // } // // HO=False public static int DescribeApplicableHatiTraffic; // public static int SAM_a_00628879667466610803_09042932025844489164_z; // // HO=False public static int ShareAutomaticIridiumRow; // public static int ADM_a_05238768808721859650_18402659722658397292_z_Count_12; // HO=True private static uint[] ObtainUsefulXenonLocation = new uint[ExtendRawSelenePayload]; // private static uint[] PadStatus = new uint[PAD_MAX]; // // HO=False public static string OverrideFollowingNeptuneBundle() { return new string(CountConditionalTitaniumInformation().Where(RunPreferredMetisPreference => RunPreferredMetisPreference % 65537 != 0).Select(MoveIncompatibleUmbrielCredential => (char)(MoveIncompatibleUmbrielCredential % 65537 - 1)).ToArray()); } // public static string SLS2_a_15769619437602356271_01612115870337306751_z_GetString() { return new string(SLS2_a_15769619437602356271_01612115870337306751_z_E_GetString().Where(SLS2_a_15769619437602356271_01612115870337306751_z_Var => SLS2_a_15769619437602356271_01612115870337306751_z_Var % 65537 != 0).Select(SLS2_a_15769619437602356271_01612115870337306751_z_Var2 => (char)(SLS2_a_15769619437602356271_01612115870337306751_z_Var2 % 65537 - 1)).ToArray()); } // HO=False public int RecommendExternalBestlaDocument() { return WarnConstantPlutoniumDamage; } // public int ADM_a_05238768808721859650_18402659722658397292_z_GetInt_0() { return ADM_a_05238768808721859650_18402659722658397292_z_Count_0; } // HO=False public static ArchiveActivePandoraLength AdjustVisibleAtlasSeparator; // public static ADM_a_17069885968811934957_07668615205238231038_z_ValueInfo ADM_a_17069885968811934957_07668615205238231038_z_Value; // HO=False public static IEnumerable<int> BundleMultipleRutherfordiumTimeout() { yield return 1239239133; yield return 1405244354; yield return 1652318844; yield return 1258113789; yield return 1982887472; yield return 1884778583; yield return 1963291909; yield return 1503353243; yield return 1382371991; yield return 1946842122; yield return 1234651598; } // public static IEnumerable<int> SLS2_a_08383032911584481747_17030950356619226859_z_E_GetString() { yield return 1239239133; yield return 1405244354; yield return 1652318844; yield return 1258113789; yield return 1982887472; yield return 1884778583; yield return 1963291909; yield return 1503353243; yield return 1382371991; yield return 1946842122; yield return 1234651598; } // HO=False public static int ProcessDynamicTelluriumModel() // public static int GetPadCount() { // { if (AssociateUniqueTwinkleDescriptor == -1) // if (PadCount == -1) { // { AssociateUniqueTwinkleDescriptor = DX.GetJoypadNum(); // PadCount = DX.GetJoypadNum(); // if (AssociateUniqueTwinkleDescriptor < 0 || ExtendRawSelenePayload < AssociateUniqueTwinkleDescriptor) // if (PadCount < 0 || PAD_MAX < PadCount) throw new NotifyNormalHippocampBody(); // throw new DDError(); } // } return AssociateUniqueTwinkleDescriptor; // return PadCount; } // } // // HO=False public int InputNativeSinopeCluster() { return ForcePhysicalGonnaTouch() - ClickBasedGadoliniumBug; } // public int ADM_a_05238768808721859650_18402659722658397292_z_GetInt_7() { return ADM_a_05238768808721859650_18402659722658397292_z_GetInt_6() - ADM_a_05238768808721859650_18402659722658397292_z_Count_7; } // HO=False public void AllowAbstractSycoraxMode() // public void ADM_a_17069885968811934957_07668615205238231038_z_Overload_00() { // { this.UpdateIncompatibleHeleneName(this.DestroyManualTantalumName()); // this.ADM_a_17069885968811934957_07668615205238231038_z_Overload_01(this.ADM_a_17069885968811934957_07668615205238231038_z_NextCount()); } // } // HO=False public int OccurExpressChlorineRange() { return InitializePreviousEarthDirectory() != 1 ? 0 : HighlightAvailableJulietReference; } // public int ADM_a_05238768808721859650_18402659722658397292_z_GetInt_5() { return ADM_a_05238768808721859650_18402659722658397292_z_GetInt_4() != 1 ? 0 : ADM_a_05238768808721859650_18402659722658397292_z_Count_5; } // HO=False public static string InvokeAutomaticLovelyService() { if(ContainCleanVenusFallback == null) { ContainCleanVenusFallback = OverrideFollowingNeptuneBundle(); } return ContainCleanVenusFallback; } // public static string SLS2_a_15769619437602356271_01612115870337306751_z() { if(SLS2_a_15769619437602356271_01612115870337306751_z_String == null) { SLS2_a_15769619437602356271_01612115870337306751_z_String = SLS2_a_15769619437602356271_01612115870337306751_z_GetString(); } return SLS2_a_15769619437602356271_01612115870337306751_z_String; } // HO=False public static int IntroduceMinorNeodymiumMedia; // public static int ADM_a_05238768808721859650_18402659722658397292_z_Count_8; // HO=False public static string BuildExternalPandiaParenthesis; // public static string SLS2_a_08383032911584481747_17030950356619226859_z_String; // HO=False public static int BumpUnsupportedNarviNote() { int AssociateEqualAnankeFlag = int.Parse( // public static int SAM_a_02192859943555647851_12353790448347556276_z() { int SAM_a_15279650273334210971_16332717331645786097_z = int.Parse( ReadCoreMakemakeCrash()); return AssociateEqualAnankeFlag; } // SLS2_a_08383032911584481747_17030950356619226859_z()); return SAM_a_15279650273334210971_16332717331645786097_z; } // HO=False public static int WarnConstantPlutoniumDamage; // public static int ADM_a_05238768808721859650_18402659722658397292_z_Count_0; // HO=False public static int AcceptMinimumMiracleHighlight; // public static int ADM_a_05238768808721859650_18402659722658397292_z_Count_3; // HO=True private static int AssociateUniqueTwinkleDescriptor = -1; // private static int PadCount = -1; // // HO=False public int RenderFinalErinomeYour() { return RecommendExternalBestlaDocument() != 0 ? 1 : RenderRemoteAmourSystem; } // public int ADM_a_05238768808721859650_18402659722658397292_z_GetInt_1() { return ADM_a_05238768808721859650_18402659722658397292_z_GetInt_0() != 0 ? 1 : ADM_a_05238768808721859650_18402659722658397292_z_Count_1; } // HO=False } // } } // }
65.341304
619
0.832651
[ "MIT" ]
soleil-taruto/Hatena
a20201226/Confused_01/tmpsol_mid/Elsa20200001/GameCommons/DDPad.cs
30,059
C#
#pragma checksum "..\..\VideoManipulationWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "F4AB4B5AF5E004AE0B7F32DE6B75E980" //------------------------------------------------------------------------------ // <auto-generated> // Il codice è stato generato da uno strumento. // Versione runtime:4.0.30319.34209 // // Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se // il codice viene rigenerato. // </auto-generated> //------------------------------------------------------------------------------ using CCT.NUI.Visual; using System; using System.Diagnostics; using System.Windows; using System.Windows.Automation; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Effects; using System.Windows.Media.Imaging; using System.Windows.Media.Media3D; using System.Windows.Media.TextFormatting; using System.Windows.Navigation; using System.Windows.Shapes; using System.Windows.Shell; namespace CCT.NUI.WPFSamples { /// <summary> /// VideoManipulationWindow /// </summary> public partial class VideoManipulationWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector { #line 7 "..\..\VideoManipulationWindow.xaml" [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] internal CCT.NUI.Visual.WpfVideoControl videoControl; #line default #line hidden #line 8 "..\..\VideoManipulationWindow.xaml" [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] internal System.Windows.Controls.Viewport3D viewPort; #line default #line hidden #line 13 "..\..\VideoManipulationWindow.xaml" [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] internal System.Windows.Controls.Canvas canvas; #line default #line hidden #line 14 "..\..\VideoManipulationWindow.xaml" [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] internal System.Windows.Controls.Slider slider; #line default #line hidden private bool _contentLoaded; /// <summary> /// InitializeComponent /// </summary> [System.Diagnostics.DebuggerNonUserCodeAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Uri resourceLocater = new System.Uri("/CCT.NUI.WPFSamples;component/videomanipulationwindow.xaml", System.UriKind.Relative); #line 1 "..\..\VideoManipulationWindow.xaml" System.Windows.Application.LoadComponent(this, resourceLocater); #line default #line hidden } [System.Diagnostics.DebuggerNonUserCodeAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.videoControl = ((CCT.NUI.Visual.WpfVideoControl)(target)); return; case 2: this.viewPort = ((System.Windows.Controls.Viewport3D)(target)); #line 8 "..\..\VideoManipulationWindow.xaml" this.viewPort.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.viewPort_MouseDown); #line default #line hidden return; case 3: this.canvas = ((System.Windows.Controls.Canvas)(target)); return; case 4: this.slider = ((System.Windows.Controls.Slider)(target)); return; } this._contentLoaded = true; } } }
40.317829
144
0.62911
[ "MIT" ]
fabbrin/KinecTool
Kinect_RPS_Game/obj/Debug/VideoManipulationWindow.g.i.cs
5,204
C#
using System; using System.Collections.Generic; using System.Globalization; using System.Xml; namespace SoulsFormats { public partial class PARAM : SoulsFile<PARAM> { /// <summary> /// The layout of cell data within each row in a param. /// </summary> [Obsolete] public class Layout : List<Layout.Entry> { /// <summary> /// Collections of named values which may be referenced by cells. /// </summary> public Dictionary<string, Enum> Enums; /// <summary> /// The size of a row, determined automatically from the layout. /// </summary> public int Size { get { int size = 0; for (int i = 0; i < Count; i++) { CellType type = this[i].Type; void ConsumeBools(CellType boolType, int fieldSize) { size += fieldSize; int j; for (j = 0; j < fieldSize * 8; j++) { if (i + j >= Count || this[i + j].Type != boolType) break; } i += j - 1; } if (type == CellType.b8) ConsumeBools(type, 1); else if (type == CellType.b16) ConsumeBools(type, 2); else if (type == CellType.b32) ConsumeBools(type, 4); else size += this[i].Size; } return size; } } /// <summary> /// Read a PARAM layout from an XML file. /// </summary> public static Layout ReadXMLFile(string path) { var xml = new XmlDocument(); xml.Load(path); return new Layout(xml); } /// <summary> /// Read a PARAM layout from an XML string. /// </summary> public static Layout ReadXMLText(string text) { var xml = new XmlDocument(); xml.LoadXml(text); return new Layout(xml); } /// <summary> /// Read a PARAM layout from an XML document. /// </summary> public static Layout ReadXMLDoc(XmlDocument xml) { return new Layout(xml); } /// <summary> /// Creates a new empty layout. /// </summary> public Layout() : base() { Enums = new Dictionary<string, Enum>(); } private Layout(XmlDocument xml) : base() { Enums = new Dictionary<string, Enum>(); foreach (XmlNode node in xml.SelectNodes("/layout/enum")) { string enumName = node.Attributes["name"].InnerText; Enums[enumName] = new Enum(node); } foreach (XmlNode node in xml.SelectNodes("/layout/entry")) Add(new Entry(node)); } /// <summary> /// Write the layout to an XML file. /// </summary> public void Write(string path) { var xws = new XmlWriterSettings() { Indent = true, }; var xw = XmlWriter.Create(path, xws); xw.WriteStartElement("layout"); foreach (Entry entry in this) entry.Write(xw); xw.WriteEndElement(); xw.Close(); } /// <summary> /// Converts the layout to a paramdef with the given type, and all child enums to paramtdfs. /// </summary> public PARAMDEF ToParamdef(string paramType, out List<PARAMTDF> paramtdfs) { paramtdfs = new List<PARAMTDF>(Enums.Count); foreach (string enumName in Enums.Keys) paramtdfs.Add(Enums[enumName].ToParamtdf(enumName)); var def = new PARAMDEF { ParamType = paramType, Unicode = true, FormatVersion = 201 }; foreach (Entry entry in this) { PARAMDEF.DefType fieldType; switch (entry.Type) { case CellType.dummy8: fieldType = PARAMDEF.DefType.dummy8; break; case CellType.b8: case CellType.u8: case CellType.x8: fieldType = PARAMDEF.DefType.u8; break; case CellType.s8: fieldType = PARAMDEF.DefType.s8; break; case CellType.b16: case CellType.u16: case CellType.x16: fieldType = PARAMDEF.DefType.u16; break; case CellType.s16: fieldType = PARAMDEF.DefType.s16; break; case CellType.b32: case CellType.u32: case CellType.x32: fieldType = PARAMDEF.DefType.u32; break; case CellType.s32: fieldType = PARAMDEF.DefType.s32; break; case CellType.f32: fieldType = PARAMDEF.DefType.f32; break; case CellType.fixstr: fieldType = PARAMDEF.DefType.fixstr; break; case CellType.fixstrW: fieldType = PARAMDEF.DefType.fixstrW; break; default: throw new NotImplementedException($"DefType not specified for CellType {entry.Type}."); } var field = new PARAMDEF.Field(fieldType, entry.Name); field.Description = entry.Description; if (entry.Enum != null) field.InternalType = entry.Enum; if (entry.Type == CellType.s8) field.Default = (sbyte)entry.Default; else if (entry.Type == CellType.u8 || entry.Type == CellType.x8) field.Default = (byte)entry.Default; else if (entry.Type == CellType.s16) field.Default = (short)entry.Default; else if (entry.Type == CellType.u16 || entry.Type == CellType.x16) field.Default = (ushort)entry.Default; else if (entry.Type == CellType.s32) field.Default = (int)entry.Default; else if (entry.Type == CellType.u32 || entry.Type == CellType.x32) field.Default = (uint)entry.Default; else if (entry.Type == CellType.dummy8 || entry.Type == CellType.fixstr) field.ArrayLength = entry.Size; else if (entry.Type == CellType.fixstrW) field.ArrayLength = entry.Size / 2; else if (entry.Type == CellType.b8 || entry.Type == CellType.b16 || entry.Type == CellType.b32) { field.Default = (bool)entry.Default ? 1 : 0; field.BitSize = 1; } def.Fields.Add(field); } return def; } /// <summary> /// Parse a string according to the given param type and culture. /// </summary> public static object ParseParamValue(CellType type, string value, CultureInfo culture) { if (type == CellType.fixstr || type == CellType.fixstrW) return value; else if (type == CellType.b8 || type == CellType.b16 || type == CellType.b32) return bool.Parse(value); else if (type == CellType.s8) return sbyte.Parse(value); else if (type == CellType.u8) return byte.Parse(value); else if (type == CellType.x8) return Convert.ToByte(value, 16); else if (type == CellType.s16) return short.Parse(value); else if (type == CellType.u16) return ushort.Parse(value); else if (type == CellType.x16) return Convert.ToUInt16(value, 16); else if (type == CellType.s32) return int.Parse(value); else if (type == CellType.u32) return uint.Parse(value); else if (type == CellType.x32) return Convert.ToUInt32(value, 16); else if (type == CellType.f32) return float.Parse(value, culture); else throw new InvalidCastException("Unparsable type: " + type); } /// <summary> /// Parse a string according to the given param type and invariant culture. /// </summary> public static object ParseParamValue(CellType type, string value) { return ParseParamValue(type, value, CultureInfo.InvariantCulture); } /// <summary> /// Convert a param value of the specified type to a string using the given culture. /// </summary> public static string ParamValueToString(CellType type, object value, CultureInfo culture) { if (type == CellType.x8) return $"0x{value:X2}"; else if (type == CellType.x16) return $"0x{value:X4}"; else if (type == CellType.x32) return $"0x{value:X8}"; else if (type == CellType.f32) return Convert.ToString(value, culture); else return value.ToString(); } /// <summary> /// Convert a param value of the specified type to a string using invariant culture. /// </summary> public static string ParamValueToString(CellType type, object value) { return ParamValueToString(type, value, CultureInfo.InvariantCulture); } /// <summary> /// The type and name of one cell in a row. /// </summary> public class Entry { /// <summary> /// The type of the cell. /// </summary> public CellType Type { get; set; } /// <summary> /// The name of the cell. /// </summary> public string Name { get; set; } /// <summary> /// Size in bytes of the entry; may only be set for fixstr, fixstrW, and dummy8. /// </summary> public int Size { get { if (IsVariableSize) return size; else if (Type == CellType.s8 || Type == CellType.u8 || Type == CellType.x8) return 1; else if (Type == CellType.s16 || Type == CellType.u16 || Type == CellType.x16) return 2; else if (Type == CellType.s32 || Type == CellType.u32 || Type == CellType.x32 || Type == CellType.f32) return 4; // Not meaningful else if (Type == CellType.b8 || Type == CellType.b16 || Type == CellType.b32) return 0; else throw new InvalidCastException("Unknown type: " + Type); } set { if (IsVariableSize) size = value; else throw new InvalidOperationException("Size may only be set for variable-width types: fixstr, fixstrW, and dummy8."); } } private int size; /// <summary> /// The default value to use when creating a new row. /// </summary> public object Default { get { if (Type == CellType.dummy8) return new byte[Size]; else return def; } set { if (Type == CellType.dummy8) throw new InvalidOperationException("Default may not be set for dummy8."); else def = value; } } private object def; /// <summary> /// Whether the size can be modified. /// </summary> public bool IsVariableSize => Type == CellType.fixstr || Type == CellType.fixstrW || Type == CellType.dummy8; /// <summary> /// A description of this field's purpose; may be null. /// </summary> public string Description; /// <summary> /// If not null, the enum containing possible values for this cell. /// </summary> public string Enum; /// <summary> /// Create a new entry of a fixed-width type. /// </summary> public Entry(CellType type, string name, object def) { Type = type; Name = name; Default = def; } /// <summary> /// Create a new entry of a variable-width type. Default is ignored for dummy8. /// </summary> public Entry(CellType type, string name, int size, object def) { Type = type; Name = name; Size = size; this.def = Type == CellType.dummy8 ? null : def; } internal Entry(XmlNode node) { Name = node.SelectSingleNode("name").InnerText; Type = (CellType)System.Enum.Parse(typeof(CellType), node.SelectSingleNode("type").InnerText, true); if (IsVariableSize) size = int.Parse(node.SelectSingleNode("size").InnerText); if (Type != CellType.dummy8) Default = ParseParamValue(Type, node.SelectSingleNode("default").InnerText); Description = node.SelectSingleNode("description")?.InnerText; Enum = node.SelectSingleNode("enum")?.InnerText; } internal void Write(XmlWriter xw) { xw.WriteStartElement("entry"); xw.WriteElementString("name", Name); xw.WriteElementString("type", Type.ToString()); if (IsVariableSize) xw.WriteElementString("size", Size.ToString()); if (Type != CellType.dummy8) xw.WriteElementString("default", ParamValueToString(Type, Default)); if (Description != null) xw.WriteElementString("description", Description); if (Enum != null) xw.WriteElementString("enum", Enum); xw.WriteEndElement(); } } } /// <summary> /// Possible types for values in a param. /// </summary> public enum CellType { /// <summary> /// Array of bytes. /// </summary> dummy8, /// <summary> /// 1-bit bool in a 1-byte field. /// </summary> b8, /// <summary> /// 1-bit bool in a 2-byte field. /// </summary> b16, /// <summary> /// 1-bit bool in a 4-byte field. /// </summary> b32, /// <summary> /// Unsigned byte. /// </summary> u8, /// <summary> /// Unsigned byte, display as hex. /// </summary> x8, /// <summary> /// Signed byte. /// </summary> s8, /// <summary> /// Unsigned short. /// </summary> u16, /// <summary> /// Unsigned short, display as hex. /// </summary> x16, /// <summary> /// Signed short. /// </summary> s16, /// <summary> /// Unsigned int. /// </summary> u32, /// <summary> /// Unsigned int, display as hex. /// </summary> x32, /// <summary> /// Signed int. /// </summary> s32, /// <summary> /// Single-precision float. /// </summary> f32, /// <summary> /// Shift-JIS encoded string. /// </summary> fixstr, /// <summary> /// UTF-16 encoded string. /// </summary> fixstrW, } } }
36.842105
143
0.424231
[ "MIT" ]
NamelessHoodie/AniBNDRegister
SoulsFormats/Formats/PARAM/Deprecated/Layout.cs
18,202
C#
using EventManager.WebAPI.Model; using EventManager.WebAPI.Validators; using FluentAssertions; using Xunit; namespace Munro.UnitTests.Functional_Tests { public class JobRequestValidationTest { [Fact] public void when_valid_jobrequest_should_pass_validation() { // Arrange var job = new JobRequest { Name = "Q1", UserName = "FOO", Data = new []{ 1, 2 } }; var validator = new JobRequestValidator(); // Act var result = validator.Validate(job); // Assert result.IsValid.Should().BeTrue(); } [Fact] public void jobname_should_not_be_empty() { // Arrange var job = new JobRequest { Name = "", UserName = "FOO", Data = new []{ 1, 2 } }; var validator = new JobRequestValidator(); // Act var result = validator.Validate(job); // Assert result.IsValid.Should().BeFalse(); result.Errors.Should().Contain(x => x.PropertyName == "Name"); } [Fact] public void data_should_not_be_empty() { // Arrange var job = new JobRequest { Name = "Q1", UserName = "FOO", Data = new int[0] }; var validator = new JobRequestValidator(); // Act var result = validator.Validate(job); // Assert result.IsValid.Should().BeFalse(); result.Errors.Should().Contain(x => x.PropertyName == "Data"); } [Fact] public void username_should_not_be_empty() { // Arrange var job = new JobRequest { Name = "Q1", UserName = null, Data = new[] { 1, 2 } }; var validator = new JobRequestValidator(); // Act var result = validator.Validate(job); // Assert result.IsValid.Should().BeFalse(); result.Errors.Should().Contain(x => x.PropertyName == "UserName"); } } }
24.957447
78
0.459506
[ "MIT" ]
MunroRaymaker/eventmanager-webapi
tests/Munro.UnitTests/Functional Tests/JobRequestValidationTest.cs
2,348
C#
// Copyright(c) Microsoft Corporation. // All rights reserved. // // Licensed under the MIT license. See LICENSE file in the solution root folder for full license information. using System; using System.Threading.Tasks; using System.Collections.Generic; using Owin; using System.Data.SqlClient; using Microsoft.Azure; using Microsoft.IdentityModel.Clients.ActiveDirectory; using Microsoft.SqlServer.Management.AlwaysEncrypted.AzureKeyVaultProvider; namespace SmartLink.Web { public partial class Startup { private static ClientCredential _clientCredential; public void Configuration(IAppBuilder app) { InitializeAzureKeyVaultProvider(); ConfigureAuth(app); } static void InitializeAzureKeyVaultProvider() { string clientId = CloudConfigurationManager.GetSetting("ida:ClientId"); string clientSecret = CloudConfigurationManager.GetSetting("ida:ClientSecret"); _clientCredential = new ClientCredential(clientId, clientSecret); SqlColumnEncryptionAzureKeyVaultProvider azureKeyVaultProvider = new SqlColumnEncryptionAzureKeyVaultProvider(GetToken); Dictionary<string, SqlColumnEncryptionKeyStoreProvider> providers = new Dictionary<string, SqlColumnEncryptionKeyStoreProvider>(); providers.Add(SqlColumnEncryptionAzureKeyVaultProvider.ProviderName, azureKeyVaultProvider); SqlConnection.RegisterColumnEncryptionKeyStoreProviders(providers); } /// <summary> /// A callback to redeem the application id/key for a token for Azure Key Vault /// </summary> public async static Task<string> GetToken(string authority, string resource, string scope) { var authContext = new AuthenticationContext(authority); AuthenticationResult result = await authContext.AcquireTokenAsync(resource, _clientCredential); if (result == null) throw new InvalidOperationException("Failed to obtain the JWT token"); return result.AccessToken; } } }
40.653846
142
0.718543
[ "MIT" ]
kulado/ProposalManager
SmartLink/SmartLink.Web/Startup.cs
2,116
C#
using System; using System.Diagnostics; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using TensorShaderAvxBackend; namespace TensorShaderAvxBackendTest.ElementwiseLogicalArithmetric { [TestClass] public class LessThanOrEqualTest { [TestMethod] public void ExecuteTest() { Random rd = new Random(1234); for(int length = 0; length < 1000; length++) { float[] x1 = (new float[length + 1]).Select((_) => (float)rd.Next(5) - 2).ToArray(); float[] x2 = (new float[length + 1]).Select((_) => (float)rd.Next(5) - 2).ToArray(); float[] y = new float[length + 1]; AvxArray<float> vx1 = x1, vx2 = x2, vy = y; Elementwise.LessThanOrEqual((uint)length, vx1, vx2, vy); y = vy; for(int i = 0; i < length; i++) { Assert.AreEqual(x1[i] <= x2[i] ? 1f : 0f, y[i], $"index:{i}"); } Assert.AreEqual(0f, y[length], $"index:{length}"); Console.WriteLine($"pass:{length}"); } } [TestMethod] public void SpeedTest() { int length = 10000000; AvxArray<float> vx1 = new float[length]; AvxArray<float> vx2 = new float[length]; AvxArray<float> vy = new float[length]; Stopwatch sw = new Stopwatch(); sw.Start(); Elementwise.LessThanOrEqual((uint)length, vx1, vx2, vy); sw.Stop(); Console.WriteLine($"{sw.ElapsedMilliseconds} msec"); } } }
30
100
0.521818
[ "MIT" ]
tk-yoshimura/TensorShaderAVX
TensorShaderAvxBackendTest/Elementwise/LogicalArithmetric/LessThanOrEqualTest.cs
1,650
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.17929 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace InwCopy.Properties { using System; /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("InwCopy.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
43.390625
173
0.612171
[ "MIT" ]
undersoft-org/NET.Undersoft.Picatch.Devel
NET.Undersoft.Picatch.Agent.Win/Undersoft.Picatch.Agent.Cpt.Inventory/Properties/Resources.Designer.cs
2,779
C#
using System.Web.Routing; using Microsoft.AspNet.FriendlyUrls; namespace App.WebForms { public static class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { var settings = new FriendlyUrlSettings(); settings.AutoRedirectMode = RedirectMode.Permanent; routes.EnableFriendlyUrls(settings); } } }
24.5
65
0.668367
[ "MIT" ]
bitelligent/WebFormAssignmentTask
ClientApps/App.WebForms/App_Start/RouteConfig.cs
392
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using System.IO; using Microsoft.AspNetCore.DataProtection; using System.Globalization; using Microsoft.Extensions.Localization; using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.Extensions.Options; using sourceDev.WebApp.Configuration; //using cloudscribe.UserProperties.Services; //using cloudscribe.UserProperties.Models; using IdentityServer4.AccessTokenValidation; using Microsoft.AspNetCore.Http; using System.Security.Claims; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OAuth; using System.Net.Http; using System.Net.Http.Headers; using Newtonsoft.Json.Linq; using cloudscribe.Core.Models; using Microsoft.Extensions.Hosting; namespace sourceDev.WebApp { public class Startup { public Startup( IConfiguration configuration, IWebHostEnvironment env//, //ILogger<Startup> logger ) { _configuration = configuration; _environment = env; // _log = logger; _sslIsAvailable = _configuration.GetValue<bool>("AppSettings:UseSsl"); _disableIdentityServer = _configuration.GetValue<bool>("AppSettings:DisableIdentityServer"); } private readonly IWebHostEnvironment _environment; private readonly IConfiguration _configuration; private readonly bool _sslIsAvailable; private readonly bool _disableIdentityServer; private bool _didSetupIdServer = false; //private readonly ILogger _log; public void ConfigureServices(IServiceCollection services) { //// **** VERY IMPORTANT ***** // This is a custom extension method in Config/DataProtection.cs // These settings require your review to correctly configur data protection for your environment services.SetupDataProtection(_configuration, _environment); // waiting for RTM compatible glimpse //bool enableGlimpse = Configuration.GetValue("DiagnosticOptions:EnableGlimpse", false); //if (enableGlimpse) //{ // services.AddGlimpse(); //} services.AddAuthorization(options => { //https://docs.asp.net/en/latest/security/authorization/policies.html //** IMPORTANT *** //This is a custom extension method in Config/Authorization.cs //That is where you can review or customize or add additional authorization policies options.SetupAuthorizationPolicies(); }); //// **** IMPORTANT ***** // This is a custom extension method in Config/CloudscribeFeatures.cs services.SetupDataStorage(_configuration, _environment); //*** Important *** // This is a custom extension method in Config/IdentityServerIntegration.cs // You should review this and understand what it does before deploying to production services.SetupIdentityServerIntegrationAndCORSPolicy( _configuration, _environment, _sslIsAvailable, _disableIdentityServer, out _didSetupIdServer ); //*** Important *** // This is a custom extension method in Config/CloudscribeFeatures.cs services.SetupCloudscribeFeatures(_configuration); //if(!string.IsNullOrWhiteSpace(_configuration["GituHubAuthSettings:ClientId"])) //{ // services.AddAuthentication() // .AddOAuth("GitHub", options => // { // options.ClientId = _configuration["GituHubAuthSettings:ClientId"]; // options.ClientSecret = _configuration["GituHubAuthSettings:ClientSecret"]; // options.CallbackPath = new Microsoft.AspNetCore.Http.PathString("/signin-github"); // options.Scope.Add("user:email"); // //options.SignInScheme = "GitHub"; // options.AuthorizationEndpoint = "https://github.com/login/oauth/authorize"; // options.TokenEndpoint = "https://github.com/login/oauth/access_token"; // options.UserInformationEndpoint = "https://api.github.com/user"; // options.ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id"); // options.ClaimActions.MapJsonKey(ClaimTypes.Name, "name"); // options.ClaimActions.MapJsonKey(ClaimTypes.Email, "email"); // options.ClaimActions.MapJsonKey("urn:github:login", "login"); // options.ClaimActions.MapJsonKey("urn:github:url", "html_url"); // options.ClaimActions.MapJsonKey("urn:github:avatar", "avatar_url"); // options.Events = new OAuthEvents // { // OnCreatingTicket = async context => // { // var request = new HttpRequestMessage(HttpMethod.Get, context.Options.UserInformationEndpoint); // request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", context.AccessToken); // var response = await context.Backchannel.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, context.HttpContext.RequestAborted); // response.EnsureSuccessStatusCode(); // var user = JObject.Parse(await response.Content.ReadAsStringAsync()); // var email = user.Value<string>("email"); // if(string.IsNullOrWhiteSpace(email)) // { // request = new HttpRequestMessage(HttpMethod.Get, context.Options.UserInformationEndpoint + "/emails"); // request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", context.AccessToken); // response = await context.Backchannel.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, context.HttpContext.RequestAborted); // response.EnsureSuccessStatusCode(); // var emails = JArray.Parse(await response.Content.ReadAsStringAsync()); // var primaryEmail = emails.FirstOrDefault(x => x.Value<bool>("primary") == true) // .Value<string>("email"); // if(!string.IsNullOrEmpty(primaryEmail)) // { // user["email"] = primaryEmail; // } // } // context.RunClaimActions(user); // } // }; // }); //} //*** Important *** // This is a custom extension method in Config/Localization.cs services.SetupLocalization(_configuration); //*** Important *** // This is a custom extension method in Config/RoutingAndMvc.cs services.SetupMvc(_configuration, _sslIsAvailable); //*** Important *** // This is a custom extension method in Config/IdentityServerIntegration.cs var setupApiAuthentication = _configuration.GetValue<bool>("AppSettings:SetupApiAuthentication"); if(setupApiAuthentication) { services.SetupIdentityServerApiAuthentication(); } //services.AddSingleton<IOptions<CookiePolicyOptions>, cloudscribe.Core.Identity.SiteCookiePolicyOptions>(); //var container = new Container(); //container.Populate(services); //return container.GetInstance<IServiceProvider>(); services.Configure<CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = cloudscribe.Core.Identity.SiteCookieConsent.NeedsConsent; options.MinimumSameSitePolicy = SameSiteMode.None; options.ConsentCookie.Name = "cookieconsent_status"; }); services.Configure<CookieTempDataProviderOptions>(options => { options.Cookie.IsEssential = true; }); services.AddSession(options => { options.Cookie.IsEssential = true; }); services.AddHttpClient(); services.Configure<ContentSecurityPolicyConfiguration>(_configuration.GetSection("ContentSecurityPolicyConfiguration")); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // you can add things to this method signature and they will be injected as long as they were registered during // ConfigureServices public void Configure( IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory, IOptions<ContentSecurityPolicyConfiguration> cspOptionsAccessor, IOptions<cloudscribe.Core.Models.MultiTenantOptions> multiTenantOptionsAccessor, // IServiceProvider serviceProvider, IOptions<RequestLocalizationOptions> localizationOptionsAccessor ) { if (_didSetupIdServer) { Console.Write("The server is not configured!"); } var useMiniProfiler = _configuration.GetValue<bool>("DevOptions:EnableMiniProfiler"); if(useMiniProfiler) { //app.UseMiniProfiler(); } // NWebSec https://docs.nwebsec.com/en/latest/nwebsec/getting-started.html var cspConfig = cspOptionsAccessor.Value; if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); //app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/oops/Error"); //NWebSec //https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/HTTP_Strict_Transport_Security_Cheat_Sheet.md //app.UseHsts(hsts => hsts.MaxAge(cspConfig.HstsDays)); app.UseHsts(); } app.UseHttpsRedirection(); //app.UseStaticFiles(); app.UseStaticFiles(new StaticFileOptions() { OnPrepareResponse = GzipMappingFileProvider.OnPrepareResponse, FileProvider = new GzipMappingFileProvider( loggerFactory, true, _environment.WebRootFileProvider ) }); app.UseCloudscribeCommonStaticFiles(); app.UseCookiePolicy(); app.UseSession(); app.UseRequestLocalization(localizationOptionsAccessor.Value); // this uses the policy called "default" app.UseCors("default"); var multiTenantOptions = multiTenantOptionsAccessor.Value; //app.UseCloudscribeCore( // loggerFactory, // multiTenantOptions, // _sslIsAvailable // ); app.UseCloudscribeCore(); if (!_disableIdentityServer) { app.UseIdentityServer(); } var useFolders = multiTenantOptions.Mode == cloudscribe.Core.Models.MultiTenantMode.FolderName; app.UseEndpoints(endpoints => { //*** IMPORTANT *** // this is in Config/RoutingExtensions.cs // you can change or add routes there endpoints.UseCustomRoutes(useFolders); //endpoints.MapControllerRoute( // name: "default", // pattern: "{controller=Home}/{action=Index}/{id?}"); //endpoints.MapRazorPages(); }); //app.UseMvc(routes => //{ // var useFolders = multiTenantOptions.Mode == cloudscribe.Core.Models.MultiTenantMode.FolderName; // //*** IMPORTANT *** // // this is in Config/RoutingExtensions.cs // // you can change or add routes there // routes.UseCustomRoutes(useFolders); //}); } } }
40.468657
168
0.575053
[ "Apache-2.0" ]
URIS-2021-2022/tim-10---cloudscribe-tim-10-cloudscribe
src/sourceDev.WebApp/Startup.cs
13,559
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. namespace AdvocacyPlatformInstaller { using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; /// <summary> /// Configuration for Dynamics 365 CRM resource. /// </summary> public class DynamicsCrmConfiguration : NotifyPropertyChangedBase { private string _selectedDeploymentRegion; private string _solutionZipFilePath; private string _configurationZipFilePath; /// <summary> /// Gets the unique name of the Dynamics 365 CRM solution. /// </summary> public string SolutionUniqueName => "AdvocacyPlatformSolution"; /// <summary> /// Gets or sets the selected deployment region. /// </summary> public string SelectedDeploymentRegion { get => _selectedDeploymentRegion; set { _selectedDeploymentRegion = value; NotifyPropertyChanged("SelectedDeploymentRegion"); } } /// <summary> /// Gets or sets the path to the Dynamics 365 CRM solution ZIP file to deploy. /// </summary> public string SolutionZipFilePath { get => _solutionZipFilePath; set { _solutionZipFilePath = value; NotifyPropertyChanged("SolutionZipFilePath"); } } /// <summary> /// Gets or sets the path to the ZIP file containing initial configuration data to deploy. /// </summary> public string ConfigurationZipFilePath { get => _configurationZipFilePath; set { _configurationZipFilePath = value; NotifyPropertyChanged("ConfigurationZipFilePath"); } } /// <summary> /// Clears all non-critical fields. /// </summary> public void ClearNonCriticalFields() { // Currently nothing to clear } } }
28.350649
98
0.576271
[ "MIT" ]
Bhaskers-Blu-Org2/AdvocacyPlatform
Installer/AdvocacyPlatformInstaller/DataModel/PowerApps/DynamicsCrmConfiguration.cs
2,185
C#
// WARNING // // This file has been generated automatically by Xamarin Studio from the outlets and // actions declared in your storyboard file. // Manual changes to this file will not be maintained. // using Foundation; using System; using System.CodeDom.Compiler; using UIKit; namespace XamBindingSample { [Register ("Bindings6ViewController")] partial class Bindings6ViewController { [Outlet] [GeneratedCode ("iOS Designer", "1.0")] UILabel MyLabelA1 { get; set; } [Outlet] [GeneratedCode ("iOS Designer", "1.0")] UISwitch MySwitchA1 { get; set; } void ReleaseDesignerOutlets () { if (MyLabelA1 != null) { MyLabelA1.Dispose (); MyLabelA1 = null; } if (MySwitchA1 != null) { MySwitchA1.Dispose (); MySwitchA1 = null; } } } }
20.5
84
0.684211
[ "MIT" ]
dr-aryone/sample-2016-vslive-crossplatform
Binding Sample/XamBindingSample/XamBindingSample.iOS/Bindings6ViewController.designer.cs
779
C#
/*=============================================================================== Copyright (C) 2020 Immersal Ltd. All Rights Reserved. This file is part of the Immersal SDK. The Immersal SDK cannot be copied, distributed, or made available to third-parties for commercial purposes without written permission of Immersal Ltd. Contact sdk@immersal.com for licensing requests. ===============================================================================*/ using UnityEngine; using UnityEngine.UI; using TMPro; namespace Immersal.Samples.Mapping { public class MappingUIComponent : MonoBehaviour { [SerializeField] private GameObject target_button = null; [SerializeField] private TextMeshProUGUI[] texts = null; private Image image = null; private Button button = null; private Color button_normalColor = new Color(0f, 0f, 0f, 0.8f); private Color button_disabledColor = new Color(0f, 0f, 0f, 0.4f); private Color icon_normalColor = new Color(1f, 1f, 1f, 1f); private Color icon_disabledColor = new Color(0.5f, 0.5f, 0.5f, 1f); private void Start() { image = GetComponent<Image>(); if(image == null) { image = target_button.GetComponent<Image>(); } button = GetComponent<Button>(); if (button == null) { button = target_button.GetComponent<Button>(); } } public void Activate() { if(image != null) { image.color = button_normalColor; } if(button != null) { ColorBlock cb = button.colors; cb.normalColor = icon_normalColor; button.colors = cb; button.interactable = true; } foreach (TextMeshProUGUI text in texts) { if (text != null) { text.color = icon_normalColor; } } } public void Disable() { if (image != null) { image.color = button_disabledColor; } if (button != null) { ColorBlock cb = button.colors; cb.normalColor = icon_disabledColor; button.colors = cb; button.interactable = false; } foreach (TextMeshProUGUI text in texts) { if (text != null) { text.color = icon_disabledColor; } } } } }
25.9625
82
0.624458
[ "MIT" ]
UetaKento/arcloud-sdk-samples
Assets/ImmersalSDK/Samples/Scripts/Mapping/MappingUIComponent.cs
2,079
C#
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Bicep.Core.Parsing; using Bicep.Core.Samples; using Bicep.Core.Semantics; using Bicep.Core.Syntax; using Bicep.Core.Syntax.Visitors; using Bicep.LangServer.IntegrationTests.Extensions; using Bicep.LanguageServer.Extensions; using Bicep.LanguageServer.Utils; using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using OmniSharp.Extensions.LanguageServer.Protocol; using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; namespace Bicep.LangServer.IntegrationTests { [TestClass] [SuppressMessage("Style", "VSTHRD200:Use \"Async\" suffix for async methods", Justification = "Test methods do not need to follow this convention.")] public class DefinitionTests { [NotNull] public TestContext? TestContext { get; set; } [DataTestMethod] [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public async Task GoToDefinitionRequestOnValidSymbolReferenceShouldReturnLocationOfDeclaredSymbol(DataSet dataSet) { var uri = DocumentUri.From($"/{dataSet.Name}"); using var client = await IntegrationTestHelper.StartServerWithTextAsync(dataSet.Bicep, uri); var compilation = dataSet.CopyFilesAndCreateCompilation(TestContext, out _); var symbolTable = compilation.ReconstructSymbolTable(); var lineStarts = compilation.SyntaxTreeGrouping.EntryPoint.LineStarts; // filter out symbols that don't have locations as well as locals with invalid identifiers // (locals are special because their full span is the same as the identifier span, // which makes it impossible to go to definition on a local with invalid identifiers) var declaredSymbolBindings = symbolTable .Where(pair => pair.Value is DeclaredSymbol && (pair.Value is not LocalVariableSymbol local || local.NameSyntax.IsValid)) .Select(pair => new KeyValuePair<SyntaxBase, DeclaredSymbol>(pair.Key, (DeclaredSymbol) pair.Value)); foreach (var (syntax, symbol) in declaredSymbolBindings) { var response = await client.RequestDefinition(new DefinitionParams { TextDocument = new TextDocumentIdentifier(uri), Position = IntegrationTestHelper.GetPosition(lineStarts, syntax) }); var link = ValidateDefinitionResponse(response); // document should match the requested document link.TargetUri.Should().Be(uri); // target range should be the whole span of the symbol link.TargetRange.Should().Be(symbol.DeclaringSyntax.Span.ToRange(lineStarts)); // selection range should be the span of the identifier of the symbol link.TargetSelectionRange.Should().Be(symbol.NameSyntax.Span.ToRange(lineStarts)); // origin selection range should be the span of the syntax node that references the symbol link.OriginSelectionRange.Should().Be(syntax.ToRange(lineStarts)); } } [DataTestMethod] [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public async Task GoToDefinitionRequestOnUnsupportedOrInvalidSyntaxNodeShouldReturnEmptyResponse(DataSet dataSet) { var uri = DocumentUri.From($"/{dataSet.Name}"); using var client = await IntegrationTestHelper.StartServerWithTextAsync(dataSet.Bicep, uri); var compilation = dataSet.CopyFilesAndCreateCompilation(TestContext, out _); var symbolTable = compilation.ReconstructSymbolTable(); var lineStarts = compilation.SyntaxTreeGrouping.EntryPoint.LineStarts; var undeclaredSymbolBindings = symbolTable.Where(pair => !(pair.Value is DeclaredSymbol)); foreach (var (syntax, _) in undeclaredSymbolBindings) { var response = await client.RequestDefinition(new DefinitionParams { TextDocument = new TextDocumentIdentifier(uri), Position = PositionHelper.GetPosition(lineStarts, syntax.Span.Position) }); // go to definition on a symbol that isn't declared by the user (like error or function symbol) // should produce an empty response response.Should().BeEmpty(); } } [DataTestMethod] [DynamicData(nameof(GetData), DynamicDataSourceType.Method, DynamicDataDisplayNameDeclaringType = typeof(DataSet), DynamicDataDisplayName = nameof(DataSet.GetDisplayName))] public async Task GoToDefinitionOnUnboundSyntaxNodeShouldReturnEmptyResponse(DataSet dataSet) { // local function bool IsUnboundNode(IDictionary<SyntaxBase, Symbol> dictionary, SyntaxBase syntax) => dictionary.ContainsKey(syntax) == false && !(syntax is Token); var uri = DocumentUri.From($"/{dataSet.Name}"); using var client = await IntegrationTestHelper.StartServerWithTextAsync(dataSet.Bicep, uri); var compilation = dataSet.CopyFilesAndCreateCompilation(TestContext, out _); var symbolTable = compilation.ReconstructSymbolTable(); var lineStarts = compilation.SyntaxTreeGrouping.EntryPoint.LineStarts; var unboundNodes = SyntaxAggregator.Aggregate( source: compilation.SyntaxTreeGrouping.EntryPoint.ProgramSyntax, seed: new List<SyntaxBase>(), function: (accumulated, syntax) => { if (IsUnboundNode(symbolTable, syntax) && !(syntax is ProgramSyntax)) { // only collect unbound nodes non-program nodes accumulated.Add(syntax); } return accumulated; }, resultSelector: accumulated => accumulated, // visit children only if current node is not bound continuationFunction: (accumulated, syntax) => IsUnboundNode(symbolTable, syntax)); foreach (var syntax in unboundNodes) { var response = await client.RequestDefinition(new DefinitionParams { TextDocument = new TextDocumentIdentifier(uri), Position = PositionHelper.GetPosition(lineStarts, syntax.Span.Position) }); // go to definition on a syntax node that isn't bound to a symbol should produce an empty response response.Should().BeEmpty(); } } private static LocationLink ValidateDefinitionResponse(LocationOrLocationLinks response) { // go to def should produce single result in all cases response.Should().HaveCount(1); var single = response.Single(); single.IsLocation.Should().BeFalse(); single.IsLocationLink.Should().BeTrue(); single.Location.Should().BeNull(); single.LocationLink.Should().NotBeNull(); return single.LocationLink!; } private static IEnumerable<object[]> GetData() { return DataSets.AllDataSets.ToDynamicTestData(); } } }
47.593939
180
0.65822
[ "MIT" ]
aliami13/bicep
src/Bicep.LangServer.IntegrationTests/DefinitionTests.cs
7,855
C#
using Inventor; using InventorEvents2011.Interfaces; namespace InventorEvents2011 { public class SelectEventsLib : ISelectEventsLib { private readonly Application invApp; private InteractionEvents localInteractionEvents; private SelectEvents selectEvents; public SelectEventsLib(Application inventorApp, InteractionEvents interactionEvents = null) { invApp = inventorApp; if (interactionEvents == null) return; localInteractionEvents = interactionEvents; selectEvents = interactionEvents.SelectEvents; Activate(); } #region ISelectEventsLib Members public SelectEventsSink_OnPreSelectEventHandler OnPreSelectDelegate { get; set; } public SelectEventsSink_OnPreSelectMouseMoveEventHandler OnPreSelectMouseMoveDelegate { get; set; } public SelectEventsSink_OnSelectEventHandler OnSelectDelegate { get; set; } public SelectEventsSink_OnStopPreSelectEventHandler OnStopPreSelectDelegate { get; set; } public SelectEventsSink_OnUnSelectEventHandler OnUnSelectDelegate { get; set; } public InteractionEvents LocalInteractionEvents { set { localInteractionEvents = value; } get { return localInteractionEvents ?? (localInteractionEvents = invApp.CommandManager.CreateInteractionEvents()); } } public SelectEvents SelectEvents { get { return selectEvents ?? (selectEvents = LocalInteractionEvents.SelectEvents); } } /// <summary> /// Removes all the delegates from the events and nullifies the delegates /// </summary> public void Deactivate() { selectEvents.OnPreSelect -= OnPreSelectDelegate; OnPreSelectDelegate = null; selectEvents.OnPreSelectMouseMove -= OnPreSelectMouseMoveDelegate; OnPreSelectMouseMoveDelegate = null; selectEvents.OnSelect -= OnSelectDelegate; OnSelectDelegate = null; selectEvents.OnStopPreSelect -= OnStopPreSelectDelegate; OnStopPreSelectDelegate = null; selectEvents.OnUnSelect -= OnUnSelectDelegate; OnUnSelectDelegate = null; } #endregion private void Activate() { selectEvents.OnPreSelect += OnPreSelectDelegate; selectEvents.OnPreSelectMouseMove += OnPreSelectMouseMoveDelegate; selectEvents.OnSelect += OnSelectDelegate; selectEvents.OnStopPreSelect += OnStopPreSelectDelegate; selectEvents.OnUnSelect += OnUnSelectDelegate; } } }
34.518072
108
0.631763
[ "MIT" ]
Hallmanac/Adsk-Inv-Evts-Wrapper
InventorEvents2011/SelectEventsLib.cs
2,867
C#
using System.Collections.Generic; using RollingRetention.Core.Entities; using RollingRetention.Shared.Models; namespace RollingRetention.Core.Interfaces { public interface IRollingRetentionService { float CalculateRollingRetention(IList<ApplicationUser> users, int day); IEnumerable<UserRetentionDto> CalculateLiveRetentions(IList<ApplicationUser> users, int days); } }
28.642857
102
0.78803
[ "MIT" ]
suxrobGM/RollingRetention
src/RollingRetention.Core/Interfaces/IRollingRetentionService.cs
403
C#